public class DefaultCommerceCartService extends java.lang.Object implements CommerceCartService
CommerceCartService| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
ESTIMATED_TAXES |
| Constructor and Description |
|---|
DefaultCommerceCartService() |
protected static final java.lang.String ESTIMATED_TAXES
@Deprecated public CommerceCartModification addToCart(CartModel cartModel, ProductModel productModel, long quantityToAdd, UnitModel unit, boolean forceNewEntry) throws CommerceCartModificationException
addToCart in interface CommerceCartServicecartModel - the user's cart in sessionproductModel - the ProductModel to addquantityToAdd - the quantity to addunit - the UnitModel of the product @see
ProductModel.getUnit()forceNewEntry - the flag for creating a new
CartEntryModelCommerceCartModificationException@Deprecated public CommerceCartModification addToCart(CartModel cartModel, ProductModel productModel, PointOfServiceModel deliveryPointOfService, long quantity, UnitModel unit, boolean forceNewEntry) throws CommerceCartModificationException
addToCart in interface CommerceCartServicecartModel - the user's cart in sessionproductModel - the ProductModel to adddeliveryPointOfService - the delivery storequantity - the quantity to addunit - the UnitModel of the product @see
ProductModel.getUnit()forceNewEntry - the flag for creating a new
CartEntryModelCommerceCartModificationExceptionpublic CommerceCartModification addToCart(CommerceCartParameter parameter) throws CommerceCartModificationException
CommerceCartServiceCartModel the (existing) ProductModel in the given UnitModel and
with the given quantity. If in the cart already an entry with the given product and given unit exists
the given quantity is added to the the quantity of this cart entry unless forceNewEntry
is set to true. After this the cart is calculated.addToCart in interface CommerceCartServiceparameter - - A parameter object containing all attributes needed for add to cart
CommerceCartParameter.cart - The user's cart in session
CommerceCartParameter.pointOfService - The store object for pick up in store items (only needs
to be passed in if you are adding an item to pick up CommerceCartParameter.product - The
ProductModel to add CommerceCartParameter.quantity - The quantity to add
CommerceCartParameter.unit - The UnitModel of the product @see
ProductModel.getUnit()
CommerceCartParameter.createNewEntry - The flag for creating a new
CartEntryModel
CommerceCartModificationException - if the product is a base product OR the quantity is less than 1 or no usable unit was
found (only when given unit is also null) or any other reason the cart could
not be modified.public java.util.List<CommerceCartModification> validateCart(CommerceCartParameter parameter) throws CommerceCartModificationException
CommerceCartServicevalidateCart in interface CommerceCartServiceCommerceCartModificationException - if the cart could not be modified.@Deprecated public java.util.List<CommerceCartModification> validateCart(CartModel cartModel) throws CommerceCartModificationException
validateCart in interface CommerceCartServicecartModel - the user's cart in sessionList of cart modificationsCommerceCartModificationException@Deprecated public boolean calculateCart(CartModel cartModel)
calculateCart in interface CommerceCartServicecartModel - the user's cart in sessionfalse if the cartModel was already calculatedpublic boolean calculateCart(CommerceCartParameter parameters)
CommerceCartServicecartModel and returns true if each entry alone and after this the
CartModel was calculated. Thereby any invalid entry will be automatically removed. The net/gross prices
depends on the current session user, see PriceFactory.isNetUser(de.hybris.platform.jalo.user.User) for
more information.calculateCart in interface CommerceCartServiceparameters - the parameter object holding the existing CartModel that will be calculatedfalse if the cartModel was already calculated.@Deprecated public void recalculateCart(CartModel cartModel) throws CalculationException
recalculateCart in interface CommerceCartServicecartModel - the user's cart in sessionCalculationExceptionpublic void recalculateCart(CommerceCartParameter parameters)
CommerceCartServicerecalculateCart in interface CommerceCartServiceparameters - A parameter object holding the cart model CartModel (must exist) that will be recalculated
CartModel@Deprecated public void removeAllEntries(CartModel cartModel)
removeAllEntries in interface CommerceCartServicecartModel - the user's cart in sessionpublic void removeAllEntries(CommerceCartParameter parameter)
CommerceCartServiceCartModel.removeAllEntries in interface CommerceCartServiceparameter - A parameter object holding the CartModel that will be emptied@Deprecated public CommerceCartModification updateQuantityForCartEntry(CartModel cartModel, long entryNumber, long newQuantity) throws CommerceCartModificationException
updateQuantityForCartEntry in interface CommerceCartServicecartModel - the user's cart in sessionentryNumber - the cart entry numbernewQuantity - the new quantityCommerceCartModificationExceptionpublic CommerceCartModification updateQuantityForCartEntry(CommerceCartParameter parameters) throws CommerceCartModificationException
CommerceCartServiceentryNumber with the given newQuantity.
Then cart is calculated.updateQuantityForCartEntry in interface CommerceCartServiceparameters - - A parameter object containing all attributes needed for add to cart
CommerceCartParameter.cart - The user's cart in session
CommerceCartParameter.pointOfService - The store object for pick up in store items (only needs
to be passed in if you are adding an item to pick up CommerceCartParameter.product - The
ProductModel to add CommerceCartParameter.quantity - The quantity to add
CommerceCartParameter.unit - The UnitModel of the product @see
ProductModel.getUnit()
CommerceCartParameter.createNewEntry - The flag for creating a new
CartEntryModel
CommerceCartModificationException - if the product is a base product OR the quantity is less than 1 or no usable unit was
found (only when given unit is also null) or any other reason the cart could
not be modified.@Deprecated public CommerceCartModification updatePointOfServiceForCartEntry(CartModel cartModel, long entryNumber, PointOfServiceModel pointOfServiceModel) throws CommerceCartModificationException
updatePointOfServiceForCartEntry in interface CommerceCartServicecartModel - the user's cart in sessionentryNumber - the cart entry numberpointOfServiceModel - the point of serviceCommerceCartModificationExceptionpublic CommerceCartModification updatePointOfServiceForCartEntry(CommerceCartParameter parameters) throws CommerceCartModificationException
CommerceCartServiceupdatePointOfServiceForCartEntry in interface CommerceCartServiceparameters - - A bean holding any number of additional parameters a client may want to pass to the method for
extension purposes, the attributes can be added to the bean via beans.xml in your extensionsCommerceCartModification objectCommerceCartModificationException@Deprecated public CommerceCartModification updateToShippingModeForCartEntry(CartModel cartModel, long entryNumber) throws CommerceCartModificationException
updateToShippingModeForCartEntry in interface CommerceCartServicecartModel - the user's cart in sessionentryNumber - the cart entry numberCommerceCartModificationExceptionpublic CommerceCartModification updateToShippingModeForCartEntry(CommerceCartParameter parameters) throws CommerceCartModificationException
CommerceCartServiceupdateToShippingModeForCartEntry in interface CommerceCartServiceparameters - - A bean holding any number of additional parameters a client may want to pass to the method for
extension purposes, the attributes can be added to the bean via beans.xml in your extensionsCommerceCartModification objectCommerceCartModificationException@Deprecated public long split(CartModel cartModel, long entryNumber) throws CommerceCartModificationException
split in interface CommerceCartServicecartModel - the user's cart in sessionentryNumber - the cart entry numberCommerceCartModificationExceptionpublic long split(CommerceCartParameter parameters) throws CommerceCartModificationException
CommerceCartServicesplit in interface CommerceCartServiceparameters - - A bean holding any number of additional parameters a client may want to pass to the method for
extension purposes, the attributes can be added to the bean via beans.xml in your extensionsCommerceCartModificationException@Deprecated public CommerceCartRestoration restoreCart(CartModel cartModel) throws CommerceCartRestorationException
restoreCart in interface CommerceCartServicecartModel - the old cart to restoreCommerceCartRestorationExceptionpublic CommerceCartRestoration restoreCart(CommerceCartParameter parameters) throws CommerceCartRestorationException
CommerceCartServicerestoreCart in interface CommerceCartServiceparameters - - A bean holding any number of additional parameters a client may want to pass to the method for
extension purposes, the attributes can be added to the bean via beans.xml in your extensionsCommerceCartRestorationException - if any problems occur in restoring the cartpublic void removeStaleCarts(CartModel currentCart, BaseSiteModel baseSite, UserModel user)
CommerceCartServiceremoveStaleCarts in interface CommerceCartServicecurrentCart - the current user's cartbaseSite - the current base siteuser - the current userpublic void removeStaleCarts(CommerceCartParameter parameters)
removeStaleCarts in interface CommerceCartServiceparameters - a parameter object holding the following values - cart Users Cart - baseSite Current base site - user
Current userpublic void configureCartEntry(CommerceCartParameter parameters) throws CommerceCartModificationException
CommerceCartServiceconfigureCartEntry in interface CommerceCartServiceparameters - cartentryNumberproductproductConfiguratorproductConfigurationCommerceCartModificationException - if product is not configurable or entry is invalidpublic void mergeCarts(CartModel fromCart, CartModel toCart, java.util.List<CommerceCartModification> modifications) throws CommerceCartMergingException
CommerceCartServicemergeCarts in interface CommerceCartServicefromCart - the cart to mergetoCart - the target cartmodifications - the list of modificationsCommerceCartMergingExceptionpublic CartModel getCartForGuidAndSiteAndUser(java.lang.String guid, BaseSiteModel site, UserModel user)
CommerceCartServicegetCartForGuidAndSiteAndUser in interface CommerceCartServiceguid - a unique identifiersite - the current BaseSite - may not be nulluser - the current user - may not be nullpublic CartModel getCartForGuidAndSite(java.lang.String guid, BaseSiteModel site)
CommerceCartServicegetCartForGuidAndSite in interface CommerceCartServicepublic CartModel getCartForCodeAndUser(java.lang.String code, UserModel user)
CommerceCartServicegetCartForCodeAndUser in interface CommerceCartServicepublic java.util.List<CartModel> getCartsForSiteAndUser(BaseSiteModel site, UserModel user)
CommerceCartServicegetCartsForSiteAndUser in interface CommerceCartServicepublic void updateCartMetadata(CommerceCartMetadataParameter parameter)
CommerceCartServiceupdateCartMetadata in interface CommerceCartServiceparameter - a bean holding any number of additional attributes a client may want to pass to the method for extension
purposes, the attributes can be added to the bean via beans.xml in your extensionspublic java.math.BigDecimal estimateTaxes(CartModel cartModel, java.lang.String deliveryZipCode, java.lang.String deliveryCountryIso)
CommerceCartServiceestimateTaxes in interface CommerceCartServicecartModel - cart to estimate taxes fordeliveryZipCode - zip code to use as the delivery addressdeliveryCountryIso - country isocode used as the delivery addresspublic CommerceTaxEstimateResult estimateTaxes(CommerceCartParameter parameters)
CommerceCartServiceestimateTaxes in interface CommerceCartServiceparameters - A parameter object holding the following properties - cartModel cart to estimate taxes for -
deliveryZipCode zip code to use as the delivery address - deliveryCountryIso country iso code used as
the delivery addresspublic CommerceCartModification removeEntryGroup(RemoveEntryGroupParameter parameter) throws CommerceCartModificationException
CommerceCartServiceremoveEntryGroup in interface CommerceCartServiceparameter - a parameter object containing all attributes needed for remove group from the cart
cart user's cartentryGroupNumber number of entry group to be removedenableHooks should the method hooks be executedCommerceCartModification objectCommerceCartModificationException - if related cart entry wasn't removed.@Deprecated protected void beforeCalculate(CartModel cartModel, boolean recalculate)
CommerceCartCalculationStrategy before calculation method hooks@Deprecated protected void afterCalculate(CartModel cartModel, boolean recalculate)
CommerceCartCalculationStrategy before calculation method hooksprotected ModelService getModelService()
public void setModelService(ModelService modelService)
protected BaseSiteService getBaseSiteService()
public void setBaseSiteService(BaseSiteService baseSiteService)
protected CommerceCartDao getCommerceCartDao()
public void setCommerceCartDao(CommerceCartDao commerceCartDao)
protected CartValidationStrategy getCartValidationStrategy()
public void setCartValidationStrategy(CartValidationStrategy cartValidationStrategy)
protected CommerceCartCalculationStrategy getCommerceCartCalculationStrategy()
public void setCommerceCartCalculationStrategy(CommerceCartCalculationStrategy commerceCartCalculationStrategy)
protected CommerceCartProductConfigurationStrategy getProductConfigurationStrategy()
public void setProductConfigurationStrategy(CommerceCartProductConfigurationStrategy productConfigurationStrategy)
protected SessionService getSessionService()
public void setSessionService(SessionService sessionService)
protected StaleCartRemovalStrategy getStaleCartRemovalStrategy()
public void setStaleCartRemovalStrategy(StaleCartRemovalStrategy staleCartRemovalStrategy)
protected CommerceAddToCartStrategy getCommerceAddToCartStrategy()
public void setCommerceAddToCartStrategy(CommerceAddToCartStrategy commerceAddToCartStrategy)
protected CommerceUpdateCartEntryStrategy getCommerceUpdateCartEntryStrategy()
public void setCommerceUpdateCartEntryStrategy(CommerceUpdateCartEntryStrategy commerceUpdateCartEntryStrategy)
protected CommerceCartHashCalculationStrategy getCommerceCartHashCalculationStrategy()
public void setCommerceCartHashCalculationStrategy(CommerceCartHashCalculationStrategy commerceCartHashCalculationStrategy)
protected CommerceCartEstimateTaxesStrategy getCommerceCartEstimateTaxesStrategy()
public void setCommerceCartEstimateTaxesStrategy(CommerceCartEstimateTaxesStrategy commerceCartEstimateTaxesStrategy)
protected CommerceCartRestorationStrategy getCommerceCartRestorationStrategy()
public void setCommerceCartRestorationStrategy(CommerceCartRestorationStrategy commerceCartRestorationStrategy)
protected CommerceCartMergingStrategy getCommerceCartMergingStrategy()
public void setCommerceCartMergingStrategy(CommerceCartMergingStrategy commerceCartMergingStrategy)
protected CommerceCartSplitStrategy getCommerceCartSplitStrategy()
public void setCommerceCartSplitStrategy(CommerceCartSplitStrategy commerceCartSplitStrategy)
protected CommerceRemoveEntriesStrategy getCommerceRemoveEntriesStrategy()
public void setCommerceRemoveEntriesStrategy(CommerceRemoveEntriesStrategy commerceRemoveEntriesStrategy)
protected CommerceCartMetadataUpdateStrategy getCommerceCartMetadataUpdateStrategy()
public void setCommerceCartMetadataUpdateStrategy(CommerceCartMetadataUpdateStrategy commerceCartMetadataUpdateStrategy)
protected CommerceRemoveEntryGroupStrategy getRemoveEntryGroupStrategy()
public void setRemoveEntryGroupStrategy(CommerceRemoveEntryGroupStrategy removeEntryGroupStrategy)
Copyright © 2018 SAP SE. All Rights Reserved.