Class DefaultTmaCartFacade
java.lang.Object
de.hybris.platform.commercefacades.order.impl.DefaultCartFacade
de.hybris.platform.b2ctelcofacades.order.impl.DefaultTmaCartFacade
- All Implemented Interfaces:
TmaCartFacade,de.hybris.platform.commercefacades.order.CartFacade
- Direct Known Subclasses:
DefaultTmaWebServicesCartFacade
public class DefaultTmaCartFacade
extends de.hybris.platform.commercefacades.order.impl.DefaultCartFacade
implements TmaCartFacade
Default implementation for
TmaCartFacade.- Since:
- 6.7
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultTmaCartFacade(Map<TmaCartStrategyType, TmaCartStrategy> cartStrategyMap, de.hybris.platform.commerceservices.order.CommerceSaveCartTextGenerationStrategy saveCartTextGenerationStrategy, de.hybris.platform.servicelayer.config.ConfigurationService configurationService, de.hybris.platform.enumeration.EnumerationService enumerationService) -
Method Summary
Modifier and TypeMethodDescriptionaddBpoSelectedOfferings(String rootBpoCode, List<String> simpleProductOfferings, String processType, int cartGroupNo, String subscriptionTerm, String subscriberIdentity, String subscriberBillingId) Adds multiple cart entries containing aTmaSimpleProductOfferingModelto the existing cart, all of them being part of theTmaBundledProductOfferingModelspecified by the rootBpoCode.addProductOfferingToCart(String spoCode, long quantity, String processType, String rootBpoCode, int cartGroupNo, String subscriptionTermId, String subscriberId, String subscriberBillingId) Adds a new cart entry containing aTmaSimpleProductOfferingModelto the existing cart.Creates a cart for the provided user if cart does not exist.protected TmaCartStrategyfindCartStrategy(CartActionInput cartActionInput) Returns the corresponding cartStrategy for a given cartActionInput.protected StringgenerateSaveCartDescription(CartModel cartModel, String description) Generate description for cart to be cloned if not provided by user.protected StringgenerateSaveCartName(CartModel cartModel) When restoring a saved cart, one copy of the restored saved cart can be kept.getCartForCode(String code, boolean recalculate) Retrieve a cart using codegetCartForCodeAndCustomer(String code, String customerId) Get a cart using code andUserModelgetCartForCodeAndCustomer(String code, String customerId, boolean recalculate) Get a cart using code and customer idgetCartForGuid(String guid) Get a cart using guidRetrieve the list of all cartsgetCartsForCustomer(String customerId) Get the list of carts for a customergetCartsForCustomer(String customerId, boolean recalculate) Get the list of carts for a customerprotected TmaCartStrategyMappingprotected de.hybris.platform.servicelayer.config.ConfigurationServiceprotected TmaCustomerFacadeprotected de.hybris.platform.enumeration.EnumerationServiceprotected de.hybris.platform.commerceservices.order.CommerceSaveCartTextGenerationStrategyprotected TmaSubscriptionTermServiceprotected de.hybris.platform.servicelayer.dto.converter.Converter<CartActionInput,CommerceCartParameter> protected TmaPoServiceprotected TmaSubscribedProductFacadeprotected Optional<TmaSubscriptionBaseData>getValidCustomerSubscription(String subscriberId, String subscriberBillingId, String processType) Deprecated, for removal: This API element is subject to removal in a future version.since 1907protected booleanhasSubscriptionTerm(TmaProductOfferingModel product, TmaBundledProductOfferingModel parentBpo, TmaProcessType processType, String subscriptionTermId) Checks if the provided subscription term is in the prices of the productOffering, parentBpo and processType provided.booleanisAnonymousUserCart(String cartGuid) Checks if given card belongs to anonymous user.booleanisCurrentUserCart(String cartGuid) Checks if given card belongs to current user.booleanisValidCartStatus(String status) Checks if the requested status for cart is valid or notprocessCartAction(List<CartActionInput> cartActionInputList) Processes cart entry updates.voidsetCartStrategyMapping(TmaCartStrategyMapping cartStrategyMapping) voidsetCustomerFacade(TmaCustomerFacade customerFacade) voidsetSubscriptionTermService(TmaSubscriptionTermService subscriptionTermService) voidsetTmaCommerceCartParameterConverter(de.hybris.platform.servicelayer.dto.converter.Converter<CartActionInput, CommerceCartParameter> tmaCommerceCartParameterConverter) voidsetTmaPoService(TmaPoService tmaPoService) voidsetTmaSubscribedProductFacade(TmaSubscribedProductFacade tmaSubscribedProductFacade) updateCartEntry(long entryNumber, long quantity) voidvalidateAndUpdateCartActionInputForClone(CartActionInput cartActionInput) Validates if cart to be cloned is valid and updates the cart action input with description and name.protected voidvalidateCartActionInput(CartActionInput cartActionInput) Validates the data provided for cart update.protected voidvalidateProductOfferingAndSubscriptionTerm(String poCode, String subscriptionTermId, String processType) Checks if the product offering isTmaSimpleProductOfferingModeleitherTmaFixedBundledProductOfferingModeland if the product offering and subscription term are valid.Methods inherited from class de.hybris.platform.commercefacades.order.impl.DefaultCartFacade
addToCart, addToCart, addToCart, configurationInfoToProductConfiguration, configureCartEntry, createCommerceCartParameter, createEmptyCart, deleteGroupedOrderEntriesMultiD, estimateExternalTaxes, filterConfigurationsByConfigurator, getBaseSiteService, getCartConverter, getCartModificationConverter, getCartRestorationConverter, getCartsForCurrentUser, getCommerceCartParameterConverter, getCommerceCartService, getCountryConverter, getDeliveryCountries, getDeliveryService, getGroupCartModificationListConverter, getMiniCartConverter, getModelService, getMostRecentCartGuidForUser, getOrderEntryConverter, getOrderEntryNumberForMultiD, getPointOfServiceService, getPriceDataFactory, getProductConfigurationMergeStrategies, getProductFacade, getProductService, getSessionCartGuid, getSessionCartWithEntryOrdering, getUserService, hasEntries, hasEntryGroups, hasSessionCart, mergeOrderEntryWithModelConfiguration, removeEntryGroup, removeSessionCart, removeStaleCarts, restoreAnonymousCartAndMerge, restoreAnonymousCartAndTakeOwnership, restoreCartAndMerge, restoreSavedCart, setBaseSiteService, setCartConverter, setCartModificationConverter, setCartRestorationConverter, setCartService, setCommerceCartParameterConverter, setCommerceCartService, setCountryConverter, setDeliveryService, setGroupCartModificationListConverter, setMiniCartConverter, setModelService, setOrderEntryConverter, setPointOfServiceService, setPriceDataFactory, setProductConfigurationMergeStrategies, setProductFacade, setProductService, setUserService, updateCartEntry, updateCartEntry, updateCartMetadata, validateCartDataMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.hybris.platform.commercefacades.order.CartFacade
addToCart, addToCart, addToCart, estimateExternalTaxes, getCartsForCurrentUser, getDeliveryCountries, getMostRecentCartGuidForUser, getSessionCartGuid, getSessionCartWithEntryOrdering, hasEntries, hasSessionCart, removeEntryGroup, removeSessionCart, removeStaleCarts, restoreAnonymousCartAndMerge, restoreAnonymousCartAndTakeOwnership, restoreCartAndMerge, restoreSavedCart, updateCartEntry, updateCartEntry, updateCartMetadata, validateCartData
-
Field Details
-
DEFAULT_QUANTITY
public static final long DEFAULT_QUANTITY- See Also:
-
-
Constructor Details
-
DefaultTmaCartFacade
public DefaultTmaCartFacade(Map<TmaCartStrategyType, TmaCartStrategy> cartStrategyMap, de.hybris.platform.commerceservices.order.CommerceSaveCartTextGenerationStrategy saveCartTextGenerationStrategy, de.hybris.platform.servicelayer.config.ConfigurationService configurationService, de.hybris.platform.enumeration.EnumerationService enumerationService)
-
-
Method Details
-
addProductOfferingToCart
public CartModificationData addProductOfferingToCart(String spoCode, long quantity, String processType, String rootBpoCode, int cartGroupNo, String subscriptionTermId, String subscriberId, String subscriberBillingId) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException Description copied from interface:TmaCartFacadeAdds a new cart entry containing aTmaSimpleProductOfferingModelto the existing cart. The product offering can be added as a single offering, but also as part of aTmaBundledProductOfferingModel.- Specified by:
addProductOfferingToCartin interfaceTmaCartFacade- Parameters:
spoCode-ProductModel.CODEquantity- product offering quantity to be added to cartprocessType- represents the process flow in the context of which the entry is added to cart (Acquisition, Retention, etc.)rootBpoCode- rootProductModel.CODEcartGroupNo- the cart entry group number on which the new entry to be attached to, if -1 a new entry group will be createdsubscriptionTermId- subscription term id for the entrysubscriberId- subscriber id in case of an existing customersubscriberBillingId- subscriber billing id in case of an existing customer- Returns:
- details related to the new cart entry
- Throws:
de.hybris.platform.commerceservices.order.CommerceCartModificationException- in case of any error occurs during new cart entry addition
-
processCartAction
public List<CartModificationData> processCartAction(List<CartActionInput> cartActionInputList) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException Description copied from interface:TmaCartFacadeProcesses cart entry updates.- Specified by:
processCartActionin interfaceTmaCartFacade- Parameters:
cartActionInputList- contains attributes used for cart entry updates- Returns:
- list
CartModificationData - Throws:
de.hybris.platform.commerceservices.order.CommerceCartModificationException- in case of any error occurs during cart entry update
-
addBpoSelectedOfferings
public List<CartModificationData> addBpoSelectedOfferings(String rootBpoCode, List<String> simpleProductOfferings, String processType, int cartGroupNo, String subscriptionTerm, String subscriberIdentity, String subscriberBillingId) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException Description copied from interface:TmaCartFacadeAdds multiple cart entries containing aTmaSimpleProductOfferingModelto the existing cart, all of them being part of theTmaBundledProductOfferingModelspecified by the rootBpoCode. If the cartGroupNo is valid, then the new entries are added as part of the corresponding cart group, otherwise, if cartGroupNo is -1, a new cart group is created for the new added entries.- Specified by:
addBpoSelectedOfferingsin interfaceTmaCartFacade- Parameters:
rootBpoCode-ProductModel.CODEof the bundled offering added to cartsimpleProductOfferings- a list containingProductModel.CODEprocessType- represents the process flow in the context of which the entry is added to cart (Acquisition, Retention, etc.)cartGroupNo- existing cart entry group numbersubscriptionTerm- subscription term id for the entrysubscriberIdentity- subscriber id in case of an existing customersubscriberBillingId- subscriber billing id in case of an existing customer- Returns:
- details regarding new added entries
- Throws:
de.hybris.platform.commerceservices.order.CommerceCartModificationException- in case of any error occurs during new cart entries addition
-
getCartForCodeAndCustomer
Description copied from interface:TmaCartFacadeGet a cart using code andUserModel- Specified by:
getCartForCodeAndCustomerin interfaceTmaCartFacade- Parameters:
code- The cart identifier codecustomerId- The id of the customer who owns the cart- Returns:
- cart
-
getCartForCodeAndCustomer
public Optional<CartData> getCartForCodeAndCustomer(String code, String customerId, boolean recalculate) throws de.hybris.platform.order.exceptions.CalculationException Description copied from interface:TmaCartFacadeGet a cart using code and customer id- Specified by:
getCartForCodeAndCustomerin interfaceTmaCartFacade- Parameters:
code- The cart identifier codecustomerId- The id of the customer who owns the cartrecalculate- Flag which indicates if the cart should be recalculated or not- Returns:
- cart
- Throws:
de.hybris.platform.order.exceptions.CalculationException- If errors occurre during cart recalculation
-
getCartForCode
public Optional<CartData> getCartForCode(String code, boolean recalculate) throws de.hybris.platform.order.exceptions.CalculationException Description copied from interface:TmaCartFacadeRetrieve a cart using code- Specified by:
getCartForCodein interfaceTmaCartFacade- Parameters:
code- The cart identifier coderecalculate- Flag which indicates if the cart should be recalculated or not- Returns:
- cart
- Throws:
de.hybris.platform.order.exceptions.CalculationException- If errors occurred during cart recalculation
-
getCartForGuid
Description copied from interface:TmaCartFacadeGet a cart using guid- Specified by:
getCartForGuidin interfaceTmaCartFacade- Returns:
- the specific cart for given guid
-
getCartsForCustomer
Description copied from interface:TmaCartFacadeGet the list of carts for a customer- Specified by:
getCartsForCustomerin interfaceTmaCartFacade- Parameters:
customerId- The id of the customer who owns the carts- Returns:
- the cart list
-
getCartsForCustomer
public List<CartData> getCartsForCustomer(String customerId, boolean recalculate) throws de.hybris.platform.order.exceptions.CalculationException Description copied from interface:TmaCartFacadeGet the list of carts for a customer- Specified by:
getCartsForCustomerin interfaceTmaCartFacade- Parameters:
customerId- The id of the customer who owns the cartsrecalculate- Flag which indicates if the cart should be recalculated or not- Returns:
- the cart list
- Throws:
de.hybris.platform.order.exceptions.CalculationException- If errors occurre during cart recalculation
-
getCarts
public List<CartData> getCarts(boolean recalculate, Integer offset, Integer limit) throws de.hybris.platform.order.exceptions.CalculationException Description copied from interface:TmaCartFacadeRetrieve the list of all carts- Specified by:
getCartsin interfaceTmaCartFacade- Parameters:
recalculate- Flag which indicates if the carts should be recalculated or notoffset- the offset represents the position in list from where the result list will start.limit- the limit represents the number of entries that will be selected for the result list.- Returns:
- the cart list
- Throws:
de.hybris.platform.order.exceptions.CalculationException- If errors occurred during cart recalculation
-
getSessionCart
- Specified by:
getSessionCartin interfacede.hybris.platform.commercefacades.order.CartFacade- Overrides:
getSessionCartin classde.hybris.platform.commercefacades.order.impl.DefaultCartFacade
-
createCartForUserAndCurrentBaseSite
Description copied from interface:TmaCartFacadeCreates a cart for the provided user if cart does not exist. If cart exists returns the existing cart.- Specified by:
createCartForUserAndCurrentBaseSitein interfaceTmaCartFacade- Parameters:
userId- The unique identifier of the user.- Returns:
- The cart which was created.
-
getMiniCart
- Specified by:
getMiniCartin interfacede.hybris.platform.commercefacades.order.CartFacade- Overrides:
getMiniCartin classde.hybris.platform.commercefacades.order.impl.DefaultCartFacade
-
isAnonymousUserCart
Checks if given card belongs to anonymous user.- Specified by:
isAnonymousUserCartin interfaceTmaCartFacade- Parameters:
cartGuid- GUID of the cart.- Returns:
- true if the cart belongs to anonymous user.
-
isCurrentUserCart
Checks if given card belongs to current user.- Specified by:
isCurrentUserCartin interfaceTmaCartFacade- Parameters:
cartGuid- GUID of the cart.- Returns:
- true if the cart belongs to current user.
-
validateAndUpdateCartActionInputForClone
public void validateAndUpdateCartActionInputForClone(CartActionInput cartActionInput) throws de.hybris.platform.commerceservices.order.CommerceSaveCartException Validates if cart to be cloned is valid and updates the cart action input with description and name.- Specified by:
validateAndUpdateCartActionInputForClonein interfaceTmaCartFacade- Parameters:
cartActionInput- contains attributes used for clone cart operation- Throws:
de.hybris.platform.commerceservices.order.CommerceSaveCartException- in case the parameters provided in case cart is null or unsaved
-
isValidCartStatus
Checks if the requested status for cart is valid or not- Specified by:
isValidCartStatusin interfaceTmaCartFacade- Parameters:
status- the requested status to be updated for cart- Returns:
- True if requested status is valid status, otherwise false
-
updateCartEntry
public CartModificationData updateCartEntry(long entryNumber, long quantity) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException - Specified by:
updateCartEntryin interfacede.hybris.platform.commercefacades.order.CartFacade- Overrides:
updateCartEntryin classde.hybris.platform.commercefacades.order.impl.DefaultCartFacade- Throws:
de.hybris.platform.commerceservices.order.CommerceCartModificationException
-
getValidCustomerSubscription
@Deprecated(since="1907", forRemoval=true) protected Optional<TmaSubscriptionBaseData> getValidCustomerSubscription(String subscriberId, String subscriberBillingId, String processType) Deprecated, for removal: This API element is subject to removal in a future version.since 1907 -
validateCartActionInput
protected void validateCartActionInput(CartActionInput cartActionInput) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException Validates the data provided for cart update.- Parameters:
cartActionInput- contains attributes used for cart entry updates- Throws:
de.hybris.platform.commerceservices.order.CommerceCartModificationException- in case the parameters provided in cartActionInputList are not correct
-
validateProductOfferingAndSubscriptionTerm
protected void validateProductOfferingAndSubscriptionTerm(String poCode, String subscriptionTermId, String processType) throws de.hybris.platform.commerceservices.order.CommerceCartModificationException Checks if the product offering isTmaSimpleProductOfferingModeleitherTmaFixedBundledProductOfferingModeland if the product offering and subscription term are valid.- Parameters:
poCode- the identifier of the product offeringsubscriptionTermId- the identifier of the subscription term- Throws:
de.hybris.platform.commerceservices.order.CommerceCartModificationException- in case the identifier or the subscription term provided is incorrect
-
hasSubscriptionTerm
protected boolean hasSubscriptionTerm(TmaProductOfferingModel product, TmaBundledProductOfferingModel parentBpo, TmaProcessType processType, String subscriptionTermId) Checks if the provided subscription term is in the prices of the productOffering, parentBpo and processType provided.- Parameters:
product- the productparentBpo- the parent of the productprocessType- the process typesubscriptionTermId- the identifier of the subscription term- Returns:
- True if provided subscription term is in the prices of the product and its parent, otherwise false.
-
findCartStrategy
Returns the corresponding cartStrategy for a given cartActionInput.- Parameters:
cartActionInput- the cartActionInput that determines the action we want to apply.- Returns:
- the
TmaCartStrategyfor the given input.
-
generateSaveCartName
When restoring a saved cart, one copy of the restored saved cart can be kept. The name of the copied/(cloned) cart is the original saved cart name + copy#. The property b2ctelcoocc.clone.savecart.name.regex set the regex for the name suffix of #- Parameters:
cartModel- the cart which will be cloned- Returns:
- name the name which will be given to cloned cart
-
generateSaveCartDescription
Generate description for cart to be cloned if not provided by user.- Parameters:
cartModel- the cart which will be cloneddescription- the description provided by user which will be given to cloned cart- Returns:
- description the description which will given to cloned cart
-
getTmaPoService
-
getSubscriptionTermService
-
getCustomerFacade
-
getCartStrategyMapping
-
getTmaCommerceCartParameterConverter
protected de.hybris.platform.servicelayer.dto.converter.Converter<CartActionInput,CommerceCartParameter> getTmaCommerceCartParameterConverter() -
getCartService
- Overrides:
getCartServicein classde.hybris.platform.commercefacades.order.impl.DefaultCartFacade
-
getTmaSubscribedProductFacade
-
getSaveCartTextGenerationStrategy
protected de.hybris.platform.commerceservices.order.CommerceSaveCartTextGenerationStrategy getSaveCartTextGenerationStrategy() -
getConfigurationService
protected de.hybris.platform.servicelayer.config.ConfigurationService getConfigurationService() -
getEnumerationService
protected de.hybris.platform.enumeration.EnumerationService getEnumerationService() -
setTmaPoService
-
setSubscriptionTermService
-
setCustomerFacade
-
setCartStrategyMapping
-
setTmaCommerceCartParameterConverter
public void setTmaCommerceCartParameterConverter(de.hybris.platform.servicelayer.dto.converter.Converter<CartActionInput, CommerceCartParameter> tmaCommerceCartParameterConverter) -
setTmaSubscribedProductFacade
-