Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

IShoppingCartService.cs

using Nop.Core.Domain.Catalog;
using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Discounts;
using Nop.Core.Domain.Orders;
using Nop.Core.Domain.Stores;

namespace Nop.Services.Orders;

/// 
/// Shopping cart service
/// 
public partial interface IShoppingCartService
{
    /// 
    /// Delete shopping cart item
    /// 
    /// Shopping cart item
    /// A value indicating whether to reset checkout data
    /// A value indicating whether to ensure that only active checkout attributes are attached to the current customer
    /// A task that represents the asynchronous operation
    Task DeleteShoppingCartItemAsync(ShoppingCartItem shoppingCartItem, bool resetCheckoutData = true,
        bool ensureOnlyActiveCheckoutAttributes = false);

    /// 
    /// Clear shopping cart
    /// 
    /// Customer
    /// Store ID
    /// A task that represents the asynchronous operation
    Task ClearShoppingCartAsync(Customer customer, int storeId);

    /// 
    /// Delete shopping cart item
    /// 
    /// Shopping cart item ID
    /// A value indicating whether to reset checkout data
    /// A value indicating whether to ensure that only active checkout attributes are attached to the current customer
    /// A task that represents the asynchronous operation
    Task DeleteShoppingCartItemAsync(int shoppingCartItemId, bool resetCheckoutData = true,
        bool ensureOnlyActiveCheckoutAttributes = false);

    /// 
    /// Deletes expired shopping cart items
    /// 
    /// Older than date and time
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the number of deleted items
    /// 
    Task DeleteExpiredShoppingCartItemsAsync(DateTime olderThanUtc);

    /// 
    /// Get products from shopping cart whether requiring specific product
    /// 
    /// Shopping cart 
    /// Product
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task> GetProductsRequiringProductAsync(IList cart, Product product);

    /// 
    /// Gets shopping cart
    /// 
    /// Customer
    /// Shopping cart type; pass null to load all records
    /// Store identifier; pass 0 to load all records
    /// Product identifier; pass null to load all records
    /// Created date from (UTC); pass null to load all records
    /// Created date to (UTC); pass null to load all records
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the shopping Cart
    /// 
    Task> GetShoppingCartAsync(Customer customer, ShoppingCartType? shoppingCartType = null,
        int storeId = 0, int? productId = null, DateTime? createdFromUtc = null, DateTime? createdToUtc = null);

    /// 
    /// Validates shopping cart item attributes
    /// 
    /// Customer
    /// Shopping cart type
    /// Product
    /// Quantity
    /// Attributes in XML format
    /// A value indicating whether we should ignore non-combinable attributes
    /// A value indicating whether we should ignore filtering by "is condition met" property
    /// A value indicating whether we should ignore bundled (associated) products
    /// Shopping cart identifier; pass 0 if it's a new item 
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the warnings
    /// 
    Task> GetShoppingCartItemAttributeWarningsAsync(Customer customer,
        ShoppingCartType shoppingCartType,
        Product product,
        int quantity = 1,
        string attributesXml = "",
        bool ignoreNonCombinableAttributes = false,
        bool ignoreConditionMet = false,
        bool ignoreBundledProducts = false,
        int shoppingCartItemId = 0);

    /// 
    /// Validates shopping cart item (gift card)
    /// 
    /// Shopping cart type
    /// Product
    /// Attributes in XML format
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the warnings
    /// 
    Task> GetShoppingCartItemGiftCardWarningsAsync(ShoppingCartType shoppingCartType,
        Product product, string attributesXml);

    /// 
    /// Validates shopping cart item for rental products
    /// 
    /// Product
    /// Rental start date
    /// Rental end date
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the warnings
    /// 
    Task> GetRentalProductWarningsAsync(Product product,
        DateTime? rentalStartDate = null, DateTime? rentalEndDate = null);

    /// 
    /// Validates shopping cart item
    /// 
    /// Customer
    /// Shopping cart type
    /// Product
    /// Store identifier
    /// Attributes in XML format
    /// Customer entered price
    /// Rental start date
    /// Rental end date
    /// Quantity
    /// Whether to add required products
    /// Shopping cart identifier; pass 0 if it's a new item
    /// A value indicating whether we should validate a product for standard properties
    /// A value indicating whether we should validate product attributes
    /// A value indicating whether we should validate gift card properties
    /// A value indicating whether we should validate required products (products which require other products to be added to the cart)
    /// A value indicating whether we should validate rental properties
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the warnings
    /// 
    Task> GetShoppingCartItemWarningsAsync(Customer customer, ShoppingCartType shoppingCartType,
        Product product, int storeId,
        string attributesXml, decimal customerEnteredPrice,
        DateTime? rentalStartDate = null, DateTime? rentalEndDate = null,
        int quantity = 1, bool addRequiredProducts = true, int shoppingCartItemId = 0,
        bool getStandardWarnings = true, bool getAttributesWarnings = true,
        bool getGiftCardWarnings = true, bool getRequiredProductWarnings = true,
        bool getRentalWarnings = true);

