public override async Task MapAsync(IEnumerable <OrganizedShoppingCartItem> from, CheckoutConfirmModel to, dynamic parameters = null) { Guard.NotNull(to, nameof(to)); Guard.NotNull(from, nameof(from)); to.TermsOfServiceEnabled = _orderSettings.TermsOfServiceEnabled; to.ShowEsdRevocationWaiverBox = _shoppingCartSettings.ShowEsdRevocationWaiverBox; to.BypassPaymentMethodInfo = _paymentSettings.BypassPaymentMethodInfo; to.NewsLetterSubscription = _shoppingCartSettings.NewsLetterSubscription; to.ThirdPartyEmailHandOver = _shoppingCartSettings.ThirdPartyEmailHandOver; if (_shoppingCartSettings.ThirdPartyEmailHandOver != CheckoutThirdPartyEmailHandOver.None) { to.ThirdPartyEmailHandOverLabel = _shoppingCartSettings.GetLocalizedSetting( x => x.ThirdPartyEmailHandOverLabel, _services.WorkContext.WorkingLanguage, _services.StoreContext.CurrentStore.Id, true, false); if (to.ThirdPartyEmailHandOverLabel.IsEmpty()) { to.ThirdPartyEmailHandOverLabel = T("Admin.Configuration.Settings.ShoppingCart.ThirdPartyEmailHandOverLabel.Default"); } } }
public async Task <IActionResult> ShoppingCart(int storeScope, ShoppingCartSettings settings) { var model = await MapperFactory.MapAsync <ShoppingCartSettings, ShoppingCartSettingsModel>(settings); AddLocales(model.Locales, (locale, languageId) => { locale.ThirdPartyEmailHandOverLabel = settings.GetLocalizedSetting(x => x.ThirdPartyEmailHandOverLabel, languageId, storeScope, false, false); }); return(View(model)); }
protected CheckoutConfirmModel PrepareConfirmOrderModel(IList <OrganizedShoppingCartItem> cart) { var model = new CheckoutConfirmModel(); // Minimum order totals validation var customerRoleIds = _workContext.CurrentCustomer.GetRoleIds(); var(isAboveMinimumOrderTotal, orderTotalMinimum) = _orderProcessingService.IsAboveOrderTotalMinimum(cart, customerRoleIds); if (!isAboveMinimumOrderTotal) { orderTotalMinimum = _currencyService.ConvertFromPrimaryStoreCurrency( orderTotalMinimum, _workContext.WorkingCurrency); var resource = _orderSettings.ApplyToSubtotal ? "Checkout.MinOrderSubtotalAmount" : "Checkout.MinOrderTotalAmount"; model.OrderAmountWarning = string.Format( _localizationService.GetResource(resource), _priceFormatter.FormatPrice(orderTotalMinimum, true, false)); } // Maximum order totals validation var(isBelowOrderTotalMaximum, orderTotalMaximum) = _orderProcessingService.IsBelowOrderTotalMaximum(cart, customerRoleIds); if (isAboveMinimumOrderTotal && !isBelowOrderTotalMaximum) { orderTotalMaximum = _currencyService.ConvertFromPrimaryStoreCurrency( orderTotalMaximum, _workContext.WorkingCurrency); var resource = _orderSettings.ApplyToSubtotal ? "Checkout.MaxOrderSubtotalAmount" : "Checkout.MaxOrderTotalAmount"; model.OrderAmountWarning = string.Format( _localizationService.GetResource(resource), _priceFormatter.FormatPrice(orderTotalMaximum, true, false)); } model.TermsOfServiceEnabled = _orderSettings.TermsOfServiceEnabled; model.ShowEsdRevocationWaiverBox = _shoppingCartSettings.ShowEsdRevocationWaiverBox; model.BypassPaymentMethodInfo = _paymentSettings.BypassPaymentMethodInfo; model.NewsLetterSubscription = _shoppingCartSettings.NewsLetterSubscription; model.ThirdPartyEmailHandOver = _shoppingCartSettings.ThirdPartyEmailHandOver; if (_shoppingCartSettings.ThirdPartyEmailHandOver != CheckoutThirdPartyEmailHandOver.None) { model.ThirdPartyEmailHandOverLabel = _shoppingCartSettings.GetLocalizedSetting(x => x.ThirdPartyEmailHandOverLabel, _workContext.WorkingLanguage, _storeContext.CurrentStore.Id, true, false); if (model.ThirdPartyEmailHandOverLabel.IsEmpty()) { model.ThirdPartyEmailHandOverLabel = T("Admin.Configuration.Settings.ShoppingCart.ThirdPartyEmailHandOverLabel.Default"); } } return(model); }
protected CheckoutConfirmModel PrepareConfirmOrderModel(IList <OrganizedShoppingCartItem> cart) { var model = new CheckoutConfirmModel { TermsOfServiceEnabled = _orderSettings.TermsOfServiceEnabled, ShowEsdRevocationWaiverBox = _shoppingCartSettings.ShowEsdRevocationWaiverBox, BypassPaymentMethodInfo = _paymentSettings.BypassPaymentMethodInfo, NewsLetterSubscription = _shoppingCartSettings.NewsLetterSubscription, ThirdPartyEmailHandOver = _shoppingCartSettings.ThirdPartyEmailHandOver }; if (_shoppingCartSettings.ThirdPartyEmailHandOver != CheckoutThirdPartyEmailHandOver.None) { model.ThirdPartyEmailHandOverLabel = _shoppingCartSettings.GetLocalizedSetting(x => x.ThirdPartyEmailHandOverLabel, _workContext.WorkingLanguage, _storeContext.CurrentStore.Id, true, false); if (model.ThirdPartyEmailHandOverLabel.IsEmpty()) { model.ThirdPartyEmailHandOverLabel = T("Admin.Configuration.Settings.ShoppingCart.ThirdPartyEmailHandOverLabel.Default"); } } return(model); }