public interface CartFacade
| Modifier and Type | Method and Description |
|---|---|
CartModificationData |
addToCart(AddToCartParams addToCartParams)
Method for adding a product to cart.
|
CartModificationData |
addToCart(java.lang.String code,
long quantity)
Method for adding a product to cart.
|
CartModificationData |
addToCart(java.lang.String code,
long quantity,
java.lang.String storeId)
Method for adding a product to cart.
|
CartData |
estimateExternalTaxes(java.lang.String deliveryZipCode,
java.lang.String countryIsoCode)
Estimate taxes on the cart.
|
java.util.List<CartData> |
getCartsForCurrentUser()
Returns all carts for current site and user.
|
java.util.List<CountryData> |
getDeliveryCountries()
Deprecated.
since 1808. Please use
CheckoutFacade.getCountries(CountryType) instead. |
CartData |
getMiniCart()
Method gets smaller version of cart, with data necessary for showing mini cart.
|
default java.lang.String |
getMostRecentCartGuidForUser(java.util.Collection<java.lang.String> excludedCartsGuid)
Returns most recent cart guid for current site and user excluding the list of carts guid passed.
|
CartData |
getSessionCart()
Method gets cart from session, if any exist.
|
default java.lang.String |
getSessionCartGuid()
Returns session cart guid if any.
|
CartData |
getSessionCartWithEntryOrdering(boolean recentlyAddedFirst)
Method gets cart sorted by recently added entries from session, if param is set to true
|
boolean |
hasEntries()
Check if session cart has entries, avoiding full conversion of the cart to CartData.
|
boolean |
hasSessionCart()
Check if session has a cart.
|
CartModificationData |
removeEntryGroup(java.lang.Integer groupNumber)
Removes group with all subsequent entries.
|
void |
removeSessionCart()
If existing the current session cart is being detached from this session and removed.
|
void |
removeStaleCarts()
Remove the stale carts of the current user.
|
CartRestorationData |
restoreAnonymousCartAndMerge(java.lang.String fromAnonumousCartGuid,
java.lang.String toUserCartGuid)
Merges carts from anonymous to given user's cart, restores user's cart to the session, sets its user to current
user.
|
CartRestorationData |
restoreAnonymousCartAndTakeOwnership(java.lang.String guid)
Restores the anonymous user's cart to the session and sets its user to current user.
|
CartRestorationData |
restoreCartAndMerge(java.lang.String fromUserCartGuid,
java.lang.String toUserCartGuid)
Merges user's carts, restores merged cart to the session, sets its user to current user.
|
CartRestorationData |
restoreSavedCart(java.lang.String guid)
Restores the user's saved cart to the session.
|
CartModificationData |
updateCartEntry(long entryNumber,
long quantity)
Method for updating the number of products.
|
CartModificationData |
updateCartEntry(long entryNumber,
java.lang.String storeId)
Method for updating the number of products.
|
CartModificationData |
updateCartEntry(OrderEntryData cartEntry)
Updates the given cart entry.
|
void |
updateCartMetadata(CommerceCartMetadata metadata)
Updates cart metadata, such as: name, description, expiration time.
|
java.util.List<CartModificationData> |
validateCartData()
Method for validating every entry in the cart
|
CartData getSessionCart()
CartData getSessionCartWithEntryOrdering(boolean recentlyAddedFirst)
recentlyAddedFirst - boolean value to determine whether to return sorted cart databoolean hasSessionCart()
boolean hasEntries()
CartData getMiniCart()
CartModificationData addToCart(java.lang.String code, long quantity) throws CommerceCartModificationException
code - code of product to addquantity - the quantity of the productCommerceCartModificationException - if the cart cannot be modifiedCartModificationData addToCart(java.lang.String code, long quantity, java.lang.String storeId) throws CommerceCartModificationException
code - code of product to addstoreId - The identifier for the store. If null addToCart(String, long) is used.quantity - the quantity of the productCommerceCartModificationException - if the cart cannot be modifiedCartModificationData addToCart(AddToCartParams addToCartParams) throws CommerceCartModificationException
addToCartParams - addToCartParamsCommerceCartModificationException - if the cart cannot be modifiedjava.util.List<CartModificationData> validateCartData() throws CommerceCartModificationException
CommerceCartModificationException - if the cart cannot be modifiedCartModificationData updateCartEntry(long entryNumber, long quantity) throws CommerceCartModificationException
entryNumber - the entry numberquantity - new value of quantity for productCommerceCartModificationException - if the cart cannot be modifiedCartModificationData updateCartEntry(long entryNumber, java.lang.String storeId) throws CommerceCartModificationException
entryNumber - The entry numberstoreId - The identifier for the store. Can be null.CommerceCartModificationException - if the cart cannot be modifiedCartRestorationData restoreSavedCart(java.lang.String guid) throws CommerceCartRestorationException
guid - the cart guid to restore for Anonymous user.CommerceCartRestorationException@Deprecated java.util.List<CountryData> getDeliveryCountries()
CheckoutFacade.getCountries(CountryType) instead.CartData estimateExternalTaxes(java.lang.String deliveryZipCode, java.lang.String countryIsoCode)
deliveryZipCode - delivery zip code used for calculating external taxescountryIsoCode - delivery country used for calculating taxesvoid removeStaleCarts()
CartRestorationData restoreAnonymousCartAndTakeOwnership(java.lang.String guid) throws CommerceCartRestorationException
guid - GUID used to find anonymous user's cartCommerceCartRestorationExceptionvoid removeSessionCart()
java.util.List<CartData> getCartsForCurrentUser()
default java.lang.String getMostRecentCartGuidForUser(java.util.Collection<java.lang.String> excludedCartsGuid)
excludedCartsGuid - the excluded carts guiddefault java.lang.String getSessionCartGuid()
CartRestorationData restoreAnonymousCartAndMerge(java.lang.String fromAnonumousCartGuid, java.lang.String toUserCartGuid) throws CommerceCartMergingException, CommerceCartRestorationException
fromAnonumousCartGuid - - Anonymous user's cart from merging is donetoUserCartGuid - - User's cart to merge toCartRestorationData object holding information about the restorationCommerceCartMergingExceptionCommerceCartRestorationExceptionCartRestorationData restoreCartAndMerge(java.lang.String fromUserCartGuid, java.lang.String toUserCartGuid) throws CommerceCartRestorationException, CommerceCartMergingException
fromUserCartGuid - - User's cart from merging is donetoUserCartGuid - - User's cart to merge toCartRestorationData object holding information about the restorationCommerceCartRestorationExceptionCommerceCartMergingExceptionCartModificationData updateCartEntry(OrderEntryData cartEntry) throws CommerceCartModificationException
cartEntry - the order entry data object identifying the order entry to update and holding the updated attributes.CommerceCartModificationExceptionvoid updateCartMetadata(CommerceCartMetadata metadata)
metadata - a bean holding parameters a client may want to pass to the method, attributes can be added to the bean
via beans.xml in your extensionsjava.lang.IllegalArgumentException - if any attributes fail validationIllegalQuoteStateException - if the cart is associated with a quote for which the operation cannot be performedCartModificationData removeEntryGroup(java.lang.Integer groupNumber) throws CommerceCartModificationException
groupNumber - group numberCommerceCartModificationExceptionCopyright © 2018 SAP SE. All Rights Reserved.