Пример #1
0
        /// <summary>
        /// This is really a fallback method, it will not be executed in normal use because we are setting the postbackurl of the button
        /// to post directly to paypal, so this method should not fire unless somehow the page is manipulated to postback to itself.
        /// In this case, we just consolidate the cart into a buy now button.
        /// </summary>
        private void DoPayPalStandardCheckout()
        {
            PayPalLog payPalLog = new PayPalLog();

            payPalLog.ProviderName    = "WebStorePayPalHandler";
            payPalLog.PDTProviderName = "WebStorePayPalPDTHandlerProvider";
            payPalLog.IPNProviderName = "WebStorePayPalIPNHandlerProvider";
            payPalLog.ReturnUrl       = SiteRoot +
                                        "/WebStore/OrderDetail.aspx?pageid="
                                        + pageId.ToInvariantString()
                                        + "&mid=" + moduleId.ToInvariantString()
                                        + "&orderid=" + cart.CartGuid.ToString();

            payPalLog.RequestType = "StandardCheckout";

            cart.SerializeCartOffers();
            payPalLog.SerializedObject = SerializationHelper.SerializeToString(cart);
            payPalLog.CartGuid         = cart.CartGuid;
            payPalLog.SiteGuid         = store.SiteGuid;
            payPalLog.StoreGuid        = store.Guid;
            payPalLog.UserGuid         = cart.UserGuid;
            payPalLog.CartTotal        = cart.OrderTotal;
            payPalLog.CurrencyCode     = siteSettings.GetCurrency().Code;

            payPalLog.Save();

            string payPalStandardUrl = StoreHelper.GetBuyNowUrl(
                payPalLog.RowGuid,
                cart,
                store,
                commerceConfig);


            WebUtils.SetupRedirect(this, payPalStandardUrl);
        }