public ActionResult AmazonPayments(bool clearSession = false)
        {
            var customer = HttpContext.GetCustomer();

            if (!PaymentOptionProvider.PaymentMethodSelectionIsValid(AppLogic.ro_PMAmazonPayments, customer))
            {
                NoticeProvider.PushNotice(
                    message: AppLogic.GetString("checkout.paymentmethodnotallowed"),
                    type: NoticeType.Failure);
                return(RedirectToAction(ActionNames.Index, ControllerNames.Checkout));
            }

            var model = new AmazonPaymentsViewModel(
                residenceTypeOptions: SelectListBuilder.BuildResidenceTypeSelectList(ResidenceTypes.Residential.ToString()),
                clientId: AmazonPaymentsApiProvider.Configuration.ClientId,
                merchantId: AmazonPaymentsApiProvider.Configuration.MerchantId,
                scriptUrl: AmazonPaymentsApiProvider.Configuration.ScriptUrl);

            if (clearSession)
            {
                var updatedPersistedCheckoutContext = new PersistedCheckoutContextBuilder()
                                                      .From(PersistedCheckoutContextProvider.LoadCheckoutContext(customer))
                                                      .WithoutAmazonPayments()
                                                      .WithoutOffsiteRequiredBillingAddressId()
                                                      .WithoutOffsiteRequiredShippingAddressId()
                                                      .Build();

                PersistedCheckoutContextProvider.SaveCheckoutContext(customer, updatedPersistedCheckoutContext);
                customer.UpdateCustomer(requestedPaymentMethod: string.Empty);
                return(Redirect(Url.Action(ActionNames.Index, ControllerNames.Checkout)));
            }

            return(View(model));
        }
        public ActionResult ECheck()
        {
            var customer = HttpContext.GetCustomer();

            if (!PaymentOptionProvider.PaymentMethodSelectionIsValid(AppLogic.ro_PMECheck, customer))
            {
                NoticeProvider.PushNotice(
                    message: AppLogic.GetString("checkout.paymentmethodnotallowed"),
                    type: NoticeType.Failure);
                return(RedirectToAction(ActionNames.Index, ControllerNames.Checkout));
            }

            // AcceptJS is currently only way to use EChecks
            if (AppLogic.ActivePaymentGatewayCleaned() != Gateway.ro_GWACCEPTJS)
            {
                NoticeProvider.PushNotice(
                    message: AppLogic.GetString("acceptjs.echeck.notconfigured"),
                    type: NoticeType.Failure);
                return(RedirectToAction(ActionNames.Index, ControllerNames.Checkout));
            }

            var liveMode = AppLogic.AppConfigBool("UseLiveTransactions");

            var acceptJsModel = new AcceptJsViewModel(
                clientKey: liveMode
                                        ? AppLogic.AppConfig("AcceptJs.Live.ClientKey")
                                        : AppLogic.AppConfig("AcceptJs.Test.ClientKey"),
                apiLoginId: liveMode
                                        ? AppLogic.AppConfig("AcceptJs.Live.ApiLoginId")
                                        : AppLogic.AppConfig("AcceptJs.Test.ApiLoginId"),
                scriptUrlHostedForm: liveMode
                                        ? AppLogic.AppConfig("AcceptJs.Form.Hosted.Live.Url")
                                        : AppLogic.AppConfig("AcceptJs.Form.Hosted.Test.Url"),
                scriptUrlOwnForm: liveMode
                                        ? AppLogic.AppConfig("AcceptJs.Form.Own.Live.Url")
                                        : AppLogic.AppConfig("AcceptJs.Form.Own.Test.Url"));

            var acceptJsECheckModel = new AcceptJsEcheckViewModel(
                acceptJsViewModel: acceptJsModel,
                eCheckViewModel: new ECheckViewModel(),
                checkoutECheckViewModel: new CheckoutECheckViewModel(string.Empty, string.Empty),
                accountTypes: ECheckAccountTypeProvider.GetECheckAccountTypesSelectList());

            return(View(ViewNames.AcceptJsECheck, acceptJsECheckModel));
        }
        public ActionResult PurchaseOrder()
        {
            var customer = HttpContext.GetCustomer();

            if (!PaymentOptionProvider.PaymentMethodSelectionIsValid(AppLogic.ro_PMPurchaseOrder, customer))
            {
                NoticeProvider.PushNotice(
                    message: "Invalid payment method!  Please choose another.",
                    type: NoticeType.Failure);
                return(RedirectToAction(ActionNames.Index, ControllerNames.Checkout));
            }

            var checkoutContext = PersistedCheckoutContextProvider.LoadCheckoutContext(customer);

            var model = BuildPurchaseOrderViewModel(checkoutContext.PurchaseOrder);

            return(View(model));
        }
