Beispiel #1
0
        public void IDEAL_CanGetIssuers()
        {
            Issuers issuers = mollieClient.GetIssuers();

            Assert.IsTrue(issuers.count > 0, "Found 0 issuers");
            foreach (Issuer issuer in issuers.data)
            {
                Assert.IsTrue(issuer.name != "");
                Assert.IsTrue(issuer.id != "");
                Assert.IsTrue(issuer.method != "");
            }
        }
        public static String GetTemplateMollieData(String templatename, NBrightInfo pluginInfo)
        {
            var templ = GetTemplateData(templatename, pluginInfo);

            #region "Get Mollie options from API"

            var info = ProviderUtils.GetProviderSettings("DnnCMolliepayment");

            var testMode   = info.GetXmlPropertyBool("genxml/checkbox/testmode");
            var testApiKey = info.GetXmlProperty("genxml/textbox/testapikey");
            var liveApiKey = info.GetXmlProperty("genxml/textbox/liveapikey");


            // Check to see if the test api keys is filled in, stops the error with the settings in the backoffice
            if (testApiKey != "")
            {
                var apiKey = testApiKey;

                if (!testMode)
                {
                    apiKey = liveApiKey;
                }

                MollieClient mollieClient = new MollieClient();
                mollieClient.setApiKey(apiKey);

                var            strPayOptions = "";
                PaymentMethods methods       = mollieClient.GetPaymentMethods();
                Issuers        issuers       = mollieClient.GetIssuers();

                foreach (PaymentMethod method in methods.data)
                {
                    strPayOptions += "<tr>";
                    strPayOptions += "<td><input type='radio' id='" + method.id + "' value='" + method.id + "' name='group1' class='rdoBanks' /></td>";
                    strPayOptions += "<td><img src='" + method.image.normal + "' /></td>";
                    strPayOptions += "<td><strong>" + method.description + "</strong></td>";

                    strPayOptions += "</tr>";
                    if (method.id == "ideal")
                    {
                        strPayOptions += "<tr><td colspan='3'><div id='bank-holder' class='hidden'>";
                        strPayOptions += "<select id='mollieidealgatewaybankselectordropdown' name='mollieidealgatewaybankselectordropdown' class='bankSelector'>";
                        strPayOptions += "<option>" + info.GetXmlProperty("genxml/textbox/bankdropdowntext") + "</option>";
                        foreach (Issuer issuer in issuers.data)
                        {
                            strPayOptions += string.Format("<option value=\"{0}\">{1}</option>", issuer.id, issuer.name);
                        }
                        strPayOptions += "</select>";
                        strPayOptions += "</div></td></tr>";
                    }


                    strPayOptions += "<tr><td colspan='3'><hr/></td></tr>";
                }
                templ = templ.Replace("[PAYMENTMETHODS]", strPayOptions);
            }
            #endregion

            return(templ);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            MollieClient mollieClient = new MollieClient();

            mollieClient.setApiKey(ConfigurationManager.AppSettings["mollie_api_key"]);

            Console.WriteLine("Loading iDeal issuers ...");
            Issuers issuers = mollieClient.GetIssuers();

            foreach (Issuer issuer in issuers.data)
            {
                Console.WriteLine(issuer.name);
            }

            Console.WriteLine("Starting payment without method ...");

            Payment payment = new Payment
            {
                amount      = 99.99M,
                description = "Test payment",
                redirectUrl = "http://www.foxip.net/completed/?orderId=1245",
            };

            PaymentStatus status = mollieClient.StartPayment(payment);

            Console.WriteLine("The status is: " + status.status);
            Console.WriteLine("Please follow this link to start the payment:");
            Console.WriteLine(status.links.paymentUrl);

            Console.WriteLine("Press [enter] to continue ...");
            Console.ReadLine();

            Console.WriteLine("Getting status ...");
            status = mollieClient.GetStatus(status.id);
            Console.WriteLine("The status is now: " + status.status);

            //Refunds only for iDEAL, Bancontact/Mister Cash, SOFORT Banking, creditcard and banktransfer
            Console.WriteLine("Refunding ...");
            try
            {
                RefundStatus refundStatus = mollieClient.Refund(status.id);
                Console.WriteLine("The status is now: " + refundStatus.payment.status);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception: " + ex.Message);
            }

            Console.WriteLine("Starting payment with a specific method ...");
            status = mollieClient.StartPayment(new Payment
            {
                amount      = 1.99M,
                method      = Method.mistercash,
                description = "Test payment",
                redirectUrl = "http://www.foxip.net/completed/?orderId=12345"
            });
            Console.WriteLine("The status is: " + status.status);
            Console.WriteLine("Please follow this link to start the payment:");
            Console.WriteLine(status.links.paymentUrl);
            Console.WriteLine("Press [enter] to continue ...");
            Console.ReadLine();
        }