Class CartOfferUtils
java.lang.Object
com.broadleafcommerce.cartoperation.service.util.offer.CartOfferUtils
Utility class to aid in retrieving offer information from
Cart.- Author:
- Sunny Yu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCartItemQualifiedOfferIdsToIgnoreList(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.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 Details
-
CartOfferUtils
-
-
Method Details
-
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:
-
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:
-
getOfferIdsToIgnore
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:
-
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:
-
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
-