Class CartOfferUtils
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.service.util.offer.CartOfferUtils
-
public class CartOfferUtils extends Object
Utility class to aid in retrieving offer information fromCart
.- Author:
- Sunny Yu
-
-
Constructor Summary
Constructors Constructor Description CartOfferUtils(CartItemOfferUtils cartItemOfferUtils)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCartItemQualifiedOfferIdsToIgnoreList(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItems)
Retrieves the offer ids that the givenCartItems
that are qualifiers of and add them to the givenCart
's offer ignore list.List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem>
getFreeGiftItemsFromOffers(com.broadleafcommerce.cart.client.domain.Cart cart)
Retrieves theFreeGiftItems
applicable to the givenCart
.List<String>
getOfferIdsToIgnore(com.broadleafcommerce.cart.client.domain.Cart cart)
Retrieves the offer ids to ignore and not apply to the givenCart
.boolean
offerShouldBeIgnored(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.promotion.offer.client.web.context.info.OfferRef offerRef)
Determines if the givenOfferRef
should be ignored for the givenCart
.void
storeFreeGiftItems(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem> freeGiftItems)
Adds the givenFreeGiftItems
toCart.getInternalAttributes()
for later processing.
-
-
-
Constructor Detail
-
CartOfferUtils
public CartOfferUtils(CartItemOfferUtils cartItemOfferUtils)
-
-
Method Detail
-
storeFreeGiftItems
public void storeFreeGiftItems(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem> freeGiftItems)
Adds the givenFreeGiftItems
toCart.getInternalAttributes()
for later processing.- Parameters:
cart
- theCart
to add theFreeGiftItems
forfreeGiftItems
- theFreeGiftItems
to add toCart.getInternalAttributes()
- See Also:
CartAttributeConstants.Internal.FREE_GIFT_OFFER_ITEMS
-
getFreeGiftItemsFromOffers
public List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem> getFreeGiftItemsFromOffers(com.broadleafcommerce.cart.client.domain.Cart cart)
Retrieves theFreeGiftItems
applicable to the givenCart
.- Parameters:
cart
- theCart
to retrieve the applicableFreeGiftItems
from- Returns:
- the
FreeGiftItems
applicable to the givenCart
- See Also:
CartAttributeConstants.Internal.FREE_GIFT_OFFER_ITEMS
-
getOfferIdsToIgnore
public List<String> getOfferIdsToIgnore(com.broadleafcommerce.cart.client.domain.Cart cart)
Retrieves the offer ids to ignore and not apply to the givenCart
.- Parameters:
cart
- theCart
to retrieve the ignored offer ids from- Returns:
- the offer ids to ignore and not apply to the given
Cart
- See Also:
CartAttributeConstants.Internal.OFFER_IDS_TO_IGNORE
-
offerShouldBeIgnored
public boolean offerShouldBeIgnored(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.promotion.offer.client.web.context.info.OfferRef offerRef)
Determines if the givenOfferRef
should be ignored for the givenCart
.- Parameters:
cart
- theCart
to check againstofferRef
- theOfferRef
to check against- Returns:
- true if given
OfferRef
should be ignored, otherwise false - See Also:
CartAttributeConstants.Internal.OFFER_IDS_TO_IGNORE
-
addCartItemQualifiedOfferIdsToIgnoreList
public void addCartItemQualifiedOfferIdsToIgnoreList(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItems)
Retrieves the offer ids that the givenCartItems
that are qualifiers of and add them to the givenCart
's offer ignore list.This is typically used when removing automatically added
CartItems
from offers, but no longer want to apply those offers again.- Parameters:
cart
- theCart
to add the offer ids to ignore forcartItems
- theCartItems
to retrieve their qualified offer ids for
-
-