All Known Implementing Classes:
DefaultOrderAndItemOfferHelper

public interface OrderAndItemOfferHelper
This class contains methods with usage shared by ItemOfferProcessor and OrderOfferProcessor.
Author:
Nathan Moore (nathanmoore).
  • Method Details

    • createCodeResponse

      com.broadleafcommerce.promotion.offer.client.web.context.discounts.CodeResponse createCodeResponse(OfferNotAppliedReasonEnum notUsedReason)
      Returns the CodeResponse built from the supplied OfferNotAppliedReasonEnum.
      Parameters:
      notUsedReason - the OfferNotAppliedReasonEnum which provides information on why an offer was not applied.
      Returns:
      the CodeResponse built from the supplied OfferNotAppliedReasonEnum
    • orderMeetsQualifyingTotalRequirements

      boolean orderMeetsQualifyingTotalRequirements(@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 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

      boolean orderMeetsTargetTotalRequirements(@NonNull CandidateItemOffer itemOffer)
      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 applicability
      candidateOffer - 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 the ItemCriteriaRule is met by ItemCriteriaRule.
      Parameters:
      itemsMetByCriteriaRule - a map of EnhancedLineItems that meet the ItemCriteriaRule
      Returns:
      a map of total number of times the ItemCriteriaRule is met by ItemCriteriaRule
    • 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 from
      item - The fulfillment item to consider
      discountableItemTotal - Stores the adjusted item amounts
      Returns:
      Item total with adjustments for the item based on the permutation result.