com.elasticpath.domain.shoppingcart.impl
Class ShoppingCartImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractPersistenceImpl
          extended by com.elasticpath.domain.impl.AbstractEntityImpl
              extended by com.elasticpath.domain.shoppingcart.impl.ShoppingCartImpl
All Implemented Interfaces:
Entity, EpDomain, Persistence, ShoppingCart, java.io.Serializable

public class ShoppingCartImpl
extends AbstractEntityImpl
implements ShoppingCart

The default implementation of ShoppingCart. Note: The guid of a shopping cart is actually the guid of the customer session it belongs to.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Constructor Summary
ShoppingCartImpl()
          Default Constructor.
 
Method Summary
 CartItem addAssociatedCartItem(ProductAssociation productAssociation, CartItem parentCartItem)
          Adds an item to the cart where the source of the item information is a ProductAssociation.
 CartItem addCartItem(CartItem cartItem)
          Add an item to the cart.
 CartItem addCartItem(ProductSku productSku, int quantity)
          Convenience method for adding an item to the cart.
 CartItem addWishListItem(ProductSku productSku)
          Convenience method for adding an item to the wishlist.
 boolean allowCheckout()
          Returns true if the shopping cart is in a state that the customer can proceed with a checkout.
 void calculateShoppingCartTaxAndBeforeTaxPrices()
          Calculate the taxes and before-tax prices for the giveing shoppingCart, including cart item and shipping cost.
 void clearEstimates()
          Removes shipping and tax estimates from the shopping cart.
 void clearItems()
          Empties the shopping cart (e.g.
 void clearSelectedShippingServiceLevel()
          Resets the selected ShippingServiceLevel to null.
 void fireRules()
          Forces the shopping cart to apply promotion rules.
 java.util.Set getAppliedRules()
          Get the set of rules that have been applied to the cart.
 Money getBeforeTaxShippingCost()
          Return the before-tax shippingCost.
 Money getBeforeTaxSubTotal()
          Return the before-tax subtotal.
 Money getBeforeTaxTotal()
          Return the before-tax total.
 Address getBillingAddress()
          Get the billing address.
 CatalogViewResultHistory getBrowsingResultHistory()
          Returns the browsing result history stored.
 CartItem getCartItem(java.lang.String skuGuid)
          Get a cart item by the GUID of its SKU.
 CartItem getCartItemById(long cartItemId)
          Returns the cart item with the given id.
 java.util.List getCartItems()
          Get the cart items in the shopping cart.
 java.util.List getCartProducts()
          Get the products in the shopping cart.
 CatalogViewResultHistory getCatalogViewResultHistory()
          Returns the catalog view result history stored.
 Order getCompletedOrder()
          Get a reference to the completed order for the items previously checked out.
 java.util.Currency getCurrency()
          Get the currency of the customer corresponding to the shopping cart.
 CustomerSession getCustomerSession()
          Return the CustomerSession.
 java.lang.String getCustomerSessionGuid()
          Return the guid of the customer session that corresponds to this shopping cart.
 java.lang.String getIpAddress()
          Get the ipAddress of the user from the shopping cart.
 Category getLastCategory()
          Returns the last category.
 java.util.Locale getLocale()
          Get the locale of the customer corresponding to the shopping cart.
 java.util.Map getLocalizedTaxMap()
          Return the localized tax category name -> tax value (Money) map for this ShoppingCart.
 int getNumItems()
          Return the number of items in the shopping cart.
 java.util.List getProductAssociationsByType(int associationType, int maxAssociations, boolean filter)
          Get a list of ProductAssociations that specify associations between items in the cart and other related products.
 java.lang.String getPromotionCode()
          Get the promotion code entered by the user.
 java.util.List getRemovedCartItems()
          Get the cart items that have been removed from the shopping cart.
 CatalogViewResultHistory getSearchResultHistory()
          Returns the CatalogViewResultHistory instance stored.
 ShippingServiceLevel getSelectedShippingServiceLevel()
          Get the selectedShippingServiceLevel.
 Address getShippingAddress()
          Get the shipping address.
 Money getShippingCost()
          Return the shippingCost of the ShoppingCart.
 java.util.List getShippingServiceLevelList()
          Return the list of shippingServiceLevel list available based on the current shopping cart info.
 java.math.BigDecimal getSubtotal()
          Get the subtotal of all items in the cart.
 java.math.BigDecimal getSubtotalDiscount()
          Get the discount to the shopping cart subtotal.
 Money getSubtotalDiscountMoney()
          Get the amount discounted from the order subtotal.
 Money getSubtotalMoney()
          Get the subtotal of all items in the cart.
 java.util.Map getTaxMap()
          Return the TaxCategory -> tax value (Money) map for this ShoppingCart.
 java.math.BigDecimal getTotal()
          Get the sub total of all items in the cart after shipping, promotions, etc.
 Money getTotalMoney()
          Get the sub total of all items in the cart after shipping, promotions, etc.
 java.math.BigDecimal getTotalWeight()
          Get the totalWeight of items in ShoppingCart.
 ViewHistory getViewHistory()
          Get the View History of the user from the shopping cart.
 java.util.List getWishListItems()
          Get the wishList items in the shopping cart.
 boolean hasSubtotalDiscount()
          Returns true if an order subtotal discount has been applied.
 void init()
          Initializes the shopping cart.
 boolean isEstimateMode()
          Get the indicator of whether in the estimate shipping and taxes mode.
 boolean isInclusiveTaxCalculationInUse()
          Return true if the "inclusive" tax calculation method is in use; otherwise false.
 boolean isPromotionCodeAccepted()
          Indicates if the promotion code set by the user is valid.
 void removeCartItem(long itemUid)
          Remove an item from the cart.
 void removeWishListItem(long itemUid)
          Remove an item from the wish list.
 boolean requiresShipping()
          Returns true if the cart contains items that must be shipped to the customer.
 void ruleApplied(long ruleId)
          Indicates that the given rule was applied by the promotion rule engine.
 void setBillingAddress(Address address)
          Set the billing address.
 void setCartItems(java.util.List cartItems)
          Set the cart items in the shopping cart.
 void setCompletedOrder(Order order)
          Set a reference to the completed order for the items previously checked out.
 void setCurrency(java.util.Currency currency)
          Set the currency of the customer corresponding to the shopping cart.
 void setCustomerSession(CustomerSession customerSession)
          Set the CustomerSession.
 void setCustomerSessionGuid(java.lang.String guid)
          Set the guid of the customer session that corresponds to this shopping cart.
 void setEstimateMode(boolean estimateMode)
          Set the indicator of whether in the estimate shipping and taxes mode.
 void setIpAddress(java.lang.String ipAddress)
          Set the users ip Address into the shopping cart.
 void setLastCategory(Category category)
          Sets the last category.
 void setLocale(java.util.Locale locale)
          Set the locale of the customer corresponding to the shopping cart.
 void setPromotionCode(java.lang.String promotionCode)
          Set the promotion code entered by the user.
 void setPromotionCodeAccepted(boolean promotionCodeAccepted)
          Set whether or not the promotion code entered by the user is valid.
 Money setSelectedShippingServiceLevelUid(long selectedShippingServiceLevelUid)
          Set the selectedShippingServiceLevelUid and update the shippingCost correspondingly.
 void setShippingAddress(Address address)
          Set the shipping address.
 void setShippingServiceLevelList(java.util.List shippingServiceLevelList)
          Set the list of shippingServiceLevel list available based on the current shopping cart info.
 void setSubtotalDiscount(java.math.BigDecimal discountAmount)
          Applies a discount to the shopping cart subtotal.
 void setTaxJurisdiction(TaxJurisdiction taxJurisdiction)
          Set the most specific TaxJurisdiction based on the shippingAddress of this ShoppingCart.
 void setWishListItems(java.util.List wishListItems)
          Set the wishList items in the shopping cart.
 CartItem updateCartItemByGuid(java.lang.String skuGuid, int quantity)
          Updates an existing cart item in the shopping cart, found by the guid of its product SKU.
 CartItem updateCartItemById(long cartItemId, java.lang.String skuGuid, int quantity)
          Updates an existing cart item in the shopping cart.
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEntityImpl
convertAttributeGroupAttributes, getGuid, setDefaultValues, setGuid
 
Methods inherited from class com.elasticpath.domain.impl.AbstractPersistenceImpl
executeBeforePersistAction, getUidPk, isPersistent, setUidPk
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.domain.Entity
getGuid, setGuid
 
Methods inherited from interface com.elasticpath.domain.Persistence
executeBeforePersistAction, getUidPk, isPersistent, setDefaultValues, setUidPk
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial version id.

See Also:
Constant Field Values
Constructor Detail

ShoppingCartImpl

public ShoppingCartImpl()
Default Constructor.

Method Detail

addAssociatedCartItem

public CartItem addAssociatedCartItem(ProductAssociation productAssociation,
                                      CartItem parentCartItem)
Adds an item to the cart where the source of the item information is a ProductAssociation.

Specified by:
addAssociatedCartItem in interface ShoppingCart
Parameters:
productAssociation - the ProductAssociation referencing the item to be added
parentCartItem - the CartItem containing the product that is the source of the ProductAssociation
Returns:
the created CartItem containing the target of the ProductAssociation

addCartItem

public CartItem addCartItem(CartItem cartItem)
Add an item to the cart. If a cart item exists the the same SKU as the given cart item, then the existing cart item will be updated to reflect the sum of the previous cart item quantity and the quantity of the new cart item.

Specified by:
addCartItem in interface ShoppingCart
Parameters:
cartItem - the CartItem to add
Returns:
the added cart item.

addCartItem

public CartItem addCartItem(ProductSku productSku,
                            int quantity)
Convenience method for adding an item to the cart.

Specified by:
addCartItem in interface ShoppingCart
Parameters:
productSku - the SKU to be added to the cart
quantity - the quantity of the SKU to be added
Returns:
the new CartItem representing the item in the cart

addWishListItem

public CartItem addWishListItem(ProductSku productSku)
Convenience method for adding an item to the wishlist.

Specified by:
addWishListItem in interface ShoppingCart
Parameters:
productSku - the SKU to be added to the wishlist *
Returns:
the new CartItem representing the item in the wishlist

allowCheckout

public boolean allowCheckout()
Returns true if the shopping cart is in a state that the customer can proceed with a checkout. Currently, this means that there is at least one item in the cart and that there is sufficient inventory for all items in the cart.

Specified by:
allowCheckout in interface ShoppingCart
Returns:
true if checkout can proceed

calculateShoppingCartTaxAndBeforeTaxPrices

public void calculateShoppingCartTaxAndBeforeTaxPrices()
Calculate the taxes and before-tax prices for the giveing shoppingCart, including cart item and shipping cost. The calculation results will be set in the given shopping cart. In case of exclusive tax calculation, the order discount is deducted before-tax; however, in case of inclusive tax calculation, the order discount is deducted after-tax. To meet the needs of real life requirement and simplifiy the calcualtion, it is assumed that the tax rate are same for different tax codes (BOOKS, CLOTHING and etc) in case of exclusive tax calculation.

Specified by:
calculateShoppingCartTaxAndBeforeTaxPrices in interface ShoppingCart

clearEstimates

public void clearEstimates()
Removes shipping and tax estimates from the shopping cart.

Specified by:
clearEstimates in interface ShoppingCart

clearItems

public void clearItems()
Empties the shopping cart (e.g. after a checkout)

Specified by:
clearItems in interface ShoppingCart

clearSelectedShippingServiceLevel

public void clearSelectedShippingServiceLevel()
Resets the selected ShippingServiceLevel to null.

Specified by:
clearSelectedShippingServiceLevel in interface ShoppingCart

fireRules

public void fireRules()
Forces the shopping cart to apply promotion rules. Promotion rules will usually be applied by the cart automatically as required. However, it is sometimes necessary to force the cart to fire rules when the cart is loaded without a state change.

Specified by:
fireRules in interface ShoppingCart

getAppliedRules

public java.util.Set getAppliedRules()
Get the set of rules that have been applied to the cart.

Specified by:
getAppliedRules in interface ShoppingCart
Returns:
a set of Long Rule UidPks

getBeforeTaxShippingCost

public Money getBeforeTaxShippingCost()
Return the before-tax shippingCost.

Specified by:
getBeforeTaxShippingCost in interface ShoppingCart
Returns:
the before-tax shippingCost.

getBeforeTaxSubTotal

public Money getBeforeTaxSubTotal()
Return the before-tax subtotal.

Specified by:
getBeforeTaxSubTotal in interface ShoppingCart
Returns:
the before-tax subtotal.

getBeforeTaxTotal

public Money getBeforeTaxTotal()
Return the before-tax total.

Specified by:
getBeforeTaxTotal in interface ShoppingCart
Returns:
the before-tax total.

getBillingAddress

public Address getBillingAddress()
Get the billing address.

Specified by:
getBillingAddress in interface ShoppingCart
Returns:
the billing address

getBrowsingResultHistory

public CatalogViewResultHistory getBrowsingResultHistory()
Returns the browsing result history stored. If none is stored, a new one will be created and returned.

Specified by:
getBrowsingResultHistory in interface ShoppingCart
Returns:
the browsing result history

getCartItem

public CartItem getCartItem(java.lang.String skuGuid)
Get a cart item by the GUID of its SKU.

Specified by:
getCartItem in interface ShoppingCart
Parameters:
skuGuid - the GUID of the SKU in the cart item to be retrieved.
Returns:
the corresponding CartItem or null if not found

getCartItemById

public CartItem getCartItemById(long cartItemId)
Returns the cart item with the given id.

Specified by:
getCartItemById in interface ShoppingCart
Parameters:
cartItemId - the cart item id
Returns:
the cart item with the given id

getCartItems

public java.util.List getCartItems()
Get the cart items in the shopping cart.

Specified by:
getCartItems in interface ShoppingCart
Returns:
the cart items in the shopping cart

getCartProducts

public java.util.List getCartProducts()
Get the products in the shopping cart.

Specified by:
getCartProducts in interface ShoppingCart
Returns:
the products in the shopping cart

getCatalogViewResultHistory

public CatalogViewResultHistory getCatalogViewResultHistory()
Returns the catalog view result history stored. A catalog view result history might be a search or a browsing. If none is stored, return null

Specified by:
getCatalogViewResultHistory in interface ShoppingCart
Returns:
the catalog view result history

getCompletedOrder

public Order getCompletedOrder()
Get a reference to the completed order for the items previously checked out.

Specified by:
getCompletedOrder in interface ShoppingCart
Returns:
the completed Order, or null if no completed order has been set.

getCurrency

public java.util.Currency getCurrency()
Get the currency of the customer corresponding to the shopping cart.

Specified by:
getCurrency in interface ShoppingCart
Returns:
the Currency

getCustomerSession

public CustomerSession getCustomerSession()
Return the CustomerSession. instance. Customer sessions track information about sessions where the customer may not be logged in.

Specified by:
getCustomerSession in interface ShoppingCart
Returns:
the CustomerSession instance

getCustomerSessionGuid

public java.lang.String getCustomerSessionGuid()
Return the guid of the customer session that corresponds to this shopping cart.

Specified by:
getCustomerSessionGuid in interface ShoppingCart
Returns:
the guid.

getIpAddress

public java.lang.String getIpAddress()
Get the ipAddress of the user from the shopping cart.

Specified by:
getIpAddress in interface ShoppingCart
Returns:
the ipAddress

getLastCategory

public Category getLastCategory()
Returns the last category.

Specified by:
getLastCategory in interface ShoppingCart
Returns:
the last category

getLocale

public java.util.Locale getLocale()
Get the locale of the customer corresponding to the shopping cart.

Specified by:
getLocale in interface ShoppingCart
Returns:
the Locale

getLocalizedTaxMap

public java.util.Map getLocalizedTaxMap()
Return the localized tax category name -> tax value (Money) map for this ShoppingCart.

Specified by:
getLocalizedTaxMap in interface ShoppingCart
Returns:
the localized tax category name -> tax value (Money) map.

getNumItems

public int getNumItems()
Return the number of items in the shopping cart.

Specified by:
getNumItems in interface ShoppingCart
Returns:
the number of items

getProductAssociationsByType

public java.util.List getProductAssociationsByType(int associationType,
                                                   int maxAssociations,
                                                   boolean filter)
Get a list of ProductAssociations that specify associations between items in the cart and other related products. The product associations are returned in decreasing order of the sales quantity of the targeted product. Note that this method expects only a small number of associations

Specified by:
getProductAssociationsByType in interface ShoppingCart
Parameters:
associationType - the type of the ProductAssociations to be returned. Use a constant defined in the ProductAssociation interface
maxAssociations - the maximum number of associations to return.
filter - when true will filter the results to remove any ProductAssociations allready in the shopping cart.
Returns:
the ProductAssociations, ordered by number of sales.

getPromotionCode

public java.lang.String getPromotionCode()
Get the promotion code entered by the user.

Specified by:
getPromotionCode in interface ShoppingCart
Returns:
the promotion code

getRemovedCartItems

public java.util.List getRemovedCartItems()
Get the cart items that have been removed from the shopping cart.

Specified by:
getRemovedCartItems in interface ShoppingCart
Returns:
the removed cart items in the shopping cart

getSearchResultHistory

public CatalogViewResultHistory getSearchResultHistory()
Returns the CatalogViewResultHistory instance stored. If none is stored, a new one will be created and returned.

Specified by:
getSearchResultHistory in interface ShoppingCart
Returns:
the CatalogViewResultHistory instance stored

getSelectedShippingServiceLevel

public ShippingServiceLevel getSelectedShippingServiceLevel()
Get the selectedShippingServiceLevel.

Specified by:
getSelectedShippingServiceLevel in interface ShoppingCart
Returns:
the selected ShippingServiceLevel.

getShippingAddress

public Address getShippingAddress()
Get the shipping address.

Specified by:
getShippingAddress in interface ShoppingCart
Returns:
the preferred shipping address

getShippingCost

public Money getShippingCost()
Return the shippingCost of the ShoppingCart.

Specified by:
getShippingCost in interface ShoppingCart
Returns:
the shippingCost of the ShoppingCart

getShippingServiceLevelList

public java.util.List getShippingServiceLevelList()
Return the list of shippingServiceLevel list available based on the current shopping cart info.

Specified by:
getShippingServiceLevelList in interface ShoppingCart
Returns:
the list of shippingServiceLevel list available based on the current shopping cart info.

getSubtotal

public java.math.BigDecimal getSubtotal()
Get the subtotal of all items in the cart.

Specified by:
getSubtotal in interface ShoppingCart
Returns:
a BigDecimal object representing the subtotal

getSubtotalDiscount

public java.math.BigDecimal getSubtotalDiscount()
Get the discount to the shopping cart subtotal.

Specified by:
getSubtotalDiscount in interface ShoppingCart
Returns:
the amount discounted from the subtotal

getSubtotalDiscountMoney

public Money getSubtotalDiscountMoney()
Get the amount discounted from the order subtotal.

Specified by:
getSubtotalDiscountMoney in interface ShoppingCart
Returns:
the order subtotal discount as a Money object

getSubtotalMoney

public Money getSubtotalMoney()
Get the subtotal of all items in the cart.

Specified by:
getSubtotalMoney in interface ShoppingCart
Returns:
a Money object representing the subtotal

getTaxMap

public java.util.Map getTaxMap()
Return the TaxCategory -> tax value (Money) map for this ShoppingCart.

Specified by:
getTaxMap in interface ShoppingCart
Returns:
the TaxCategory -> tax value (Money) map.

getTotal

public java.math.BigDecimal getTotal()
Get the sub total of all items in the cart after shipping, promotions, etc.

Specified by:
getTotal in interface ShoppingCart
Returns:
a BigDecimal object representing the total

getTotalMoney

public Money getTotalMoney()
Get the sub total of all items in the cart after shipping, promotions, etc.

Specified by:
getTotalMoney in interface ShoppingCart
Returns:
a Money object representing the total

getTotalWeight

public java.math.BigDecimal getTotalWeight()
Get the totalWeight of items in ShoppingCart.

Specified by:
getTotalWeight in interface ShoppingCart
Returns:
totalWeight

getViewHistory

public ViewHistory getViewHistory()
Get the View History of the user from the shopping cart.

Specified by:
getViewHistory in interface ShoppingCart
Returns:
the ViewHistory

getWishListItems

public java.util.List getWishListItems()
Get the wishList items in the shopping cart.

Specified by:
getWishListItems in interface ShoppingCart
Returns:
the wishList items in the shopping cart

hasSubtotalDiscount

public boolean hasSubtotalDiscount()
Returns true if an order subtotal discount has been applied.

Specified by:
hasSubtotalDiscount in interface ShoppingCart
Returns:
true if an order subtotal discount has been applied

init

public void init()
Initializes the shopping cart. Call setElasticPath before initializing.

Specified by:
init in interface ShoppingCart

isEstimateMode

public boolean isEstimateMode()
Get the indicator of whether in the estimate shipping and taxes mode.

Specified by:
isEstimateMode in interface ShoppingCart
Returns:
true when estimating shipping and taxes; otherwise, false.

isInclusiveTaxCalculationInUse

public boolean isInclusiveTaxCalculationInUse()
Return true if the "inclusive" tax calculation method is in use; otherwise false. This is based on the shippingAddress. If there is no taxJurisdiction set, return false by default.

Specified by:
isInclusiveTaxCalculationInUse in interface ShoppingCart
Returns:
true if the "inclusive" tax calculation method is in use; otherwise false.

isPromotionCodeAccepted

public boolean isPromotionCodeAccepted()
Indicates if the promotion code set by the user is valid.

Specified by:
isPromotionCodeAccepted in interface ShoppingCart
Returns:
true if the promotion code is valid.

removeCartItem

public void removeCartItem(long itemUid)
Remove an item from the cart.

Specified by:
removeCartItem in interface ShoppingCart
Parameters:
itemUid - the uidPk of the CartItem to remove

removeWishListItem

public void removeWishListItem(long itemUid)
Remove an item from the wish list.

Specified by:
removeWishListItem in interface ShoppingCart
Parameters:
itemUid - the uidPk of the CartItem to remove

requiresShipping

public boolean requiresShipping()
Returns true if the cart contains items that must be shipped to the customer.

Specified by:
requiresShipping in interface ShoppingCart
Returns:
true if the cart contains items that must be shipped to the customer.

ruleApplied

public void ruleApplied(long ruleId)
Indicates that the given rule was applied by the promotion rule engine.

Specified by:
ruleApplied in interface ShoppingCart
Parameters:
ruleId - the uidPk of the Rule

setBillingAddress

public void setBillingAddress(Address address)
Set the billing address.

Specified by:
setBillingAddress in interface ShoppingCart
Parameters:
address - the Address

setCartItems

public void setCartItems(java.util.List cartItems)
Set the cart items in the shopping cart.

Specified by:
setCartItems in interface ShoppingCart
Parameters:
cartItems - the cart items in the shopping cart.

setCompletedOrder

public void setCompletedOrder(Order order)
Set a reference to the completed order for the items previously checked out.

Specified by:
setCompletedOrder in interface ShoppingCart
Parameters:
order - the completed order

setCurrency

public void setCurrency(java.util.Currency currency)
Set the currency of the customer corresponding to the shopping cart.

Specified by:
setCurrency in interface ShoppingCart
Parameters:
currency - the Currency

setCustomerSession

public void setCustomerSession(CustomerSession customerSession)
Set the CustomerSession. instance. Customer sessions track information about sessions where the customer may not be logged in.

Specified by:
setCustomerSession in interface ShoppingCart
Parameters:
customerSession - the CustomerSession instance

setCustomerSessionGuid

public void setCustomerSessionGuid(java.lang.String guid)
Set the guid of the customer session that corresponds to this shopping cart. This method should only be called by hibernate. Set the CustomerSession instead.

Specified by:
setCustomerSessionGuid in interface ShoppingCart
Parameters:
guid - the guid to set.

setEstimateMode

public void setEstimateMode(boolean estimateMode)
Set the indicator of whether in the estimate shipping and taxes mode.

Specified by:
setEstimateMode in interface ShoppingCart
Parameters:
estimateMode - true when estimating shipping and taxes; otherwise, false.

setIpAddress

public void setIpAddress(java.lang.String ipAddress)
Set the users ip Address into the shopping cart.

Specified by:
setIpAddress in interface ShoppingCart
Parameters:
ipAddress - the ipAddress of the user.

setLastCategory

public void setLastCategory(Category category)
Sets the last category.

Specified by:
setLastCategory in interface ShoppingCart
Parameters:
category - the category to set.

setLocale

public void setLocale(java.util.Locale locale)
Set the locale of the customer corresponding to the shopping cart.

Specified by:
setLocale in interface ShoppingCart
Parameters:
locale - the Locale

setPromotionCode

public void setPromotionCode(java.lang.String promotionCode)
Set the promotion code entered by the user.

Specified by:
setPromotionCode in interface ShoppingCart
Parameters:
promotionCode - the promotion code

setPromotionCodeAccepted

public void setPromotionCodeAccepted(boolean promotionCodeAccepted)
Set whether or not the promotion code entered by the user is valid.

Specified by:
setPromotionCodeAccepted in interface ShoppingCart
Parameters:
promotionCodeAccepted - set to true if the promotion code is valid

setSelectedShippingServiceLevelUid

public Money setSelectedShippingServiceLevelUid(long selectedShippingServiceLevelUid)
                                         throws EpDomainException
Set the selectedShippingServiceLevelUid and update the shippingCost correspondingly.

Specified by:
setSelectedShippingServiceLevelUid in interface ShoppingCart
Parameters:
selectedShippingServiceLevelUid - - the selected ShippingServiceLevel uid.
Returns:
shippingCost
Throws:
EpDomainException - - if something goes wrong.

setShippingAddress

public void setShippingAddress(Address address)
Set the shipping address.

Specified by:
setShippingAddress in interface ShoppingCart
Parameters:
address - the Address

setShippingServiceLevelList

public void setShippingServiceLevelList(java.util.List shippingServiceLevelList)
Set the list of shippingServiceLevel list available based on the current shopping cart info.

Specified by:
setShippingServiceLevelList in interface ShoppingCart
Parameters:
shippingServiceLevelList - the list of shippingServiceLevel list available based on the current shopping cart info.

setSubtotalDiscount

public void setSubtotalDiscount(java.math.BigDecimal discountAmount)
Applies a discount to the shopping cart subtotal.

Specified by:
setSubtotalDiscount in interface ShoppingCart
Parameters:
discountAmount - the amount to discount the subtotal by as a BigInteger

setTaxJurisdiction

public void setTaxJurisdiction(TaxJurisdiction taxJurisdiction)
Set the most specific TaxJurisdiction based on the shippingAddress of this ShoppingCart.

Specified by:
setTaxJurisdiction in interface ShoppingCart
Parameters:
taxJurisdiction - the most specific TaxJurisdiction

setWishListItems

public void setWishListItems(java.util.List wishListItems)
Set the wishList items in the shopping cart.

Specified by:
setWishListItems in interface ShoppingCart
Parameters:
wishListItems - the wishList items in the shopping cart.

updateCartItemByGuid

public CartItem updateCartItemByGuid(java.lang.String skuGuid,
                                     int quantity)
Updates an existing cart item in the shopping cart, found by the guid of its product SKU. Becaue the cart item id is not known, the SKU cannot be changed using this method. To change the SKU of an existing cart item, call updateCartItemById.

Specified by:
updateCartItemByGuid in interface ShoppingCart
Parameters:
skuGuid - The GUID of the particular SKU in the cart item to be updated
quantity - the quantity of the given cart item to appear in the cart
Returns:
the updated CartItem

updateCartItemById

public CartItem updateCartItemById(long cartItemId,
                                   java.lang.String skuGuid,
                                   int quantity)
Updates an existing cart item in the shopping cart.

Specified by:
updateCartItemById in interface ShoppingCart
Parameters:
cartItemId - the UID of the cart item to be updated. The suppliced UID must match a cart item in the cart.
skuGuid - The GUID of the particular SKU to be in the cart. If skuGuid is null or "", then the sku in the cart item will not be updated. If the skuGuid is specified, then the SKU in the cart item will be changed to the one matching the specified GUID. An exception will be thrown if the GUID does not match a SKU from the previous SKU's product (Changing the product is not an update operation).
quantity - the quantity of the given cart item to appear in the cart
Returns:
the updated CartItem