コード例 #1
0
        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);
        }
コード例 #2
0
        public void CanGetPaymentMethodDetails()
        {
            PaymentMethods methods = mollieClient.GetPaymentMethods();

            Assert.IsTrue(methods.count > 0, "Found 0 payment methods");
            foreach (PaymentMethod method in methods.data)
            {
                Assert.IsTrue(method.id != "");
                Assert.IsTrue(method.description != "");
                Assert.IsTrue(method.image.bigger != "");
                Assert.IsTrue(method.image.normal != "");
                Assert.IsTrue(method.amount.minimum > -1);
                Assert.IsTrue(method.amount.maximum > -1);
            }
        }