Class DefaultOfferApplicationService
java.lang.Object
com.broadleafcommerce.promotion.offer.service.engine.application.DefaultOfferApplicationService
- All Implemented Interfaces:
OfferApplicationService
- Author:
- Chad Harchar (charchar), Brian Polster (bpolster)
-
Constructor Summary
ConstructorDescriptionDefaultOfferApplicationService
(ItemOfferProcessor orderLineItemOfferProcessor, ItemOfferProcessor fulfillmentLineItemOfferProcessor, OrderOfferProcessor orderOfferProcessor, FulfillmentGroupOfferProcessor fulfillmentGroupOfferProcessor) -
Method Summary
Modifier and TypeMethodDescriptionapplyAdjustments
(OfferProcessingContext context) Applies the adjustments to the EnhancedOrder and returns the order with adjustments applied and totals updated.protected void
protected void
protected void
protected void
protected boolean
protected boolean
protected void
createNewCTOPs
(CombinedTypesOfferPermutation ctop, List<CombinedTypesOfferPermutation> newCTOPlist) protected org.springframework.context.MessageSource
protected com.broadleafcommerce.common.extension.TypeFactory
protected void
Before scoring item offer permutations, it is helpful to prepare the list of offers by calculating potential savings, sorting, and enforcing in order max-uses rules.protected void
This method can be used to manipulate the list ofCombinedTypesOfferPermutation
s after the Item Offer Processing phase is complete.void
Calculates the value of each offer permutation and determines the best combination of all offer types.protected void
scoreFulfillmentGroupOfferPermutations
(OfferProcessingContext context, CombinedTypesOfferPermutation combinedTypesOfferPermutation) protected void
scoreFulfillmentItemOfferPermutations
(OfferProcessingContext context, CombinedTypesOfferPermutation combinedTypesOfferPermutation) protected void
scoreItemOfferPermutations
(OfferProcessingContext context, CombinedTypesOfferPermutation combinedTypesOfferPermutation) protected void
scoreOrderOfferPermutations
(OfferProcessingContext context, CombinedTypesOfferPermutation combinedTypesOfferPermutation) void
setMessageSource
(org.springframework.context.MessageSource messageSource) void
setOfferFactory
(com.broadleafcommerce.common.extension.TypeFactory offerFactory)
-
Constructor Details
-
DefaultOfferApplicationService
public DefaultOfferApplicationService(ItemOfferProcessor orderLineItemOfferProcessor, ItemOfferProcessor fulfillmentLineItemOfferProcessor, OrderOfferProcessor orderOfferProcessor, FulfillmentGroupOfferProcessor fulfillmentGroupOfferProcessor)
-
-
Method Details
-
processOfferPermutations
Description copied from interface:OfferApplicationService
Calculates the value of each offer permutation and determines the best combination of all offer types. Updates theOfferProcessingContext.setBestOfferPermutation(com.broadleafcommerce.promotion.offer.service.dto.CombinedTypesOfferPermutation)
with the results of the offers to apply.- Specified by:
processOfferPermutations
in interfaceOfferApplicationService
-
processItemOfferEdgeCases
This method can be used to manipulate the list ofCombinedTypesOfferPermutation
s after the Item Offer Processing phase is complete. The default implementation expands the list of permutations for the edge case where the best item permutation includes multiple segments AND the potential order offers include at least one order offer whereOffer#getExcludeDiscountedItemsFromTotals()
is true.- Parameters:
context
-
-
createNewCTOPs
protected void createNewCTOPs(CombinedTypesOfferPermutation ctop, List<CombinedTypesOfferPermutation> newCTOPlist) -
containsMultipleSegmentAdjustments
-
containsExcludeDiscountedItemOffers
-
prepareForItemOfferProcessing
Before scoring item offer permutations, it is helpful to prepare the list of offers by calculating potential savings, sorting, and enforcing in order max-uses rules.- Parameters:
context
-
-
scoreItemOfferPermutations
protected void scoreItemOfferPermutations(OfferProcessingContext context, CombinedTypesOfferPermutation combinedTypesOfferPermutation) -
scoreOrderOfferPermutations
protected void scoreOrderOfferPermutations(OfferProcessingContext context, CombinedTypesOfferPermutation combinedTypesOfferPermutation) -
scoreFulfillmentItemOfferPermutations
protected void scoreFulfillmentItemOfferPermutations(OfferProcessingContext context, CombinedTypesOfferPermutation combinedTypesOfferPermutation) -
scoreFulfillmentGroupOfferPermutations
protected void scoreFulfillmentGroupOfferPermutations(OfferProcessingContext context, CombinedTypesOfferPermutation combinedTypesOfferPermutation) -
applyAdjustments
Description copied from interface:OfferApplicationService
Applies the adjustments to the EnhancedOrder and returns the order with adjustments applied and totals updated.- Specified by:
applyAdjustments
in interfaceOfferApplicationService
- Parameters:
context
- Context containing the adjustments that were computed in the previously calledOfferApplicationService.processOfferPermutations(OfferProcessingContext)
method.- Returns:
- The order with its adjustments and totals updated
-
applyItemAdjustments
-
applyOfferAdjustments
-
applyFulfillmentItemAdjustments
-
applyFulfillmentGroupAdjustments
-
getOfferFactory
protected com.broadleafcommerce.common.extension.TypeFactory getOfferFactory() -
setOfferFactory
@Autowired public void setOfferFactory(com.broadleafcommerce.common.extension.TypeFactory offerFactory) -
getMessageSource
protected org.springframework.context.MessageSource getMessageSource() -
setMessageSource
@Autowired public void setMessageSource(org.springframework.context.MessageSource messageSource)
-