Class CartItemOfferUtils


  • public class CartItemOfferUtils
    extends Object
    Utility class to aid in processing CartItems regarding offers.
    Author:
    Sunny Yu
    • Constructor Detail

      • CartItemOfferUtils

        public CartItemOfferUtils​(com.fasterxml.jackson.databind.ObjectMapper mapper)
    • Method Detail

      • isFreeGiftItem

        public boolean isFreeGiftItem​(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
        Identifies if the given CartItem is a free gift item.
        Parameters:
        cartItem - CartItem to check against
        Returns:
        true if the given CartItem is a free gift item, otherwise false
      • getFreeGiftAdjustment

        public com.broadleafcommerce.order.common.domain.Adjustment getFreeGiftAdjustment​(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
        Gets the temporarily stored Adjustment for the free gift item.
        See Also:
        CartItemAttributeConstants.Internal.FREE_GIFT_ADJUSTMENT
      • getQualifierCartItemIds

        public List<String> getQualifierCartItemIds​(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
        The ids of the offer qualifier CartItems that the given CartItem was added from.
        Parameters:
        cartItem - CartItem to get the offer qualifier cart item ids from
        Returns:
        The ids of the offer qualifier CartItems that the given CartItem was added from
      • getQualifierCartItemDetails

        public List<com.broadleafcommerce.order.common.domain.OfferItemDetail> getQualifierCartItemDetails​(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
        Gets the offer qualifier OfferItemDetails that the given CartItem was a target of.
        Parameters:
        cartItem - the CartItem to get the offer qualifier OfferItemDetails from
        Returns:
        the offer qualifier OfferItemDetails that the given CartItem was a target of
      • convertAdjustment

        protected com.broadleafcommerce.order.common.domain.Adjustment convertAdjustment​(Object adjustment)
        Converts the given Object to an Adjustment.
        Parameters:
        adjustment - the Object to convert from
        Returns:
        an Adjustment converted from Object
      • getOriginOfferId

        public String getOriginOfferId​(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
        Gets the id of the offer that this CartItem was a target of. In other words, this id identifies which offer this CartItem was added from.
        Parameters:
        cartItem - CartItem to get the target offer id from
        Returns:
        the id of the offer that this CartItem was a target of
        See Also:
        CartItemAttributeConstants.Internal.ORIGIN_OFFER_ID
      • getMapper

        protected com.fasterxml.jackson.databind.ObjectMapper getMapper()