Class SubscriptionItemAdjustment

java.lang.Object
com.broadleafcommerce.subscriptionoperation.domain.SubscriptionItemAdjustment
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware, Adjustment, Serializable

public class SubscriptionItemAdjustment extends Object implements Adjustment, com.broadleafcommerce.data.tracking.core.ContextStateAware
This represents a line item price adjustment for a Subscription
See Also:
  • Constructor Details

    • SubscriptionItemAdjustment

      public SubscriptionItemAdjustment()
  • Method Details

    • getOwnerId

      public String getOwnerId()
      Description copied from interface: Adjustment
      Identifier for the subscription entity that owns this adjustment, e.g., the Subscription ID.
      Specified by:
      getOwnerId in interface Adjustment
      Returns:
      Identifier for the subscription entity that owns this adjustment, e.g., the Subscription ID.
      See Also:
    • getOwnerType

      public String getOwnerType()
      Description copied from interface: Adjustment
      The type of subscription entity that owns this adjustment, e.g., DefaultAdjustmentOwnerType.SUBSCRIPTION.
      Specified by:
      getOwnerType in interface Adjustment
      Returns:
      The type of subscription entity that owns this adjustment, e.g., DefaultAdjustmentOwnerType.SUBSCRIPTION.
      See Also:
    • getAdjustmentQuantity

      public Optional<Integer> getAdjustmentQuantity()
      Description copied from interface: Adjustment
      The quantity of the target item's units the adjustment applies to. If null, then the full quantity of the item is targeted. Not applicable to all types of adjustments.
      Specified by:
      getAdjustmentQuantity in interface Adjustment
      Returns:
      The quantity of the adjustment owner the adjustment applies to if applicable.
      See Also:
    • getId

      public String getId()
    • getSubscriptionItemId

      public String getSubscriptionItemId()
      Reference to the SubscriptionItem whose price this adjusts
    • getAdjustmentRef

      public String getAdjustmentRef()
      Description copied from interface: Adjustment
      Reference to the promotion or offer that drives this adjustment
      Specified by:
      getAdjustmentRef in interface Adjustment
      Returns:
      Reference to the promotion or offer that drives this adjustment
      See Also:
    • getSubscriptionAdjustmentType

      public String getSubscriptionAdjustmentType()
      Description copied from interface: Adjustment
      Type of adjustment that this adds
      Specified by:
      getSubscriptionAdjustmentType in interface Adjustment
      Returns:
      Type of adjustment that this adds
      See Also:
    • getAdjustmentAmount

      public BigDecimal getAdjustmentAmount()
      Description copied from interface: Adjustment
      Adjustment amount applied to the unit price of the target item.
      Specified by:
      getAdjustmentAmount in interface Adjustment
      Returns:
      Amount of the price adjustment
      See Also:
    • getBeginPeriod

      public Integer getBeginPeriod()
      Description copied from interface: Adjustment
      Number of the billing period this adjustment starts being active
      Specified by:
      getBeginPeriod in interface Adjustment
      Returns:
      Number of the billing period this adjustment starts being active
      See Also:
    • getEndPeriod

      public Integer getEndPeriod()
      Description copied from interface: Adjustment
      Number of the billing period this adjustment stops. If this field is null, the adjustment is considered indefinite
      Specified by:
      getEndPeriod in interface Adjustment
      Returns:
      Number of the billing period this adjustment stops. If this field is null, the adjustment is considered indefinite
      See Also:
    • getAdjustmentName

      public String getAdjustmentName()
      Description copied from interface: Adjustment
      Name of the adjustment applied.
      Specified by:
      getAdjustmentName in interface Adjustment
      Returns:
      Name of the adjustment applied.
      See Also:
    • getAdjustmentCartLabel

      public String getAdjustmentCartLabel()
      Description copied from interface: Adjustment
      Friendly label to display in the cart or to a customer in general instead of the Adjustment.getAdjustmentName().
      Specified by:
      getAdjustmentCartLabel in interface Adjustment
      Returns:
      Friendly label to display in the cart or to a customer in general instead of the Adjustment.getAdjustmentName().
      See Also:
    • getAdjustmentDescription

      public String getAdjustmentDescription()
      Description copied from interface: Adjustment
      A description of what benefits the adjustment provides to a customer.
      Specified by:
      getAdjustmentDescription in interface Adjustment
      Returns:
      A description of what benefits the adjustment provides to a customer.
      See Also:
    • getAdjustmentProrationType

      public String getAdjustmentProrationType()
      Description copied from interface: Adjustment
      Determines how an adjustment's discount amount is distributed across the adjustment's related item types. This can either be set to prorate across target items or target and qualifier items.
      Specified by:
      getAdjustmentProrationType in interface Adjustment
      Returns:
      Determines how an adjustment's discount amount is distributed across the adjustment's related item types. This can either be set to prorate across target items or target and qualifier items.
      See Also:
    • getAdjustmentCodeRef

      public String getAdjustmentCodeRef()
      Description copied from interface: Adjustment
      A reference to the Offer Code (if any).
      Specified by:
      getAdjustmentCodeRef in interface Adjustment
      Returns:
      A reference to the Offer Code (if any).
      See Also:
    • getAdjustmentDiscountMethodType

      public String getAdjustmentDiscountMethodType()
      Description copied from interface: Adjustment
      Determines the method used to apply the discount. Typically in Broadleaf, the Adjustment.getSubscriptionAdjustmentType() ends up as DefaultSubscriptionAdjustmentType.AMOUNT_OFF since the offer system calculates the actual amount to discount even if the base offer was a percentage off or fixed price. This field then is distinguished as the actual method specified on the offer before it was applied.
      Specified by:
      getAdjustmentDiscountMethodType in interface Adjustment
      Returns:
      The type of discount method used for this adjustment.
      See Also:
    • getAdjustmentDiscountFactor

      public BigDecimal getAdjustmentDiscountFactor()
      Description copied from interface: Adjustment
      The discount factor by which to discount a target. If the amount is 10, then whether it is calculated as a percentage (10%) or a currency amount ($10) is determined by Adjustment.getAdjustmentDiscountMethodType(). This does not represent that actual amount discounted from the target.
      Specified by:
      getAdjustmentDiscountFactor in interface Adjustment
      Returns:
      The discount factor used for this adjustment.
      See Also:
    • getCodeUsed

      public String getCodeUsed()
      Description copied from interface: Adjustment
      The code used (if any) that triggered the application of the adjustment for this adjustment.
      Specified by:
      getCodeUsed in interface Adjustment
      Returns:
      The code used (if any) that triggered the application of the adjustment for this adjustment.
      See Also:
    • getCampaignTrackingId

      public String getCampaignTrackingId()
      Description copied from interface: Adjustment
      The campaign tracking id (if any) for this adjustment.
      Specified by:
      getCampaignTrackingId in interface Adjustment
      Returns:
      The campaign tracking id (if any) for this adjustment.
      See Also:
    • getDiscountType

      public String getDiscountType()
      Description copied from interface: Adjustment
      Defines the type of the discount, e.g., free trial, order discount, future credit, etc. 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.
      Specified by:
      getDiscountType in interface Adjustment
      Returns:
      The type of the discount.
      See Also:
    • getQualifierDetails

      public List<com.broadleafcommerce.order.common.domain.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.

    • getItemAdjustmentQuantity

      public Integer getItemAdjustmentQuantity()
      The quantity of the SubscriptionItem the adjustment applies to. If null, then the full quantity of the item is targeted.
    • getFreeTrialLength

      public Integer getFreeTrialLength()
      Description copied from interface: Adjustment
      If Adjustment.getDiscountType() is FREE_TRIAL, then this defines the free trial's length.
      Specified by:
      getFreeTrialLength in interface Adjustment
      Returns:
      If Adjustment.getDiscountType() is FREE_TRIAL, then this defines the free trial's length.
      See Also:
    • getFreeTrialLengthUnits

      public String getFreeTrialLengthUnits()
      Description copied from interface: Adjustment
      If Adjustment.getDiscountType() is FREE_TRIAL, then this defines the units for Adjustment.getFreeTrialLength().
      Specified by:
      getFreeTrialLengthUnits in interface Adjustment
      Returns:
      If Adjustment.getDiscountType() is FREE_TRIAL, then this defines the units for Adjustment.getFreeTrialLength().
      See Also:
    • getCurrencyConversionDetail

      public com.broadleafcommerce.order.common.domain.CurrencyConversionDetail getCurrencyConversionDetail()
      Represents the details of the exchange rate used to convert a MonetaryAmount from one currency to another. This is used to describe the amount of the adjustment if it was converted from a base currency. This is done when the target item was in a different currency from the offer and was also converted, that is, the item's original currency was the same as that which the offer targets but its price was converted to another currency.
    • getAttributes

      public Map<String,Object> getAttributes()
      Miscellaneous attributes for this subscription item adjustment.
    • getContextState

      public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      getContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
    • setId

      public void setId(String id)
    • setSubscriptionItemId

      public void setSubscriptionItemId(String subscriptionItemId)
      Reference to the SubscriptionItem whose price this adjusts
    • setAdjustmentRef

      public void setAdjustmentRef(String adjustmentRef)
      See Also:
    • setSubscriptionAdjustmentType

      public void setSubscriptionAdjustmentType(String subscriptionAdjustmentType)
      See Also:
    • setAdjustmentAmount

      public void setAdjustmentAmount(BigDecimal adjustmentAmount)
      See Also:
    • setBeginPeriod

      public void setBeginPeriod(Integer beginPeriod)
      See Also:
    • setEndPeriod

      public void setEndPeriod(Integer endPeriod)
      See Also:
    • setAdjustmentName

      public void setAdjustmentName(String adjustmentName)
      See Also:
    • setAdjustmentCartLabel

      public void setAdjustmentCartLabel(String adjustmentCartLabel)
      See Also:
    • setAdjustmentDescription

      public void setAdjustmentDescription(String adjustmentDescription)
      See Also:
    • setAdjustmentProrationType

      public void setAdjustmentProrationType(String adjustmentProrationType)
      See Also:
    • setAdjustmentCodeRef

      public void setAdjustmentCodeRef(String adjustmentCodeRef)
      See Also:
    • setAdjustmentDiscountMethodType

      public void setAdjustmentDiscountMethodType(String adjustmentDiscountMethodType)
      See Also:
    • setAdjustmentDiscountFactor

      public void setAdjustmentDiscountFactor(BigDecimal adjustmentDiscountFactor)
      See Also:
    • setCodeUsed

      public void setCodeUsed(String codeUsed)
      See Also:
    • setCampaignTrackingId

      public void setCampaignTrackingId(String campaignTrackingId)
      See Also:
    • setDiscountType

      public void setDiscountType(String discountType)
      See Also:
    • setQualifierDetails

      public void setQualifierDetails(List<com.broadleafcommerce.order.common.domain.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.

    • setItemAdjustmentQuantity

      public void setItemAdjustmentQuantity(Integer itemAdjustmentQuantity)
      The quantity of the SubscriptionItem the adjustment applies to. If null, then the full quantity of the item is targeted.
    • setFreeTrialLength

      public void setFreeTrialLength(Integer freeTrialLength)
      See Also:
    • setFreeTrialLengthUnits

      public void setFreeTrialLengthUnits(String freeTrialLengthUnits)
      See Also:
    • setCurrencyConversionDetail

      public void setCurrencyConversionDetail(com.broadleafcommerce.order.common.domain.CurrencyConversionDetail currencyConversionDetail)
      Represents the details of the exchange rate used to convert a MonetaryAmount from one currency to another. This is used to describe the amount of the adjustment if it was converted from a base currency. This is done when the target item was in a different currency from the offer and was also converted, that is, the item's original currency was the same as that which the offer targets but its price was converted to another currency.
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
      Miscellaneous attributes for this subscription item adjustment.
    • setContextState

      public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      setContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
    • 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