예제 #4
0
        public ActionResult StartPayPalExpress(bool isPayPalCredit = false)
        {
            var customer = HttpContext.GetCustomer();

            if (!PaymentOptionProvider.PaymentMethodSelectionIsValid(AppLogic.ro_PMPayPalExpress, customer))
            {
                NoticeProvider.PushNotice(
                    message: AppLogic.GetString("checkout.paymentmethodnotallowed"),
                    type: NoticeType.Failure);

                return(RedirectToAction(ActionNames.Index, ControllerNames.Checkout));
            }

            var cart = CachedShoppingCartProvider.Get(customer, CartTypeEnum.ShoppingCart, AppLogic.StoreID());

            Address shippingAddress = null;

            if (customer.IsRegistered && customer.PrimaryShippingAddressID != 0)
            {
                shippingAddress = new Address();
                shippingAddress.LoadByCustomer(customer.CustomerID, customer.PrimaryShippingAddressID, AddressTypes.Shipping);
            }

            var checkoutOptions = new Dictionary <string, string>();

            if (isPayPalCredit)
            {
                checkoutOptions.Add("UserSelectedFundingSource", "BML");
            }

            var payPalExpressRedirectUrl = Gateway.StartExpressCheckout(
                cart: cart,
                boolBypassOrderReview: false,
                checkoutOptions: checkoutOptions);

            // PPE gets the redirect URL via an AJAX request, so we have to return it in the content.
            if (Request.IsAjaxRequest() && !isPayPalCredit)
            {
                return(Content(payPalExpressRedirectUrl));
            }

            return(Redirect(payPalExpressRedirectUrl));
        }
예제 #5
0
        public ActionResult AmazonPayments(bool clearSession = false)
        {
            var customer = HttpContext.GetCustomer();

            if (!PaymentOptionProvider.PaymentMethodSelectionIsValid(AppLogic.ro_PMAmazonPayments, customer))
            {
                NoticeProvider.PushNotice(
                    message: "Invalid payment method!  Please choose another.",
                    type: NoticeType.Failure);
                return(RedirectToAction(ActionNames.Index, ControllerNames.Checkout));
            }

            var model = new AmazonPaymentsViewModel(
                clientId: AmazonPaymentsApiProvider.Configuration.ClientId,
                merchantId: AmazonPaymentsApiProvider.Configuration.MerchantId,
                scriptUrl: AmazonPaymentsApiProvider.Configuration.ScriptUrl);

            if (clearSession)
            {
                var checkoutContext        = PersistedCheckoutContextProvider.LoadCheckoutContext(customer);
                var updatedCheckoutContext = new PersistedCheckoutContext(
                    creditCard: checkoutContext.CreditCard,
                    payPalExpress: checkoutContext.PayPalExpress,
                    purchaseOrder: checkoutContext.PurchaseOrder,
                    braintree: checkoutContext.Braintree,
                    amazonPayments: null,
                    termsAndConditionsAccepted: checkoutContext.TermsAndConditionsAccepted,
                    over13Checked: checkoutContext.Over13Checked,
                    shippingEstimateDetails: checkoutContext.ShippingEstimateDetails,
                    offsiteRequiresBillingAddressId: null,
                    offsiteRequiresShippingAddressId: null,
                    email: checkoutContext.Email,
                    selectedShippingMethodId: checkoutContext.SelectedShippingMethodId);

                PersistedCheckoutContextProvider.SaveCheckoutContext(customer, updatedCheckoutContext);
                customer.UpdateCustomer(requestedPaymentMethod: string.Empty);
                return(Redirect(Url.Action(ActionNames.Index, ControllerNames.Checkout)));
            }

            return(View(model));
        }
