Class ExistingAdjustmentDetail

java.lang.Object
com.broadleafcommerce.cartoperation.domain.subscription.ExistingAdjustmentDetail
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ExistingSubscriptionAdjustmentDetail, ExistingSubscriptionItemAdjustmentDetail

public class ExistingAdjustmentDetail extends Object implements Serializable
Represents details of an existing adjustment when entering a modify-subscription flow such as for edit, upgrade, or downgrade.

This is helpful to avoid any existing adjustments from being lost after modifying a subscription.

Since:
Cart Operation Service 2.3.0, Release Train 2.3.0
Author:
Sunny Yu
See Also:
  • Constructor Details

    • ExistingAdjustmentDetail

      public ExistingAdjustmentDetail()
  • Method Details

    • isAdjustmentUsable

      public boolean isAdjustmentUsable()
      Determines whether this adjustment is still usable based on the freeTrialEndDate or periodsAlreadyUsed.
    • getId

      public String getId()
    • getAdjustmentRef

      public String getAdjustmentRef()
      The reference of the adjustment, the id of the applied offer by default.
    • getAdjustmentName

      public String getAdjustmentName()
      The name of the adjustment, the name of the applied offer by default.
    • getAdjustmentType

      public String getAdjustmentType()
      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.
      See Also:
      • DefaultAdjustmentType
    • getBeginPeriod

      public Integer getBeginPeriod()
      Number of the billing period this adjustment starts being active.
    • getEndPeriod

      @Nullable public Integer getEndPeriod()
      Number of the billing period this adjustment stops. If this field is null, the adjustment is considered indefinite
    • getFreeTrialEndDate

      @Nullable public Instant getFreeTrialEndDate()
      The end date of the free trial for this subscription, if applicable, null if none applied.

      This is an easy way to determine if a subscription is in a free trial period without having to calculate from the adjustment.

    • getPeriodsAlreadyUsed

      public int getPeriodsAlreadyUsed()
      Represents the number of periods this adjustment has already been used. This is helpful to determine if the adjustment has any remaining periods.
    • getAttributes

      public Map<String,Object> getAttributes()
      Additional attributes to include.
    • setId

      public void setId(String id)
    • setAdjustmentRef

      public void setAdjustmentRef(String adjustmentRef)
      The reference of the adjustment, the id of the applied offer by default.
    • setAdjustmentName

      public void setAdjustmentName(String adjustmentName)
      The name of the adjustment, the name of the applied offer by default.
    • setAdjustmentType

      public void setAdjustmentType(String adjustmentType)
      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.
      See Also:
      • DefaultAdjustmentType
    • setBeginPeriod

      public void setBeginPeriod(Integer beginPeriod)
      Number of the billing period this adjustment starts being active.
    • setEndPeriod

      public void setEndPeriod(@Nullable Integer endPeriod)
      Number of the billing period this adjustment stops. If this field is null, the adjustment is considered indefinite
    • setFreeTrialEndDate

      public void setFreeTrialEndDate(@Nullable Instant freeTrialEndDate)
      The end date of the free trial for this subscription, if applicable, null if none applied.

      This is an easy way to determine if a subscription is in a free trial period without having to calculate from the adjustment.

    • setPeriodsAlreadyUsed

      public void setPeriodsAlreadyUsed(int periodsAlreadyUsed)
      Represents the number of periods this adjustment has already been used. This is helpful to determine if the adjustment has any remaining periods.
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
      Additional attributes to include.
    • 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