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 voidaddCartItemQualifiedOfferIdsToIgnoreList(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.cart.client.domain.CartItem> cartItems)Retrieves the offer ids that the givenCartItemsthat 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 theFreeGiftItemsapplicable 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.booleanofferShouldBeIgnored(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.promotion.offer.client.web.context.info.OfferRef offerRef)Determines if the givenOfferRefshould be ignored for the givenCart.voidstoreFreeGiftItems(com.broadleafcommerce.cart.client.domain.Cart cart, List<com.broadleafcommerce.promotion.offer.client.web.context.info.FreeGiftItem> freeGiftItems)Adds the givenFreeGiftItemstoCart.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 givenFreeGiftItemstoCart.getInternalAttributes()for later processing.- Parameters:
cart- theCartto add theFreeGiftItemsforfreeGiftItems- theFreeGiftItemsto 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 theFreeGiftItemsapplicable to the givenCart.- Parameters:
cart- theCartto retrieve the applicableFreeGiftItemsfrom- Returns:
- the
FreeGiftItemsapplicable 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- theCartto 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 givenOfferRefshould be ignored for the givenCart.- Parameters:
cart- theCartto check againstofferRef- theOfferRefto check against- Returns:
- true if given
OfferRefshould 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 givenCartItemsthat are qualifiers of and add them to the givenCart's offer ignore list.This is typically used when removing automatically added
CartItemsfrom offers, but no longer want to apply those offers again.- Parameters:
cart- theCartto add the offer ids to ignore forcartItems- theCartItemsto retrieve their qualified offer ids for
-
-