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 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 Details

    • ItemOfferAdjustment

      public ItemOfferAdjustment()
  • Method Details

    • getQuantity

      public int getQuantity()
    • getLineItem

      public EnhancedLineItem getLineItem()
    • isCombinable

      public boolean isCombinable()
      Returns:
      whether the offer is CombinabilityType.ANY
    • isTotalitarian

      public boolean isTotalitarian()
      Returns:
      whether the offer is CombinabilityType.NONE
    • finalizeAdjustment

      public void finalizeAdjustment(boolean useSalePrice)
      Sets adjustmentValue and appliedToSalePrice.
      Parameters:
      useSalePrice - whether to use the saleAdjustmentValue or the standardAdjustmentValue.
    • copy

      @NonNull public ItemOfferAdjustment copy(@NonNull com.broadleafcommerce.common.extension.TypeFactory offerFactory)
      Creates a copy of this adjustment.
      Parameters:
      offerFactory - the TypeFactory used to create a new adjustment instance
      Returns:
      the new adjustment instance
    • getOffer

      public Offer getOffer()
      Returns:
      The Offer targeting some EnhancedLineItem.
    • 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

      public CandidateItemOffer getCandidateItemOffer()
      The CandidateItemOffer DTO related to offer.
      Returns:
      The CandidateItemOffer DTO related to offer.
    • getSaleAdjustmentValue

      public javax.money.MonetaryAmount getSaleAdjustmentValue()
      The amount by which to adjust the EnhancedLineItem.getSalePrice().
      Returns:
      The amount by which to adjust the EnhancedLineItem.getSalePrice().
    • getStandardAdjustmentValue

      public javax.money.MonetaryAmount getStandardAdjustmentValue()
      The amount by which to adjust the EnhancedLineItem.getStandardPrice().
      Returns:
      The amount by which to adjust the EnhancedLineItem.getStandardPrice().
    • getAdjustmentValue

      public javax.money.MonetaryAmount getAdjustmentValue()
      The final amount by which to adjust the order item's price.
      Returns:
      The final amount by which to adjust the order item's price.
    • isAppliedToSalePrice

      public boolean isAppliedToSalePrice()
      Whether the adjustmentValue was applied to EnhancedLineItem.getStandardPrice() or EnhancedLineItem.getSalePrice().
      Returns:
      Whether the adjustmentValue was applied to EnhancedLineItem.getStandardPrice() or EnhancedLineItem.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

      public LineItemOfferDetail getParentDetail()
    • getQualifierDetails

      public List<com.broadleafcommerce.promotion.offer.client.web.context.info.OfferItemDetail> getQualifierDetails()
      A list of OfferItemDetails 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

      public String getMaxSavingIndicator()
      Set to "Y" if the adjustment should ignore a merge due to being part of a max savings calculation.
    • setOffer

      public void setOffer(Offer offer)
      The Offer targeting some EnhancedLineItem.
      Parameters:
      offer - The Offer targeting some EnhancedLineItem.
    • setCandidateItemOffer

      public void setCandidateItemOffer(CandidateItemOffer candidateItemOffer)
      The CandidateItemOffer DTO related to offer.
      Parameters:
      candidateItemOffer - The CandidateItemOffer DTO related to offer.
    • setSaleAdjustmentValue

      public void setSaleAdjustmentValue(javax.money.MonetaryAmount saleAdjustmentValue)
      The amount by which to adjust the EnhancedLineItem.getSalePrice().
      Parameters:
      saleAdjustmentValue - The amount by which to adjust the EnhancedLineItem.getSalePrice().
    • setStandardAdjustmentValue

      public void setStandardAdjustmentValue(javax.money.MonetaryAmount standardAdjustmentValue)
      The amount by which to adjust the EnhancedLineItem.getStandardPrice().
      Parameters:
      amount - The amount by which to adjust the EnhancedLineItem.getStandardPrice().
    • setAdjustmentValue

      public void setAdjustmentValue(javax.money.MonetaryAmount adjustmentValue)
      The final amount by which to adjust the order item's price.
      Parameters:
      adjustmentValue - The final amount by which to adjust the order item's price.
    • setAppliedToSalePrice

      public void setAppliedToSalePrice(boolean appliedToSalePrice)
      Whether the adjustmentValue was applied to EnhancedLineItem.getStandardPrice() or EnhancedLineItem.getSalePrice().
      Parameters:
      appliedToSalePrice - Whether the adjustmentValue was applied to EnhancedLineItem.getStandardPrice() or EnhancedLineItem.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

      public void setParentDetail(LineItemOfferDetail parentDetail)
    • setQualifierDetails

      public void setQualifierDetails(List<com.broadleafcommerce.promotion.offer.client.web.context.info.OfferItemDetail> qualifierDetails)
      A list of OfferItemDetails 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

      public void setMaxSavingIndicator(String maxSavingIndicator)
      Set to "Y" if the adjustment should ignore a merge due to being part of a max savings calculation.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object