public class DefaultSubscriptionCommerceCartService extends DefaultCommerceCartService implements SubscriptionCommerceCartService
SubscriptionCommerceCartService.| Constructor and Description |
|---|
DefaultSubscriptionCommerceCartService() |
| Modifier and Type | Method and Description |
|---|---|
CommerceCartModification |
addToCart(CartModel masterCartModel,
ProductModel productModel,
long quantityToAdd,
UnitModel unit,
boolean forceNewEntry)
Deprecated.
|
CommerceCartModification |
addToCart(CartModel masterCartModel,
ProductModel productModel,
long quantityToAdd,
UnitModel unit,
boolean forceNewEntry,
String xmlProduct) |
CommerceCartModification |
addToCart(CartModel masterCartModel,
ProductModel productModel,
long quantityToAdd,
UnitModel unit,
boolean forceNewEntry,
String xmlProduct,
String originalSubscriptionId,
AbstractOrderEntryModel originalEntry) |
protected void |
checkMasterCart(CartModel cartModel,
BillingTimeModel masterCartBillingTimeModel)
Checks if the given
CartModel is a master cart and has the correct BillingTimeModel. |
protected void |
checkQuantityToAdd(long quantityToAdd,
long maxQuantity) |
protected CartModel |
createChildCartForBillingTime(CartModel masterCart,
BillingTimeModel billFreq)
Creates a new child cart for the given billing frequency and assigns it as child cart to the given master cart.
|
protected long |
getAvailableStockLevel(ProductModel productModel,
PointOfServiceModel pointOfServiceModel)
Find the available stock quantity for a product.
|
protected BaseStoreService |
getBaseStoreService() |
protected List<BillingTimeModel> |
getBillingFrequenciesForMasterEntry(AbstractOrderEntryModel entry) |
protected BillingTimeModel |
getBillingTimeForCode(String code) |
protected BillingTimeService |
getBillingTimeService() |
protected AbstractOrderEntryModel |
getCartEntryToBeUpdated(CartModel cartModel,
long entryNumber)
Searches in the given
cartModel for the cart entry with has the given entryNumber and
returns it. |
CartModel |
getChildCartForBillingTime(CartModel masterCart,
BillingTimeModel billFreq)
Get the child cart for the given
BillingTimeModel, if any. |
protected SubscriptionCommercePriceService |
getCommercePriceService() |
protected CommerceStockService |
getCommerceStockService() |
String |
getMasterCartBillingTimeCode()
Get the billing frequency code for the master cart.
|
CartModel |
getMasterCartForCartEntry(CartEntryModel cartEntryModel)
Get the master cart for the given
cartEntryModel. |
protected SubscriptionCommerceCartStrategy |
getSubscriptionCommerceCartStrategy() |
protected SubscriptionProductService |
getSubscriptionProductService() |
protected int |
getSubscriptionProductStockQuantity() |
protected boolean |
isMasterCart(CartModel cartModel) |
void |
recalculateCart(CartModel masterCartModel)
Overrides the super class' method to make sure that in a multi-cart system the master cart and its child carts are
re-calculated.
|
void |
recalculateCart(CommerceCartParameter parameter)
Overrides the super class' method to make sure that in a multi-cart system the master cart and its child carts are
re-calculated.
|
void |
removeAllEntries(CartModel masterCartModel) |
protected void |
removeEmptyChildCarts(CartModel cartModel) |
void |
setBaseStoreService(BaseStoreService baseStoreService) |
void |
setBillingTimeService(BillingTimeService billingTimeService) |
void |
setCommercePriceService(SubscriptionCommercePriceService commercePriceService) |
void |
setCommerceStockService(CommerceStockService commerceStockService) |
void |
setMasterCartBillingTimeCode(String masterCartBillingTimeCode) |
void |
setSubscriptionCommerceCartStrategy(SubscriptionCommerceCartStrategy subscriptionCommerceCartStrategy) |
void |
setSubscriptionProductService(SubscriptionProductService subscriptionProductService) |
void |
setSubscriptionProductStockQuantity(int subscriptionProductStockQuantity) |
CommerceCartModification |
updateQuantityForCartEntry(CartModel cartModel,
long entryNumber,
long newQuantity)
Update quantity for the cart entry with given
entryNumber with the given newQuantity. |
CommerceCartModification |
updateQuantityForCartEntry(CommerceCartParameter parameter) |
public DefaultSubscriptionCommerceCartService()
@Deprecated public CommerceCartModification addToCart(CartModel masterCartModel, ProductModel productModel, long quantityToAdd, UnitModel unit, boolean forceNewEntry) throws CommerceCartModificationException
CommerceCartModificationExceptionpublic CommerceCartModification addToCart(CartModel masterCartModel, ProductModel productModel, long quantityToAdd, UnitModel unit, boolean forceNewEntry, String xmlProduct, String originalSubscriptionId, AbstractOrderEntryModel originalEntry) throws CommerceCartModificationException
addToCart in interface SubscriptionCommerceCartServiceCommerceCartModificationExceptionpublic CommerceCartModification addToCart(CartModel masterCartModel, ProductModel productModel, long quantityToAdd, UnitModel unit, boolean forceNewEntry, String xmlProduct) throws CommerceCartModificationException
addToCart in interface SubscriptionCommerceCartServiceCommerceCartModificationExceptionprotected List<BillingTimeModel> getBillingFrequenciesForMasterEntry(AbstractOrderEntryModel entry)
public void removeAllEntries(CartModel masterCartModel)
protected void removeEmptyChildCarts(CartModel cartModel)
public CommerceCartModification updateQuantityForCartEntry(CommerceCartParameter parameter) throws CommerceCartModificationException
CommerceCartModificationExceptionpublic CommerceCartModification updateQuantityForCartEntry(CartModel cartModel, long entryNumber, long newQuantity) throws CommerceCartModificationException
SubscriptionCommerceCartServiceentryNumber with the given newQuantity.
Then cart is calculated.updateQuantityForCartEntry in interface SubscriptionCommerceCartServicecartModel - the CartModel that we will perform update onentryNumber - the entry number that will be updatednewQuantity - the new quantity that will be set for specified cart entryCommerceCartModificationException - 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.protected AbstractOrderEntryModel getCartEntryToBeUpdated(CartModel cartModel, long entryNumber) throws CommerceCartModificationException
cartModel for the cart entry with has the given entryNumber and
returns it.cartModel - the cartentryNumber - number of the cart entryentryNumberCommerceCartModificationException - if there is no cart entry with the given entryNumberprotected long getAvailableStockLevel(ProductModel productModel, PointOfServiceModel pointOfServiceModel)
productModel - the product in the cartpublic CartModel getChildCartForBillingTime(CartModel masterCart, BillingTimeModel billFreq)
SubscriptionCommerceCartServiceBillingTimeModel, if any.getChildCartForBillingTime in interface SubscriptionCommerceCartServicemasterCart - the CartModel of the master cartbillFreq - the BillingTimeModel to look forCartModel for the given BillingTimeModel or null.protected CartModel createChildCartForBillingTime(CartModel masterCart, BillingTimeModel billFreq)
protected boolean isMasterCart(CartModel cartModel)
protected void checkMasterCart(CartModel cartModel, BillingTimeModel masterCartBillingTimeModel) throws IllegalArgumentException, CommerceCartModificationException
CartModel is a master cart and has the correct BillingTimeModel.cartModel - the cart model to be checked whether it is a master cartmasterCartBillingTimeModel - the BillingTimeModel that a master cart must have. If the given cart's billing frequency is
empty the masterCartBillingTimeModel will be set as billing frequencyIllegalArgumentException - if the given cart is not a master cartCommerceCartModificationException - if the given cart's billing frequency does no equal the given masterCartBillingTimeModelpublic void recalculateCart(CartModel masterCartModel) throws CalculationException
masterCartModel - the cart model CartModel (must exist) that will be recalculated CartModel. It must be
the master cart of the multi-cart system. In addition, the master cart's child carts will also be
re-calculated.IllegalArgumentException - in case the given masterCartModel is not a master cartCalculationExceptionpublic void recalculateCart(CommerceCartParameter parameter)
parameter - checkout parameter containing the the master cart of the multi-cartpublic CartModel getMasterCartForCartEntry(CartEntryModel cartEntryModel)
SubscriptionCommerceCartServicecartEntryModel. The cartEntryModel may be a master or
child cart entry.getMasterCartForCartEntry in interface SubscriptionCommerceCartServicecartEntryModel - the CartEntryModel whose master CartModel is searchedcartEntryModel's master CartModelprotected void checkQuantityToAdd(long quantityToAdd,
long maxQuantity)
throws CommerceCartModificationException
CommerceCartModificationExceptionprotected BillingTimeModel getBillingTimeForCode(String code)
public void setMasterCartBillingTimeCode(String masterCartBillingTimeCode)
public String getMasterCartBillingTimeCode()
SubscriptionCommerceCartServicegetMasterCartBillingTimeCode in interface SubscriptionCommerceCartServicepublic void setBillingTimeService(BillingTimeService billingTimeService)
protected BillingTimeService getBillingTimeService()
public void setSubscriptionProductStockQuantity(int subscriptionProductStockQuantity)
protected int getSubscriptionProductStockQuantity()
protected SubscriptionCommercePriceService getCommercePriceService()
public void setCommercePriceService(SubscriptionCommercePriceService commercePriceService)
protected SubscriptionCommerceCartStrategy getSubscriptionCommerceCartStrategy()
public void setSubscriptionCommerceCartStrategy(SubscriptionCommerceCartStrategy subscriptionCommerceCartStrategy)
protected BaseStoreService getBaseStoreService()
public void setBaseStoreService(BaseStoreService baseStoreService)
protected CommerceStockService getCommerceStockService()
public void setCommerceStockService(CommerceStockService commerceStockService)
protected SubscriptionProductService getSubscriptionProductService()
public void setSubscriptionProductService(SubscriptionProductService subscriptionProductService)
Copyright © 2017 SAP SE. All Rights Reserved.