com.bea.alcs.domain.shoppingcart
Interface ShoppingCart

All Superinterfaces:
EpDomain, java.io.Serializable, StoreObject, Transient
All Known Implementing Classes:
ShoppingCartImpl

public interface ShoppingCart
extends Transient, StoreObject

ShoppingCart represents a shopping cart of a Customer.


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(ProductSku productSku, int quantity)
          Convenience method for adding an item to the cart.
 CartItem addCartItem(ShoppingCartItem cartItem)
          Add an item to the cart.
 GiftCertificateItem addGiftCertificateItem(GiftCertificateItem giftCertificateItem)
          Add a giftCertificate 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 applyGiftCertificate(GiftCertificate giftCertificate)
          Adds the given gift certificate to the set which will be redeemed / applied to this shopping cart.
 void applyPromotionCode(java.lang.String promotionCode)
          Add a new promotion code to the list of promotion codes added to the shopping cart.
 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.List<CartItem> getAllItems()
          Get all the items in the shopping cart, including the ShoppingCartItems, WishListItems, GiftCertificateItems.
 java.util.List<Rule> getApplicableRules()
          Returns the list of promotion rules that are applicable to the cart based on rule conditions and promo codes in the cart.
 java.util.Set<GiftCertificate> getAppliedGiftCertificates()
          Get the set of applied gift certificates.
 java.util.Set<java.lang.Long> 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 preferred billing address.
 CatalogViewResultHistory getBrowsingResultHistory()
          Returns the browsing result history stored.
 ShoppingCartItem 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<ShoppingCartItem> getCartItems()
          Get the cart items in the shopping cart.
 java.util.List<Product> getCartProducts()
          Get the products in the shopping cart.
 CatalogViewResultHistory getCatalogViewResultHistory()
          Returns the catalog view result history stored.
 java.lang.Long getCmUserUID()
          Gets the cmUserUID.
 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.math.BigDecimal getGiftCertificateDiscount()
          Get the amount redeemed from gift certificate.
 GiftCertificateItem getGiftCertificateItemById(long giftCertificateItemId)
          Returns the gift certificate item with the given id.
 java.util.List<GiftCertificateItem> getGiftCertificateItems()
          Get the GiftCertificate items in the shopping cart.
 java.lang.String getGuid()
          Return the guid.
 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<java.lang.String,Money> 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<ProductAssociation> 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.util.List<java.lang.String> getPromotionCodes()
          Gets the list of promotion codes successfully applied to the cart.
 CatalogViewResultHistory getSearchResultHistory()
          Returns the search result history stored.
 ShippingServiceLevel getSelectedShippingServiceLevel()
          Get the selectedShippingServiceLevel.
 Address getShippingAddress()
          Get the preferred shipping address.
 Money getShippingCost()
          Return the shippingCost of the ShoppingCart.
 java.util.List<ShippingServiceLevel> getShippingServiceLevelList()
          Return the list of shippingServiceLevel list available based on the current shopping cart info.
 ShoppingCartMemento getShoppingCartMemento()
          Gets the persistent shopping cart object.
 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.
 TaxCalculationResult getTaxCalculationResult()
          Retrieves the current tax values.
 java.util.Map<TaxCategory,Money> getTaxMap()
          Retrieves the mapping of TaxCategories to values.
 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.
 long getUidPk()
          Gets the unique identifier for this domain object.
 java.util.Collection<ShoppingCartItem> getUnavailableCartItems()
          Get the cart items that have been removed from the shopping cart because of they have run out of stock meanwhile.
 ViewHistory getViewHistory()
          Get the View History of the user from the shopping cart.
 java.util.List<CartItem> getWishListItems()
          Get the wish list items in the shopping cart.
 boolean hasSubtotalDiscount()
          Returns true if an order subtotal discount has been applied.
 void init()
          Initializes the shopping cart.
 boolean isCartItemRemoved(java.lang.String skuCode)
          Checks if a cart item with specific SKU code was previously removed.
 boolean isCodeValid()
          Indicates if the promotion or gift certificate code entered by the user is valid.
 boolean isEstimateMode()
          Get the indicator of whether in the estimate shipping and taxes mode.
 boolean isExchangeOrderShoppingCart()
          Returns true is this shopping cart will be used for checking out exchange order, false for ordinary shopping cart.
 boolean isInclusiveTaxCalculationInUse()
          Return true if the "inclusive" tax calculation method is in use; otherwise false.
 boolean isPersistent()
          true if the object has previously been persisted.
 boolean isValidPromoCode(java.lang.String code)
          Validates if the code matches a promotion code in the system.
 void removeCartItem(long itemUid)
          Remove an item from the cart.
 void removeGiftCertificateItem(long itemUid)
          Remove a giftCertificate from the cart.
 void removePromotionCode(java.lang.String promotionCode)
          Remove a promotion code from the list of promotion codes added to the shopping 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 preferred billing address.
 void setCmUserUID(java.lang.Long cmUserUID)
          Sets the CmUserUID.
 void setCodeValid(boolean codeValid)
          Set whether or not the promotion or gift certificate code entered by the user is valid.
 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 setExchangeOrderShoppingCart(boolean isExchangeOrderShoppingCart)
          Sets the flag depending if this shopping cart will be used for checking out exchange order, or for ordinary shopping cart.
 void setGiftCertificateItems(java.util.List<GiftCertificateItem> giftCertificateItems)
          Set the GiftCertificate items in the shopping cart.
 void setGuid(java.lang.String guid)
          Set the guid.
 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 setPromotionCodes(java.util.List<java.lang.String> promotionCodes)
          Sets the list of promotion codes successfully applied to the cart.
 Money setSelectedShippingServiceLevelUid(long selectedSSLUid)
          Set the selectedShippingServiceLevelUid and update the shippingCost correspondingly.
 void setShippingAddress(Address address)
          Set the preferred shipping address.
 void setShippingCost(java.math.BigDecimal shippingCost)
          Set shipping cost.
 void setShippingServiceLevelList(java.util.List<ShippingServiceLevel> shippingServiceLevelList)
          Set the list of shippingServiceLevel list available based on the current shopping cart info.
 void setShoppingCartMemento(ShoppingCartMemento shoppingCartMemento)
           
 void setSubtotalDiscount(java.math.BigDecimal discountAmount)
          Applies a discount to the shopping cart subtotal.
 void setTaxCalculationResult(TaxCalculationResult taxCalculationResult)
          Sets the tax calculation result.
 void setUidPk(long uidPk)
          Sets the unique identifier for this domain model object.
 void setWishListItems(java.util.List<CartItem> wishListItems)
          Set the wish list 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 interface com.bea.alcs.domain.EpDomain
