Class CartItemOfferUtils
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.service.util.offer.CartItemOfferUtils
-
public class CartItemOfferUtils extends Object
Utility class to aid in processingCartItems
regarding 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.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
getMapper()
String
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.List<String>
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()
.
-
-
-
Method Detail
-
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
protected com.broadleafcommerce.order.common.domain.Adjustment convertAdjustment(Object adjustment)
Converts the givenObject
to anAdjustment
.
-
getOriginOfferId
public String getOriginOfferId(com.broadleafcommerce.cart.client.domain.CartItem cartItem)
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:
CartItemAttributeConstants.Internal.ORIGIN_OFFER_ID
-
getMapper
protected com.fasterxml.jackson.databind.ObjectMapper getMapper()
-
-