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 Detail

      • getMasterCartForCartEntry

        @Nonnull
        CartModel getMasterCartForCartEntry​(@Nonnull
                                            CartEntryModel cartEntryModel)
        Get the master cart for the given cartEntryModel. The cartEntryModel may be a master or child cart entry.
        Parameters:
        cartEntryModel - the CartEntryModel whose master CartModel is searched
        Returns:
        the given cartEntryModel's master CartModel
      • getChildCartForBillingTime

        CartModel getChildCartForBillingTime​(CartModel masterCart,
                                             BillingTimeModel billFreq)
        Get the child cart for the given BillingTimeModel, if any.
        Parameters:
        masterCart - the CartModel of the master cart
        billFreq - the BillingTimeModel to look for
        Returns:
        the CartModel for the given BillingTimeModel or 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 - CartModel to be checked
        masterCartBillingTimeModel - billing time of master cart
        Throws:
        java.lang.IllegalArgumentException - if given cart is not a master cart
        CommerceCartModificationException - if billing time is not correct
      • createChildCartForBillingTime

        CartModel createChildCartForBillingTime​(CartModel masterCart,
                                                BillingTimeModel billFreq)
        Creates child cart for given master cart and billing time.
        Parameters:
        masterCart - CartModel representing master cart for which child cart should be created
        billFreq - BillingTimeModel for child cart
        Returns:
        Created child cart.