org.broadleafcommerce.core.order.service
Class MergeCartServiceImpl

java.lang.Object
  extended by org.broadleafcommerce.core.order.service.MergeCartServiceImpl
All Implemented Interfaces:
MergeCartService

@Service(value="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
protected  FulfillmentGroupService fulfillmentGroupService
           
protected  OrderItemService orderItemService
           
protected  OrderService orderService
           
 
Constructor Summary
MergeCartServiceImpl()
           
 
Method Summary
protected  boolean checkActive(DiscreteOrderItem orderItem)
           
protected  boolean checkInventory(DiscreteOrderItem orderItem)
          By default, Broadleaf does not provide an inventory check.
protected  boolean checkOtherValidity(OrderItem orderItem)
          By default, Broadleaf does not provide additional validity checks.
 MergeCartResponse mergeCart(Customer customer, Order anonymousCart)
          Delegates to mergeCart(Customer, Order, boolean) with priceOrder set to true Merges the anonymous cart with the customer's current cart, taking into consideration the active status of the SKUs to merge.
 MergeCartResponse mergeCart(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.
 ReconstructCartResponse reconstructCart(Customer customer)
          Delegates to reconstructCart(Customer, boolean) with priceOrder set to true Reconstruct the cart using previous stored state taking into consideration sku activation
 ReconstructCartResponse reconstructCart(Customer customer, boolean priceOrder)
          Reconstruct the cart using previous stored state taking into consideration sku activation
protected  void setNewCartOwnership(Order cart, Customer customer)
           
protected  void setSavedCartAttributes(Order cart)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

orderService

protected OrderService orderService

orderItemService

protected OrderItemService orderItemService

fulfillmentGroupService

protected FulfillmentGroupService fulfillmentGroupService
Constructor Detail

MergeCartServiceImpl

public MergeCartServiceImpl()
Method Detail

mergeCart

public MergeCartResponse mergeCart(Customer customer,
                                   Order anonymousCart)
                            throws PricingException,
                                   RemoveFromCartException
Description copied from interface: MergeCartService
Delegates to mergeCart(Customer, Order, boolean) with priceOrder set to true Merges 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:
mergeCart in interface MergeCartService
Parameters:
customer - the customer whose cart is to be merged
Returns:
the response containing the cart, any items added to the cart, and any items removed from the cart
Throws:
PricingException
RemoveFromCartException

reconstructCart

public ReconstructCartResponse reconstructCart(Customer customer)
                                        throws PricingException,
                                               RemoveFromCartException
Description copied from interface: MergeCartService
Delegates to reconstructCart(Customer, boolean) with priceOrder set to true Reconstruct the cart using previous stored state taking into consideration sku activation

Specified by:
reconstructCart in interface MergeCartService
Parameters:
customer - the customer whose cart is to be reconstructed
Returns:
the response containing the cart and any items removed from the cart
Throws:
PricingException
RemoveFromCartException

mergeCart

public MergeCartResponse mergeCart(Customer customer,
                                   Order anonymousCart,
                                   boolean priceOrder)
                            throws PricingException,
                                   RemoveFromCartException
Description copied from interface: MergeCartService
Merges 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:
mergeCart in interface MergeCartService
Parameters:
customer - the customer whose cart is to be merged
priceOrder - 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:
PricingException
RemoveFromCartException

reconstructCart

public ReconstructCartResponse reconstructCart(Customer customer,
                                               boolean priceOrder)
                                        throws PricingException,
                                               RemoveFromCartException
Description copied from interface: MergeCartService
Reconstruct the cart using previous stored state taking into consideration sku activation

Specified by:
reconstructCart in interface MergeCartService
Parameters:
customer - the customer whose cart is to be reconstructed
Returns:
the response containing the cart and any items removed from the cart
Throws:
RemoveFromCartException
PricingException

setSavedCartAttributes

protected void setSavedCartAttributes(Order cart)

setNewCartOwnership

protected void setNewCartOwnership(Order cart,
                                   Customer customer)

checkActive

protected boolean checkActive(DiscreteOrderItem orderItem)
Parameters:
orderItem -
Returns:
whether or not the discrete order item's sku is active

checkInventory

protected boolean checkInventory(DiscreteOrderItem orderItem)
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

protected boolean checkOtherValidity(OrderItem orderItem)
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


Copyright © 2013. All Rights Reserved.