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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancopy(com.broadleafcommerce.common.extension.TypeFactory offerFactory) Creates a copy of this adjustment.booleanvoidfinalizeAdjustment(boolean useSalePrice) SetsadjustmentValueandappliedToSalePrice.javax.money.MonetaryAmountThe final amount by which to adjust theorder item'sprice.javax.money.MonetaryAmountMax value per order filtering occurs as an item offer is being processed.TheCandidateItemOfferDTO related tooffer.intThe 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()intThe 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 ofOfferItemDetailsrepresenting the qualifier items where this adjustment was from.intintThe quantity per offer usage of the item where this adjustment is applied to (target item).javax.money.MonetaryAmountThe amount by which to adjust theEnhancedLineItem.getSalePrice().javax.money.MonetaryAmountThe amount by which to adjust theEnhancedLineItem.getStandardPrice().inthashCode()booleanWhether theadjustmentValuewas applied toEnhancedLineItem.getStandardPrice()orEnhancedLineItem.getSalePrice().booleanbooleanFuture credit means that the associated adjustment will be discounted at a later time to the customer via a credit.booleanvoidsetAdjustmentValue(javax.money.MonetaryAmount adjustmentValue) The final amount by which to adjust theorder item'sprice.voidsetAppliedToSalePrice(boolean appliedToSalePrice) Whether theadjustmentValuewas applied toEnhancedLineItem.getStandardPrice()orEnhancedLineItem.getSalePrice().voidsetCandidateItemOffer(CandidateItemOffer candidateItemOffer) TheCandidateItemOfferDTO related tooffer.voidsetFutureCredit(boolean futureCredit) Future credit means that the associated adjustment will be discounted at a later time to the customer via a credit.voidsetItemAdjustmentQuantity(int itemAdjustmentQuantity) The total quantity of the current line item this offer was applied to.voidsetMaxSavingIndicator(String maxSavingIndicator) Set to "Y" if the adjustment should ignore a merge due to being part of a max savings calculation.voidTheOffertargeting someEnhancedLineItem.voidsetOfferUses(int offerUses) The total number of times that the offer this adjustment was created from is applied.voidsetParentDetail(LineItemOfferDetail parentDetail) voidsetQualifierDetails(List<com.broadleafcommerce.promotion.offer.client.web.context.info.OfferItemDetail> qualifierDetails) A list ofOfferItemDetailsrepresenting the qualifier items where this adjustment was from.voidsetQuantityPerUsage(int quantityPerUsage) The quantity per offer usage of the item where this adjustment is applied to (target item).voidsetSaleAdjustmentValue(javax.money.MonetaryAmount saleAdjustmentValue) The amount by which to adjust theEnhancedLineItem.getSalePrice().voidsetStandardAdjustmentValue(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
offerisCombinabilityType.ANY
-
isTotalitarian
public boolean isTotalitarian()- Returns:
- whether the
offerisCombinabilityType.NONE
-
finalizeAdjustment
public void finalizeAdjustment(boolean useSalePrice) SetsadjustmentValueandappliedToSalePrice.- Parameters:
useSalePrice- whether to use thesaleAdjustmentValueor thestandardAdjustmentValue.
-
copy
@NonNull public ItemOfferAdjustment copy(@NonNull com.broadleafcommerce.common.extension.TypeFactory offerFactory) Creates a copy of this adjustment.- Parameters:
offerFactory- theTypeFactoryused to create a new adjustment instance- Returns:
- the new adjustment instance
-
getOffer
- Returns:
- The
Offertargeting 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
TheCandidateItemOfferDTO related tooffer.- Returns:
- The
CandidateItemOfferDTO 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'sprice.- Returns:
- The final amount by which to adjust the
order item'sprice.
-
isAppliedToSalePrice
public boolean isAppliedToSalePrice()Whether theadjustmentValuewas applied toEnhancedLineItem.getStandardPrice()orEnhancedLineItem.getSalePrice().- Returns:
- Whether the
adjustmentValuewas 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 ofOfferItemDetailsrepresenting 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
TheOffertargeting someEnhancedLineItem.- Parameters:
offer- TheOffertargeting someEnhancedLineItem.
-
setCandidateItemOffer
TheCandidateItemOfferDTO related tooffer.- Parameters:
candidateItemOffer- TheCandidateItemOfferDTO 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'sprice.- Parameters:
adjustmentValue- The final amount by which to adjust theorder item'sprice.
-
setAppliedToSalePrice
public void setAppliedToSalePrice(boolean appliedToSalePrice) Whether theadjustmentValuewas applied toEnhancedLineItem.getStandardPrice()orEnhancedLineItem.getSalePrice().- Parameters:
appliedToSalePrice- Whether theadjustmentValuewas 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 ofOfferItemDetailsrepresenting 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
-