Class MergeCartServiceImpl
java.lang.Object
org.broadleafcommerce.core.order.service.MergeCartServiceImpl
- All Implemented Interfaces:
MergeCartService
@Service("blMergeCartService")
public class MergeCartServiceImpl
extends Object
implements MergeCartService
The 2.0 implementation of merge cart service. Instead of merging items directly from one cart to another, we will
convert the previous cart to a named order that the customer is able to interact with as they see fit.
- Author:
- Andre Azzolini (apazzolini)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MergeCartServiceExtensionManagerprotected FulfillmentGroupServiceprotected OrderItemServiceprotected OrderService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckActive(DiscreteOrderItem orderItem) protected booleancheckInventory(DiscreteOrderItem orderItem) By default, Broadleaf does not provide an inventory check.protected booleancheckOtherValidity(OrderItem orderItem) By default, Broadleaf does not provide additional validity checks.Delegates to mergeCart(Customer, Order, boolean) with priceOrder set to truemergeCart(org.broadleafcommerce.profile.core.domain.Customer customer, Order anonymousCart, boolean priceOrder) Merges the anonymous cart with the customer's current cart, taking into consideration the active status of the SKUs to merge.reconstructCart(org.broadleafcommerce.profile.core.domain.Customer customer) Delegates to reconstructCart(Customer, boolean) with priceOrder set to truereconstructCart(org.broadleafcommerce.profile.core.domain.Customer customer, boolean priceOrder) Reconstruct the cart using previous stored state taking into consideration sku activationprotected voidsetNewCartOwnership(Order cart, org.broadleafcommerce.profile.core.domain.Customer customer) protected voidsetSavedCartAttributes(Order cart)
-
Field Details
-
orderService
-
orderItemService
-
fulfillmentGroupService
-
extensionManager
-
-
Constructor Details
-
MergeCartServiceImpl
public MergeCartServiceImpl()
-
-
Method Details
-
mergeCart
public MergeCartResponse mergeCart(org.broadleafcommerce.profile.core.domain.Customer customer, Order anonymousCart) throws PricingException, RemoveFromCartException Description copied from interface:MergeCartServiceDelegates to mergeCart(Customer, Order, boolean) with priceOrder set to trueMerges the anonymous cart with the customer's current cart, taking into consideration the active status of the SKUs to merge. For example, if the customer had a SKU in their anonymous cart that is no longer active, it will not be merged into the new cart.
- Specified by:
mergeCartin interfaceMergeCartService- Parameters:
customer- the customer whose cart is to be mergedanonymousCart- the anonymous cart id- Returns:
- the response containing the cart, any items added to the cart, and any items removed from the cart
- Throws:
PricingExceptionRemoveFromCartException
-
reconstructCart
public ReconstructCartResponse reconstructCart(org.broadleafcommerce.profile.core.domain.Customer customer) throws PricingException, RemoveFromCartException Description copied from interface:MergeCartServiceDelegates to reconstructCart(Customer, boolean) with priceOrder set to trueReconstruct the cart using previous stored state taking into consideration sku activation
- Specified by:
reconstructCartin interfaceMergeCartService- Parameters:
customer- the customer whose cart is to be reconstructed- Returns:
- the response containing the cart and any items removed from the cart
- Throws:
PricingExceptionRemoveFromCartException
-
mergeCart
public MergeCartResponse mergeCart(org.broadleafcommerce.profile.core.domain.Customer customer, Order anonymousCart, boolean priceOrder) throws PricingException, RemoveFromCartException Description copied from interface:MergeCartServiceMerges the anonymous cart with the customer's current cart, taking into consideration the active status of the SKUs to merge. For example, if the customer had a SKU in their anonymous cart that is no longer active, it will not be merged into the new cart.- Specified by:
mergeCartin interfaceMergeCartService- Parameters:
customer- the customer whose cart is to be mergedanonymousCart- the anonymous cart idpriceOrder- whether or not to price the order- Returns:
- the response containing the cart, any items added to the cart, and any items removed from the cart
- Throws:
PricingExceptionRemoveFromCartException
-
reconstructCart
public ReconstructCartResponse reconstructCart(org.broadleafcommerce.profile.core.domain.Customer customer, boolean priceOrder) throws PricingException, RemoveFromCartException Description copied from interface:MergeCartServiceReconstruct the cart using previous stored state taking into consideration sku activation- Specified by:
reconstructCartin interfaceMergeCartService- Parameters:
customer- the customer whose cart is to be reconstructed- Returns:
- the response containing the cart and any items removed from the cart
- Throws:
RemoveFromCartExceptionPricingException
-
setSavedCartAttributes
-
setNewCartOwnership
protected void setNewCartOwnership(Order cart, org.broadleafcommerce.profile.core.domain.Customer customer) -
checkActive
- Parameters:
orderItem-- Returns:
- whether or not the discrete order item's sku is active
-
checkInventory
By default, Broadleaf does not provide an inventory check. This is set up as an extension point if your application needs it.- Parameters:
orderItem-- Returns:
- whether or not the item is in stock
-
checkOtherValidity
By default, Broadleaf does not provide additional validity checks. This is set up as an extension point if your application needs it.- Parameters:
orderItem-- Returns:
- whether or not the orderItem is valid
-