Class CartItemOfferUtils
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.service.util.offer.CartItemOfferUtils
-
public class CartItemOfferUtils extends Object
Utility class to aid in processingCartItemsregarding offers.- Author:
- Sunny Yu
-
-
Constructor Summary
Constructors Constructor Description CartItemOfferUtils(com.fasterxml.jackson.databind.ObjectMapper mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.broadleafcommerce.order.common.domain.AdjustmentconvertAdjustment(Object adjustment)Converts the givenObjectto anAdjustment.com.broadleafcommerce.order.common.domain.AdjustmentgetFreeGiftAdjustment(com.broadleafcommerce.cart.client.domain.CartItem cartItem)Gets the temporarily storedAdjustmentfor the free gift item.protected com.fasterxml.jackson.databind.ObjectMappergetMapper()StringgetOriginOfferId(com.broadleafcommerce.cart.client.domain.CartItem cartItem)Gets the id of the offer that thisCartItemwas a target of.List<com.broadleafcommerce.order.common.domain.OfferItemDetail>getQualifierCartItemDetails(com.broadleafcommerce.cart.client.domain.CartItem cartItem)Gets the offer qualifierOfferItemDetailsthat the givenCartItemwas a target of.List<String>getQualifierCartItemIds(com.broadleafcommerce.cart.client.domain.CartItem cartItem)Theidsof the offer qualifierCartItemsthat the givenCartItemwas added from.booleanisFreeGiftItem(com.broadleafcommerce.cart.client.domain.CartItem cartItem)Identifies if the givenCartItemis a free gift item.voidremoveIsFreeGiftItemFlag(com.broadleafcommerce.cart.client.domain.CartItem cartItem)Removes theCartItemAttributeConstants.Internal.IS_FREE_GIFT_ITEMattribute from the givenCartItem.getInternalAttributes().
-
-
-
Method Detail
-
isFreeGiftItem
public boolean isFreeGiftItem(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
Identifies if the givenCartItemis a free gift item.- Parameters:
cartItem-CartItemto check against- Returns:
- true if the given
CartItemis a free gift item, otherwise false
-
removeIsFreeGiftItemFlag
public void removeIsFreeGiftItemFlag(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
Removes theCartItemAttributeConstants.Internal.IS_FREE_GIFT_ITEMattribute from the givenCartItem.getInternalAttributes().- Parameters:
cartItem-CartItemto remove theCartItemAttributeConstants.Internal.IS_FREE_GIFT_ITEMfrom
-
getFreeGiftAdjustment
public com.broadleafcommerce.order.common.domain.Adjustment getFreeGiftAdjustment(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
Gets the temporarily storedAdjustmentfor the free gift item.
-
getQualifierCartItemIds
public List<String> getQualifierCartItemIds(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
Theidsof the offer qualifierCartItemsthat the givenCartItemwas added from.- Parameters:
cartItem-CartItemto get the offer qualifiercart item idsfrom- Returns:
- The
idsof the offer qualifierCartItemsthat the givenCartItemwas added from
-
getQualifierCartItemDetails
public List<com.broadleafcommerce.order.common.domain.OfferItemDetail> getQualifierCartItemDetails(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
Gets the offer qualifierOfferItemDetailsthat the givenCartItemwas a target of.- Parameters:
cartItem- theCartItemto get the offer qualifierOfferItemDetailsfrom- Returns:
- the offer qualifier
OfferItemDetailsthat the givenCartItemwas a target of
-
convertAdjustment
protected com.broadleafcommerce.order.common.domain.Adjustment convertAdjustment(Object adjustment)
Converts the givenObjectto anAdjustment.
-
getOriginOfferId
public String getOriginOfferId(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
Gets the id of the offer that thisCartItemwas a target of. In other words, this id identifies which offer thisCartItemwas added from.- Parameters:
cartItem-CartItemto get the target offer id from- Returns:
- the id of the offer that this
CartItemwas a target of - See Also:
CartItemAttributeConstants.Internal.ORIGIN_OFFER_ID
-
getMapper
protected com.fasterxml.jackson.databind.ObjectMapper getMapper()
-
-