예제 #6
0
        public ActionResult MicroPayDetail()
        {
            var customer = HttpContext.GetCustomer();

            if (!PaymentOptionProvider.PaymentMethodSelectionIsValid(AppLogic.ro_PMMicropay, customer))
            {
                NoticeProvider.PushNotice(
                    message: "Invalid payment method!  Please choose another.",
                    type: NoticeType.Failure);
                return(RedirectToAction(ActionNames.Index, ControllerNames.Checkout));
            }

            var cart = CachedShoppingCartProvider.Get(customer, CartTypeEnum.ShoppingCart, AppLogic.StoreID());

            var model = new MicroPayViewModel
            {
                Balance             = Localization.CurrencyStringForDisplayWithExchangeRate(customer.MicroPayBalance, customer.CurrencySetting),
                BalanceIsSufficient = customer.MicroPayBalance >= cart.Total(true)
            };

            return(PartialView(ViewNames.MicroPayPartial, model));
        }
예제 #7
0
        public ActionResult CreditCard()
        {
            var customer = HttpContext.GetCustomer();

            if (!PaymentOptionProvider.PaymentMethodSelectionIsValid(AppLogic.ro_PMCreditCard, customer))
            {
                NoticeProvider.PushNotice(
                    message: "Invalid payment method!  Please choose another.",
                    type: NoticeType.Failure);
                return(RedirectToAction(ActionNames.Index, ControllerNames.Checkout));
            }

            //Decide which form to display
            if (AppLogic.ActivePaymentGatewayCleaned() == Gateway.ro_GWBRAINTREE)
            {
                var processor = GatewayLoader.GetProcessor(Gateway.ro_GWBRAINTREE);

                var clientToken = processor.ObtainBraintreeToken();

                if (string.IsNullOrEmpty(clientToken))
                {
                    NoticeProvider.PushNotice("Our credit card processor is currently excperiencing difficulties.  Please try another payment method or contact us for assistance.", NoticeType.Failure);
                    return(RedirectToAction(ActionNames.Index, ControllerNames.Checkout));
                }

                var braintreeModel = new BraintreeViewModel(token: clientToken,
                                                            scriptUrl: AppLogic.AppConfig("Braintree.ScriptUrl"));

                return(View(ViewNames.BraintreeCreditCard, braintreeModel));
            }
            else
            {
                var ccModel = BuildCheckoutCreditCardViewModel(customer);
                return(View(ViewNames.CreditCard, ccModel));
            }
        }
        public ActionResult CreditCard()
        {
            var customer = HttpContext.GetCustomer();

            if (!PaymentOptionProvider.PaymentMethodSelectionIsValid(AppLogic.ro_PMCreditCard, customer))
            {
                NoticeProvider.PushNotice(
                    message: AppLogic.GetString("checkout.paymentmethodnotallowed"),
                    type: NoticeType.Failure);
                return(RedirectToAction(ActionNames.Index, ControllerNames.Checkout));
            }

            //Decide which form to display
            if (AppLogic.ActivePaymentGatewayCleaned() == Gateway.ro_GWBRAINTREE)
            {
                var processor = GatewayLoader.GetProcessor(Gateway.ro_GWBRAINTREE);

                var clientToken = processor.ObtainBraintreeToken();

                if (string.IsNullOrEmpty(clientToken))
                {
                    NoticeProvider.PushNotice(AppLogic.GetString("braintree.creditcardunavailable"), NoticeType.Failure);
                    return(RedirectToAction(ActionNames.Index, ControllerNames.Checkout));
                }

                var braintreeModel = new BraintreeViewModel(token: clientToken,
                                                            scriptUrl: AppLogic.AppConfig("Braintree.ScriptUrl"));

                return(View(ViewNames.BraintreeCreditCard, braintreeModel));
            }
            else if (AppLogic.ActivePaymentGatewayCleaned() == Gateway.ro_GWACCEPTJS)
            {
                var liveMode = AppLogic.AppConfigBool("UseLiveTransactions");
                var cart     = CachedShoppingCartProvider.Get(customer, CartTypeEnum.ShoppingCart, AppLogic.StoreID());

                var acceptJsModel = new AcceptJsViewModel(
                    clientKey: liveMode
                                                ? AppLogic.AppConfig("AcceptJs.Live.ClientKey")
                                                : AppLogic.AppConfig("AcceptJs.Test.ClientKey"),
                    apiLoginId: liveMode
                                                ? AppLogic.AppConfig("AcceptJs.Live.ApiLoginId")
                                                : AppLogic.AppConfig("AcceptJs.Test.ApiLoginId"),
                    scriptUrlHostedForm: liveMode
                                                ? AppLogic.AppConfig("AcceptJs.Form.Hosted.Live.Url")
                                                : AppLogic.AppConfig("AcceptJs.Form.Hosted.Test.Url"),
                    scriptUrlOwnForm: liveMode
                                                ? AppLogic.AppConfig("AcceptJs.Form.Own.Live.Url")
                                                : AppLogic.AppConfig("AcceptJs.Form.Own.Test.Url"));


                return(View(ViewNames.AcceptJsCreditCard, acceptJsModel));
            }
            else if (AppLogic.ActivePaymentGatewayCleaned() == Gateway.ro_GWSAGEPAYPI)
            {
                var processor = (ISagePayPiGatewayProcessor)GatewayLoader.GetProcessor(Gateway.ro_GWSAGEPAYPI);

                var clientMerchantSessionKey = processor.ObtainSagePayPiMerchantSessionKey();

                if (string.IsNullOrEmpty(clientMerchantSessionKey))
                {
                    NoticeProvider.PushNotice(AppLogic.GetString("sagepaypi.creditcardunavailable"), NoticeType.Failure);
                    return(RedirectToAction(ActionNames.Index, ControllerNames.Checkout));
                }

                var sagePayPiModel = new SagePayPiViewModel(merchantSessionKey: clientMerchantSessionKey,
                                                            scriptUrl: AppLogic.AppConfigBool("UseLiveTransactions")
                                                ? AppLogic.AppConfig("SagePayPi.LiveScriptUrl")
                                                : AppLogic.AppConfig("SagePayPi.TestScriptUrl"),
                                                            validateCreditCardNumber: AppLogic.AppConfigBool("ValidateCreditCardNumbers"));

                return(View(ViewNames.SagePayPiCreditCard, sagePayPiModel));
            }
            else
            {
                var ccModel = BuildCheckoutCreditCardViewModel(customer);
                return(View(ViewNames.CreditCard, ccModel));
            }
        }
