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
-
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.order.common.domain.Adjustment
convertAdjustment
(Object adjustment) Converts the givenObject
to anAdjustment
.com.broadleafcommerce.order.common.domain.Adjustment
getFreeGiftAdjustment
(com.broadleafcommerce.cart.client.domain.CartItem cartItem) Gets the temporarily storedAdjustment
for the free gift item.protected com.fasterxml.jackson.databind.ObjectMapper
getOriginOfferId
(com.broadleafcommerce.cart.client.domain.CartItem cartItem) Gets the id of the offer that thisCartItem
was a target of.List<com.broadleafcommerce.order.common.domain.OfferItemDetail>
getQualifierCartItemDetails
(com.broadleafcommerce.cart.client.domain.CartItem cartItem) Gets the offer qualifierOfferItemDetails
that the givenCartItem
was a target of.getQualifierCartItemIds
(com.broadleafcommerce.cart.client.domain.CartItem cartItem) Theids
of the offer qualifierCartItems
that the givenCartItem
was added from.boolean
isFreeGiftItem
(com.broadleafcommerce.cart.client.domain.CartItem cartItem) Identifies if the givenCartItem
is a free gift item.void
removeIsFreeGiftItemFlag
(com.broadleafcommerce.cart.client.domain.CartItem cartItem) Removes theCartItemAttributeConstants.Internal.IS_FREE_GIFT_ITEM
attribute 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 givenCartItem
is a free gift item.- Parameters:
cartItem
-CartItem
to check against- Returns:
- true if the given
CartItem
is a free gift item, otherwise false
-
removeIsFreeGiftItemFlag
public void removeIsFreeGiftItemFlag(com.broadleafcommerce.cart.client.domain.CartItem cartItem) Removes theCartItemAttributeConstants.Internal.IS_FREE_GIFT_ITEM
attribute from the givenCartItem.getInternalAttributes()
.- Parameters:
cartItem
-CartItem
to remove theCartItemAttributeConstants.Internal.IS_FREE_GIFT_ITEM
from
-
getFreeGiftAdjustment
public com.broadleafcommerce.order.common.domain.Adjustment getFreeGiftAdjustment(com.broadleafcommerce.cart.client.domain.CartItem cartItem) Gets the temporarily storedAdjustment
for the free gift item. -
getQualifierCartItemIds
public List<String> getQualifierCartItemIds(com.broadleafcommerce.cart.client.domain.CartItem cartItem) Theids
of the offer qualifierCartItems
that the givenCartItem
was added from.- Parameters:
cartItem
-CartItem
to get the offer qualifiercart item ids
from- Returns:
- The
ids
of the offer qualifierCartItems
that the givenCartItem
was added from
-
getQualifierCartItemDetails
public List<com.broadleafcommerce.order.common.domain.OfferItemDetail> getQualifierCartItemDetails(com.broadleafcommerce.cart.client.domain.CartItem cartItem) Gets the offer qualifierOfferItemDetails
that the givenCartItem
was a target of.- Parameters:
cartItem
- theCartItem
to get the offer qualifierOfferItemDetails
from- Returns:
- the offer qualifier
OfferItemDetails
that the givenCartItem
was a target of
-
convertAdjustment
Converts the givenObject
to anAdjustment
. -
getOriginOfferId
Gets the id of the offer that thisCartItem
was a target of. In other words, this id identifies which offer thisCartItem
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:
-
getMapper
protected com.fasterxml.jackson.databind.ObjectMapper getMapper()
-