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.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.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.com.broadleafcommerce.promotion.offer.client.web.context.discounts.CodeResponse
createCodeResponse
(OfferNotAppliedReasonEnum notUsedReason) Returns the CodeResponse built from the suppliedOfferNotAppliedReasonEnum
.org.springframework.context.MessageSource
com.broadleafcommerce.common.extension.TypeFactory
com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService
getTotalTimesCriteriaIsMetByCriteria
(Map<ItemCriteriaRule, Collection<EnhancedLineItem>> itemsMetByCriteriaRule) Gets a map of total number of times theItemCriteriaRule
is met byItemCriteriaRule
.boolean
orderMeetsQualifyingTotalRequirements
(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.boolean
orderMeetsSubtotalRequirements
(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.boolean
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.
-
Method Details
-
createCodeResponse
com.broadleafcommerce.promotion.offer.client.web.context.discounts.CodeResponse createCodeResponse(OfferNotAppliedReasonEnum notUsedReason) Returns the CodeResponse built from the suppliedOfferNotAppliedReasonEnum
.- Parameters:
notUsedReason
- theOfferNotAppliedReasonEnum
which 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 offer
to 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 offer
to 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
-EnhancedOrder
against whose subtotal to verify the candidate offer's applicabilitycandidateOffer
-candidate offer
to 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 theItemCriteriaRule
is met byItemCriteriaRule
.- Parameters:
itemsMetByCriteriaRule
- a map ofEnhancedLineItems
that meet theItemCriteriaRule
- Returns:
- a map of total number of times the
ItemCriteriaRule
is 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
TypeFactory
that 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
item
based on the permutation result.
-