예제 #9
0
        public ActionResult Index(string errorMessage, string returnUrl, bool?showErrors)
        {
            PushErrorMessages(errorMessage);

            var defaultReturnUrl = "";

            if (string.IsNullOrEmpty(defaultReturnUrl))
            {
                defaultReturnUrl = Url.Action(ActionNames.Index, ControllerNames.Home);
            }

            var safeReturnUrl = Url.MakeSafeReturnUrl(returnUrl, defaultReturnUrl);

            // Get the current checkout state
            var customer = HttpContext.GetCustomer();

            // We need to validate that a (potentially previously) selected PM is still available and valid (as any number of site settings/configs/customerLevel values could have changed)
            if (!string.IsNullOrEmpty(customer.RequestedPaymentMethod) &&
                !PaymentOptionProvider.PaymentMethodSelectionIsValid(customer.RequestedPaymentMethod, customer))
            {
                customer.UpdateCustomer(requestedPaymentMethod: string.Empty);
            }

            var storeId = AppLogic.StoreID();
            var cart    = CachedShoppingCartProvider.Get(customer, CartTypeEnum.ShoppingCart, AppLogic.StoreID());

            // Make sure there's a GiftCard record for every gift card product in the cart
            CreateGiftCards(customer, cart);

            var checkoutConfiguration = CheckoutConfigurationProvider.GetCheckoutConfiguration();

            var selectedPaymentMethod = PaymentMethodInfoProvider
                                        .GetPaymentMethodInfo(
                paymentMethod: customer.RequestedPaymentMethod,
                gateway: AppLogic.ActivePaymentGatewayCleaned());

            var persistedCheckoutContext = PersistedCheckoutContextProvider
                                           .LoadCheckoutContext(customer);

            var cartContext = CartContextProvider
                              .LoadCartContext(
                customer: customer,
                configuration: checkoutConfiguration,
                persistedCheckoutContext: persistedCheckoutContext,
                selectedPaymentMethod: selectedPaymentMethod);

            var checkoutSelectionContext = CheckoutSelectionProvider
                                           .GetCheckoutSelection(
                customer: customer,
                persistedCheckoutContext: persistedCheckoutContext,
                selectedPaymentMethod: selectedPaymentMethod);

            var result = CheckoutEngine
                         .EvaluateCheckout(
                customer: customer,
                configuration: checkoutConfiguration,
                persistedCheckoutContext: persistedCheckoutContext,
                checkoutSelectionContext: checkoutSelectionContext,
                storeId: storeId,
                cartContext: cartContext);

            var updated = CheckoutSelectionProvider.ApplyCheckoutSelections(customer, result.Selections);

            var action = GetActionForState(result.State);

            // Perform the resulting action
            switch (action)
            {
            case CheckoutAction.Error:
                if (result.State == CheckoutState.CustomerIsNotOver13)
                {
                    break;
                }
                else if (result.State == CheckoutState.TermsAndConditionsRequired)
                {
                    break;
                }
                else if (result.State == CheckoutState.ShippingAddressDoesNotMatchBillingAddress)
                {
                    NoticeProvider.PushNotice("This store can only ship to the billing address", NoticeType.Failure);
                }
                else if (result.State == CheckoutState.MicroPayBalanceIsInsufficient)
                {
                    NoticeProvider.PushNotice(
                        string.Format("Your MicroPay balance is insufficient for purchasing this order. <br />(<b>Your MicroPay Balance is {0}</b>)",
                                      Localization.CurrencyStringForDisplayWithExchangeRate(updated.Customer.MicroPayBalance, updated.Customer.CurrencySetting)),
                        NoticeType.Failure);
                }
                else if (result.State == CheckoutState.SubtotalDoesNotMeetMinimumAmount)
                {
                    NoticeProvider.PushNotice(
                        string.Format("The minimum allowed order amount is {0} Please add additional items to your cart, or increase item quantities.",
                                      updated.Customer.CurrencyString(AppLogic.AppConfigNativeDecimal("CartMinOrderAmount"))),
                        NoticeType.Failure);
                }
                else if (result.State == CheckoutState.CartItemsLessThanMinimumItemCount)
                {
                    NoticeProvider.PushNotice(
                        string.Format("Please make sure you have ordered at least {0} items - any {1} items from our site - before checking out.",
                                      AppLogic.AppConfigNativeInt("MinCartItemsBeforeCheckout"),
                                      AppLogic.AppConfigNativeInt("MinCartItemsBeforeCheckout")),
                        NoticeType.Failure);
                }
                else if (result.State == CheckoutState.CartItemsGreaterThanMaximumItemCount)
                {
                    NoticeProvider.PushNotice(
                        string.Format("We allow a maximum of {0} items per order.  Please remove some products from your cart before beginning checkout.",
                                      AppLogic.AppConfigNativeInt("MaxCartItemsBeforeCheckout")),
                        NoticeType.Failure);
                }
                else if (result.State == CheckoutState.RecurringScheduleMismatchOnItems)
                {
                    NoticeProvider.PushNotice("Your cart has Auto-Ship items with conflicting shipment schedules. Only one Auto-Ship schedule is allowed per order.", NoticeType.Failure);
                }
                else
                {
                    NoticeProvider.PushNotice(result.State.ToString(), NoticeType.Failure);
                }
                break;

            case CheckoutAction.Empty:
                return(View("EmptyCart"));
            }

            return(RenderIndexView(
                       checkoutStageContext: result.CheckoutStageContext,
                       persistedCheckoutContext: updated.PersistedCheckoutContext,
                       selectedPaymentMethod: updated.SelectedPaymentMethod,
                       customer: updated.Customer,
                       termsAndConditionsAccepted: result.Selections.TermsAndConditionsAccepted,
                       returnUrl: safeReturnUrl,
                       showCheckoutStageErrors: showErrors ?? false));
        }
        public ActionResult Index(string errorMessage, string returnUrl, bool?showErrors)
        {
            PushErrorMessages(errorMessage);

            var safeReturnUrl = Url.MakeSafeReturnUrl(returnUrl, Url.GetDefaultContinueShoppingUrl());

            // Get the current checkout state
            var customer = HttpContext.GetCustomer();

            // We need to validate that a (potentially previously) selected PM is still available and valid (as any number of site settings/configs/customerLevel values could have changed)
            if (!string.IsNullOrEmpty(customer.RequestedPaymentMethod) &&
                !PaymentOptionProvider.PaymentMethodSelectionIsValid(customer.RequestedPaymentMethod, customer))
            {
                customer.UpdateCustomer(requestedPaymentMethod: string.Empty);
            }

            var storeId = AppLogic.StoreID();
            var cart    = CachedShoppingCartProvider.Get(customer, CartTypeEnum.ShoppingCart, AppLogic.StoreID());

            // Make sure there's a GiftCard record for every gift card product in the cart
            CreateGiftCards(customer, cart);

            var checkoutConfiguration = CheckoutConfigurationProvider.GetCheckoutConfiguration();

            var selectedPaymentMethod = PaymentMethodInfoProvider
                                        .GetPaymentMethodInfo(
                paymentMethod: customer.RequestedPaymentMethod,
                gateway: AppLogic.ActivePaymentGatewayCleaned());

            var persistedCheckoutContext = PersistedCheckoutContextProvider
                                           .LoadCheckoutContext(customer);

            var cartContext = CartContextProvider
                              .LoadCartContext(
                customer: customer,
                configuration: checkoutConfiguration,
                persistedCheckoutContext: persistedCheckoutContext,
                selectedPaymentMethod: selectedPaymentMethod);

            var checkoutSelectionContext = CheckoutSelectionProvider
                                           .GetCheckoutSelection(
                customer: customer,
                persistedCheckoutContext: persistedCheckoutContext,
                selectedPaymentMethod: selectedPaymentMethod);

            var result = CheckoutEngine
                         .EvaluateCheckout(
                customer: customer,
                configuration: checkoutConfiguration,
                persistedCheckoutContext: persistedCheckoutContext,
                checkoutSelectionContext: checkoutSelectionContext,
                storeId: storeId,
                cartContext: cartContext);

            var updated = CheckoutSelectionProvider.ApplyCheckoutSelections(customer, result.Selections);

            var action = GetActionForState(result.State);

            // Perform the resulting action
            switch (action)
            {
            case CheckoutAction.Error:
                if (result.State == CheckoutState.CustomerIsNotOver13)
                {
                    break;
                }
                else if (result.State == CheckoutState.TermsAndConditionsRequired)
                {
                    break;
                }
                else if (result.State == CheckoutState.ShippingAddressDoesNotMatchBillingAddress)
                {
                    NoticeProvider.PushNotice(AppLogic.GetString("checkout.AllowShipToDifferentThanBillTo"), NoticeType.Failure);
                }
                else if (result.State == CheckoutState.MicroPayBalanceIsInsufficient)
                {
                    NoticeProvider.PushNotice(
                        string.Format(AppLogic.GetString("checkoutpayment.aspx.26"),
                                      Localization.CurrencyStringForDisplayWithExchangeRate(updated.Customer.MicroPayBalance, updated.Customer.CurrencySetting)),
                        NoticeType.Failure);
                }
                else if (result.State == CheckoutState.SubtotalDoesNotMeetMinimumAmount)
                {
                    NoticeProvider.PushNotice(
                        string.Format(AppLogic.GetString("shoppingcart.aspx.4"),
                                      updated.Customer.CurrencyString(AppLogic.AppConfigNativeDecimal("CartMinOrderAmount"))),
                        NoticeType.Failure);
                }
                else if (result.State == CheckoutState.CartItemsLessThanMinimumItemCount)
                {
                    NoticeProvider.PushNotice(
                        string.Format(AppLogic.GetString("shoppingcart.cs.20"),
                                      AppLogic.AppConfigNativeInt("MinCartItemsBeforeCheckout"),
                                      AppLogic.AppConfigNativeInt("MinCartItemsBeforeCheckout")),
                        NoticeType.Failure);
                }
                else if (result.State == CheckoutState.CartItemsGreaterThanMaximumItemCount)
                {
                    NoticeProvider.PushNotice(
                        string.Format(AppLogic.GetString("shoppingcart.cs.119"),
                                      AppLogic.AppConfigNativeInt("MaxCartItemsBeforeCheckout")),
                        NoticeType.Failure);
                }
                else if (result.State == CheckoutState.RecurringScheduleMismatchOnItems)
                {
                    NoticeProvider.PushNotice(AppLogic.GetString("shoppingcart.aspx.19"), NoticeType.Failure);
                }
                else
                {
                    NoticeProvider.PushNotice(result.State.ToString(), NoticeType.Failure);
                }
                break;

            case CheckoutAction.Empty:
                return(View("EmptyCart"));
            }

            return(RenderIndexView(
                       checkoutStageContext: result.CheckoutStageContext,
                       persistedCheckoutContext: updated.PersistedCheckoutContext,
                       selectedPaymentMethod: updated.SelectedPaymentMethod,
                       customer: updated.Customer,
                       termsAndConditionsAccepted: result.Selections.TermsAndConditionsAccepted,
                       returnUrl: safeReturnUrl,
                       showCheckoutStageErrors: showErrors ?? false));
        }