Class ItemOfferAdjustment
java.lang.Object
com.broadleafcommerce.promotion.offer.web.context.info.ItemOfferAdjustment
- All Implemented Interfaces:
Serializable
DTO containing price adjustment information for a
EnhancedLineItem
caused by a
CandidateItemOffer
targeting it. Tracks whether the
EnhancedLineItem.getStandardPrice()
or EnhancedLineItem.getSalePrice()
should be
discounted.- Author:
- Nathan Moore (nathanmoore).
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
copy
(com.broadleafcommerce.common.extension.TypeFactory offerFactory) Creates a copy of this adjustment.boolean
void
finalizeAdjustment
(boolean useSalePrice) SetsadjustmentValue
andappliedToSalePrice
.javax.money.MonetaryAmount
The final amount by which to adjust theorder item's
price.javax.money.MonetaryAmount
Max value per order filtering occurs as an item offer is being processed.TheCandidateItemOffer
DTO related tooffer
.int
The total quantity of the current line item this offer was applied to.Set to "Y" if the adjustment should ignore a merge due to being part of a max savings calculation.getOffer()
int
The total number of times that the offer this adjustment was created from is applied.List<com.broadleafcommerce.promotion.offer.client.web.context.info.OfferItemDetail>
A list ofOfferItemDetails
representing the qualifier items where this adjustment was from.int
int
The quantity per offer usage of the item where this adjustment is applied to (target item).javax.money.MonetaryAmount
The amount by which to adjust theEnhancedLineItem.getSalePrice()
.javax.money.MonetaryAmount
The amount by which to adjust theEnhancedLineItem.getStandardPrice()
.int
hashCode()
boolean
Whether theadjustmentValue
was applied toEnhancedLineItem.getStandardPrice()
orEnhancedLineItem.getSalePrice()
.boolean
boolean
Future credit means that the associated adjustment will be discounted at a later time to the customer via a credit.boolean
void
setAdjustmentValue
(javax.money.MonetaryAmount adjustmentValue) The final amount by which to adjust theorder item's
price.void
setAppliedToSalePrice
(boolean appliedToSalePrice) Whether theadjustmentValue
was applied toEnhancedLineItem.getStandardPrice()
orEnhancedLineItem.getSalePrice()
.void
setCandidateItemOffer
(CandidateItemOffer candidateItemOffer) TheCandidateItemOffer
DTO related tooffer
.void
setFutureCredit
(boolean futureCredit) Future credit means that the associated adjustment will be discounted at a later time to the customer via a credit.void
setItemAdjustmentQuantity
(int itemAdjustmentQuantity) The total quantity of the current line item this offer was applied to.void
setMaxSavingIndicator
(String maxSavingIndicator) Set to "Y" if the adjustment should ignore a merge due to being part of a max savings calculation.void
TheOffer
targeting someEnhancedLineItem
.void
setOfferUses
(int offerUses) The total number of times that the offer this adjustment was created from is applied.void
setParentDetail
(LineItemOfferDetail parentDetail) void
setQualifierDetails
(List<com.broadleafcommerce.promotion.offer.client.web.context.info.OfferItemDetail> qualifierDetails) A list ofOfferItemDetails
representing the qualifier items where this adjustment was from.void
setQuantityPerUsage
(int quantityPerUsage) The quantity per offer usage of the item where this adjustment is applied to (target item).void
setSaleAdjustmentValue
(javax.money.MonetaryAmount saleAdjustmentValue) The amount by which to adjust theEnhancedLineItem.getSalePrice()
.void
setStandardAdjustmentValue
(javax.money.MonetaryAmount standardAdjustmentValue) The amount by which to adjust theEnhancedLineItem.getStandardPrice()
.toString()
-
Constructor Details
-
ItemOfferAdjustment
public ItemOfferAdjustment()
-
-
Method Details
-
getQuantity
public int getQuantity() -
getLineItem
-
isCombinable
public boolean isCombinable()- Returns:
- whether the
offer
isCombinabilityType.ANY
-
isTotalitarian
public boolean isTotalitarian()- Returns:
- whether the
offer
isCombinabilityType.NONE
-
finalizeAdjustment
public void finalizeAdjustment(boolean useSalePrice) SetsadjustmentValue
andappliedToSalePrice
.- Parameters:
useSalePrice
- whether to use thesaleAdjustmentValue
or thestandardAdjustmentValue
.
-
copy
@NonNull public ItemOfferAdjustment copy(@NonNull com.broadleafcommerce.common.extension.TypeFactory offerFactory) Creates a copy of this adjustment.- Parameters:
offerFactory
- theTypeFactory
used to create a new adjustment instance- Returns:
- the new adjustment instance
-
getOffer
- Returns:
- The
Offer
targeting someEnhancedLineItem
.
-
getAdjustmentValueForMaxSavings
public javax.money.MonetaryAmount getAdjustmentValueForMaxSavings()Max value per order filtering occurs as an item offer is being processed. The check is made based on the probable end adjustment. -
getCandidateItemOffer
TheCandidateItemOffer
DTO related tooffer
.- Returns:
- The
CandidateItemOffer
DTO related tooffer
.
-
getSaleAdjustmentValue
public javax.money.MonetaryAmount getSaleAdjustmentValue()The amount by which to adjust theEnhancedLineItem.getSalePrice()
.- Returns:
- The amount by which to adjust the
EnhancedLineItem.getSalePrice()
.
-
getStandardAdjustmentValue
public javax.money.MonetaryAmount getStandardAdjustmentValue()The amount by which to adjust theEnhancedLineItem.getStandardPrice()
.- Returns:
- The amount by which to adjust the
EnhancedLineItem.getStandardPrice()
.
-
getAdjustmentValue
public javax.money.MonetaryAmount getAdjustmentValue()The final amount by which to adjust theorder item's
price.- Returns:
- The final amount by which to adjust the
order item's
price.
-
isAppliedToSalePrice
public boolean isAppliedToSalePrice()Whether theadjustmentValue
was applied toEnhancedLineItem.getStandardPrice()
orEnhancedLineItem.getSalePrice()
.- Returns:
- Whether the
adjustmentValue
was applied toEnhancedLineItem.getStandardPrice()
orEnhancedLineItem.getSalePrice()
.
-
isFutureCredit
public boolean isFutureCredit()Future credit means that the associated adjustment will be discounted at a later time to the customer via a credit. It is up to the implementor to decide how to achieve this. This field is used to determine if the adjustment originated from an offer marked as FUTURE_CREDIT.- See Also:
-
getParentDetail
-
getQualifierDetails
public List<com.broadleafcommerce.promotion.offer.client.web.context.info.OfferItemDetail> getQualifierDetails()A list ofOfferItemDetails
representing the qualifier items where this adjustment was from. -
getQuantityPerUsage
public int getQuantityPerUsage()The quantity per offer usage of the item where this adjustment is applied to (target item). -
getItemAdjustmentQuantity
public int getItemAdjustmentQuantity()The total quantity of the current line item this offer was applied to. -
getOfferUses
public int getOfferUses()The total number of times that the offer this adjustment was created from is applied. -
getMaxSavingIndicator
Set to "Y" if the adjustment should ignore a merge due to being part of a max savings calculation. -
setOffer
TheOffer
targeting someEnhancedLineItem
.- Parameters:
offer
- TheOffer
targeting someEnhancedLineItem
.
-
setCandidateItemOffer
TheCandidateItemOffer
DTO related tooffer
.- Parameters:
candidateItemOffer
- TheCandidateItemOffer
DTO related tooffer
.
-
setSaleAdjustmentValue
public void setSaleAdjustmentValue(javax.money.MonetaryAmount saleAdjustmentValue) The amount by which to adjust theEnhancedLineItem.getSalePrice()
.- Parameters:
saleAdjustmentValue
- The amount by which to adjust theEnhancedLineItem.getSalePrice()
.
-
setStandardAdjustmentValue
public void setStandardAdjustmentValue(javax.money.MonetaryAmount standardAdjustmentValue) The amount by which to adjust theEnhancedLineItem.getStandardPrice()
.- Parameters:
amount
- The amount by which to adjust theEnhancedLineItem.getStandardPrice()
.
-
setAdjustmentValue
public void setAdjustmentValue(javax.money.MonetaryAmount adjustmentValue) The final amount by which to adjust theorder item's
price.- Parameters:
adjustmentValue
- The final amount by which to adjust theorder item's
price.
-
setAppliedToSalePrice
public void setAppliedToSalePrice(boolean appliedToSalePrice) Whether theadjustmentValue
was applied toEnhancedLineItem.getStandardPrice()
orEnhancedLineItem.getSalePrice()
.- Parameters:
appliedToSalePrice
- Whether theadjustmentValue
was applied toEnhancedLineItem.getStandardPrice()
orEnhancedLineItem.getSalePrice()
.
-
setFutureCredit
public void setFutureCredit(boolean futureCredit) Future credit means that the associated adjustment will be discounted at a later time to the customer via a credit. It is up to the implementor to decide how to achieve this. This field is used to determine if the adjustment originated from an offer marked as FUTURE_CREDIT.- See Also:
-
setParentDetail
-
setQualifierDetails
public void setQualifierDetails(List<com.broadleafcommerce.promotion.offer.client.web.context.info.OfferItemDetail> qualifierDetails) A list ofOfferItemDetails
representing the qualifier items where this adjustment was from. -
setQuantityPerUsage
public void setQuantityPerUsage(int quantityPerUsage) The quantity per offer usage of the item where this adjustment is applied to (target item). -
setItemAdjustmentQuantity
public void setItemAdjustmentQuantity(int itemAdjustmentQuantity) The total quantity of the current line item this offer was applied to. -
setOfferUses
public void setOfferUses(int offerUses) The total number of times that the offer this adjustment was created from is applied. -
setMaxSavingIndicator
Set to "Y" if the adjustment should ignore a merge due to being part of a max savings calculation. -
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-