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
-
Method Summary
Modifier and TypeMethodDescriptioncopy
(com.broadleafcommerce.common.extension.TypeFactory offerFactory) Creates a copy of this offer discount.TheCandidateItemOffer
DTO related tooffer
.int
The actual item quantity of anEnhancedLineItem
matched to theoffer
.The line item number of theEnhancedLineItem
that this target represents.getOffer()
Optional<javax.money.MonetaryAmount>
Stores the remainder when the max per order item threshold has been reached.int
The potential item quantity of anEnhancedLineItem
that matched theoffer
.TheOffer.getTargetItemCriteria()
that anEnhancedLineItem
matched.A map of usageIds to quantity of theEnhancedLineItem
for the usages of this target.int
incrementQuantity
(int incrementQuantity) Increments thequantity
by the given amount.void
setCandidateItemOffer
(CandidateItemOffer candidateItemOffer) TheCandidateItemOffer
DTO related tooffer
.void
setFinalizedQuantity
(int finalizedQuantity) The actual item quantity of anEnhancedLineItem
matched to theoffer
.void
void
setLineNumber
(String lineNumber) The line item number of theEnhancedLineItem
that this target represents.void
TheOffer
targeting someEnhancedLineItem
.void
setPartialSavingsAmount
(Optional<javax.money.MonetaryAmount> partialSavingsAmount) Stores the remainder when the max per order item threshold has been reached.void
setQuantity
(int quantity) The potential item quantity of anEnhancedLineItem
that matched theoffer
.void
setTargetItemCriteria
(ItemCriteriaRule targetItemCriteria) TheOffer.getTargetItemCriteria()
that anEnhancedLineItem
matched.void
setUsageDetails
(Map<String, Integer> usageDetails) A map of usageIds to quantity of theEnhancedLineItem
for 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 thequantity
by 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
- theTypeFactory
required to create a new instance- Returns:
- the copied instance
-
toString
-
setOffer
TheOffer
targeting someEnhancedLineItem
.- Parameters:
offer
- TheOffer
targeting someEnhancedLineItem
.
-
getCandidateItemOffer
TheCandidateItemOffer
DTO related tooffer
.- Returns:
- The
CandidateItemOffer
DTO related tooffer
.
-
setCandidateItemOffer
TheCandidateItemOffer
DTO related tooffer
.- Parameters:
candidateItemOffer
- TheCandidateItemOffer
DTO related tooffer
.
-
getTargetItemCriteria
TheOffer.getTargetItemCriteria()
that anEnhancedLineItem
matched.- Returns:
- The
Offer.getTargetItemCriteria()
that anEnhancedLineItem
matched.
-
setTargetItemCriteria
TheOffer.getTargetItemCriteria()
that anEnhancedLineItem
matched.- Parameters:
targetItemCriteria
- TheOffer.getTargetItemCriteria()
that anEnhancedLineItem
matched.
-
getQuantity
public int getQuantity()The potential item quantity of anEnhancedLineItem
that matched theoffer
.- Returns:
- The potential item quantity of an
EnhancedLineItem
that matched theoffer
.
-
setQuantity
public void setQuantity(int quantity) The potential item quantity of anEnhancedLineItem
that matched theoffer
.- Parameters:
quantity
- The potential item quantity of anEnhancedLineItem
that matched theoffer
.
-
getFinalizedQuantity
public int getFinalizedQuantity()The actual item quantity of anEnhancedLineItem
matched to theoffer
.- Returns:
- The actual item quantity of an
EnhancedLineItem
matched to theoffer
.
-
setFinalizedQuantity
public void setFinalizedQuantity(int finalizedQuantity) The actual item quantity of anEnhancedLineItem
matched to theoffer
.- Parameters:
quantity
- The actual item quantity of anEnhancedLineItem
matched to theoffer
.
-
getLineNumber
The line item number of theEnhancedLineItem
that this target represents.- Returns:
- The line item number of the
EnhancedLineItem
that this target represents.
-
setLineNumber
The line item number of theEnhancedLineItem
that this target represents.- Parameters:
quantity
- The line item number of theEnhancedLineItem
that this target represents.
-
getUsageDetails
A map of usageIds to quantity of theEnhancedLineItem
for the usages of this target.- Returns:
- A map of usageIds to quantity of the
EnhancedLineItem
for the usages of this target.
-
setUsageDetails
A map of usageIds to quantity of theEnhancedLineItem
for the usages of this target.- Parameters:
quantity
- A map of usageIds to quantity of theEnhancedLineItem
for 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
-