Interface OfferEngineService
-
- All Known Implementing Classes:
DefaultOfferEngineService
public interface OfferEngineServiceThis serves as the entry and exist points for the offer engine, which takes in an order and context then determines what offers can apply before calculating the best possible permutation of offers and applying them.- Author:
- Chad Harchar (charchar)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidapplyAdjustments(EnhancedOrder order, OfferProcessingContext processingContext)Applies the offers to the order in a way that gives the best discount for the customer based on possible permutations.com.broadleafcommerce.promotion.offer.client.web.context.discounts.OrderResponseexecuteOnOrderAndContext(EnhancedOrder order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)For the provided order and context, determines the candidate offers and applies them to the order in the permutation that gives the best discount.CandidateOffersgetCandidateOffers(EnhancedOrder order, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Determines all of the candidate offers that can apply to the provided order for the given context.voidpopulateProratedFulfillmentGroupAdjustments(EnhancedOrder order)Populates all of theEnhancedProratedOfferAdjustmentsfor anyOfferthat has aDiscount.getTargetType()ofDiscountTargetType.FULFILLMENT_GROUPand add them onto the individual discountablefulfillment items, as well as populatingEnhancedFulfillmentGroup.getProratedFulfillmentAdjustments().voidpopulateProratedItemAdjustments(EnhancedOrder order)For anyOfferthat has aDiscount.prorationTypeofProrationType.TARGET_AND_QUALIFIER, this will populate all of theProratedItemOfferAdjustmentson theLineItemOfferDetailsmostly for the sake of reporting instruments.voidpopulateProratedOrderAdjustments(EnhancedOrder order)Populates all of theEnhancedProratedOfferAdjustmentsfor anyOfferthat has aDiscount.getTargetType()ofDiscountTargetType.ORDERand add them onto the individual discountableorder line items.
-
-
-
Method Detail
-
getCandidateOffers
@NonNull CandidateOffers getCandidateOffers(@NonNull EnhancedOrder order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Determines all of the candidate offers that can apply to the provided order for the given context.- Parameters:
order- context information around the offercontextInfo- Context information around sandbox and multitenant state.- Returns:
- The list of offers that can apply to the provided order and context.
-
applyAdjustments
void applyAdjustments(@NonNull EnhancedOrder order, @NonNull OfferProcessingContext processingContext)Applies the offers to the order in a way that gives the best discount for the customer based on possible permutations.- Parameters:
order- the order to be considered forOfferdiscounts.processingContext- all permutations of orders that can be considered for the order
-
executeOnOrderAndContext
com.broadleafcommerce.promotion.offer.client.web.context.discounts.OrderResponse executeOnOrderAndContext(@NonNull EnhancedOrder order, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)For the provided order and context, determines the candidate offers and applies them to the order in the permutation that gives the best discount.- Parameters:
order- context information around the offercontextInfo- Context information around sandbox and multitenant state.- Returns:
- A response DTO that details the adjustments and their discounts applied to the order
-
populateProratedItemAdjustments
@NonNull void populateProratedItemAdjustments(@NonNull EnhancedOrder order)For anyOfferthat has aDiscount.prorationTypeofProrationType.TARGET_AND_QUALIFIER, this will populate all of theProratedItemOfferAdjustmentson theLineItemOfferDetailsmostly for the sake of reporting instruments.- Parameters:
order- theEnhancedOrderwhoseLineItemsmight haveProratedItemOfferAdjustments
-
populateProratedOrderAdjustments
@NonNull void populateProratedOrderAdjustments(@NonNull EnhancedOrder order)Populates all of theEnhancedProratedOfferAdjustmentsfor anyOfferthat has aDiscount.getTargetType()ofDiscountTargetType.ORDERand add them onto the individual discountableorder line items.- Parameters:
order- theEnhancedOrderto populate the order offer adjustment prorations
-
populateProratedFulfillmentGroupAdjustments
@NonNull void populateProratedFulfillmentGroupAdjustments(@NonNull EnhancedOrder order)Populates all of theEnhancedProratedOfferAdjustmentsfor anyOfferthat has aDiscount.getTargetType()ofDiscountTargetType.FULFILLMENT_GROUPand add them onto the individual discountablefulfillment items, as well as populatingEnhancedFulfillmentGroup.getProratedFulfillmentAdjustments().- Parameters:
order- theEnhancedOrderto populate the fulfillment group offer adjustment prorations
-
-