Interface CartItemConfigurationService<P extends CatalogItem>

All Known Implementing Classes:
DefaultCartItemConfigurationService

public interface CartItemConfigurationService<P extends CatalogItem>
Author:
Chad Harchar (charchar)
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    cartItemHasQuantityThresholds(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull CatalogItemList<? extends CatalogItem> catalogItemList)
    Determines if the provided CartItem's related CatalogItem has quantity threshold restrictions.
    void
    validateCartItem(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartItem cartItem, CatalogItemList<? extends CatalogItem> catalogItemList, String validationFlow)
    Process cart item configuration by validating catalog information.
    void
    validateCartItem(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartItem cartItem, CatalogItem catalogItem, String validationFlow)
    Process cart item configuration by validating catalog information.
    void
    validateCustomQuoteItem(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartItem cartItem)
    Processes item configuration validation for custom quote items.
  • Method Details

    • cartItemHasQuantityThresholds

      default boolean cartItemHasQuantityThresholds(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull CatalogItemList<? extends CatalogItem> catalogItemList)
      Determines if the provided CartItem's related CatalogItem has quantity threshold restrictions.
      Parameters:
      cartItem - The CartItem that we need to check for quantity thresholds.
      catalogItemList - The CatalogItemList that should contain the CartItem's related CatalogItem.
      Returns:
      If the provided CartItem's related CatalogItem has quantity threshold restrictions.
    • validateCartItem

      void validateCartItem(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartItem cartItem, CatalogItemList<? extends CatalogItem> catalogItemList, String validationFlow)
      Process cart item configuration by validating catalog information. Errors for the item will be recorded into CartItem.getGlobalConfigErrors(), while errors for specific attributes will be recorded into CartItem.getAttributeConfigErrors(). For hierarchical cart items (items with CartItem.getDependentCartItems()) it is intended that this method be called from the bottom up, i.e., the lowest level dependent item gets called first. That way, errors on items will be properly cascaded up the hierarchy as CartItemConfigurationErrorEnum.MISCONFIGURED_DEPENDENT_ITEMS on CartItem.getGlobalConfigErrors().
      Parameters:
      cart - The cart with the cart item
      cartItem - The cart item with which to process configuration.
      catalogItemList - The CatalogItemList that should contain the CartItem's related CatalogItem.
      validationFlow - The context used to identify validation requirements of the CartItem at that point in its lifecycle. If this is set to ValidationStrategy.ADD_ITEM, then the configuration service will try to
    • validateCartItem

      void validateCartItem(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartItem cartItem, CatalogItem catalogItem, String validationFlow)
      Process cart item configuration by validating catalog information. Errors for the item will be recorded into CartItem.getGlobalConfigErrors(), while errors for specific attributes will be recorded into CartItem.getAttributeConfigErrors(). For hierarchical cart items (items with CartItem.getDependentCartItems()) it is intended that this method be called from the bottom up, i.e., the lowest level dependent item gets called first. That way, errors on items will be properly cascaded up the hierarchy as CartItemConfigurationErrorEnum.MISCONFIGURED_DEPENDENT_ITEMS on CartItem.getGlobalConfigErrors().
      Parameters:
      cart - The cart with the cart item
      cartItem - The cart item with which to process configuration.
      catalogItem - The CatalogItem with configuration to be used for validation.
      validationFlow - The context used to identify validation requirements of the CartItem at that point in its lifecycle. If this is set to ValidationStrategy.ADD_ITEM, then the configuration service will try to
    • validateCustomQuoteItem

      void validateCustomQuoteItem(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartItem cartItem)
      Processes item configuration validation for custom quote items.

      Any customization should be added here.

      Parameters:
      cart - The cart with the cart item
      cartItem - The cart item with which to process configuration
      See Also:
      • DefaultCartItemTypes.CUSTOM_QUOTE_ITEM