Interface OfferProvider
- All Known Implementing Classes:
ExternalOfferProvider
Cart
.- Author:
- Chad Harchar (charchar)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyOffers
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, boolean runOrderAndItemOffers, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handles requests against the Offer Engine to retrieve and apply discounts for aCart
and its contents.void
applyOffers
(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handles requests against the Offer Engine to retrieve and apply discounts for aCart
and its contents.getCodeUsabilityType
(String code, com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines the usability type of the promocode
in the context of the givencart
.com.broadleafcommerce.promotion.offer.client.web.context.OfferAndOfferCodeUsageValidationResult
validateOfferAndOfferCodeUsages
(com.broadleafcommerce.cart.client.domain.Cart cart, List<String> offerCodes, List<String> offerRefIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve validation information regarding the cart's usage of the provided offers and offer codes to determine if the usage is still valid.
-
Method Details
-
applyOffers
void applyOffers(com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handles requests against the Offer Engine to retrieve and apply discounts for aCart
and its contents. This method should apply all kinds of offers applicable to the contents including all order, order item, fulfillment, and fulfillment item offers.To control whether order and order item offers are applied use
applyOffers(Cart, boolean, ContextInfo)
and set `runOrderAndItemOffers` as desired. Set it tofalse
if you only want to run fulfillment and fulfillment item offers. By default, fulfillment pricing occurs after order and order items have been priced and their offers applied since fulfillment pricing and promotions can depend on the price of the merchandise being fulfilled.- Parameters:
cart
- TheCart
whose contents to send to the offer engine for evaluationcontextInfo
- Additional sandbox and tenancy info
-
applyOffers
void applyOffers(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, boolean runOrderAndItemOffers, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Handles requests against the Offer Engine to retrieve and apply discounts for aCart
and its contents. Allows specifying whether order and order item offers will be applied in the calculation. SetrunOrderAndItemOffers
tofalse
if you only want to run fulfillment and fulfillment item offers.By default, fulfillment pricing occurs after order and order items have been priced and their offers applied since fulfillment pricing and promotions can depend on the price of the merchandise being fulfilled. Thus, when fulfillment offers are processed, order and order item offers should not also be reprocessed or the results can be incorrect—this also makes the request run faster since only fulfillment will be considered.
- Parameters:
cart
- TheCart
whose contents to send to the offer engine for evaluationrunOrderAndItemOffers
- Whether to have the Offer Engine run order and order item level offers. Set this tofalse
if you only want to run fulfillment and fulfillment item offers. By default, fulfillment pricing occurs after order and order items have been priced and their offers applied since fulfillment pricing and promotions can depend on the price of the merchandise being fulfilled.contextInfo
- Additional sandbox and tenancy info
-
getCodeUsabilityType
String getCodeUsabilityType(String code, com.broadleafcommerce.cart.client.domain.Cart cart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines the usability type of the promocode
in the context of the givencart
. Possible values are defined inCodeUsabilityType
and include whether the code is usable, cannot be used because it has reached its max uses limit, or cannot be used because it does not match any offers (may be a campaign code or some other type in this case).- Parameters:
code
- The promo code to apply tocart
cart
- TheCart
that promocode
is to be applied tocontextInfo
- Additional sandbox and tenancy info- Returns:
- The usability type
- See Also:
-
CodeUsabilityType
-
validateOfferAndOfferCodeUsages
com.broadleafcommerce.promotion.offer.client.web.context.OfferAndOfferCodeUsageValidationResult validateOfferAndOfferCodeUsages(com.broadleafcommerce.cart.client.domain.Cart cart, List<String> offerCodes, List<String> offerRefIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Retrieve validation information regarding the cart's usage of the provided offers and offer codes to determine if the usage is still valid.- Parameters:
cart
- The cart against which to validate offer and code uses.offerCodes
- The codes to check for validity.offerRefIds
- The offer ids to check for validity.contextInfo
- Context information around sandbox and multitenant state.- Returns:
- A validation result that holds information about which offer & offer code usages are invalid and why
-