getElasticPath, getUtility, setDefaultValues, setElasticPath
 
Methods inherited from interface com.bea.alcs.domain.catalog.StoreObject
getStore, setStore
 

Method Detail

getGuid

java.lang.String getGuid()
Return the guid.

Returns:
the guid.

setGuid

void setGuid(java.lang.String guid)
Set the guid.

Parameters:
guid - the guid to set.

getUidPk

long getUidPk()
Gets the unique identifier for this domain object. This unique identifier is system-dependant. That means on differenct systems(like staging and production environments), different identifiers might be assigned to the same(from business perspective) domain object.

Notice: not all persistent domain objects has unique identifier. Some value objects don't have unique identifer. They are cascading loaded and updated through their parents.

Returns:
the unique identifier.

setUidPk

void setUidPk(long uidPk)
Sets the unique identifier for this domain model object.

Parameters:
uidPk - the new unique identifier.

isPersistent

boolean isPersistent()
true if the object has previously been persisted.

Notice: not all persistent domain objects has unique identifier. Some value objects don't have unique identifer. They are cascading loaded and updated through their parents. It doesn't make sense to call this method on those value object.

Returns:
true if the object has previously been persisted.

getAppliedGiftCertificates

java.util.Set<GiftCertificate> getAppliedGiftCertificates()
Get the set of applied gift certificates.

Returns:
the giftCertificateRedeems

applyGiftCertificate

void applyGiftCertificate(GiftCertificate giftCertificate)
Adds the given gift certificate to the set which will be redeemed / applied to this shopping cart.

