public static String GetBankRemotePost(OrderData orderData)
        {
            // use this class to build up the post html
            var rPost = new RemotePost();

            // get the gateway settings which have been entered into the back office page (settings.html template)
            var settings = ProviderUtils.GetProviderSettings("NBrightPayPalpayment");

            // get the order data
            var payData = new PayData(orderData);

            rPost.Url = payData.PostUrl;

            rPost.Add("cmd", "_xclick");
            rPost.Add("item_number", payData.ItemId);
            rPost.Add("return", payData.ReturnUrl);
            rPost.Add("currency_code", payData.CurrencyCode);
            rPost.Add("cancel_return", payData.ReturnCancelUrl);
            rPost.Add("notify_url", payData.NotifyUrl);
            rPost.Add("custom", Utils.GetCurrentCulture());
            rPost.Add("business", payData.PayPalId);
            rPost.Add("item_name", orderData.PurchaseInfo.GetXmlProperty("genxml/ordernumber"));
            rPost.Add("amount", payData.Amount);
            rPost.Add("shipping", payData.ShippingAmount);
            rPost.Add("tax", payData.TaxAmount);
            rPost.Add("lc", Utils.GetCurrentCulture().Substring(3, 2));

            var extrafields = settings.GetXmlProperty("genxml/textbox/extrafields");
            var fields      = extrafields.Split(',');

            foreach (var f in fields)
            {
                var ary = f.Split('=');
                if (ary.Count() == 2)
                {
                    var n = ary[0];
                    var v = ary[1];
                    var d = orderData.PurchaseInfo.GetXmlProperty(v);
                    rPost.Add(n, d);
                }
            }


            //Build the re-direct html
            var rtnStr = rPost.GetPostHtml("/DesktopModules/NBright/NBrightPayPal/Themes/config/img/paypal.gif");

            if (settings.GetXmlPropertyBool("genxml/checkbox/debug.mode"))
            {
                File.WriteAllText(PortalSettings.Current.HomeDirectoryMapPath + "\\debug_NBrightPayPalpost.html", rtnStr);
            }
            return(rtnStr);
        }
Example #2
0
        public static String GetBankRemotePost(OrderData orderData)
        {
            // use this class to build up the post html
            var rPost = new RemotePost();

            // get the gateway settings which have been entered into the back office page (settings.html template)
            var settings = ProviderUtils.GetProviderSettings("NBrightPayPalpayment");

            // get the order data
            var payData = new PayData(orderData);

            rPost.Url = payData.PostUrl;

            rPost.Add("cmd", "_xclick");
            rPost.Add("item_number", payData.ItemId);
            rPost.Add("return", payData.ReturnUrl);
            rPost.Add("currency_code", payData.CurrencyCode);
            rPost.Add("cancel_return", payData.ReturnCancelUrl);
            rPost.Add("notify_url", payData.NotifyUrl);
            rPost.Add("custom", Utils.GetCurrentCulture());
            rPost.Add("business", payData.PayPalId);
            rPost.Add("item_name", orderData.PurchaseInfo.GetXmlProperty("genxml/ordernumber"));
            rPost.Add("amount", payData.Amount);
            rPost.Add("shipping", payData.ShippingAmount);
            rPost.Add("tax", payData.TaxAmount);
            rPost.Add("lc", Utils.GetCurrentCulture().Substring(3,2));

            var extrafields = settings.GetXmlProperty("genxml/textbox/extrafields");
            var fields = extrafields.Split(',');
            foreach (var f in fields)
            {
                var ary = f.Split('=');
                if (ary.Count() == 2)
                {
                    var n = ary[0];
                    var v = ary[1];
                    var d = orderData.PurchaseInfo.GetXmlProperty(v);
                    rPost.Add(n, d);
                }
            }

            //Build the re-direct html
            var rtnStr = rPost.GetPostHtml("/DesktopModules/NBright/NBrightPayPal/Themes/config/img/paypal.gif");
            if (settings.GetXmlPropertyBool("genxml/checkbox/debug.mode"))
            {
                File.WriteAllText(PortalSettings.Current.HomeDirectoryMapPath + "\\debug_NBrightPayPalpost.html", rtnStr);
            }
            return rtnStr;
        }