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 TypeMethodDescriptionvoid
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) Deprecated.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 cartcontextInfo
- 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) Deprecated.in favor ofpriceCart(Cart, PriceCartRequest, ContextInfo)
Price the cart with the provided locale and currency.- Initialize pricing request
- Clear current pricing information from cart
- Update cart item pricing
- Retrieve prices from the pricing provider
- Calculate each item's subtotal
- Record whether each item was priced
- If the items were all priced, continue, otherwise mark the cart as un-priced, update, and return
- Calculate fulfillment pricing by calling the fulfillment pricing provider
- Apply adjustments by calling the offer provider
- Calculate the cart totals
- 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 cartupdate
- whether to update (save) the cart after pricingcontextInfo
- 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.
-
priceCart(Cart, PriceCartRequest, ContextInfo)