Class OfferDiscount
java.lang.Object
com.broadleafcommerce.promotion.offer.web.context.info.OfferDiscount
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy(com.broadleafcommerce.common.extension.TypeFactory offerFactory) Creates a copy of this offer discount.TheCandidateItemOfferDTO related tooffer.intThe actual item quantity of anEnhancedLineItemmatched to theoffer.The line item number of theEnhancedLineItemthat this target represents.getOffer()Optional<javax.money.MonetaryAmount>Stores the remainder when the max per order item threshold has been reached.intThe potential item quantity of anEnhancedLineItemthat matched theoffer.TheOffer.getTargetItemCriteria()that anEnhancedLineItemmatched.A map of usageIds to quantity of theEnhancedLineItemfor the usages of this target.intincrementQuantity(int incrementQuantity) Increments thequantityby the given amount.voidsetCandidateItemOffer(CandidateItemOffer candidateItemOffer) TheCandidateItemOfferDTO related tooffer.voidsetFinalizedQuantity(int finalizedQuantity) The actual item quantity of anEnhancedLineItemmatched to theoffer.voidvoidsetLineNumber(String lineNumber) The line item number of theEnhancedLineItemthat this target represents.voidTheOffertargeting someEnhancedLineItem.voidsetPartialSavingsAmount(Optional<javax.money.MonetaryAmount> partialSavingsAmount) Stores the remainder when the max per order item threshold has been reached.voidsetQuantity(int quantity) The potential item quantity of anEnhancedLineItemthat matched theoffer.voidsetTargetItemCriteria(ItemCriteriaRule targetItemCriteria) TheOffer.getTargetItemCriteria()that anEnhancedLineItemmatched.voidsetUsageDetails(Map<String, Integer> usageDetails) A map of usageIds to quantity of theEnhancedLineItemfor the usages of this target.split(com.broadleafcommerce.common.extension.TypeFactory offerFactory, int splitQty) Checks to see that the discount quantities match the target quantities.toString()
-
Constructor Details
-
OfferDiscount
public OfferDiscount()
-
-
Method Details
-
setLineItemOfferDetail
-
getOffer
-
incrementQuantity
public int incrementQuantity(int incrementQuantity) Increments thequantityby the given amount.- Parameters:
incrementQuantity- amount by which to incrementquantity- 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
Creates a copy of this offer discount.- Parameters:
offerFactory- theTypeFactoryrequired to create a new instance- Returns:
- the copied instance
-
toString
-
setOffer
TheOffertargeting someEnhancedLineItem.- Parameters:
offer- TheOffertargeting someEnhancedLineItem.
-
getCandidateItemOffer
TheCandidateItemOfferDTO related tooffer.- Returns:
- The
CandidateItemOfferDTO related tooffer.
-
setCandidateItemOffer
TheCandidateItemOfferDTO related tooffer.- Parameters:
candidateItemOffer- TheCandidateItemOfferDTO related tooffer.
-
getTargetItemCriteria
TheOffer.getTargetItemCriteria()that anEnhancedLineItemmatched.- Returns:
- The
Offer.getTargetItemCriteria()that anEnhancedLineItemmatched.
-
setTargetItemCriteria
TheOffer.getTargetItemCriteria()that anEnhancedLineItemmatched.- Parameters:
targetItemCriteria- TheOffer.getTargetItemCriteria()that anEnhancedLineItemmatched.
-
getQuantity
public int getQuantity()The potential item quantity of anEnhancedLineItemthat matched theoffer.- Returns:
- The potential item quantity of an
EnhancedLineItemthat matched theoffer.
-
setQuantity
public void setQuantity(int quantity) The potential item quantity of anEnhancedLineItemthat matched theoffer.- Parameters:
quantity- The potential item quantity of anEnhancedLineItemthat matched theoffer.
-
getFinalizedQuantity
public int getFinalizedQuantity()The actual item quantity of anEnhancedLineItemmatched to theoffer.- Returns:
- The actual item quantity of an
EnhancedLineItemmatched to theoffer.
-
setFinalizedQuantity
public void setFinalizedQuantity(int finalizedQuantity) The actual item quantity of anEnhancedLineItemmatched to theoffer.- Parameters:
quantity- The actual item quantity of anEnhancedLineItemmatched to theoffer.
-
getLineNumber
The line item number of theEnhancedLineItemthat this target represents.- Returns:
- The line item number of the
EnhancedLineItemthat this target represents.
-
setLineNumber
The line item number of theEnhancedLineItemthat this target represents.- Parameters:
quantity- The line item number of theEnhancedLineItemthat this target represents.
-
getUsageDetails
A map of usageIds to quantity of theEnhancedLineItemfor the usages of this target.- Returns:
- A map of usageIds to quantity of the
EnhancedLineItemfor the usages of this target.
-
setUsageDetails
A map of usageIds to quantity of theEnhancedLineItemfor the usages of this target.- Parameters:
quantity- A map of usageIds to quantity of theEnhancedLineItemfor the usages of this target.
-
getPartialSavingsAmount
Stores the remainder when the max per order item threshold has been reached.- Returns:
- The partial discount amount to apply
-
setPartialSavingsAmount
Stores the remainder when the max per order item threshold has been reached.- Parameters:
partialSavingsAmount- The partial discount amount to apply.
-
getLineItemOfferDetail
-