コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        RegisterStoreEvents();

        if (Request.QueryString["Token"] != null)
        {
            PayPalProExpressPaymentMethod payment = ( PayPalProExpressPaymentMethod )
                                                    StoreContext.CheckoutDetails.PaymentMethod;

            if (!payment.ProcessPostLoginDetails(Request.QueryString["Token"], StoreContext.CheckoutDetails))
            {
                CheckoutNotCompletePage.RedirectToPage(
                    "Error Message",
                    payment.GetErrorMessage(),
                    "ShoppingCart.aspx",
                    "Return To Shopping");
            }
        }
        else
        {
            if (DataAccessContext.Configurations.GetValue("CheckoutMode").ToString() != "Normal")
            {
                if (!IsAnonymousCheckout())
                {
                    Response.Redirect("OnePageCheckout.aspx");
                }
                else
                {
                    Response.Redirect("OnePageCheckout.aspx?skiplogin=true");
                }
            }
        }
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        RegisterStoreEvents();

        if (Request.QueryString["Token"] != null)
        {
            PayPalProExpressPaymentMethod payment = (PayPalProExpressPaymentMethod)
                                                    StoreContext.CheckoutDetails.PaymentMethod;
            //if (!payment.ProcessPostLoginDetails( Request.QueryString["Token"], StoreContext.CheckoutSession ))
            //{
            //    payment.RedirectToErrorPage();
            //}

            if (!payment.ProcessPostLoginDetails(Request.QueryString["Token"], StoreContext.CheckoutDetails))
            {
                //payment.RedirectToErrorPage();
                CheckoutNotCompletePage.RedirectToPage(
                    "Error Message",
                    payment.GetErrorMessage(),
                    "ShoppingCart.aspx",
                    "Return To Shopping");
            }
        }
    }
コード例 #3
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (GetShippingOptionAmount() <= 0)
        {
            SwitchPanelByState(CheckoutPageState.Error);
            uxValidateMessage.DisplayError("[$NoShippingOptionError]");
            return;
        }
        if (GetPaymentGatewayAmount() <= 0)
        {
            SwitchPanelByState(CheckoutPageState.Error);
            uxValidateMessage.DisplayError("[$NoPaymentGatewayError]");
            return;
        }

        if (CurrentState == CheckoutPageState.ShippingAddress)
        {
            if (!Roles.IsUserInRole("Customers") && !IsAnonymousCheckout())
            {
                Response.Redirect("UserLogin.aspx?ReturnUrl=Checkout.aspx");
            }

            if (!DataAccessContext.Configurations.GetBoolValue("ShippingAddressMode"))
            {
                uxCheckoutShippingAddress.SetShippingAddress();

                SwitchPanelByState(CheckoutPageState.ShippingOptions);
                uxCheckoutShippingOption.PopulateControls();
                if (isRestoredShippingOption == false)
                {
                    uxCheckoutShippingOption.RestoreSelectedShippingOption();
                    isRestoredShippingOption = true;
                }
            }
        }
        else if (CurrentState == CheckoutPageState.ShippingOptions)
        {
            uxCheckoutShippingAddress.SetBillingAddressAnonymous();
            if (Request.QueryString["Token"] != null)
            {
                PayPalProExpressPaymentMethod payment = ( PayPalProExpressPaymentMethod )
                                                        StoreContext.CheckoutDetails.PaymentMethod;

                if (!payment.ProcessPostLoginDetails(Request.QueryString["Token"], StoreContext.CheckoutDetails))
                {
                    CheckoutNotCompletePage.RedirectToPage(
                        "Error Message",
                        payment.GetErrorMessage(),
                        "ShoppingCart.aspx",
                        "Return To Shopping");
                }
            }

            if (uxCheckoutShippingOption.ShippingOptionList.Items.Count <= 0)
            {
                uxShippingOptionNextImageButton.Visible = false;
                uxCheckoutShippingOption.DisplayNoShippingOption();
            }

            if ((StoreContext.ShoppingCart.GetCartItems().Length > 0 &&
                 !StoreContext.ShoppingCart.ContainsShippableItem()) ||
                !DataAccessContext.Configurations.GetBoolValue("ShippingAddressMode"))
            {
                StoreContext.CheckoutDetails.SetShipping(ShippingMethod.Null);

                SwitchPanelByState(CheckoutPageState.PaymentMethods);
                uxCheckoutPaymentMethods.PopulateControls();
                if (isRestoredShippingMethod == false)
                {
                    uxCheckoutPaymentMethods.RestorePaymentMethod();
                    isRestoredShippingMethod = true;
                }
            }
        }
        else if (CurrentState == CheckoutPageState.PaymentMethods)
        {
            PaymentOption paymentOption = DataAccessContext.PaymentOptionRepository.GetOne(
                StoreContext.Culture, StoreContext.CheckoutDetails.PaymentMethod.Name);

            if (!StoreContext.ShoppingCart.ContainsRecurringProduct())
            {
                if (!paymentOption.PaymentMethodSelectionAllowed)
                {
                    if (!(Request.QueryString["skiplogin"] == "true"))
                    {
                        Response.Redirect("OrderSummary.aspx");
                    }
                    else
                    {
                        Response.Redirect("OrderSummary.aspx?skiplogin=true");
                    }
                }

                if (StoreContext.GetOrderAmount().Total <= 0)
                {
                    string paymentMethodName = PaymentOption.NoPaymentName;
                    string secondaryName     = String.Empty;

                    if (HasCoupon() || HasGiftCertificate())
                    {
                        if (HasCoupon())
                        {
                            secondaryName += "Coupon";
                        }

                        if (HasGiftCertificate())
                        {
                            if (HasCoupon())
                            {
                                secondaryName += " / ";
                            }

                            secondaryName += "Gift Certificate";
                        }
                    }
                    PaymentOption zeroPaymentOption = DataAccessContext.PaymentOptionRepository.GetOne(
                        StoreContext.Culture, paymentMethodName);
                    PaymentMethod paymentMethod = zeroPaymentOption.CreatePaymentMethod();
                    paymentMethod.SecondaryName = secondaryName;
                    StoreContext.CheckoutDetails.SetPaymentMethod(paymentMethod);

                    if (!(Request.QueryString["skiplogin"] == "true"))
                    {
                        Response.Redirect("OrderSummary.aspx");
                    }
                    else
                    {
                        Response.Redirect("OrderSummary.aspx?skiplogin=true");
                    }
                }
            }


            if (StoreContext.ShoppingCart.ContainsRecurringProduct())
            {
                if (uxCheckoutPaymentMethods.PaymentList.Items.Count > 1)
                {
                    uxCheckoutPaymentMethods.DisplayError("[$RecurringPaymentError]");
                }
            }
        }
        else if (CurrentState == CheckoutPageState.PaymentInfo)
        {
            PaymentMethod paymentMethod = StoreContext.CheckoutDetails.PaymentMethod;
            PaymentOption paymentOption = DataAccessContext.PaymentOptionRepository.GetOne(StoreContext.Culture, paymentMethod.Name);

            if (!paymentOption.CreditCardRequired)
            {
                uxCheckoutPaymentInfo.SetCheckoutBillingAddress();

                if (!IsAnonymousCheckout())
                {
                    Response.Redirect("OrderSummary.aspx");
                }
                else
                {
                    Response.Redirect("OrderSummary.aspx?skiplogin=true");
                }
            }
        }
    }