Parameters:
giftCertificate - the gift certificate.

getGiftCertificateDiscount

java.math.BigDecimal getGiftCertificateDiscount()
Get the amount redeemed from gift certificate.

Returns:
the gift certificate discounted from the total

getCustomerSession

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

Returns:
the CustomerSession instance

setCustomerSession

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

Parameters:
customerSession - the CustomerSession instance

getLocale

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

Returns:
the Locale

setLocale

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

Parameters:
locale - the Locale

getCurrency

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

Returns:
the Currency

setCurrency

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

Parameters:
currency - the Currency

init

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


getCustomerSessionGuid

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

Returns:
the guid.

setCustomerSessionGuid

void setCustomerSessionGuid(java.lang.String guid)
Set the guid of the customer session that corresponds to this shopping cart.

Parameters:
guid - the guid to set.

getCartItems

java.util.List<ShoppingCartItem> getCartItems()
Get the cart items in the shopping cart.

Returns:
the cart items in the shopping cart

getCartProducts

java.util.List<Product> getCartProducts()
Get the products in the shopping cart.

Returns:
the products in the shopping cart

getUnavailableCartItems

java.util.Collection<ShoppingCartItem> getUnavailableCartItems()
Get the cart items that have been removed from the shopping cart because of they have run out of stock meanwhile.

Returns:
the removed cart items in the shopping cart

getGiftCertificateItems

java.util.List<GiftCertificateItem> getGiftCertificateItems()
Get the GiftCertificate items in the shopping cart.

Returns:
the giftCertificate items in the shopping cart

setGiftCertificateItems

void setGiftCertificateItems(java.util.List<GiftCertificateItem> giftCertificateItems)
Set the GiftCertificate items in the shopping cart.

Parameters:
giftCertificateItems - the GiftCertificate items in the shopping cart.

getWishListItems

java.util.List<CartItem> getWishListItems()
Get the wish list items in the shopping cart.

Returns:
the wish list items in the shopping cart

setWishListItems

void setWishListItems(java.util.List<CartItem> wishListItems)
Set the wish list items in the shopping cart.

Parameters:
wishListItems - the wish list items in the shopping cart.

addCartItem

