Interface SubscriptionCommerceCartService
-
- All Superinterfaces:
CommerceCartService
- All Known Implementing Classes:
DefaultSubscriptionCommerceCartService
public interface SubscriptionCommerceCartService extends CommerceCartService
Overrides the DefaultCommerceCartService where necessary to implement the multi-cart functionality for subscription products. The master cart which always has the billing time 'paynow' stores an entry for each product that is added to cart. Entries of subscription products that do no have a paynow price are stored with a 0.00 price in the master cart. The master cart may have one or more child carts which contain additional entries for those subscription products that have other/additional billing times. One child cart per billing time is created. On a method level it adds or overrides existing methods in order to support SubscriptionProducts and especially their billing times. It creates or resolves the specific child cart based on the BillingFrequency and delegates the add, update (incl. remove) or calculate operation to that child cart.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcheckMasterCart(CartModel cartModel, BillingTimeModel masterCartBillingTimeModel)Checks if given cart is a master cart and if its billing time is correct.voidcheckQuantityToAdd(long quantityToAdd)Checks if given quantity can be added.CartModelcreateChildCartForBillingTime(CartModel masterCart, BillingTimeModel billFreq)Creates child cart for given master cart and billing time.java.util.List<BillingTimeModel>getBillingFrequenciesForMasterEntry(AbstractOrderEntryModel entry)Get billing frequencies for the master entry.CartModelgetChildCartForBillingTime(CartModel masterCart, BillingTimeModel billFreq)Get the child cart for the givenBillingTimeModel, if any.java.lang.StringgetMasterCartBillingTimeCode()Get the billing frequency code for the master cart.CartModelgetMasterCartForCartEntry(CartEntryModel cartEntryModel)Get the master cart for the givencartEntryModel.-
Methods inherited from interface de.hybris.platform.commerceservices.order.CommerceCartService
addToCart, addToCart, addToCart, calculateCart, calculateCart, configureCartEntry, estimateTaxes, estimateTaxes, getCartForCodeAndUser, getCartForGuidAndSite, getCartForGuidAndSiteAndUser, getCartsForSiteAndUser, mergeCarts, recalculateCart, recalculateCart, removeAllEntries, removeAllEntries, removeEntryGroup, removeStaleCarts, removeStaleCarts, restoreCart, restoreCart, split, split, updateCartMetadata, updatePointOfServiceForCartEntry, updatePointOfServiceForCartEntry, updateQuantityForCartEntry, updateQuantityForCartEntry, updateToShippingModeForCartEntry, updateToShippingModeForCartEntry, validateCart, validateCart
-
-
-
-
Method Detail
-
getMasterCartForCartEntry
@Nonnull CartModel getMasterCartForCartEntry(@Nonnull CartEntryModel cartEntryModel)
Get the master cart for the givencartEntryModel. ThecartEntryModelmay be a master or child cart entry.- Parameters:
cartEntryModel- theCartEntryModelwhose masterCartModelis searched- Returns:
- the given
cartEntryModel's masterCartModel
-
getChildCartForBillingTime
CartModel getChildCartForBillingTime(CartModel masterCart, BillingTimeModel billFreq)
Get the child cart for the givenBillingTimeModel, if any.- Parameters:
masterCart- theCartModelof the master cartbillFreq- theBillingTimeModelto look for- Returns:
- the
CartModelfor the givenBillingTimeModelor null.
-
getMasterCartBillingTimeCode
java.lang.String getMasterCartBillingTimeCode()
Get the billing frequency code for the master cart.- Returns:
- a String with the billing frequency code for the master cart
-
checkMasterCart
void checkMasterCart(CartModel cartModel, BillingTimeModel masterCartBillingTimeModel) throws java.lang.IllegalArgumentException, CommerceCartModificationException
Checks if given cart is a master cart and if its billing time is correct.- Parameters:
cartModel-CartModelto be checkedmasterCartBillingTimeModel- billing time of master cart- Throws:
java.lang.IllegalArgumentException- if given cart is not a master cartCommerceCartModificationException- if billing time is not correct
-
checkQuantityToAdd
void checkQuantityToAdd(long quantityToAdd) throws CommerceCartModificationExceptionChecks if given quantity can be added.- Parameters:
quantityToAdd- quantyty to add- Throws:
CommerceCartModificationException- If given quantity is not allowed to add.
-
getBillingFrequenciesForMasterEntry
@Nonnull java.util.List<BillingTimeModel> getBillingFrequenciesForMasterEntry(@Nonnull AbstractOrderEntryModel entry)
Get billing frequencies for the master entry.- Parameters:
entry-AbstractOrderEntryModelto get list of billing frequencies for- Returns:
- List of
BillingTimeModels
-
createChildCartForBillingTime
CartModel createChildCartForBillingTime(CartModel masterCart, BillingTimeModel billFreq)
Creates child cart for given master cart and billing time.- Parameters:
masterCart-CartModelrepresenting master cart for which child cart should be createdbillFreq-BillingTimeModelfor child cart- Returns:
- Created child cart.
-
-