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, boolean shouldCalculateTaxes, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Calculate the totals for the cart.default void
calculateTotals
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version.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.in favor ofpriceCart(Cart, PriceCartRequest, 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 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
@Deprecated(since="2.1.3", forRemoval=true) default void calculateTotals(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.3 in favor ofcalculateTotals(Cart, boolean, ContextInfo)
The default implementation to callcalculateTotals(Cart, boolean, ContextInfo)
. This method calculates taxes by default. To skip or control tax-calculation within this method, usecalculateTotals(Cart, boolean, ContextInfo)
instead.- Parameters:
cart
- The cart to calculate totals for.
-
calculateTotals
void calculateTotals(com.broadleafcommerce.cart.client.domain.Cart cart, boolean shouldCalculateTaxes, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Calculate the totals for the cart. This assumes pricing such as item amount and adjustments, have been determined already.This method also provides an option to calculate the taxes as a side effect, which may be refactored out in the future.
- Parameters:
cart
- The cart to calculate totals forshouldCalculateTaxes
- Whether taxes should be calculatedcontextInfo
- The context info
-
calculateTotals(Cart, boolean, ContextInfo)