Class DefaultSapCartFacade
- java.lang.Object
-
- de.hybris.platform.commercefacades.order.impl.DefaultCartFacade
-
- de.hybris.platform.sap.sapordermgmtb2bfacades.order.impl.DefaultSapCartFacade
-
- All Implemented Interfaces:
CartFacade
public class DefaultSapCartFacade extends DefaultCartFacade
Implementation forCartFacade
. Delivers main functionality for cart.
-
-
Constructor Summary
Constructors Constructor Description DefaultSapCartFacade()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<CartModificationData>
addItemsToCart(java.util.List<OrderEntryData> cartEntries)
Add quick order entries to cartCartModificationData
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.BackendAvailabilityService
getBackendAvailabilityService()
BaseStoreService
getBaseStoreService()
CartRestorationFacade
getCartRestorationFacade()
java.util.List<CartData>
getCartsForCurrentUser()
Returns all carts for current site and user.java.util.List<CountryData>
getDeliveryCountries()
Get the supported delivery countries.I18NService
getI18nService()
org.springframework.context.MessageSource
getMessageSource()
CartData
getMiniCart()
Method gets smaller version of cart, with data necessary for showing mini cart.ProductImageHelper
getProductImageHelper()
java.util.List<SapCartFacadeHook>
getSapCartFacadeHooks()
CartService
getSapCartService()
CartData
getSessionCart()
Method gets cart from session, if any exist.CartData
getSessionCartWithEntryOrdering(boolean recentlyAddedFirst)
Method gets cart sorted by recently added entries from session, if param is set to trueSessionService
getSessionService()
boolean
hasEntries()
Check if session cart has entries, avoiding full conversion of the cart to CartData.boolean
hasSessionCart()
Check if session has a cart.protected boolean
isSyncOrdermgmtEnabled()
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 code)
Restores the user's saved cart to the session.void
setBackendAvailabilityService(BackendAvailabilityService backendAvailabilityService)
void
setBaseStoreService(BaseStoreService baseStoreService)
void
setCartRestorationFacade(CartRestorationFacade cartRestorationFacade)
void
setI18nService(I18NService i18nService)
void
setMessageSource(org.springframework.context.MessageSource messageSource)
void
setProductImageHelper(ProductImageHelper productImageHelper)
void
setSapCartFacadeHooks(java.util.List<SapCartFacadeHook> sapCartFacadeHooks)
void
setSapCartService(CartService sapCartService)
void
setSessionService(SessionService sessionService)
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.java.util.List<CartModificationData>
validateCartData()
Method for validating every entry in the cart-
Methods inherited from class de.hybris.platform.commercefacades.order.impl.DefaultCartFacade
addToCart, configurationInfoToProductConfiguration, configureCartEntry, createCommerceCartParameter, createEmptyCart, deleteGroupedOrderEntriesMultiD, filterConfigurationsByConfigurator, getBaseSiteService, getCartConverter, getCartModificationConverter, getCartRestorationConverter, getCartService, getCommerceCartParameterConverter, getCommerceCartService, getCountryConverter, getDeliveryService, getGroupCartModificationListConverter, getMiniCartConverter, getModelService, getMostRecentCartGuidForUser, getOrderEntryConverter, getOrderEntryNumberForMultiD, getPointOfServiceService, getPriceDataFactory, getProductConfigurationMergeStrategies, getProductFacade, getProductService, getSessionCartGuid, getUserService, hasEntryGroups, mergeOrderEntryWithModelConfiguration, removeEntryGroup, setBaseSiteService, setCartConverter, setCartModificationConverter, setCartRestorationConverter, setCartService, setCommerceCartParameterConverter, setCommerceCartService, setCountryConverter, setDeliveryService, setGroupCartModificationListConverter, setMiniCartConverter, setModelService, setOrderEntryConverter, setPointOfServiceService, setPriceDataFactory, setProductConfigurationMergeStrategies, setProductFacade, setProductService, setUserService, updateCartEntry, updateCartMetadata
-
-
-
-
Method Detail
-
getI18nService
public I18NService getI18nService()
- Returns:
- the i18nService
-
setI18nService
public void setI18nService(I18NService i18nService)
- Parameters:
i18nService
- the i18nService to set
-
getMessageSource
public org.springframework.context.MessageSource getMessageSource()
- Returns:
- the messageSource
-
setMessageSource
public void setMessageSource(org.springframework.context.MessageSource messageSource)
- Parameters:
messageSource
- the messageSource to set
-
hasSessionCart
public boolean hasSessionCart()
Description copied from interface:CartFacade
Check if session has a cart.- Specified by:
hasSessionCart
in interfaceCartFacade
- Overrides:
hasSessionCart
in classDefaultCartFacade
- Returns:
- true if the session has a cart
-
getMiniCart
public CartData getMiniCart()
Description copied from interface:CartFacade
Method gets smaller version of cart, with data necessary for showing mini cart.- Specified by:
getMiniCart
in interfaceCartFacade
- Overrides:
getMiniCart
in classDefaultCartFacade
- Returns:
- the mini card data
-
getSessionCart
public CartData getSessionCart()
Description copied from interface:CartFacade
Method gets cart from session, if any exist.- Specified by:
getSessionCart
in interfaceCartFacade
- Overrides:
getSessionCart
in classDefaultCartFacade
- Returns:
- the cart data
-
getSessionCartWithEntryOrdering
public CartData getSessionCartWithEntryOrdering(boolean recentlyAddedFirst)
Description copied from interface:CartFacade
Method gets cart sorted by recently added entries from session, if param is set to true- Specified by:
getSessionCartWithEntryOrdering
in interfaceCartFacade
- Overrides:
getSessionCartWithEntryOrdering
in classDefaultCartFacade
- Parameters:
recentlyAddedFirst
- boolean value to determine whether to return sorted cart data- Returns:
- the cart data sorted by recently added entries
-
addToCart
public CartModificationData addToCart(java.lang.String code, long quantity) throws CommerceCartModificationException
Description copied from interface:CartFacade
Method for adding a product to cart.- Specified by:
addToCart
in interfaceCartFacade
- Overrides:
addToCart
in classDefaultCartFacade
- Parameters:
code
- code of product to addquantity
- the quantity of the product- Returns:
- the cart modification data that includes a statusCode and the actual quantity added to the cart
- Throws:
CommerceCartModificationException
- if the cart cannot be modified
-
addToCart
public CartModificationData addToCart(java.lang.String code, long quantity, java.lang.String storeId) throws CommerceCartModificationException
Description copied from interface:CartFacade
Method for adding a product to cart.- Specified by:
addToCart
in interfaceCartFacade
- Overrides:
addToCart
in classDefaultCartFacade
- Parameters:
code
- code of product to addquantity
- the quantity of the productstoreId
- The identifier for the store. If null {@see CartFacade#addToCart(String, long)} is used.- Returns:
- the cart modification data that includes a statusCode and the actual quantity added to the cart
- Throws:
CommerceCartModificationException
- if the cart cannot be modified
-
addItemsToCart
public java.util.List<CartModificationData> addItemsToCart(java.util.List<OrderEntryData> cartEntries) throws CommerceCartModificationException
Add quick order entries to cart- Parameters:
cartEntries
- list of cart entries- Returns:
- cart modification data
- Throws:
CommerceCartModificationException
- exception
-
validateCartData
public java.util.List<CartModificationData> validateCartData() throws CommerceCartModificationException
Description copied from interface:CartFacade
Method for validating every entry in the cart- Specified by:
validateCartData
in interfaceCartFacade
- Overrides:
validateCartData
in classDefaultCartFacade
- Returns:
- a list of cart modifications that includes a statusCode and the actual quantity that the entry was updated to
- Throws:
CommerceCartModificationException
- if the cart cannot be modified
-
updateCartEntry
public CartModificationData updateCartEntry(long entryNumber, long quantity) throws CommerceCartModificationException
Description copied from interface:CartFacade
Method for updating the number of products.- Specified by:
updateCartEntry
in interfaceCartFacade
- Overrides:
updateCartEntry
in classDefaultCartFacade
- Parameters:
entryNumber
- the entry numberquantity
- new value of quantity for product- Returns:
- the cart modification data that includes a statusCode and the actual quantity that the entry was updated to
- Throws:
CommerceCartModificationException
- if the cart cannot be modified
-
isSyncOrdermgmtEnabled
protected boolean isSyncOrdermgmtEnabled()
-
getBaseStoreService
public BaseStoreService getBaseStoreService()
- Returns:
- the baseStoreService
-
setBaseStoreService
public void setBaseStoreService(BaseStoreService baseStoreService)
- Parameters:
baseStoreService
- the baseStoreService to set
-
getSapCartService
public CartService getSapCartService()
- Returns:
- the sapCartService
-
setSapCartService
public void setSapCartService(CartService sapCartService)
- Parameters:
sapCartService
- the sapCartService to set
-
getBackendAvailabilityService
public BackendAvailabilityService getBackendAvailabilityService()
- Returns:
- the backendAvailabilityService
-
setBackendAvailabilityService
public void setBackendAvailabilityService(BackendAvailabilityService backendAvailabilityService)
- Parameters:
backendAvailabilityService
- the backendAvailabilityService to set
-
getProductImageHelper
public ProductImageHelper getProductImageHelper()
- Returns:
- the productImageHelper
-
setProductImageHelper
public void setProductImageHelper(ProductImageHelper productImageHelper)
- Parameters:
productImageHelper
- the productImageHelper to set
-
getCartRestorationFacade
public CartRestorationFacade getCartRestorationFacade()
- Returns:
- the cartRestorationFacade
-
setCartRestorationFacade
public void setCartRestorationFacade(CartRestorationFacade cartRestorationFacade)
- Parameters:
cartRestorationFacade
- the cartRestorationFacade to set
-
updateCartEntry
public CartModificationData updateCartEntry(long entryNumber, java.lang.String storeId) throws CommerceCartModificationException
Description copied from interface:CartFacade
Method for updating the number of products.- Specified by:
updateCartEntry
in interfaceCartFacade
- Overrides:
updateCartEntry
in classDefaultCartFacade
- Parameters:
entryNumber
- The entry numberstoreId
- The identifier for the store. Can be null.- Returns:
- the cart modification data that includes a statusCode and the actual quantity that the entry was updated to
- Throws:
CommerceCartModificationException
- if the cart cannot be modified
-
restoreSavedCart
public CartRestorationData restoreSavedCart(java.lang.String code) throws CommerceCartRestorationException
Description copied from interface:CartFacade
Restores the user's saved cart to the session. For non-anonymous users, the cart restored will be for the current user and site.- Specified by:
restoreSavedCart
in interfaceCartFacade
- Overrides:
restoreSavedCart
in classDefaultCartFacade
- Parameters:
code
- the cart guid to restore for Anonymous user.- Returns:
- the cart restoration data that includes details of any items that could not be restored in part or in full.
- Throws:
CommerceCartRestorationException
-
getDeliveryCountries
public java.util.List<CountryData> getDeliveryCountries()
Description copied from interface:CartFacade
Get the supported delivery countries. The list is sorted alphabetically.- Specified by:
getDeliveryCountries
in interfaceCartFacade
- Overrides:
getDeliveryCountries
in classDefaultCartFacade
- Returns:
- list of supported delivery countries.
-
estimateExternalTaxes
public CartData estimateExternalTaxes(java.lang.String deliveryZipCode, java.lang.String countryIsoCode)
Description copied from interface:CartFacade
Estimate taxes on the cart.- Specified by:
estimateExternalTaxes
in interfaceCartFacade
- Overrides:
estimateExternalTaxes
in classDefaultCartFacade
- Parameters:
deliveryZipCode
- delivery zip code used for calculating external taxescountryIsoCode
- delivery country used for calculating taxes- Returns:
- cart data that represents the current cart with taxes estimations added
-
removeStaleCarts
public void removeStaleCarts()
Description copied from interface:CartFacade
Remove the stale carts of the current user.- Specified by:
removeStaleCarts
in interfaceCartFacade
- Overrides:
removeStaleCarts
in classDefaultCartFacade
-
restoreAnonymousCartAndTakeOwnership
public CartRestorationData restoreAnonymousCartAndTakeOwnership(java.lang.String guid) throws CommerceCartRestorationException
Description copied from interface:CartFacade
Restores the anonymous user's cart to the session and sets its user to current user.- Specified by:
restoreAnonymousCartAndTakeOwnership
in interfaceCartFacade
- Overrides:
restoreAnonymousCartAndTakeOwnership
in classDefaultCartFacade
- Parameters:
guid
- GUID used to find anonymous user's cart- Returns:
- the cart restoration data that includes details of any items that could not be restored in part or in full.
- Throws:
CommerceCartRestorationException
-
removeSessionCart
public void removeSessionCart()
Description copied from interface:CartFacade
If existing the current session cart is being detached from this session and removed. Afterwards it's no longer available.- Specified by:
removeSessionCart
in interfaceCartFacade
- Overrides:
removeSessionCart
in classDefaultCartFacade
-
getCartsForCurrentUser
public java.util.List<CartData> getCartsForCurrentUser()
Description copied from interface:CartFacade
Returns all carts for current site and user.- Specified by:
getCartsForCurrentUser
in interfaceCartFacade
- Overrides:
getCartsForCurrentUser
in classDefaultCartFacade
- Returns:
- list of carts
-
restoreAnonymousCartAndMerge
public CartRestorationData restoreAnonymousCartAndMerge(java.lang.String fromAnonumousCartGuid, java.lang.String toUserCartGuid) throws CommerceCartMergingException, CommerceCartRestorationException
Description copied from interface:CartFacade
Merges carts from anonymous to given user's cart, restores user's cart to the session, sets its user to current user.- Specified by:
restoreAnonymousCartAndMerge
in interfaceCartFacade
- Overrides:
restoreAnonymousCartAndMerge
in classDefaultCartFacade
- Parameters:
fromAnonumousCartGuid
- - Anonymous user's cart from merging is donetoUserCartGuid
- - User's cart to merge to- Returns:
CartRestorationData
object holding information about the restoration- Throws:
CommerceCartMergingException
CommerceCartRestorationException
-
restoreCartAndMerge
public CartRestorationData restoreCartAndMerge(java.lang.String fromUserCartGuid, java.lang.String toUserCartGuid) throws CommerceCartRestorationException, CommerceCartMergingException
Description copied from interface:CartFacade
Merges user's carts, restores merged cart to the session, sets its user to current user.- Specified by:
restoreCartAndMerge
in interfaceCartFacade
- Overrides:
restoreCartAndMerge
in classDefaultCartFacade
- Parameters:
fromUserCartGuid
- - User's cart from merging is donetoUserCartGuid
- - User's cart to merge to- Returns:
CartRestorationData
object holding information about the restoration- Throws:
CommerceCartRestorationException
CommerceCartMergingException
-
hasEntries
public boolean hasEntries()
Description copied from interface:CartFacade
Check if session cart has entries, avoiding full conversion of the cart to CartData. For Performance.- Specified by:
hasEntries
in interfaceCartFacade
- Overrides:
hasEntries
in classDefaultCartFacade
- Returns:
- true if the cart has any entries.
-
getSapCartFacadeHooks
public java.util.List<SapCartFacadeHook> getSapCartFacadeHooks()
- Returns:
- the sapCartFacadeHooks
-
setSapCartFacadeHooks
public void setSapCartFacadeHooks(java.util.List<SapCartFacadeHook> sapCartFacadeHooks)
- Parameters:
sapCartFacadeHooks
- the sapCartFacadeHooks to set
-
getSessionService
public SessionService getSessionService()
- Returns:
- the sessionService
-
setSessionService
public void setSessionService(SessionService sessionService)
- Parameters:
sessionService
- the sessionService to set
-
-