using Nop.Core.Domain.Customers; using Nop.Core.Domain.Discounts; using Nop.Core.Domain.Orders; namespace Nop.Services.Orders; /// /// Order service interface /// public partial interface IOrderTotalCalculationService { /// /// Gets shopping cart subtotal /// /// Cart /// A value indicating whether calculated price should include tax /// /// A task that represents the asynchronous operation /// The task result contains the applied discount amount. Applied discounts. Sub total (without discount). Sub total (with discount). Tax rates (of order sub total) /// Task<(decimal discountAmount, List appliedDiscounts, decimal subTotalWithoutDiscount, decimal subTotalWithDiscount, SortedDictionary taxRates)> GetShoppingCartSubTotalAsync(IList cart, bool includingTax); /// /// Gets shopping cart subtotal /// /// Cart /// /// A task that represents the asynchronous operation /// The task result contains the applied discount amount. Applied discounts. Sub total (without discount). Sub total (with discount). Tax rates (of order sub total) /// Task<(decimal discountAmountInclTax, decimal discountAmountExclTax, List appliedDiscounts, decimal subTotalWithoutDiscountInclTax, decimal subTotalWithoutDiscountExclTax, decimal subTotalWithDiscountInclTax, decimal subTotalWithDiscountExclTax, SortedDictionary taxRates)> GetShoppingCartSubTotalsAsync(IList cart); /// /// Adjust shipping rate (free shipping, additional charges, discounts) /// /// Shipping rate to adjust /// Cart /// Adjust shipping rate to pickup in store shipping option rate /// /// A task that represents the asynchronous operation /// The task result contains the adjusted shipping rate. Applied discounts /// Task<(decimal adjustedShippingRate, List appliedDiscounts)> AdjustShippingRateAsync(decimal shippingRate, IList cart, bool applyToPickupInStore = false); /// /// Gets a value indicating whether shipping is free /// /// Cart /// Subtotal amount; pass null to calculate subtotal /// /// A task that represents the asynchronous operation /// The task result contains a value indicating whether shipping is free /// Task IsFreeShippingAsync(IList cart, decimal? subTotal = null); /// /// Gets shopping cart shipping total /// /// Cart /// /// A task that represents the asynchronous operation /// The task result contains the shipping total /// Task GetShoppingCartShippingTotalAsync(IList cart); /// /// Gets shopping cart shipping total /// /// Cart /// A value indicating whether calculated price should include tax /// /// A task that represents the asynchronous operation /// The task result contains the shipping total. Applied tax rate. Applied discounts /// Task<(decimal? shippingTotal, decimal taxRate, List appliedDiscounts)> GetShoppingCartShippingTotalAsync( IList cart, bool includingTax); /// /// Gets shopping cart shipping total /// /// Cart /// /// A task that represents the asynchronous operation /// The task result contains the shipping total. Applied tax rate. Applied discounts /// Task<(decimal? shippingTotalInclTax, decimal? shippingTotaExclTax, decimal taxRate, List appliedDiscounts)> GetShoppingCartShippingTotalsAsync( IList cart); /// /// Gets tax /// /// Shopping cart /// A value indicating whether we should use payment method additional fee when calculating tax /// /// A task that represents the asynchronous operation /// The task result contains the ax total, Tax rates /// Task<(decimal taxTotal, SortedDictionary taxRates)> GetTaxTotalAsync(IList cart, bool usePaymentMethodAdditionalFee = true); /// /// Gets shopping cart total /// /// Cart /// A value indicating reward points should be used; null to detect current choice of the customer /// A value indicating whether we should use payment method additional fee when calculating order total /// /// A task that represents the asynchronous operation /// The task result contains the shopping cart total;Null if shopping cart total couldn't be calculated now. Applied gift cards. Applied discount amount. Applied discounts. Reward points to redeem. Reward points amount in primary store currency to redeem /// Task<(decimal? shoppingCartTotal, decimal discountAmount, List appliedDiscounts, List appliedGiftCards, int redeemedRewardPoints, decimal redeemedRewardPointsAmount)> GetShoppingCartTotalAsync(IList cart, bool? useRewardPoints = null, bool usePaymentMethodAdditionalFee = true); /// /// Calculate payment method fee /// /// Cart /// Fee value /// Is fee amount specified as percentage or fixed value? /// /// A task that represents the asynchronous operation /// The task result contains the result /// Task CalculatePaymentAdditionalFeeAsync(IList cart, decimal fee, bool usePercentage); /// /// Update order totals /// /// Parameters for the updating order /// Shopping cart /// A task that represents the asynchronous operation Task UpdateOrderTotalsAsync(UpdateOrderParameters updateOrderParameters, IList restoredCart); /// /// Converts existing reward points to amount /// /// Reward points /// /// A task that represents the asynchronous operation /// The task result contains the converted value /// Task ConvertRewardPointsToAmountAsync(int rewardPoints); /// /// Gets a value indicating whether a customer has minimum amount of reward points to use (if enabled) /// /// Reward points to check /// true - reward points could use; false - cannot be used. bool CheckMinimumRewardPointsToUseRequirement(int rewardPoints); /// /// Calculate how order total (maximum amount) for which reward points could be earned/reduced /// /// Order shipping (including tax) /// Order total /// Applicable order total decimal CalculateApplicableOrderTotalForRewardPoints(decimal orderShippingInclTax, decimal orderTotal); /// /// Calculate how much reward points will be earned/reduced based on certain amount spent /// /// Customer /// Amount (in primary store currency) /// /// A task that represents the asynchronous operation /// The task result contains the number of reward points /// Task CalculateRewardPointsAsync(Customer customer, decimal amount); }