Interface CartPricingService

All Known Implementing Classes:
DefaultCartPricingService

public interface CartPricingService
Defines a service that handles pricing operations on a Cart.
Author:
Chad Harchar (charchar)
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    calculateTotals(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Calculate the totals for the cart.
    com.broadleafcommerce.cart.client.domain.Cart
    priceCart(com.broadleafcommerce.cart.client.domain.Cart cart, PriceCartRequest priceCartRequest, boolean update, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    com.broadleafcommerce.cart.client.domain.Cart
    priceCart(com.broadleafcommerce.cart.client.domain.Cart cart, PriceCartRequest priceCartRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Price the cart with the provided locale and currency.
    default com.broadleafcommerce.cart.client.domain.Cart
    priceCart(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Price the cart.
    void
    priceCartItems(com.broadleafcommerce.cart.client.domain.Cart cart, PriceCartRequest priceCartRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    default void
    priceCartItems(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     
    com.broadleafcommerce.cart.client.domain.Cart
    priceCartWithCatalogPriceUpdates(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reprice the cart, including applying the latest catalog-based prices for each of its items
  • Method Details

    • priceCart

      default com.broadleafcommerce.cart.client.domain.Cart priceCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Price the cart.
      Parameters:
      cart - The cart on which to perform the operation.
      contextInfo - the context info
      Returns:
      the priced cart
      See Also:
    • priceCart

      com.broadleafcommerce.cart.client.domain.Cart priceCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable PriceCartRequest priceCartRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Price the cart with the provided locale and currency.
      Parameters:
      cart - The cart on which to perform the operation.
      priceCartRequest - optional info to be used when deciding how to price the cart
      contextInfo - the context info
      Returns:
      the priced cart
    • priceCartWithCatalogPriceUpdates

      com.broadleafcommerce.cart.client.domain.Cart priceCartWithCatalogPriceUpdates(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reprice the cart, including applying the latest catalog-based prices for each of its items
      Parameters:
      cart - The cart on which to perform the operation.
      contextInfo - the context info
      Returns:
      the priced cart
    • priceCart

      @Deprecated com.broadleafcommerce.cart.client.domain.Cart priceCart(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable PriceCartRequest priceCartRequest, boolean update, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Price the cart with the provided locale and currency.

      1. Initialize pricing request
      2. Clear current pricing information from cart
      3. Update cart item pricing
        1. Retrieve prices from the pricing provider
        2. Calculate each item's subtotal
        3. Record whether each item was priced
      4. If the items were all priced, continue, otherwise mark the cart as un-priced, update, and return
      5. Calculate fulfillment pricing by calling the fulfillment pricing provider
      6. Apply adjustments by calling the offer provider
      7. Calculate the cart totals
      8. Record the cart as priced, update (if specified), and return
      Parameters:
      cart - The cart on which to perform the operation.
      priceCartRequest - optional info to be used when deciding how to price the cart
      update - whether to update (save) the cart after pricing
      contextInfo - the context info
      Returns:
      the priced cart
    • priceCartItems

      default void priceCartItems(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • priceCartItems

      void priceCartItems(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable PriceCartRequest priceCartRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • calculateTotals

      void calculateTotals(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Calculate the totals for the cart. This assumes pricing such as item amount, adjustments, and taxes have been determined already.
      Parameters:
      cart - The cart to calculate totals for.