コード例 #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string action = AlwaysConvert.ToString(Request.QueryString["Action"]).Trim().ToUpperInvariant();

            switch (action)
            {
            case "GET":
                GetExpressCheckout();
                break;

            case "RETRY":
            case "SET":
                ExpressCheckoutSession.Delete(CommerceBuilder.Common.AbleContext.Current.User);
                SetExpressCheckout();
                break;

            case "DO":
                DoExpressCheckout();
                break;

            case "CANCEL":
                CancelExpressCheckout();
                break;

            case "ERROR":
                DisplayExpressCheckoutErrors();
                break;

            default:
                RedirectWithDefaultError();
                break;
            }
        }
コード例 #2
0
        private bool IsPayPalExpress()
        {
            ExpressCheckoutSession paypalSession = ExpressCheckoutSession.Current;

            if (paypalSession != null)
            {
                return(true);
            }
            return(false);
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ExpressCheckoutSession paypalSession = ExpressCheckoutSession.Current;

            if (paypalSession != null)
            {
                PayPalAccount.Text    = paypalSession.Payer;
                PayPalButton.ImageUrl = string.Format(PayPalButton.ImageUrl, Request.Url.Scheme);
            }
            else
            {
                this.Controls.Clear();
            }

            ChangeLink.NavigateUrl = NavigationHelper.GetMobileStoreUrl("~/PayPalExpressCheckout.aspx?Action=CANCEL&ReturnURL=PAY");
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool hasSubscriptions     = BasketHelper.HasRecurringSubscriptions(AbleContext.Current.User.Basket);
            bool newSubFeatureEnabled = AbleContext.Current.Store.Settings.ROCreateNewOrdersEnabled;

            if (!hasSubscriptions || !newSubFeatureEnabled)
            {
                ExpressCheckoutSession paypalSession = ExpressCheckoutSession.Current;
                if (paypalSession != null)
                {
                    PayPalAccount.Text    = paypalSession.Payer;
                    PayPalButton.ImageUrl = string.Format(PayPalButton.ImageUrl, Request.Url.Scheme);
                }
                else
                {
                    this.Controls.Clear();
                }
            }
            else
            {
                this.Controls.Clear();
            }
        }
コード例 #5
0
        private void CancelExpressCheckout()
        {
            ExpressCheckoutSession.Delete(CommerceBuilder.Common.AbleContext.Current.User);
            string sReturnURL = Request.QueryString["ReturnURL"];

            if (!string.IsNullOrEmpty(sReturnURL))
            {
                switch (sReturnURL)
                {
                case "REF":
                    Response.Redirect(Request.UrlReferrer.ToString());
                    break;

                case "PAY":
                    Response.Redirect(AbleCommerce.Code.NavigationHelper.GetPaymentUrl());
                    break;

                case "SHIP":
                    Response.Redirect(AbleCommerce.Code.NavigationHelper.GetShipMethodUrl());
                    break;
                }
            }
            Response.Redirect(AbleCommerce.Code.NavigationHelper.GetBasketUrl());
        }