Class CartItemOfferUtils
java.lang.Object
com.broadleafcommerce.cartoperation.service.util.offer.CartItemOfferUtils
Utility class to aid in processing
CartItems regarding offers.- Author:
- Sunny Yu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.ObjectMappergetOriginOfferId(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.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().
-
Constructor Details
-
CartItemOfferUtils
public CartItemOfferUtils(com.fasterxml.jackson.databind.ObjectMapper mapper)
-
-
Method Details
-
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
Converts the givenObjectto anAdjustment. -
getOriginOfferId
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:
-
getMapper
protected com.fasterxml.jackson.databind.ObjectMapper getMapper()
-