protected virtual OrderTotalsModel PrepareOrderTotalsModel(bool isEditable) { var model = new OrderTotalsModel(); model.IsEditable = isEditable; var orderTotals = _cartService.CalculateOrderTotals(_workContext.CurrentProfile.Id); if (orderTotals != null && orderTotals.ItemCount > 0) { //subtotal model.SubTotal = _priceFormatter.FormatPrice(orderTotals.Subtotal); //discount if (orderTotals.Discount > 0M) { model.SubTotalDiscount = _priceFormatter.FormatPrice(orderTotals.Discount * -1); foreach (var discount in orderTotals.Discounts) { model.CartOffers.Add(discount.Key); } } //allocated points if (orderTotals.AllocatedPoints > 0) { model.AllocatedPoints = orderTotals.AllocatedPoints; model.AllocatedPointsAmount = _priceFormatter.FormatPrice(orderTotals.AllocatedPoints / 100M * -1); } //shipping info if (orderTotals.ShippingCost > 0M) { model.Shipping = _priceFormatter.FormatPrice(orderTotals.ShippingCost); } else { model.Shipping = "FREE"; } model.SelectedShippingMethod = orderTotals.ShippingMethod; //tax if (orderTotals.DisplayTax) { model.DisplayTax = true; model.Tax = _priceFormatter.FormatTaxRate(orderTotals.Tax); } model.OrderTotal = _priceFormatter.FormatPrice(orderTotals.Total); } return(model); }
protected virtual OrderTotalsModel PrepareOrderTotalsModal(IList <ShoppingCartItem> cart) { var model = new OrderTotalsModel(); if (cart.Any()) { var total = 0; // общая стоимость foreach (var item in cart) { total += (int)(item.Item.InitialPrice * item.Quantity); } model.OrderTotal = total.ToString(); } return(model); }
protected virtual OrderTotalsModel PrepareOrderTotalsModel(IList <ShoppingCartItem> cart, bool isEditable) { var model = new OrderTotalsModel(); model.IsEditable = isEditable; if (cart.Count > 0) { //subtotal model.SubTotal = cart.Sum(c => c.Price * c.Quantity); model.Shipping = _settingService.GetSettingByKey <decimal>(OrderSettingNames.ShipFee); var minTotalFreeShip = _settingService.GetSettingByKey <decimal>(OrderSettingNames.OrderFreeShip); if (model.SubTotal > minTotalFreeShip) { model.OrderTotalDiscount = model.Shipping; } //total model.OrderTotal = model.SubTotal + model.Shipping - model.OrderTotalDiscount; } return(model); }
/// <summary> /// Prepare the order totals model /// </summary> /// <param name="cart">List of the shopping cart item</param> /// <param name="isEditable">Whether model is editable</param> /// <returns>Order totals model</returns> public override OrderTotalsModel PrepareOrderTotalsModel(IList <ShoppingCartItem> cart, bool isEditable) { var model = new OrderTotalsModel { IsEditable = isEditable }; if (cart.Any()) { //Avalara plugin changes PrepareTaxDetails(cart); //Avalara plugin changes //subtotal var subTotalIncludingTax = _workContext.TaxDisplayType == TaxDisplayType.IncludingTax && !_taxSettings.ForceTaxExclusionFromOrderSubtotal; _orderTotalCalculationService.GetShoppingCartSubTotal(cart, subTotalIncludingTax, out var orderSubTotalDiscountAmountBase, out var _, out var subTotalWithoutDiscountBase, out var _); var subtotalBase = subTotalWithoutDiscountBase; var subtotal = _currencyService.ConvertFromPrimaryStoreCurrency(subtotalBase, _workContext.WorkingCurrency); model.SubTotal = _priceFormatter.FormatPrice(subtotal, true, _workContext.WorkingCurrency, _workContext.WorkingLanguage, subTotalIncludingTax); if (orderSubTotalDiscountAmountBase > decimal.Zero) { var orderSubTotalDiscountAmount = _currencyService.ConvertFromPrimaryStoreCurrency(orderSubTotalDiscountAmountBase, _workContext.WorkingCurrency); model.SubTotalDiscount = _priceFormatter.FormatPrice(-orderSubTotalDiscountAmount, true, _workContext.WorkingCurrency, _workContext.WorkingLanguage, subTotalIncludingTax); } //LoadAllShippingRateComputationMethods var shippingRateComputationMethods = _shippingPluginManager.LoadActivePlugins(_workContext.CurrentCustomer, _storeContext.CurrentStore.Id); //shipping info model.RequiresShipping = _shoppingCartService.ShoppingCartRequiresShipping(cart); if (model.RequiresShipping) { var shoppingCartShippingBase = _orderTotalCalculationService.GetShoppingCartShippingTotal(cart, shippingRateComputationMethods); if (shoppingCartShippingBase.HasValue) { var shoppingCartShipping = _currencyService.ConvertFromPrimaryStoreCurrency(shoppingCartShippingBase.Value, _workContext.WorkingCurrency); model.Shipping = _priceFormatter.FormatShippingPrice(shoppingCartShipping, true); //selected shipping method var shippingOption = _genericAttributeService.GetAttribute <ShippingOption>(_workContext.CurrentCustomer, NopCustomerDefaults.SelectedShippingOptionAttribute, _storeContext.CurrentStore.Id); if (shippingOption != null) { model.SelectedShippingMethod = shippingOption.Name; } } } else { model.HideShippingTotal = _shippingSettings.HideShippingTotal; } //payment method fee var paymentMethodSystemName = _genericAttributeService.GetAttribute <string>(_workContext.CurrentCustomer, NopCustomerDefaults.SelectedPaymentMethodAttribute, _storeContext.CurrentStore.Id); var paymentMethodAdditionalFee = _paymentService.GetAdditionalHandlingFee(cart, paymentMethodSystemName); var paymentMethodAdditionalFeeWithTaxBase = _taxService.GetPaymentMethodAdditionalFee(paymentMethodAdditionalFee, _workContext.CurrentCustomer); if (paymentMethodAdditionalFeeWithTaxBase > decimal.Zero) { var paymentMethodAdditionalFeeWithTax = _currencyService.ConvertFromPrimaryStoreCurrency(paymentMethodAdditionalFeeWithTaxBase, _workContext.WorkingCurrency); model.PaymentMethodAdditionalFee = _priceFormatter.FormatPaymentMethodAdditionalFee(paymentMethodAdditionalFeeWithTax, true); } //tax var displayTax = true; var displayTaxRates = true; if (_taxSettings.HideTaxInOrderSummary && _workContext.TaxDisplayType == TaxDisplayType.IncludingTax) { displayTax = false; displayTaxRates = false; } else { var shoppingCartTaxBase = _orderTotalCalculationService.GetTaxTotal(cart, shippingRateComputationMethods, out var taxRates); //Avalara plugin changes //get tax details from the Avalara tax service, it may slightly differ from the original calculated tax var taxDetails = _httpContextAccessor.HttpContext.Session.Get <TaxDetails>(AvalaraTaxDefaults.TaxDetailsSessionValue); if (taxDetails != null) { //adjust tax total according to received value from the Avalara if (taxDetails.TaxTotal.HasValue) { shoppingCartTaxBase = taxDetails.TaxTotal.Value; } if (taxDetails.TaxRates?.Any() ?? false) { taxRates = new SortedDictionary <decimal, decimal>(taxDetails.TaxRates); } } //Avalara plugin changes var shoppingCartTax = _currencyService.ConvertFromPrimaryStoreCurrency(shoppingCartTaxBase, _workContext.WorkingCurrency); if (shoppingCartTaxBase == 0 && _taxSettings.HideZeroTax) { displayTax = false; displayTaxRates = false; } else { displayTaxRates = _taxSettings.DisplayTaxRates && taxRates.Any(); displayTax = !displayTaxRates; model.Tax = _priceFormatter.FormatPrice(shoppingCartTax, true, false); foreach (var tr in taxRates) { model.TaxRates.Add(new OrderTotalsModel.TaxRate { Rate = _priceFormatter.FormatTaxRate(tr.Key), Value = _priceFormatter.FormatPrice(_currencyService.ConvertFromPrimaryStoreCurrency(tr.Value, _workContext.WorkingCurrency), true, false), }); } } } model.DisplayTaxRates = displayTaxRates; model.DisplayTax = displayTax; //total var shoppingCartTotalBase = _orderTotalCalculationService.GetShoppingCartTotal(cart, out var orderTotalDiscountAmountBase, out var _, out var appliedGiftCards, out var redeemedRewardPoints, out var redeemedRewardPointsAmount); if (shoppingCartTotalBase.HasValue) { var shoppingCartTotal = _currencyService.ConvertFromPrimaryStoreCurrency(shoppingCartTotalBase.Value, _workContext.WorkingCurrency); model.OrderTotal = _priceFormatter.FormatPrice(shoppingCartTotal, true, false); } //discount if (orderTotalDiscountAmountBase > decimal.Zero) { var orderTotalDiscountAmount = _currencyService.ConvertFromPrimaryStoreCurrency(orderTotalDiscountAmountBase, _workContext.WorkingCurrency); model.OrderTotalDiscount = _priceFormatter.FormatPrice(-orderTotalDiscountAmount, true, false); } //gift cards if (appliedGiftCards != null && appliedGiftCards.Any()) { foreach (var appliedGiftCard in appliedGiftCards) { var gcModel = new OrderTotalsModel.GiftCard { Id = appliedGiftCard.GiftCard.Id, CouponCode = appliedGiftCard.GiftCard.GiftCardCouponCode, }; var amountCanBeUsed = _currencyService.ConvertFromPrimaryStoreCurrency(appliedGiftCard.AmountCanBeUsed, _workContext.WorkingCurrency); gcModel.Amount = _priceFormatter.FormatPrice(-amountCanBeUsed, true, false); var remainingAmountBase = _giftCardService.GetGiftCardRemainingAmount(appliedGiftCard.GiftCard) - appliedGiftCard.AmountCanBeUsed; var remainingAmount = _currencyService.ConvertFromPrimaryStoreCurrency(remainingAmountBase, _workContext.WorkingCurrency); gcModel.Remaining = _priceFormatter.FormatPrice(remainingAmount, true, false); model.GiftCards.Add(gcModel); } } //reward points to be spent (redeemed) if (redeemedRewardPointsAmount > decimal.Zero) { var redeemedRewardPointsAmountInCustomerCurrency = _currencyService.ConvertFromPrimaryStoreCurrency(redeemedRewardPointsAmount, _workContext.WorkingCurrency); model.RedeemedRewardPoints = redeemedRewardPoints; model.RedeemedRewardPointsAmount = _priceFormatter.FormatPrice(-redeemedRewardPointsAmountInCustomerCurrency, true, false); } //reward points to be earned if (_rewardPointsSettings.Enabled && _rewardPointsSettings.DisplayHowMuchWillBeEarned && shoppingCartTotalBase.HasValue) { //get shipping total var shippingBaseInclTax = !model.RequiresShipping ? 0 : _orderTotalCalculationService.GetShoppingCartShippingTotal(cart, true, shippingRateComputationMethods) ?? 0; //get total for reward points var totalForRewardPoints = _orderTotalCalculationService .CalculateApplicableOrderTotalForRewardPoints(shippingBaseInclTax, shoppingCartTotalBase.Value); if (totalForRewardPoints > decimal.Zero) { model.WillEarnRewardPoints = _orderTotalCalculationService.CalculateRewardPoints(_workContext.CurrentCustomer, totalForRewardPoints); } } } return(model); }
public async Task <IViewComponentResult> InvokeAsync(bool isEditable = false) { var orderTotalsEvent = new RenderingOrderTotalsEvent(); await Services.EventPublisher.PublishAsync(orderTotalsEvent); var currency = Services.WorkContext.WorkingCurrency; var customer = orderTotalsEvent.Customer ?? Services.WorkContext.CurrentCustomer; var storeId = orderTotalsEvent.StoreId ?? Services.StoreContext.CurrentStore.Id; var cart = await _shoppingCartService.GetCartItemsAsync(customer, ShoppingCartType.ShoppingCart, storeId); var model = new OrderTotalsModel { IsEditable = isEditable }; if (!cart.Any()) { return(View(model)); } model.Weight = decimal.Zero; foreach (var cartItem in cart) { model.Weight += cartItem.Item.Product.Weight * cartItem.Item.Quantity; } var measureWeight = await _db.MeasureWeights.FindByIdAsync(_measureSettings.BaseWeightId, false); if (measureWeight != null) { model.WeightMeasureUnitName = measureWeight.GetLocalized(x => x.Name); } // SubTotal var cartSubTotal = await _orderCalculationService.GetShoppingCartSubtotalAsync(cart); var subTotalConverted = _currencyService.ConvertFromPrimaryCurrency(cartSubTotal.SubtotalWithoutDiscount.Amount, currency); model.SubTotal = subTotalConverted; if (cartSubTotal.DiscountAmount > decimal.Zero) { var subTotalDiscountAmountConverted = _currencyService.ConvertFromPrimaryCurrency(cartSubTotal.DiscountAmount.Amount, currency); model.SubTotalDiscount = subTotalDiscountAmountConverted * -1; model.AllowRemovingSubTotalDiscount = cartSubTotal.AppliedDiscount != null && cartSubTotal.AppliedDiscount.RequiresCouponCode && cartSubTotal.AppliedDiscount.CouponCode.HasValue() && model.IsEditable; } // Shipping info // TODO: (ms) (core) Re-implement when any payment method has been implemented model.RequiresShipping = false;// cart.IsShippingRequired(); if (model.RequiresShipping) { var shippingTotal = await _orderCalculationService.GetShoppingCartShippingTotalAsync(cart); if (shippingTotal.ShippingTotal.HasValue) { var shippingTotalConverted = _currencyService.ConvertFromPrimaryCurrency(shippingTotal.ShippingTotal.Value.Amount, currency); model.Shipping = shippingTotalConverted.ToString(); // Selected shipping method var shippingOption = customer.GenericAttributes.SelectedShippingOption; if (shippingOption != null) { model.SelectedShippingMethod = shippingOption.Name; } } } // Payment method fee var paymentFee = await _orderCalculationService.GetShoppingCartPaymentFeeAsync(cart, customer.GenericAttributes.SelectedPaymentMethod); var paymentFeeTax = await _taxCalculator.CalculatePaymentFeeTaxAsync(paymentFee.Amount, customer : customer); if (paymentFeeTax.Price != 0m) { var convertedPaymentFeeTax = _currencyService.ConvertFromPrimaryCurrency(paymentFeeTax.Price, currency); model.PaymentMethodAdditionalFee = convertedPaymentFeeTax; } // Tax var displayTax = true; var displayTaxRates = true; if (_taxSettings.HideTaxInOrderSummary && Services.WorkContext.TaxDisplayType == TaxDisplayType.IncludingTax) { displayTax = false; displayTaxRates = false; } else { (Money Price, TaxRatesDictionary TaxRates)cartTaxBase = (new Money(1.19m, currency), new TaxRatesDictionary()); //await _orderCalculationService.GetShoppingCartTaxTotalAsync(cart); var cartTax = _currencyService.ConvertFromPrimaryCurrency(cartTaxBase.Price.Amount, currency); if (cartTaxBase.Price == decimal.Zero && _taxSettings.HideZeroTax) { displayTax = false; displayTaxRates = false; } else { displayTaxRates = _taxSettings.DisplayTaxRates && cartTaxBase.TaxRates.Count > 0; displayTax = !displayTaxRates; model.Tax = cartTax.ToString(true); foreach (var taxRate in cartTaxBase.TaxRates) { var rate = _taxService.FormatTaxRate(taxRate.Key); var labelKey = "ShoppingCart.Totals.TaxRateLine" + (Services.WorkContext.TaxDisplayType == TaxDisplayType.IncludingTax ? "Incl" : "Excl"); model.TaxRates.Add(new OrderTotalsModel.TaxRate { Rate = rate, Value = _currencyService.ConvertFromPrimaryCurrency(taxRate.Value, currency), Label = _localizationService.GetResource(labelKey).FormatCurrent(rate) }); } } } model.DisplayTaxRates = displayTaxRates; model.DisplayTax = displayTax; model.DisplayWeight = _shoppingCartSettings.ShowWeight; model.ShowConfirmOrderLegalHint = _shoppingCartSettings.ShowConfirmOrderLegalHint; // Cart total // TODO: (ms) (core) Re-implement when any payment method has been implemented //var cartTotal = await _orderCalculationService.GetShoppingCartTotalAsync(cart); var cartTotal = new ShoppingCartTotal { Total = new(decimal.Zero, currency), ToNearestRounding = new(decimal.Zero, currency), DiscountAmount = new(15, currency), AppliedDiscount = (await _db.Discounts.FirstOrDefaultAsync()) ?? new(), RedeemedRewardPoints = 10, RedeemedRewardPointsAmount = new(10, currency), CreditBalance = new(decimal.Zero, currency), AppliedGiftCards = new() { new() { GiftCard = (await _db.GiftCards.Include(x => x.GiftCardUsageHistory).FirstOrDefaultAsync()) ?? new(), UsableAmount = new(50m, _currencyService.PrimaryCurrency) } }, ConvertedAmount = new ShoppingCartTotal.ConvertedAmounts { Total = new(decimal.Zero, currency), ToNearestRounding = new(decimal.Zero, currency) } }; if (cartTotal.ConvertedAmount.Total.HasValue) { model.OrderTotal = cartTotal.ConvertedAmount.Total.Value; if (cartTotal.ConvertedAmount.ToNearestRounding != decimal.Zero) { model.OrderTotalRounding = cartTotal.ConvertedAmount.ToNearestRounding; } } // Discount if (cartTotal.DiscountAmount > decimal.Zero) { var orderTotalDiscountAmount = _currencyService.ConvertFromPrimaryCurrency(cartTotal.DiscountAmount.Amount, currency); model.OrderTotalDiscount = orderTotalDiscountAmount * -1; model.AllowRemovingOrderTotalDiscount = cartTotal.AppliedDiscount != null && cartTotal.AppliedDiscount.RequiresCouponCode && cartTotal.AppliedDiscount.CouponCode.HasValue() && model.IsEditable; } // Gift cards if (!cartTotal.AppliedGiftCards.IsNullOrEmpty()) { foreach (var appliedGiftCard in cartTotal.AppliedGiftCards) { if (appliedGiftCard?.GiftCard == null) { continue; } var gcModel = new OrderTotalsModel.GiftCard { Id = appliedGiftCard.GiftCard.Id, CouponCode = appliedGiftCard.GiftCard.GiftCardCouponCode, }; var amountCanBeUsed = _currencyService.ConvertFromPrimaryCurrency(appliedGiftCard.UsableAmount.Amount, currency); gcModel.Amount = amountCanBeUsed * -1; var remainingAmountBase = _giftCardService.GetRemainingAmount(appliedGiftCard.GiftCard) - appliedGiftCard.UsableAmount; var remainingAmount = _currencyService.ConvertFromPrimaryCurrency(remainingAmountBase.Amount, currency); gcModel.Remaining = remainingAmount; model.GiftCards.Add(gcModel); } } // Reward points if (cartTotal.RedeemedRewardPointsAmount > decimal.Zero) { var redeemedRewardPointsAmountInCustomerCurrency = _currencyService.ConvertFromPrimaryCurrency(cartTotal.RedeemedRewardPointsAmount.Amount, currency); model.RedeemedRewardPoints = cartTotal.RedeemedRewardPoints; model.RedeemedRewardPointsAmount = (redeemedRewardPointsAmountInCustomerCurrency * -1).ToString(true); } // Credit balance. if (cartTotal.CreditBalance > decimal.Zero) { var convertedCreditBalance = _currencyService.ConvertFromPrimaryCurrency(cartTotal.CreditBalance.Amount, currency); model.CreditBalance = (convertedCreditBalance * -1).ToString(true); } return(View(model)); }
/// <summary> /// PrepareOrderTotalsModel: /// </summary> /// <param name="cart"></param> /// <param name="isEditable"></param> /// <returns></returns> public virtual decimal PrepareOrderTotalsModel(IList <ShoppingCartItem> cart, bool isEditable) { var model = new OrderTotalsModel(); model.IsEditable = isEditable; if (cart.Count > 0) { //subtotal decimal orderSubTotalDiscountAmountBase; Discount orderSubTotalAppliedDiscount; decimal subTotalWithoutDiscountBase; decimal subTotalWithDiscountBase; var subTotalIncludingTax = _workContext.TaxDisplayType == TaxDisplayType.IncludingTax && !_taxSettings.ForceTaxExclusionFromOrderSubtotal; _orderTotalCalculationService.GetShoppingCartSubTotal(cart, subTotalIncludingTax, out orderSubTotalDiscountAmountBase, out orderSubTotalAppliedDiscount, out subTotalWithoutDiscountBase, out subTotalWithDiscountBase); decimal subtotalBase = subTotalWithoutDiscountBase; decimal subtotal = _currencyService.ConvertFromPrimaryStoreCurrency(subtotalBase, _workContext.WorkingCurrency); model.SubTotal = _priceFormatter.FormatPrice(subtotal, true, _workContext.WorkingCurrency, _workContext.WorkingLanguage, subTotalIncludingTax); if (orderSubTotalDiscountAmountBase > decimal.Zero) { decimal orderSubTotalDiscountAmount = _currencyService.ConvertFromPrimaryStoreCurrency(orderSubTotalDiscountAmountBase, _workContext.WorkingCurrency); model.SubTotalDiscount = _priceFormatter.FormatPrice(-orderSubTotalDiscountAmount, true, _workContext.WorkingCurrency, _workContext.WorkingLanguage, subTotalIncludingTax); model.AllowRemovingSubTotalDiscount = orderSubTotalAppliedDiscount != null && orderSubTotalAppliedDiscount.RequiresCouponCode && !String.IsNullOrEmpty(orderSubTotalAppliedDiscount.CouponCode) && model.IsEditable; } //shipping info model.RequiresShipping = cart.RequiresShipping(); if (model.RequiresShipping) { decimal?shoppingCartShippingBase = _orderTotalCalculationService.GetShoppingCartShippingTotal(cart); if (shoppingCartShippingBase.HasValue) { decimal shoppingCartShipping = _currencyService.ConvertFromPrimaryStoreCurrency(shoppingCartShippingBase.Value, _workContext.WorkingCurrency); model.Shipping = _priceFormatter.FormatShippingPrice(shoppingCartShipping, true); //selected shipping method var shippingOption = _workContext.CurrentCustomer.GetAttribute <ShippingOption>(SystemCustomerAttributeNames.SelectedShippingOption, _storeContext.CurrentStore.Id); if (shippingOption != null) { model.SelectedShippingMethod = shippingOption.Name; } } } //payment method fee var paymentMethodSystemName = _workContext.CurrentCustomer.GetAttribute <string>( SystemCustomerAttributeNames.SelectedPaymentMethod, _storeContext.CurrentStore.Id); decimal paymentMethodAdditionalFee = _paymentService.GetAdditionalHandlingFee(cart, paymentMethodSystemName); decimal paymentMethodAdditionalFeeWithTaxBase = _taxService.GetPaymentMethodAdditionalFee(paymentMethodAdditionalFee, _workContext.CurrentCustomer); if (paymentMethodAdditionalFeeWithTaxBase > decimal.Zero) { decimal paymentMethodAdditionalFeeWithTax = _currencyService.ConvertFromPrimaryStoreCurrency(paymentMethodAdditionalFeeWithTaxBase, _workContext.WorkingCurrency); model.PaymentMethodAdditionalFee = _priceFormatter.FormatPaymentMethodAdditionalFee(paymentMethodAdditionalFeeWithTax, true); } //tax bool displayTax = true; bool displayTaxRates = true; if (_taxSettings.HideTaxInOrderSummary && _workContext.TaxDisplayType == TaxDisplayType.IncludingTax) { displayTax = false; displayTaxRates = false; } else { SortedDictionary <decimal, decimal> taxRates; decimal shoppingCartTaxBase = _orderTotalCalculationService.GetTaxTotal(cart, out taxRates); decimal shoppingCartTax = _currencyService.ConvertFromPrimaryStoreCurrency(shoppingCartTaxBase, _workContext.WorkingCurrency); if (shoppingCartTaxBase == 0 && _taxSettings.HideZeroTax) { displayTax = false; displayTaxRates = false; } else { displayTaxRates = _taxSettings.DisplayTaxRates && taxRates.Count > 0; displayTax = !displayTaxRates; model.Tax = _priceFormatter.FormatPrice(shoppingCartTax, true, false); foreach (var tr in taxRates) { model.TaxRates.Add(new OrderTotalsModel.TaxRate { Rate = _priceFormatter.FormatTaxRate(tr.Key), Value = _priceFormatter.FormatPrice(_currencyService.ConvertFromPrimaryStoreCurrency(tr.Value, _workContext.WorkingCurrency), true, false), }); } } } model.DisplayTaxRates = displayTaxRates; model.DisplayTax = displayTax; //total decimal orderTotalDiscountAmountBase; Discount orderTotalAppliedDiscount; List <AppliedGiftCard> appliedGiftCards; int redeemedRewardPoints; decimal redeemedRewardPointsAmount; decimal?shoppingCartTotalBase = _orderTotalCalculationService.GetShoppingCartTotal(cart, out orderTotalDiscountAmountBase, out orderTotalAppliedDiscount, out appliedGiftCards, out redeemedRewardPoints, out redeemedRewardPointsAmount); return(_currencyService.ConvertFromPrimaryStoreCurrency(shoppingCartTotalBase.Value, _workContext.WorkingCurrency)); } return(decimal.Zero); }