public class PromotableCandidateItemOfferImpl extends AbstractPromotionRounding implements PromotableCandidateItemOffer, OfferHolder
| Modifier and Type | Field and Description |
|---|---|
protected HashMap<OfferItemCriteria,List<PromotableOrderItem>> |
candidateQualifiersMap |
protected HashMap<OfferItemCriteria,List<PromotableOrderItem>> |
candidateTargetsMap |
protected List<PromotableOrderItem> |
legacyCandidateTargets |
protected int |
minimumTargetsRequired |
protected Offer |
offer |
protected Money |
originalPrice |
protected Money |
potentialSavings |
protected Money |
potentialSavingsQtyOne |
protected PromotableOrder |
promotableOrder |
protected boolean |
useQtyOnlyTierCalculation |
protected int |
uses |
protected BigDecimal |
weightedPercentSaved |
roundingMode, roundingScale, roundOfferValues| Constructor and Description |
|---|
PromotableCandidateItemOfferImpl(PromotableOrder promotableOrder,
Offer offer) |
PromotableCandidateItemOfferImpl(PromotableOrder promotableOrder,
Offer offer,
boolean useQtyOnlyTierCalculation) |
| Modifier and Type | Method and Description |
|---|---|
void |
addUse() |
int |
calculateMaximumNumberOfUses()
Determines the maximum number of times this promotion can be used based on the
ItemCriteria and promotion's maxQty setting.
|
int |
calculateMaxUsesForItemCriteria(OfferItemCriteria itemCriteria,
Offer promotion)
Determines the max number of times this itemCriteria might apply.
|
Money |
calculateSavingsForOrderItem(PromotableOrderItem orderItem,
int qtyToReceiveSavings)
Public only for unit testing - not intended to be called
|
int |
calculateTargetQuantityForTieredOffer()
Returns the number of items that potentially could be targets for the offer.
|
HashMap<OfferItemCriteria,List<PromotableOrderItem>> |
getCandidateQualifiersMap() |
HashMap<OfferItemCriteria,List<PromotableOrderItem>> |
getCandidateTargetsMap() |
BroadleafCurrency |
getCurrency() |
List<PromotableOrderItem> |
getLegacyCandidateTargets() |
int |
getMinimumRequiredTargetQuantity()
If the offer has a minimum required number of targets, then the first time this
offer is processed, return that number.
|
Offer |
getOffer() |
Money |
getOriginalPrice() |
Money |
getPotentialSavings() |
Money |
getPotentialSavingsQtyOne() |
int |
getPriority() |
int |
getUses() |
BigDecimal |
getWeightedPercentSaved() |
boolean |
hasQualifyingItemCriteria() |
boolean |
isUseQtyOnlyTierCalculation()
Returns whether to use quantity only tier calculation.
|
void |
resetUses()
Resets the uses for this candidate offer item.
|
void |
setCandidateQualifiersMap(HashMap<OfferItemCriteria,List<PromotableOrderItem>> candidateItemsMap) |
void |
setCandidateTargetsMap(HashMap<OfferItemCriteria,List<PromotableOrderItem>> candidateItemsMap) |
void |
setLegacyCandidateTargets(List<PromotableOrderItem> candidateTargets) |
void |
setMinimumTargetsRequired(Integer minimumTargetsRequired) |
void |
setOriginalPrice(Money originalPrice) |
void |
setPotentialSavings(Money potentialSavings) |
void |
setPotentialSavingsQtyOne(Money potentialSavingsQtyOne) |
void |
setUseQtyOnlyTierCalculation(boolean useQtyOnlyTierCalculation)
Sets whether to use quantity only tier calculation.
|
void |
setWeightedPercentSaved(BigDecimal weightedPercentSaved) |
getRoundingMode, getRoundingScale, isRoundOfferValues, setRoundingMode, setRoundingScaleprotected Offer offer
protected PromotableOrder promotableOrder
protected Money potentialSavings
protected Money potentialSavingsQtyOne
protected BigDecimal weightedPercentSaved
protected Money originalPrice
protected int uses
protected boolean useQtyOnlyTierCalculation
protected HashMap<OfferItemCriteria,List<PromotableOrderItem>> candidateQualifiersMap
protected HashMap<OfferItemCriteria,List<PromotableOrderItem>> candidateTargetsMap
protected List<PromotableOrderItem> legacyCandidateTargets
protected int minimumTargetsRequired
public PromotableCandidateItemOfferImpl(PromotableOrder promotableOrder, Offer offer)
public PromotableCandidateItemOfferImpl(PromotableOrder promotableOrder, Offer offer, boolean useQtyOnlyTierCalculation)
public BroadleafCurrency getCurrency()
getCurrency in interface OfferHolderpublic Money calculateSavingsForOrderItem(PromotableOrderItem orderItem, int qtyToReceiveSavings)
PromotableCandidateItemOffercalculateSavingsForOrderItem in interface PromotableCandidateItemOfferpublic int calculateTargetQuantityForTieredOffer()
calculateTargetQuantityForTieredOffer in interface PromotableCandidateItemOfferpublic Money getPotentialSavings()
getPotentialSavings in interface PromotableCandidateItemOfferpublic void setPotentialSavings(Money potentialSavings)
setPotentialSavings in interface PromotableCandidateItemOfferpublic Money getPotentialSavingsQtyOne()
getPotentialSavingsQtyOne in interface PromotableCandidateItemOfferpublic void setPotentialSavingsQtyOne(Money potentialSavingsQtyOne)
setPotentialSavingsQtyOne in interface PromotableCandidateItemOfferpublic boolean hasQualifyingItemCriteria()
hasQualifyingItemCriteria in interface PromotableCandidateItemOfferpublic int calculateMaximumNumberOfUses()
calculateMaximumNumberOfUses in interface PromotableCandidateItemOfferpublic int calculateMaxUsesForItemCriteria(OfferItemCriteria itemCriteria, Offer promotion)
PromotableCandidateItemOffercalculateMaxUsesForItemCriteria in interface PromotableCandidateItemOfferpublic HashMap<OfferItemCriteria,List<PromotableOrderItem>> getCandidateQualifiersMap()
getCandidateQualifiersMap in interface PromotableCandidateItemOfferpublic void setCandidateQualifiersMap(HashMap<OfferItemCriteria,List<PromotableOrderItem>> candidateItemsMap)
setCandidateQualifiersMap in interface PromotableCandidateItemOfferpublic HashMap<OfferItemCriteria,List<PromotableOrderItem>> getCandidateTargetsMap()
getCandidateTargetsMap in interface PromotableCandidateItemOfferpublic void setCandidateTargetsMap(HashMap<OfferItemCriteria,List<PromotableOrderItem>> candidateItemsMap)
setCandidateTargetsMap in interface PromotableCandidateItemOfferpublic int getPriority()
getPriority in interface PromotableCandidateItemOfferpublic Offer getOffer()
getOffer in interface OfferHoldergetOffer in interface PromotableCandidateItemOfferpublic int getUses()
getUses in interface PromotableCandidateItemOfferpublic void addUse()
addUse in interface PromotableCandidateItemOfferpublic void resetUses()
PromotableCandidateItemOfferresetUses in interface PromotableCandidateItemOfferItemOfferProcessor#applyAndCompareOrderAndItemOffers(PromotableOrder, List, List)}public List<PromotableOrderItem> getLegacyCandidateTargets()
getLegacyCandidateTargets in interface PromotableCandidateItemOfferpublic void setLegacyCandidateTargets(List<PromotableOrderItem> candidateTargets)
setLegacyCandidateTargets in interface PromotableCandidateItemOfferpublic BigDecimal getWeightedPercentSaved()
getWeightedPercentSaved in interface PromotableCandidateItemOfferpublic void setWeightedPercentSaved(BigDecimal weightedPercentSaved)
setWeightedPercentSaved in interface PromotableCandidateItemOfferpublic Money getOriginalPrice()
getOriginalPrice in interface PromotableCandidateItemOfferpublic void setOriginalPrice(Money originalPrice)
setOriginalPrice in interface PromotableCandidateItemOfferpublic void setMinimumTargetsRequired(Integer minimumTargetsRequired)
setMinimumTargetsRequired in interface PromotableCandidateItemOfferMiniumTargetsRequiredpublic int getMinimumRequiredTargetQuantity()
getMinimumRequiredTargetQuantity in interface PromotableCandidateItemOfferMinimumTargetsRequiredpublic boolean isUseQtyOnlyTierCalculation()
PromotableCandidateItemOfferPromotableCandidateItemOffer.calculateTargetQuantityForTieredOffer() will use only the
quantity in cart for determining which tier level to apply for a group of qualifying items. This mode
is disabled by default. To turn it back on, use
`use.quantity.only.tier.calculation=true` in your `common-shared.properties`.
Otherwise, the default behavior is to factor in the number of iterations that the qualifying items have been
applied.isUseQtyOnlyTierCalculation in interface PromotableCandidateItemOfferPromotableCandidateItemOffer#calculateTargetQuantityForTieredOffer()}public void setUseQtyOnlyTierCalculation(boolean useQtyOnlyTierCalculation)
PromotableCandidateItemOfferPromotableCandidateItemOffer.calculateTargetQuantityForTieredOffer() will use only the
quantity in cart for determining which tier level to apply for a group of qualifying items. This mode
is disabled by default. To turn it back on, use
`use.quantity.only.tier.calculation=true` in your `common-shared.properties`.
Otherwise, the default behavior is to factor in the number of iterations that the qualifying items have been
applied.setUseQtyOnlyTierCalculation in interface PromotableCandidateItemOfferPromotableCandidateItemOffer#calculateTargetQuantityForTieredOffer()}Copyright © 2017. All rights reserved.