java.lang.Object
com.broadleafcommerce.cartoperation.service.util.offer.CartOfferUtils

public class CartOfferUtils extends Object
Utility class to aid in retrieving offer information from Cart.
Author:
Sunny Yu
  • Constructor Summary

    Constructors
    Constructor
    Description
    CartOfferUtils(CartItemOfferUtils cartItemOfferUtils)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addCartItemQualifiedOfferIdsToIgnoreList(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItems)
    Retrieves the offer ids that the given CartItems that are qualifiers of and add them to the given Cart's offer ignore list.
    List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem>
    getFreeGiftItemsFromOffers(com.broadleafcommerce.cart.client.domain.Cart cart)
    Retrieves the FreeGiftItems applicable to the given Cart.
    getOfferIdsToIgnore(com.broadleafcommerce.cart.client.domain.Cart cart)
    Retrieves the offer ids to ignore and not apply to the given Cart.
    boolean
    offerShouldBeIgnored(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.promotion.offer.client.web.context.info.OfferRef offerRef)
    Determines if the given OfferRef should be ignored for the given Cart.
    void
    storeFreeGiftItems(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem> freeGiftItems)
    Adds the given FreeGiftItems to Cart.getInternalAttributes() for later processing.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • storeFreeGiftItems

      public void storeFreeGiftItems(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem> freeGiftItems)
      Adds the given FreeGiftItems to Cart.getInternalAttributes() for later processing.
      Parameters:
      cart - the Cart to add the FreeGiftItems for
      freeGiftItems - the FreeGiftItems to add to Cart.getInternalAttributes()
      See Also:
    • getFreeGiftItemsFromOffers

      public List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem> getFreeGiftItemsFromOffers(com.broadleafcommerce.cart.client.domain.Cart cart)
      Retrieves the FreeGiftItems applicable to the given Cart.
      Parameters:
      cart - the Cart to retrieve the applicable FreeGiftItems from
      Returns:
      the FreeGiftItems applicable to the given Cart
      See Also:
    • getOfferIdsToIgnore

      public List<String> getOfferIdsToIgnore(com.broadleafcommerce.cart.client.domain.Cart cart)
      Retrieves the offer ids to ignore and not apply to the given Cart.
      Parameters:
      cart - the Cart to retrieve the ignored offer ids from
      Returns:
      the offer ids to ignore and not apply to the given Cart
      See Also:
    • offerShouldBeIgnored

      public boolean offerShouldBeIgnored(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.promotion.offer.client.web.context.info.OfferRef offerRef)
      Determines if the given OfferRef should be ignored for the given Cart.
      Parameters:
      cart - the Cart to check against
      offerRef - the OfferRef to check against
      Returns:
      true if given OfferRef should be ignored, otherwise false
      See Also:
    • addCartItemQualifiedOfferIdsToIgnoreList

      public void addCartItemQualifiedOfferIdsToIgnoreList(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItems)
      Retrieves the offer ids that the given CartItems that are qualifiers of and add them to the given Cart's offer ignore list.

      This is typically used when removing automatically added CartItems from offers, but no longer want to apply those offers again.

      Parameters:
      cart - the Cart to add the offer ids to ignore for
      cartItems - the CartItems to retrieve their qualified offer ids for