    /// 
    /// Validates whether this shopping cart is valid
    /// 
    /// Shopping cart
    /// Checkout attributes in XML format
    /// A value indicating whether to validate checkout attributes
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the warnings
    /// 
    Task> GetShoppingCartWarningsAsync(IList shoppingCart,
        string checkoutAttributesXml, bool validateCheckoutAttributes);

    /// 
    /// Gets the shopping cart unit price (one item)
    /// 
    /// The shopping cart item
    /// A value indicating whether include discounts or not for price computation
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the shopping cart unit price (one item). Applied discount amount. Applied discounts
    /// 
    Task<(decimal unitPrice, decimal discountAmount, List appliedDiscounts)> GetUnitPriceAsync(ShoppingCartItem shoppingCartItem,
        bool includeDiscounts);

    /// 
    /// Gets the shopping cart unit price (one item)
    /// 
    /// Product
    /// Customer
    /// Shopping cart type
    /// Quantity
    /// Product attributes (XML format)
    /// Customer entered price (if specified)
    /// Rental start date (null for not rental products)
    /// Rental end date (null for not rental products)
    /// A value indicating whether include discounts or not for price computation
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the shopping cart unit price (one item)
    /// 
    Task<(decimal unitPrice, decimal discountAmount, List appliedDiscounts)> GetUnitPriceAsync(Product product,
        Customer customer,
        Store store,
        ShoppingCartType shoppingCartType,
        int quantity,
        string attributesXml,
        decimal customerEnteredPrice,
        DateTime? rentalStartDate, DateTime? rentalEndDate,
        bool includeDiscounts);

    /// 
    /// Gets the shopping cart item sub total
    /// 
    /// The shopping cart item
    /// A value indicating whether include discounts or not for price computation
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the shopping cart item sub total. Applied discount amount.Applied discounts. Maximum discounted qty. Return not nullable value if discount cannot be applied to ALL items
    /// 
    Task<(decimal subTotal, decimal discountAmount, List appliedDiscounts, int? maximumDiscountQty)> GetSubTotalAsync(ShoppingCartItem shoppingCartItem,
        bool includeDiscounts);

    /// 
    /// Finds a shopping cart item in the cart
    /// 
    /// Shopping cart
    /// Shopping cart type
    /// Product
    /// Attributes in XML format
    /// Price entered by a customer
    /// Rental start date
    /// Rental end date
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the found shopping cart item
    /// 
    Task FindShoppingCartItemInTheCartAsync(IList shoppingCart,
        ShoppingCartType shoppingCartType,
        Product product,
        string attributesXml = "",
        decimal customerEnteredPrice = decimal.Zero,
        DateTime? rentalStartDate = null,
        DateTime? rentalEndDate = null);

    /// 
    /// Add a product to shopping cart
    /// 
    /// Customer
    /// Product
    /// Shopping cart type
    /// Store identifier
    /// Attributes in XML format
    /// The price enter by a customer
    /// Rental start date
    /// Rental end date
    /// Quantity
    /// Whether to add required products
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the warnings
    /// 
    Task> AddToCartAsync(Customer customer, Product product,
        ShoppingCartType shoppingCartType, int storeId, string attributesXml = null,
        decimal customerEnteredPrice = decimal.Zero,
        DateTime? rentalStartDate = null, DateTime? rentalEndDate = null,
        int quantity = 1, bool addRequiredProducts = true);

    /// 
    /// Updates the shopping cart item
    /// 
    /// Customer
    /// Shopping cart item identifier
    /// Attributes in XML format
    /// New customer entered price
    /// Rental start date
    /// Rental end date
    /// New shopping cart item quantity
    /// A value indicating whether to reset checkout data
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the warnings
    /// 
    Task> UpdateShoppingCartItemAsync(Customer customer,
        int shoppingCartItemId, string attributesXml,
        decimal customerEnteredPrice,
        DateTime? rentalStartDate = null, DateTime? rentalEndDate = null,
        int quantity = 1, bool resetCheckoutData = true);

    /// 
    /// Migrate shopping cart
    /// 
    /// From customer
    /// To customer
    /// A value indicating whether to coupon codes (discount and gift card) should be also re-applied
    /// A task that represents the asynchronous operation
    Task MigrateShoppingCartAsync(Customer fromCustomer, Customer toCustomer, bool includeCouponCodes);

    /// 
    /// Indicates whether the shopping cart requires shipping
    /// 
    /// Shopping cart
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains true if the shopping cart requires shipping; otherwise, false.
    /// 
    Task ShoppingCartRequiresShippingAsync(IList shoppingCart);

    /// 
    /// Gets a value indicating whether shopping cart is recurring
    /// 
    /// Shopping cart
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task ShoppingCartIsRecurringAsync(IList shoppingCart);

    /// 
    /// Get a recurring cycle information
    /// 
    /// Shopping cart
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the error (if exists); otherwise, empty string
    /// 
    Task<(string error, int cycleLength, RecurringProductCyclePeriod cyclePeriod, int totalCycles)> GetRecurringCycleInfoAsync(IList shoppingCart);
}