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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
.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 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 givenFreeGiftItems
toCart.getInternalAttributes()
for later processing.- Parameters:
cart
- theCart
to add theFreeGiftItems
forfreeGiftItems
- theFreeGiftItems
to 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 theFreeGiftItems
applicable to the givenCart
.- Parameters:
cart
- theCart
to retrieve the applicableFreeGiftItems
from- Returns:
- the
FreeGiftItems
applicable to the givenCart
- See Also:
-
getOfferIdsToIgnore
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:
-
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:
-
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
-