public CheckoutEvaluationResult( CheckoutState state, CheckoutStageContext checkoutStageContext, CheckoutSelectionContext selections) { State = state; CheckoutStageContext = checkoutStageContext; Selections = selections; }
public static CheckoutStageContext UpdateShippingAddress(this CheckoutStageContext context, CheckoutStageStatus shippingAddress) { return(new CheckoutStageContext( account: context.Account, paymentMethod: context.PaymentMethod, billingAddress: context.BillingAddress, shippingAddress: shippingAddress, shippingMethod: context.ShippingMethod, giftCardSetup: context.GiftCardSetup, placeOrderButton: context.PlaceOrderButton)); }
ActionResult RenderIndexView(CheckoutStageContext checkoutStageContext, PersistedCheckoutContext persistedCheckoutContext, PaymentMethodInfo selectedPaymentMethod, Customer customer, bool termsAndConditionsAccepted, string returnUrl, bool showCheckoutStageErrors) { var cart = CachedShoppingCartProvider.Get(customer, CartTypeEnum.ShoppingCart, AppLogic.StoreID()); // Build a model and render it var billingAddressViewModel = customer.PrimaryBillingAddress != null ? AddressViewModelConverter.ConvertToAddressViewModel(customer.PrimaryBillingAddress, customer) : null; var shippingAddressViewModel = customer.PrimaryShippingAddress != null ? AddressViewModelConverter.ConvertToAddressViewModel(customer.PrimaryShippingAddress, customer) : null; var cartPageAd = new PayPalAd(PayPalAd.TargetPage.Cart); var gatewayIsTwoCheckout = AppLogic.ActivePaymentGatewayCleaned() == Gateway.ro_GWTWOCHECKOUT && selectedPaymentMethod != null && selectedPaymentMethod.Name == AppLogic.ro_PMCreditCard; var shippingEnabled = checkoutStageContext.ShippingAddress.Disabled != true || checkoutStageContext.ShippingMethod.Disabled != true; var shippingInfoRequired = checkoutStageContext.ShippingAddress.Required == true || checkoutStageContext.ShippingMethod.Required == true; var displayBillingSection = checkoutStageContext.BillingAddress.Disabled != true; // nal //var allowShipToDifferentThanBillTo = AppLogic.AppConfigBool("AllowShipToDifferentThanBillTo"); var allowShipToDifferentThanBillTo = true; // Display the shipping section only if shipping is enabled on the site. If so, than if shipping can be different // than billing, we need to show the form. If shipping and billing can be different or the current payment // option doesn't care about billing, then show just the shipping section and that address will be used for // both shipping and billing. var displayShippingSection = shippingEnabled && allowShipToDifferentThanBillTo; var checkoutIsOffsiteOnly = PaymentOptionProvider.CheckoutIsOffsiteOnly(customer, cart); var paymentMethodStageState = ConvertStageStatusToDisplayState(checkoutStageContext.PaymentMethod, showCheckoutStageErrors); var model = new CheckoutIndexViewModel( selectedPaymentMethod: selectedPaymentMethod, selectedBillingAddress: billingAddressViewModel, selectedShippingAddress: shippingAddressViewModel, checkoutButtonDisabled: checkoutStageContext.PlaceOrderButton.Fulfilled != true, showOver13Required: Over13Required(customer), showOkToEmail: AppLogic.AppConfigBool("Checkout.ShowOkToEmailOnCheckout"), showTermsAndConditions: AppLogic.AppConfigBool("RequireTermsAndConditionsAtCheckout"), displayGiftCardSetup: checkoutStageContext.GiftCardSetup.Required == true, showOrderOptions: cart.AllOrderOptions.Any(), // nal //showOrderNotes: !AppLogic.AppConfigBool("DisallowOrderNotes"), showOrderNotes: true, showRealTimeShippingInfo: AppLogic.AppConfigBool("RTShipping.DumpDebugXmlOnCheckout") && (customer.IsAdminUser || customer.IsAdminSuperUser), allowShipToDifferentThanBillTo: allowShipToDifferentThanBillTo, displayShippingSection: displayShippingSection, displayBillingSection: displayBillingSection, shippingInfoIsRequired: shippingInfoRequired, displayTwoCheckoutText: gatewayIsTwoCheckout, displayContinueOffsite: selectedPaymentMethod != null && selectedPaymentMethod.Location == PaymentMethodLocation.Offsite, // nal //showPromotions: AppLogic.AppConfigBool("Promotions.Enabled"), showPromotions: true, // nal //showGiftCards: AppLogic.AppConfigBool("GiftCards.Enabled"), showGiftCards: true, giftCardCoversTotal: cart.GiftCardCoversTotal(), checkoutIsOffsiteOnly: checkoutIsOffsiteOnly, pageTitle: "Secure Checkout", payPalBanner: cartPageAd.Show ? cartPageAd.ImageScript : null, accountStageState: ConvertStageStatusToDisplayState(checkoutStageContext.Account, showCheckoutStageErrors), // nal continueShoppingUrl: Url.Content(returnUrl), offsiteCheckoutError: checkoutIsOffsiteOnly && paymentMethodStageState == CheckoutStageDisplayState.Failing ? "Please choose a payment method" : string.Empty, paymentMethodStageState: paymentMethodStageState, billingAddressStageState: ConvertStageStatusToDisplayState(checkoutStageContext.BillingAddress, showCheckoutStageErrors), shippingAddressStageState: ConvertStageStatusToDisplayState(checkoutStageContext.ShippingAddress, showCheckoutStageErrors), shippingMethodStageState: ConvertStageStatusToDisplayState(checkoutStageContext.ShippingMethod, showCheckoutStageErrors), giftCardSetupStageState: ConvertStageStatusToDisplayState(checkoutStageContext.GiftCardSetup, showCheckoutStageErrors)) { Over13Selected = persistedCheckoutContext.Over13Checked, OkToEmailSelected = customer.OKToEMail, TermsAndConditionsAccepted = termsAndConditionsAccepted }; return(View(model)); }