CartItem addCartItem(ShoppingCartItem 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.

Parameters:
cartItem - the CartItem to add
Returns:
the added cart item.

removeCartItem

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

Parameters:
itemUid - the uidPk of the CartItem to remove

addGiftCertificateItem

GiftCertificateItem addGiftCertificateItem(GiftCertificateItem giftCertificateItem)
Add a giftCertificate to the cart.

Parameters:
giftCertificateItem - the GiftCertificateItem to add
Returns:
the added giftCertificate item.

removeGiftCertificateItem

void removeGiftCertificateItem(long itemUid)
Remove a giftCertificate from the cart.

Parameters:
itemUid - the uidPk of the GiftCertificateItem to remove

removeWishListItem

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

Parameters:
itemUid - the uidPk of the CartItem to remove

getCartItem

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

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

getNumItems

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

Returns:
the number of items

getSubtotal

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

Returns:
a BigDecimal object representing the subtotal

getSubtotalMoney

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

Returns:
a Money object representing the subtotal

getTotalMoney

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

Returns:
a Money object representing the total

getTotal

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

Returns:
a BigDecimal object representing the total

setSubtotalDiscount

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

Parameters:
discountAmount - the amount to discount the subtotal by as a BigInteger

getSubtotalDiscount

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

Returns:
the amount discounted from the subtotal

getSubtotalDiscountMoney

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

Returns:
the order subtotal discount as a Money object

hasSubtotalDiscount

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

Returns:
true if an order subtotal discount has been applied

clearItems

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


setBillingAddress

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

Parameters:
address - the Address

getBillingAddress

Address getBillingAddress()
Get the preferred billing address.

Returns:
the preferred shipping address

setShippingAddress

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

Parameters:
address - the Address

getShippingAddress

Address getShippingAddress()
Get the preferred shipping address.

Returns:
the preferred shipping address

getLastCategory

Category getLastCategory()
Returns the last category.

Returns:
the last category

setLastCategory

void setLastCategory(Category category)
Sets the last category.

Parameters:
category - the category to set.

setCompletedOrder

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

Parameters:
order - the completed order

getCompletedOrder

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

Returns:
the completed Order, or null if no completed order has been set.

getSearchResultHistory

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

Returns:
the search result history

getBrowsingResultHistory

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

Returns:
the browsing result history

getCatalogViewResultHistory

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

Returns:
the catalog view result history

getShippingCost

Money getShippingCost()
Return the shippingCost of the ShoppingCart.

Returns:
the shippingCost of the ShoppingCart

getShippingServiceLevelList

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

Returns:
the list of shippingServiceLevel list available based on the current shopping cart info. It is guaranteed to be not null.

setShippingServiceLevelList

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

Parameters:
shippingServiceLevelList - the list of shippingServiceLevel list available based on the current shopping cart info. If parameter value is null the list will be cleared.

getSelectedShippingServiceLevel

ShippingServiceLevel getSelectedShippingServiceLevel()
Get the selectedShippingServiceLevel.

Returns:
the selected ShippingServiceLevel.

setSelectedShippingServiceLevelUid

Money setSelectedShippingServiceLevelUid(long selectedSSLUid)
Set the selectedShippingServiceLevelUid and update the shippingCost correspondingly.

Parameters:
selectedSSLUid - - the selected ShippingServiceLevel uid.
Returns:
shippingCost

clearSelectedShippingServiceLevel

void clearSelectedShippingServiceLevel()
Resets the selected ShippingServiceLevel to null.


getTotalWeight

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

Returns:
totalWeight

requiresShipping

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

Returns:
true if the cart contains items that must be shipped to the customer.

isInclusiveTaxCalculationInUse

boolean isInclusiveTaxCalculationInUse()
Return true if the "inclusive" tax calculation method is in use; otherwise false. This is based on the shippingAddress.

Returns:
true if the "inclusive" tax calculation method is in use; otherwise false.

getLocalizedTaxMap

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

Returns:
the localized tax category name -> tax value (Money) map.

getBeforeTaxShippingCost

Money getBeforeTaxShippingCost()
Return the before-tax shippingCost.

Returns:
the before-tax shippingCost.

getBeforeTaxSubTotal

Money getBeforeTaxSubTotal()
Return the before-tax subtotal.

Returns:
the before-tax subtotal.

getBeforeTaxTotal

Money getBeforeTaxTotal()
Return the before-tax total.

Returns:
the before-tax total.

calculateShoppingCartTaxAndBeforeTaxPrices

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.


getProductAssociationsByType

java.util.List<ProductAssociation> 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 targetted product.

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.

getCartItemById

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

Parameters:
cartItemId - the cart item id
Returns:
the cart item with the given id

getGiftCertificateItemById

GiftCertificateItem getGiftCertificateItemById(long giftCertificateItemId)
Returns the gift certificate item with the given id.

Parameters:
giftCertificateItemId - the giftCertificate item id
Returns:
the giftCertificate item with the given id

updateCartItemById

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

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

addCartItem

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

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

addAssociatedCartItem

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

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

updateCartItemByGuid

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.

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

addWishListItem

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

Parameters:
productSku - the SKU to be added to the wishlist *
Returns:
the new CartItem representing the item in the wishlist

getPromotionCodes

java.util.List<java.lang.String> getPromotionCodes()
Gets the list of promotion codes successfully applied to the cart.

Returns:
the promotion codes

setPromotionCodes

void setPromotionCodes(java.util.List<java.lang.String> promotionCodes)
Sets the list of promotion codes successfully applied to the cart.

Parameters:
promotionCodes - the promotion codes

applyPromotionCode

void applyPromotionCode(java.lang.String promotionCode)
Add a new promotion code to the list of promotion codes added to the shopping cart.

Parameters:
promotionCode - the promotion code to add to the list

removePromotionCode

void removePromotionCode(java.lang.String promotionCode)
Remove a promotion code from the list of promotion codes added to the shopping cart.

Parameters:
promotionCode - the promotion code to remove from the list

isValidPromoCode

boolean isValidPromoCode(java.lang.String code)
Validates if the code matches a promotion code in the system.

Parameters:
code - the code to validate
Returns:
true if the code is a valid promotion code

isCodeValid

boolean isCodeValid()
Indicates if the promotion or gift certificate code entered by the user is valid.

Returns:
true if the code is valid

setCodeValid

void setCodeValid(boolean codeValid)
Set whether or not the promotion or gift certificate code entered by the user is valid.

Parameters:
codeValid - set to true if the code is valid

clearEstimates

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


getIpAddress

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

Returns:
the ipAddress

setIpAddress

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

Parameters:
ipAddress - the ipAddress of the user.

getViewHistory

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

Returns:
the ViewHistory

allowCheckout

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.

Returns:
true if checkout can proceed

isEstimateMode

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

Returns:
true when estimating shipping and taxes; otherwise, false.

setEstimateMode

void setEstimateMode(boolean estimateMode)
Set the indicator of whether in the estimate shipping and taxes mode. Disabling estimate mode cleards the billing and shipping addresses (because they may not be full, valid addresses), but tax and shipping calculations are not cleared. If you wish to clear the estimated calculations/values, then call clearEstimates().

Parameters:
estimateMode - true when estimating shipping and taxes; otherwise, false.

getAllItems

java.util.List<CartItem> getAllItems()
Get all the items in the shopping cart, including the ShoppingCartItems, WishListItems, GiftCertificateItems.

Returns:
an unmodifiable list of all the items in the shopping cart

fireRules

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.


getApplicableRules

java.util.List<Rule> getApplicableRules()
Returns the list of promotion rules that are applicable to the cart based on rule conditions and promo codes in the cart. A rule in this list might not be applied if it conflicts with another rule.

Returns:
A set of Rule objects

ruleApplied

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

Parameters:
ruleId - the uidPk of the Rule

getAppliedRules

java.util.Set<java.lang.Long> getAppliedRules()
Get the set of rules that have been applied to the cart.

Returns:
a set of Long Rule UidPks

getTaxCalculationResult

TaxCalculationResult getTaxCalculationResult()
Retrieves the current tax values.

Returns:
the current tax values

getTaxMap

java.util.Map<TaxCategory,Money> getTaxMap()
Retrieves the mapping of TaxCategories to values.

Returns:
the map of TaxCategories to values.

setTaxCalculationResult

void setTaxCalculationResult(TaxCalculationResult taxCalculationResult)
Sets the tax calculation result.

Parameters:
taxCalculationResult - the tax calculation result to set

getCmUserUID

java.lang.Long getCmUserUID()
Gets the cmUserUID.

Returns:
CmUserUID the cmUser's uid

setCmUserUID

void setCmUserUID(java.lang.Long cmUserUID)
Sets the CmUserUID.

Parameters:
cmUserUID - the cmUser's uid

setShippingCost

void setShippingCost(java.math.BigDecimal shippingCost)
Set shipping cost. Basically shipping cost is a calculated value. This setter is required for exchange order.

Parameters:
shippingCost - the shipping cost

isExchangeOrderShoppingCart

boolean isExchangeOrderShoppingCart()
Returns true is this shopping cart will be used for checking out exchange order, false for ordinary shopping cart.

Returns:
true if this cart is exchange shopping cart, false otherwise.

setExchangeOrderShoppingCart

void setExchangeOrderShoppingCart(boolean isExchangeOrderShoppingCart)
Sets the flag depending if this shopping cart will be used for checking out exchange order, or for ordinary shopping cart.

Parameters:
isExchangeOrderShoppingCart - exchange shopping cart flag.

getShoppingCartMemento

ShoppingCartMemento getShoppingCartMemento()
Gets the persistent shopping cart object.

Returns:
the shoppingCartPersistent

setShoppingCartMemento

void setShoppingCartMemento(ShoppingCartMemento shoppingCartMemento)
Parameters:
shoppingCartMemento - the shoppingCartPersistent to set

isCartItemRemoved

boolean isCartItemRemoved(java.lang.String skuCode)
Checks if a cart item with specific SKU code was previously removed.

Parameters:
skuCode - the SKU code to check
Returns:
true if a cart item with this SKU code was removed