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
ConstructorsConstructorDescriptionDefaultOfferApplicationService(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 voidprotected voidprotected voidprotected voidprotected booleanprotected booleanprotected voidcreateNewCTOPs(CombinedTypesOfferPermutation ctop, List<CombinedTypesOfferPermutation> newCTOPlist) protected org.springframework.context.MessageSourceprotected com.broadleafcommerce.common.extension.TypeFactoryprotected voidBefore 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 voidThis method can be used to manipulate the list ofCombinedTypesOfferPermutations after the Item Offer Processing phase is complete.voidCalculates the value of each offer permutation and determines the best combination of all offer types.protected voidscoreFulfillmentGroupOfferPermutations(OfferProcessingContext context, CombinedTypesOfferPermutation combinedTypesOfferPermutation) protected voidscoreFulfillmentItemOfferPermutations(OfferProcessingContext context, CombinedTypesOfferPermutation combinedTypesOfferPermutation) protected voidscoreItemOfferPermutations(OfferProcessingContext context, CombinedTypesOfferPermutation combinedTypesOfferPermutation) protected voidscoreOrderOfferPermutations(OfferProcessingContext context, CombinedTypesOfferPermutation combinedTypesOfferPermutation) voidsetMessageSource(org.springframework.context.MessageSource messageSource) voidsetOfferFactory(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:OfferApplicationServiceCalculates 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:
processOfferPermutationsin interfaceOfferApplicationService
-
processItemOfferEdgeCases
This method can be used to manipulate the list ofCombinedTypesOfferPermutations 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:OfferApplicationServiceApplies the adjustments to the EnhancedOrder and returns the order with adjustments applied and totals updated.- Specified by:
applyAdjustmentsin 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)
-