Class Adjustment

java.lang.Object
com.broadleafcommerce.order.common.domain.Adjustment
All Implemented Interfaces:
Serializable

public class Adjustment extends Object implements Serializable
An adjustment to be applied to the original price of the containing entity. Typically, this could be applied to a cart, order, fulfillment, or their items.
Author:
Chad Harchar (charchar)
See Also:
  • Constructor Details

    • Adjustment

      public Adjustment()
  • Method Details

    • getType

      public String getType()
      Determines the value to return for the adjustment's timing type. If type is null, then this returns DefaultAdjustmentType.ORDER_DISCOUNT, else the value of type.
      Returns:
      The timing type for the adjustment.
    • getOfferRef

      public OfferRef getOfferRef()
      A reference to the offer that originated this adjustment.
      Returns:
      A reference to the offer that originated this adjustment.
    • getOfferCodeRef

      public String getOfferCodeRef()
      A reference to the OfferCode (if any).
    • getAmount

      public javax.money.MonetaryAmount getAmount()
      The amount of this adjustment.
      Returns:
      The amount of this adjustment.
    • getCodeUsed

      public String getCodeUsed()
      The code used (if any) that triggered the application of the offer for this adjustment.
      Returns:
      The code used (if any) that triggered the application of the offer for this adjustment.
    • getAlternateAdjustmentSource

      public String getAlternateAdjustmentSource()
      If this adjustment is not created by an offer this parameter will specify the source of adjustment.
      Returns:
      the source of the adjustment.
      See Also:
    • getQualifierDetails

      public List<OfferItemDetail> getQualifierDetails()
      A list of OfferItemDetails representing the qualifier items where this adjustment was from.

      For example, ItemA and ItemB qualify for a free gift offer, which results Item_FG to be added as a free gift item. These details are used to identify ItemA and ItemB from free gift item Item_FG using its adjustment.

      Take another example, ItemA qualifies for a Buy 1 itemA Get 1 itemB free offer. These details are used to identity the qualifier item ItemA from target item ItemB.

    • getQuantityPerUsage

      public int getQuantityPerUsage()
      The quantity per offer usage of the target item that this adjustment is for.
    • getItemAdjustmentQuantity

      public int getItemAdjustmentQuantity()
      The quantity of the current line item that this offer was applied to.
    • getOfferUses

      public int getOfferUses()
      The number of times that the offer this adjustment was created from is applied.
    • getCampaignTrackingId

      public String getCampaignTrackingId()
      The campaign tracking id (if any) for this adjustment.
    • getServiceLevel

      public String getServiceLevel()
      The serviceLevel that this adjustment applies to (typically used only with fulfillment group offers to indicate that the discount applies to the portion of the fulfillment price related to a specific service level. For example, for a group containing some items shipped by STANDARD and some as EXPRESS it is possible the discount only applies to the EXPRESS items. A blank value would indicate the discount applies to all service levels.
    • getFreeTrialLength

      public int getFreeTrialLength()
      If type is DefaultAdjustmentType.FREE_TRIAL, then this defines the free trial's length.
      Since:
      Order Common 2.0.3
      See Also:
      • freeTrialLengthUnits
    • getFreeTrialLengthUnits

      public String getFreeTrialLengthUnits()
      If type is DefaultAdjustmentType.FREE_TRIAL, then this defines the units for freeTrialLength. Default is DefaultFreeTrialLengthUnits.DAYS.
      Since:
      Order Common 2.0.3
      See Also:
    • getBeginPeriod

      public int getBeginPeriod()
      If type is DefaultAdjustmentType.RECURRING_DISCOUNT, this is the beginning period for the discount. 1 refers to the first recurring billing period, and so on.
      Since:
      Order Common 2.0.3
    • getEndPeriod

      public Integer getEndPeriod()
      If type is DefaultAdjustmentType.RECURRING_DISCOUNT, this is the ending period for the discount. 1 refers to the first recurring billing period, and so on.
      Since:
      Order Common 2.0.3
    • setOfferRef

      public void setOfferRef(OfferRef offerRef)
      A reference to the offer that originated this adjustment.
      Parameters:
      offerRef - A reference to the offer that originated this adjustment.
    • setOfferCodeRef

      public void setOfferCodeRef(String offerCodeRef)
      A reference to the OfferCode (if any).
    • setAmount

      public void setAmount(javax.money.MonetaryAmount amount)
      The amount of this adjustment.
      Parameters:
      amount - The amount of this adjustment.
    • setCodeUsed

      public void setCodeUsed(String codeUsed)
      The code used (if any) that triggered the application of the offer for this adjustment.
      Parameters:
      codeUsed - The code used (if any) that triggered the application of the offer for this adjustment.
    • setAlternateAdjustmentSource

      public void setAlternateAdjustmentSource(String alternateAdjustmentSource)
      If this adjustment is not created by an offer this parameter will specify the source of adjustment.
      Parameters:
      alternateAdjustmentSource - the source of the adjustment.
      See Also:
    • setQualifierDetails

      public void setQualifierDetails(List<OfferItemDetail> qualifierDetails)
      A list of OfferItemDetails representing the qualifier items where this adjustment was from.

      For example, ItemA and ItemB qualify for a free gift offer, which results Item_FG to be added as a free gift item. These details are used to identify ItemA and ItemB from free gift item Item_FG using its adjustment.

      Take another example, ItemA qualifies for a Buy 1 itemA Get 1 itemB free offer. These details are used to identity the qualifier item ItemA from target item ItemB.

    • setQuantityPerUsage

      public void setQuantityPerUsage(int quantityPerUsage)
      The quantity per offer usage of the target item that this adjustment is for.
    • setItemAdjustmentQuantity

      public void setItemAdjustmentQuantity(int itemAdjustmentQuantity)
      The quantity of the current line item that this offer was applied to.
    • setOfferUses

      public void setOfferUses(int offerUses)
      The number of times that the offer this adjustment was created from is applied.
    • setCampaignTrackingId

      public void setCampaignTrackingId(String campaignTrackingId)
      The campaign tracking id (if any) for this adjustment.
    • setServiceLevel

      public void setServiceLevel(String serviceLevel)
      The serviceLevel that this adjustment applies to (typically used only with fulfillment group offers to indicate that the discount applies to the portion of the fulfillment price related to a specific service level. For example, for a group containing some items shipped by STANDARD and some as EXPRESS it is possible the discount only applies to the EXPRESS items. A blank value would indicate the discount applies to all service levels.
    • setType

      public void setType(String type)
      Defines the type of the adjustment. This primarily determines when it should be applied to the order or items. This helps distinguish whether the adjustment applies at checkout or later such as for a subscription.
      Since:
      Order Common 2.0.3
    • setFreeTrialLength

      public void setFreeTrialLength(int freeTrialLength)
      If type is DefaultAdjustmentType.FREE_TRIAL, then this defines the free trial's length.
      Since:
      Order Common 2.0.3
      See Also:
      • freeTrialLengthUnits
    • setFreeTrialLengthUnits

      public void setFreeTrialLengthUnits(String freeTrialLengthUnits)
      If type is DefaultAdjustmentType.FREE_TRIAL, then this defines the units for freeTrialLength. Default is DefaultFreeTrialLengthUnits.DAYS.
      Since:
      Order Common 2.0.3
      See Also:
    • setBeginPeriod

      public void setBeginPeriod(int beginPeriod)
      If type is DefaultAdjustmentType.RECURRING_DISCOUNT, this is the beginning period for the discount. 1 refers to the first recurring billing period, and so on.
      Since:
      Order Common 2.0.3
    • setEndPeriod

      public void setEndPeriod(Integer endPeriod)
      If type is DefaultAdjustmentType.RECURRING_DISCOUNT, this is the ending period for the discount. 1 refers to the first recurring billing period, and so on.
      Since:
      Order Common 2.0.3
    • 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