java.lang.Object
com.broadleafcommerce.promotion.offer.web.context.info.OfferDiscount
All Implemented Interfaces:
Serializable

public class OfferDiscount extends Object implements Serializable
Additional info for all the offers treating an EnhancedLineItem as a target. While ItemOfferAdjustments track the price adjustment effects of targeting offers, "offer discounts" track which Offer.getTargetItemCriteria() matched the EnhancedLineItem and how many were matched.
Author:
Nathan Moore (nathanmoore).
See Also:
  • Constructor Details

    • OfferDiscount

      public OfferDiscount()
  • Method Details

    • setLineItemOfferDetail

      public void setLineItemOfferDetail(LineItemOfferDetail lod)
    • getOffer

      public Offer getOffer()
    • incrementQuantity

      public int incrementQuantity(int incrementQuantity)
      Increments the quantity by the given amount.
      Parameters:
      incrementQuantity - amount by which to increment quantity
      Returns:
      the new quantity
    • split

      @NonNull public Optional<OfferDiscount> split(@NonNull com.broadleafcommerce.common.extension.TypeFactory offerFactory, int splitQty)
      Checks to see that the discount quantities match the target quantities. If not, splits this item into two.
      Returns:
      the item created by splitting
    • copy

      public OfferDiscount copy(com.broadleafcommerce.common.extension.TypeFactory offerFactory)
      Creates a copy of this offer discount.
      Parameters:
      offerFactory - the TypeFactory required to create a new instance
      Returns:
      the copied instance
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setOffer

      public void setOffer(Offer offer)
      The Offer targeting some EnhancedLineItem.
      Parameters:
      offer - The Offer targeting some EnhancedLineItem.
    • getCandidateItemOffer

      public CandidateItemOffer getCandidateItemOffer()
      The CandidateItemOffer DTO related to offer.
      Returns:
      The CandidateItemOffer DTO related to offer.
    • setCandidateItemOffer

      public void setCandidateItemOffer(CandidateItemOffer candidateItemOffer)
      The CandidateItemOffer DTO related to offer.
      Parameters:
      candidateItemOffer - The CandidateItemOffer DTO related to offer.
    • getTargetItemCriteria

      public ItemCriteriaRule getTargetItemCriteria()
      Returns:
      The Offer.getTargetItemCriteria() that an EnhancedLineItem matched.
    • setTargetItemCriteria

      public void setTargetItemCriteria(ItemCriteriaRule targetItemCriteria)
      Parameters:
      targetItemCriteria - The Offer.getTargetItemCriteria() that an EnhancedLineItem matched.
    • getQuantity

      public int getQuantity()
      The potential item quantity of an EnhancedLineItem that matched the offer.
      Returns:
      The potential item quantity of an EnhancedLineItem that matched the offer.
    • setQuantity

      public void setQuantity(int quantity)
      The potential item quantity of an EnhancedLineItem that matched the offer.
      Parameters:
      quantity - The potential item quantity of an EnhancedLineItem that matched the offer.
    • getFinalizedQuantity

      public int getFinalizedQuantity()
      The actual item quantity of an EnhancedLineItem matched to the offer.
      Returns:
      The actual item quantity of an EnhancedLineItem matched to the offer.
    • setFinalizedQuantity

      public void setFinalizedQuantity(int finalizedQuantity)
      The actual item quantity of an EnhancedLineItem matched to the offer.
      Parameters:
      quantity - The actual item quantity of an EnhancedLineItem matched to the offer.
    • getLineNumber

      public String getLineNumber()
      The line item number of the EnhancedLineItem that this target represents.
      Returns:
      The line item number of the EnhancedLineItem that this target represents.
    • setLineNumber

      public void setLineNumber(String lineNumber)
      The line item number of the EnhancedLineItem that this target represents.
      Parameters:
      quantity - The line item number of the EnhancedLineItem that this target represents.
    • getUsageDetails

      public Map<String,Integer> getUsageDetails()
      A map of usageIds to quantity of the EnhancedLineItem for the usages of this target.
      Returns:
      A map of usageIds to quantity of the EnhancedLineItem for the usages of this target.
    • setUsageDetails

      public void setUsageDetails(Map<String,Integer> usageDetails)
      A map of usageIds to quantity of the EnhancedLineItem for the usages of this target.
      Parameters:
      quantity - A map of usageIds to quantity of the EnhancedLineItem for the usages of this target.
    • getPartialSavingsAmount

      public Optional<javax.money.MonetaryAmount> getPartialSavingsAmount()
      Stores the remainder when the max per order item threshold has been reached.
      Returns:
      The partial discount amount to apply
    • setPartialSavingsAmount

      public void setPartialSavingsAmount(Optional<javax.money.MonetaryAmount> partialSavingsAmount)
      Stores the remainder when the max per order item threshold has been reached.
      Parameters:
      partialSavingsAmount - The partial discount amount to apply.
    • getLineItemOfferDetail

      public LineItemOfferDetail getLineItemOfferDetail()