Interface OrderAndItemOfferHelper
- All Known Implementing Classes:
DefaultOrderAndItemOfferHelper
public interface OrderAndItemOfferHelper
This class contains methods with usage shared by
ItemOfferProcessor and
OrderOfferProcessor.- Author:
- Nathan Moore (nathanmoore).
-
Method Summary
Modifier and TypeMethodDescriptionjavax.money.MonetaryAmountcalculateFulfillmentItemTotalFromPermutation(Optional<ItemOfferPermutationResult> itemResult, EnhancedFulfillmentLineItem item, DiscountableItemInfo discountableItemTotal) Uses the passed in results from a permutation result which holds the non-final item and offer adjustments relevant to the permutation.javax.money.MonetaryAmountcalculateItemTotalFromPermutation(Optional<ItemOfferPermutationResult> itemResult, Optional<OrderOfferPermutationResult> orderResult, EnhancedOrderLineItem item, boolean excludeItemTotalsWithDiscounts, DiscountableItemInfo discountableItemTotal) Uses the passed in results from a permutation result which holds the non-final item and offer adjustments relevant to the permutation.com.broadleafcommerce.promotion.offer.client.web.context.discounts.CodeResponsecreateCodeResponse(OfferNotAppliedReasonEnum notUsedReason) Returns the CodeResponse built from the suppliedOfferNotAppliedReasonEnum.org.springframework.context.MessageSourcecom.broadleafcommerce.common.extension.TypeFactorycom.broadleafcommerce.rulesengine.expression.service.RuleEvaluationServicegetTotalTimesCriteriaIsMetByCriteria(Map<ItemCriteriaRule, Collection<EnhancedLineItem>> itemsMetByCriteriaRule) Gets a map of total number of times theItemCriteriaRuleis met byItemCriteriaRule.booleanorderMeetsQualifyingTotalRequirements(BaseCandidateOffer candidateOffer) As offers are applied, recheck to ensure that the next offer in the collection of candidates can be applied based on the total of item qualifier prices.booleanorderMeetsSubtotalRequirements(EnhancedOrder order, BaseCandidateOffer candidateOffer) As offers are applied, recheck to ensure that the next offer in the collection of candidates can be applied based on the order subtotal.booleanAs offers are applied, recheck to ensure that the next offer in the collection of candidates can be applied based on the total of target item prices.
-
Method Details
-
createCodeResponse
com.broadleafcommerce.promotion.offer.client.web.context.discounts.CodeResponse createCodeResponse(OfferNotAppliedReasonEnum notUsedReason) Returns the CodeResponse built from the suppliedOfferNotAppliedReasonEnum.- Parameters:
notUsedReason- theOfferNotAppliedReasonEnumwhich provides information on why an offer was not applied.- Returns:
- the CodeResponse built from the supplied
OfferNotAppliedReasonEnum
-
orderMeetsQualifyingTotalRequirements
As offers are applied, recheck to ensure that the next offer in the collection of candidates can be applied based on the total of item qualifier prices.- Parameters:
candidateOffer-candidate offerto verify that it can be applied based on the total of item qualifier prices.- Returns:
- whether the offer can be applied based on the total of item qualifier prices.
-
orderMeetsTargetTotalRequirements
As offers are applied, recheck to ensure that the next offer in the collection of candidates can be applied based on the total of target item prices.- Parameters:
itemOffer-candidate offerto verify that it can be applied based on the total of target item prices.- Returns:
- whether the offer can be applied based on the total of target item prices.
-
orderMeetsSubtotalRequirements
boolean orderMeetsSubtotalRequirements(@NonNull EnhancedOrder order, @NonNull BaseCandidateOffer candidateOffer) As offers are applied, recheck to ensure that the next offer in the collection of candidates can be applied based on the order subtotal.- Parameters:
order-EnhancedOrderagainst whose subtotal to verify the candidate offer's applicabilitycandidateOffer-candidate offerto verify that it can be applied based on the order subtotal.- Returns:
- whether the offer can be applied based on the order subtotal.
-
getTotalTimesCriteriaIsMetByCriteria
Map<ItemCriteriaRule,Integer> getTotalTimesCriteriaIsMetByCriteria(@NonNull Map<ItemCriteriaRule, Collection<EnhancedLineItem>> itemsMetByCriteriaRule) Gets a map of total number of times theItemCriteriaRuleis met byItemCriteriaRule.- Parameters:
itemsMetByCriteriaRule- a map ofEnhancedLineItemsthat meet theItemCriteriaRule- Returns:
- a map of total number of times the
ItemCriteriaRuleis met byItemCriteriaRule
-
getRuleEvaluationService
com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService getRuleEvaluationService()- Returns:
- an instance of
RuleEvaluationService.
-
getOfferFactory
com.broadleafcommerce.common.extension.TypeFactory getOfferFactory()- Returns:
- an instance of
TypeFactorythat creates offer domain objects
-
getMessageSource
org.springframework.context.MessageSource getMessageSource()- Returns:
- an instance of
MessageSource
-
calculateItemTotalFromPermutation
javax.money.MonetaryAmount calculateItemTotalFromPermutation(Optional<ItemOfferPermutationResult> itemResult, Optional<OrderOfferPermutationResult> orderResult, EnhancedOrderLineItem item, boolean excludeItemTotalsWithDiscounts, DiscountableItemInfo discountableItemTotal) Uses the passed in results from a permutation result which holds the non-final item and offer adjustments relevant to the permutation. Stores the details for the item total calculation on the passed in DiscountableItemTotal -
calculateFulfillmentItemTotalFromPermutation
javax.money.MonetaryAmount calculateFulfillmentItemTotalFromPermutation(Optional<ItemOfferPermutationResult> itemResult, EnhancedFulfillmentLineItem item, DiscountableItemInfo discountableItemTotal) Uses the passed in results from a permutation result which holds the non-final item and offer adjustments relevant to the permutation. Stores the details for the item total calculation on the passed in DiscountableItemTotal- Parameters:
itemResult- The permutation context to calculate the adjustments fromitem- The fulfillment item to considerdiscountableItemTotal- Stores the adjusted item amounts- Returns:
- Item total with adjustments for the
itembased on the permutation result.
-