Class ItemOfferAdjustment
- java.lang.Object
-
- com.broadleafcommerce.promotion.offer.web.context.info.ItemOfferAdjustment
-
- All Implemented Interfaces:
Serializable
public class ItemOfferAdjustment extends Object implements Serializable
DTO containing price adjustment information for aEnhancedLineItemcaused by aCandidateItemOffertargeting it. Tracks whether theEnhancedLineItem.getStandardPrice()orEnhancedLineItem.getSalePrice()should be discounted.- Author:
- Nathan Moore (nathanmoore).
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ItemOfferAdjustment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)ItemOfferAdjustmentcopy(com.broadleafcommerce.common.extension.TypeFactory offerFactory)Creates a copy of this adjustment.booleanequals(Object o)voidfinalizeAdjustment(boolean useSalePrice)SetsadjustmentValueandappliedToSalePrice.javax.money.MonetaryAmountgetAdjustmentValue()The final amount by which to adjust theorder item'sprice.CandidateItemOffergetCandidateItemOffer()TheCandidateItemOfferDTO related tooffer.EnhancedLineItemgetLineItem()OffergetOffer()intgetOfferUses()The number of times that the offer this adjustment was created from is applied.LineItemOfferDetailgetParentDetail()List<com.broadleafcommerce.promotion.offer.client.web.context.info.OfferItemDetail>getQualifierDetails()A list ofOfferItemDetailsrepresenting the qualifier items where this adjustment was from.intgetQuantity()intgetQuantityPerUsage()The quantity per offer usage of the item where this adjustment is applied to (target item).javax.money.MonetaryAmountgetSaleAdjustmentValue()The amount by which to adjust theEnhancedLineItem.getSalePrice().javax.money.MonetaryAmountgetStandardAdjustmentValue()The amount by which to adjust theEnhancedLineItem.getStandardPrice().inthashCode()booleanisAppliedToSalePrice()Whether theadjustmentValuewas applied toEnhancedLineItem.getStandardPrice()orEnhancedLineItem.getSalePrice().booleanisCombinable()booleanisFutureCredit()Future credit means that the associated adjustment will be discounted at a later time to the customer via a credit.booleanisTotalitarian()voidsetAdjustmentValue(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.voidsetOffer(Offer offer)TheOffertargeting someEnhancedLineItem.voidsetOfferUses(int offerUses)The 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().StringtoString()
-
-
-
Method Detail
-
getQuantity
public int getQuantity()
-
getLineItem
public EnhancedLineItem 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
public Offer getOffer()
- Returns:
- The
Offertargeting someEnhancedLineItem.
-
getCandidateItemOffer
public CandidateItemOffer 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:
DiscountTimingType.FUTURE_CREDIT
-
getParentDetail
public LineItemOfferDetail 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).
-
getOfferUses
public int getOfferUses()
The number of times that the offer this adjustment was created from is applied.
-
setOffer
public void setOffer(Offer offer)
TheOffertargeting someEnhancedLineItem.- Parameters:
offer- TheOffertargeting someEnhancedLineItem.
-
setCandidateItemOffer
public void setCandidateItemOffer(CandidateItemOffer candidateItemOffer)
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:
DiscountTimingType.FUTURE_CREDIT
-
setParentDetail
public void setParentDetail(LineItemOfferDetail parentDetail)
-
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).
-
setOfferUses
public void setOfferUses(int offerUses)
The number of times that the offer this adjustment was created from is applied.
-
canEqual
protected boolean canEqual(Object other)
-
-