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 Details

  • 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: TmaCartFacade
      Adds a new cart entry containing a TmaSimpleProductOfferingModel to the existing cart. The product offering can be added as a single offering, but also as part of a TmaBundledProductOfferingModel.
      Specified by:
      addProductOfferingToCart in interface TmaCartFacade
      Parameters:
      spoCode - ProductModel.CODE
      quantity - product offering quantity to be added to cart
      processType - represents the process flow in the context of which the entry is added to cart (Acquisition, Retention, etc.)
      rootBpoCode - root ProductModel.CODE
      cartGroupNo - the cart entry group number on which the new entry to be attached to, if -1 a new entry group will be created
      subscriptionTermId - subscription term id for the entry
      subscriberId - subscriber id in case of an existing customer
      subscriberBillingId - 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: TmaCartFacade
      Processes cart entry updates.
      Specified by:
      processCartAction in interface TmaCartFacade
      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: TmaCartFacade
      Adds multiple cart entries containing a TmaSimpleProductOfferingModel to the existing cart, all of them being part of the TmaBundledProductOfferingModel specified 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:
      addBpoSelectedOfferings in interface TmaCartFacade
      Parameters:
      rootBpoCode - ProductModel.CODE of the bundled offering added to cart
      simpleProductOfferings - a list containing ProductModel.CODE
      processType - represents the process flow in the context of which the entry is added to cart (Acquisition, Retention, etc.)
      cartGroupNo - existing cart entry group number
      subscriptionTerm - subscription term id for the entry
      subscriberIdentity - subscriber id in case of an existing customer
      subscriberBillingId - 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

      public Optional<CartData> getCartForCodeAndCustomer(String code, String customerId)
      Description copied from interface: TmaCartFacade
      Get a cart using code and UserModel
      Specified by:
      getCartForCodeAndCustomer in interface TmaCartFacade
      Parameters:
      code - The cart identifier code
      customerId - 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: TmaCartFacade
      Get a cart using code and customer id
      Specified by:
      getCartForCodeAndCustomer in interface TmaCartFacade
      Parameters:
      code - The cart identifier code
      customerId - The id of the customer who owns the cart
      recalculate - 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: TmaCartFacade
      Retrieve a cart using code
      Specified by:
      getCartForCode in interface TmaCartFacade
      Parameters:
      code - The cart identifier code
      recalculate - 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

      public Optional<CartData> getCartForGuid(String guid)
      Description copied from interface: TmaCartFacade
      Get a cart using guid
      Specified by:
      getCartForGuid in interface TmaCartFacade
      Returns:
      the specific cart for given guid
    • getCartsForCustomer

      public List<CartData> getCartsForCustomer(String customerId)
      Description copied from interface: TmaCartFacade
      Get the list of carts for a customer
      Specified by:
      getCartsForCustomer in interface TmaCartFacade
      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: TmaCartFacade
      Get the list of carts for a customer
      Specified by:
      getCartsForCustomer in interface TmaCartFacade
      Parameters:
      customerId - The id of the customer who owns the carts
      recalculate - 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: TmaCartFacade
      Retrieve the list of all carts
      Specified by:
      getCarts in interface TmaCartFacade
      Parameters:
      recalculate - Flag which indicates if the carts should be recalculated or not
      offset - 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

      public CartData getSessionCart()
      Specified by:
      getSessionCart in interface de.hybris.platform.commercefacades.order.CartFacade
      Overrides:
      getSessionCart in class de.hybris.platform.commercefacades.order.impl.DefaultCartFacade
    • createCartForUserAndCurrentBaseSite

      public CartData createCartForUserAndCurrentBaseSite(String userId)
      Description copied from interface: TmaCartFacade
      Creates a cart for the provided user if cart does not exist. If cart exists returns the existing cart.
      Specified by:
      createCartForUserAndCurrentBaseSite in interface TmaCartFacade
      Parameters:
      userId - The unique identifier of the user.
      Returns:
      The cart which was created.
    • getMiniCart

      public CartData getMiniCart()
      Specified by:
      getMiniCart in interface de.hybris.platform.commercefacades.order.CartFacade
      Overrides:
      getMiniCart in class de.hybris.platform.commercefacades.order.impl.DefaultCartFacade
    • isAnonymousUserCart

      public boolean isAnonymousUserCart(String cartGuid)
      Checks if given card belongs to anonymous user.
      Specified by:
      isAnonymousUserCart in interface TmaCartFacade
      Parameters:
      cartGuid - GUID of the cart.
      Returns:
      true if the cart belongs to anonymous user.
    • isCurrentUserCart

      public boolean isCurrentUserCart(String cartGuid)
      Checks if given card belongs to current user.
      Specified by:
      isCurrentUserCart in interface TmaCartFacade
      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:
      validateAndUpdateCartActionInputForClone in interface TmaCartFacade
      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

      public boolean isValidCartStatus(String status)
      Checks if the requested status for cart is valid or not
      Specified by:
      isValidCartStatus in interface TmaCartFacade
      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:
      updateCartEntry in interface de.hybris.platform.commercefacades.order.CartFacade
      Overrides:
      updateCartEntry in class de.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 is TmaSimpleProductOfferingModel either TmaFixedBundledProductOfferingModel and if the product offering and subscription term are valid.
      Parameters:
      poCode - the identifier of the product offering
      subscriptionTermId - 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 product
      parentBpo - the parent of the product
      processType - the process type
      subscriptionTermId - 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

      protected TmaCartStrategy findCartStrategy(CartActionInput cartActionInput)
      Returns the corresponding cartStrategy for a given cartActionInput.
      Parameters:
      cartActionInput - the cartActionInput that determines the action we want to apply.
      Returns:
      the TmaCartStrategy for the given input.
    • generateSaveCartName

      protected String generateSaveCartName(CartModel cartModel)
      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

      protected String generateSaveCartDescription(CartModel cartModel, String description)
      Generate description for cart to be cloned if not provided by user.
      Parameters:
      cartModel - the cart which will be cloned
      description - the description provided by user which will be given to cloned cart
      Returns:
      description the description which will given to cloned cart
    • getTmaPoService

      protected TmaPoService getTmaPoService()
    • getSubscriptionTermService

      protected TmaSubscriptionTermService getSubscriptionTermService()
    • getCustomerFacade

      protected TmaCustomerFacade getCustomerFacade()
    • getCartStrategyMapping

      protected TmaCartStrategyMapping getCartStrategyMapping()
    • getTmaCommerceCartParameterConverter

      protected de.hybris.platform.servicelayer.dto.converter.Converter<CartActionInput,CommerceCartParameter> getTmaCommerceCartParameterConverter()
    • getCartService

      public TmaCartService getCartService()
      Overrides:
      getCartService in class de.hybris.platform.commercefacades.order.impl.DefaultCartFacade
    • getTmaSubscribedProductFacade

      protected TmaSubscribedProductFacade 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

      public void setTmaPoService(TmaPoService tmaPoService)
    • setSubscriptionTermService

      public void setSubscriptionTermService(TmaSubscriptionTermService subscriptionTermService)
    • setCustomerFacade

      public void setCustomerFacade(TmaCustomerFacade customerFacade)
    • setCartStrategyMapping

      public void setCartStrategyMapping(TmaCartStrategyMapping cartStrategyMapping)
    • setTmaCommerceCartParameterConverter

      public void setTmaCommerceCartParameterConverter(de.hybris.platform.servicelayer.dto.converter.Converter<CartActionInput,CommerceCartParameter> tmaCommerceCartParameterConverter)
    • setTmaSubscribedProductFacade

      public void setTmaSubscribedProductFacade(TmaSubscribedProductFacade tmaSubscribedProductFacade)