java.lang.Object
com.broadleafcommerce.orderoperation.domain.subscription.Subscription
All Implemented Interfaces:
com.broadleafcommerce.money.CurrencyConsumer, Serializable, javax.money.CurrencySupplier

public class Subscription extends Object implements javax.money.CurrencySupplier, com.broadleafcommerce.money.CurrencyConsumer, Serializable
This is a domain representing a user's subscription to a service or a good. The particular line items of the subscription are contained in SubscriptionItem objects, while any price changes would be held by adjustments. Changes to a subscription's status should be followed by a SubscriptionStatusAudit to track them.
Since:
Order Operation Service 2.2.0, Release Train 2.3.0
See Also:
  • Constructor Details

    • Subscription

      public Subscription()
  • Method Details

    • setCurrencyCode

      public void setCurrencyCode(String currencyCode)
    • addAttribute

      public void addAttribute(String name, Object value)
      Takes in any additional attributes passed in the request not matching any defined properties.
      Parameters:
      name - Name of the additional attribute
      value - Value of the additional attribute
    • getAttribute

      public Map<String,Object> getAttribute()
      Return any additional attributes passed in the request not matching any defined properties.
      Returns:
      any additional attributes passed in the request not matching any defined properties.
    • getId

      public String getId()
    • getName

      public String getName()
      Name of this subscription
    • getSubscriptionStatus

      public String getSubscriptionStatus()
      Current status of this subscription
      See Also:
    • getSubscriptionNextStatus

      public String getSubscriptionNextStatus()
      Next status for this subscription
      See Also:
    • getNextStatusChangeDate

      public Date getNextStatusChangeDate()
      Date when the next status should begin
      See Also:
      • subscriptionNextStatus
    • getNextStatusChangeReason

      public String getNextStatusChangeReason()
      Reason for the update to the next status
      See Also:
      • subscriptionNextStatus
    • getResumeDate

      public Date getResumeDate()
      Date this subscription will or did continue. This is likely to be used only after a subscription was paused or stopped.
    • getRootItemRefType

      public String getRootItemRefType()
      Type of the item for which this subscription was provisioned
    • getRootItemRef

      public String getRootItemRef()
      Reference to the item id for which this subscription was provision
    • getUserRefType

      public String getUserRefType()
      Type of user owning this subscription
      See Also:
      • DefaultUserTypes
    • getUserRef

      public String getUserRef()
      Reference to the user to whom this subscription belongs
    • getAlternateUserRefType

      public String getAlternateUserRefType()
      Type of the alternative user reference
      See Also:
      • DefaultUserTypes
    • getAlternateUserRef

      public String getAlternateUserRef()
      Alternate reference to the user. Useful for third-party authentication system identifiers
    • getSubscriptionSource

      public String getSubscriptionSource()
      This field shows from which process or user action this subscription originated.
      See Also:
    • getSubscriptionSourceRef

      public String getSubscriptionSourceRef()
      This field shows the identifier of the process or user action this subscription originated.
      See Also:
      • subscriptionSource
    • getSecondarySourceType

      public String getSecondarySourceType()
      The type of the secondary source to reference, e.g, an Order Item on an Order. Optional.
      See Also:
    • getSecondarySourceRef

      public String getSecondarySourceRef()
      The secondary source to reference, e.g, an Order Item on an Order. Optional.
      See Also:
      • secondarySourceType
    • getSiteIdentifier

      public String getSiteIdentifier()
      Multi-tenancy support
    • getPeriodFrequency

      public int getPeriodFrequency()
      The frequency with which the recurring price should be charged., e.g., a value of 1 combined with periodType of MONTH would indicate to a subscription service that the price should be charged every 1 month.
      See Also:
      • periodType
    • getPeriodType

      public String getPeriodType()
      The period type for the price, e.g. MONTHLY, QUARTERLY, ANNUALLY
      See Also:
      • periodFrequency
    • getPaymentStrategy

      public String getPaymentStrategy()
      Declares that payments made against a subscription are going towards the goods/services rendered in the previous vs current period.
      See Also:
    • getPriorBillDate

      public Date getPriorBillDate()
      The bill date for the previous period
    • getNextBillDate

      public Date getNextBillDate()
      Next date this subscription will be billed
    • getPreferredPaymentAccountId

      public String getPreferredPaymentAccountId()
      References an identifier of a PaymentAccount that is considered preferred for this subscription.
    • getCurrency

      public javax.money.CurrencyUnit getCurrency()
      Currency of this subscription
      Specified by:
      getCurrency in interface javax.money.CurrencySupplier
    • getNextSubscription

      public String getNextSubscription()
      If this subscription was upgraded or downgraded, holds the reference to the subscription replacing this one
    • getLastBillingBatchId

      public String getLastBillingBatchId()
      The batch id of the last billing job run for this subscription
    • getLastBillingOperationStatus

      public String getLastBillingOperationStatus()
      The most current status of the last billing event for this subscription
    • getLastBillingSuccessDate

      public Date getLastBillingSuccessDate()
      Last date this that the Billing Job succeeded billing this subscription
    • getCreatedDate

      public Date getCreatedDate()
      Date this subscription was created. This field should not be updated or set by a request.
    • isChargeback

      public boolean isChargeback()
      Whether this subscription is being cancelled due to a chargeback
    • getNextPeriod

      public Integer getNextPeriod()
      The next period this subscription will cover. This value is related to 'beginPeriod' and 'endPeriod' fields of SubscriptionAdjustment and SubscriptionItemAdjustment
    • getPeriods

      public List<SubscriptionPeriod> getPeriods()
      List tracking the Subscription's periods. Typically, this correlates to the set of periods for which a BillingEvent has been created.
    • isNeedGrantEntitlements

      public boolean isNeedGrantEntitlements()
      Whether the system has outstanding entitlements to grant on this subscription
    • getSubscriptionAdjustments

      public List<SubscriptionAdjustment> getSubscriptionAdjustments()
      Adjustments for this subscription. This field is used for creation from an API request and is not persisted with the object
    • isAutoRenewalEnabled

      public boolean isAutoRenewalEnabled()
      Whether this subscription automatically renews at the end of the current subscription term.
    • getStartOfTermDate

      public Instant getStartOfTermDate()
      The start of term date for this subscription.
    • getEndOfTermDate

      public Instant getEndOfTermDate()
      The end of term date for this subscription.
    • getTermDurationLength

      public Integer getTermDurationLength()
      The length of the terms, e.g., if this is 36 and termDurationType is MONTHS, then the user should be billed for 36 months.
      See Also:
      • termDurationType
    • getTermDurationType

      public String getTermDurationType()
      The term duration type, e.g. DAYS, WEEKS, MONTHS, YEARS.
      See Also:
      • termDurationLength
    • getCancellationPolicyRef

      public String getCancellationPolicyRef()
      A reference of the CancellationPolicy that governs how this subscription would be cancelled.
    • getFulfillmentWorkflow

      public String getFulfillmentWorkflow()
      A reference to the workflow used to fulfill the creation of, & modifications to, this subscription.
    • getAttributes

      public Map<String,Object> getAttributes()
      Map holding any additional attributes passed in the request not matching any defined properties.
    • getInternalAttributes

      public Map<String,Object> getInternalAttributes()
      Miscellaneous internal attributes for this subscription. Distinguished from getAttributes() in that this map is used for attributes that assist in the internal working of Broadleaf.
      Since:
      Order Operation Service 2.2.0, Release Train 2.3.0
    • getVersion

      public Integer getVersion()
      The version of this subscription. Used for checking if the requested version of the subscription is up-to-date before saving changes. This should never be manually decremented/incremented.
    • 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.
    • setId

      public void setId(String id)
    • setName

      public void setName(String name)
      Name of this subscription
    • setSubscriptionStatus

      public void setSubscriptionStatus(String subscriptionStatus)
      Current status of this subscription
      See Also:
    • setSubscriptionNextStatus

      public void setSubscriptionNextStatus(String subscriptionNextStatus)
      Next status for this subscription
      See Also:
    • setNextStatusChangeDate

      public void setNextStatusChangeDate(Date nextStatusChangeDate)
      Date when the next status should begin
      See Also:
      • subscriptionNextStatus
    • setNextStatusChangeReason

      public void setNextStatusChangeReason(String nextStatusChangeReason)
      Reason for the update to the next status
      See Also:
      • subscriptionNextStatus
    • setResumeDate

      public void setResumeDate(Date resumeDate)
      Date this subscription will or did continue. This is likely to be used only after a subscription was paused or stopped.
    • setRootItemRefType

      public void setRootItemRefType(String rootItemRefType)
      Type of the item for which this subscription was provisioned
    • setRootItemRef

      public void setRootItemRef(String rootItemRef)
      Reference to the item id for which this subscription was provision
    • setUserRefType

      public void setUserRefType(String userRefType)
      Type of user owning this subscription
      See Also:
      • DefaultUserTypes
    • setUserRef

      public void setUserRef(String userRef)
      Reference to the user to whom this subscription belongs
    • setAlternateUserRefType

      public void setAlternateUserRefType(String alternateUserRefType)
      Type of the alternative user reference
      See Also:
      • DefaultUserTypes
    • setAlternateUserRef

      public void setAlternateUserRef(String alternateUserRef)
      Alternate reference to the user. Useful for third-party authentication system identifiers
    • setSubscriptionSource

      public void setSubscriptionSource(String subscriptionSource)
      This field shows from which process or user action this subscription originated.
      See Also:
    • setSubscriptionSourceRef

      public void setSubscriptionSourceRef(String subscriptionSourceRef)
      This field shows the identifier of the process or user action this subscription originated.
      See Also:
      • subscriptionSource
    • setSecondarySourceType

      public void setSecondarySourceType(String secondarySourceType)
      The type of the secondary source to reference, e.g, an Order Item on an Order. Optional.
      See Also:
    • setSecondarySourceRef

      public void setSecondarySourceRef(String secondarySourceRef)
      The secondary source to reference, e.g, an Order Item on an Order. Optional.
      See Also:
      • secondarySourceType
    • setSiteIdentifier

      public void setSiteIdentifier(String siteIdentifier)
      Multi-tenancy support
    • setPeriodFrequency

      public void setPeriodFrequency(int periodFrequency)
      The frequency with which the recurring price should be charged., e.g., a value of 1 combined with periodType of MONTH would indicate to a subscription service that the price should be charged every 1 month.
      See Also:
      • periodType
    • setPeriodType

      public void setPeriodType(String periodType)
      The period type for the price, e.g. MONTHLY, QUARTERLY, ANNUALLY
      See Also:
      • periodFrequency
    • setPaymentStrategy

      public void setPaymentStrategy(String paymentStrategy)
      Declares that payments made against a subscription are going towards the goods/services rendered in the previous vs current period.
      See Also:
    • setPriorBillDate

      public void setPriorBillDate(Date priorBillDate)
      The bill date for the previous period
    • setNextBillDate

      public void setNextBillDate(Date nextBillDate)
      Next date this subscription will be billed
    • setPreferredPaymentAccountId

      public void setPreferredPaymentAccountId(String preferredPaymentAccountId)
      References an identifier of a PaymentAccount that is considered preferred for this subscription.
    • setCurrency

      public void setCurrency(javax.money.CurrencyUnit currency)
      Currency of this subscription
      Specified by:
      setCurrency in interface com.broadleafcommerce.money.CurrencyConsumer
    • setNextSubscription

      public void setNextSubscription(String nextSubscription)
      If this subscription was upgraded or downgraded, holds the reference to the subscription replacing this one
    • setLastBillingBatchId

      public void setLastBillingBatchId(String lastBillingBatchId)
      The batch id of the last billing job run for this subscription
    • setLastBillingOperationStatus

      public void setLastBillingOperationStatus(String lastBillingOperationStatus)
      The most current status of the last billing event for this subscription
    • setLastBillingSuccessDate

      public void setLastBillingSuccessDate(Date lastBillingSuccessDate)
      Last date this that the Billing Job succeeded billing this subscription
    • setCreatedDate

      public void setCreatedDate(Date createdDate)
      Date this subscription was created. This field should not be updated or set by a request.
    • setChargeback

      public void setChargeback(boolean chargeback)
      Whether this subscription is being cancelled due to a chargeback
    • setNextPeriod

      public void setNextPeriod(Integer nextPeriod)
      The next period this subscription will cover. This value is related to 'beginPeriod' and 'endPeriod' fields of SubscriptionAdjustment and SubscriptionItemAdjustment
    • setPeriods

      public void setPeriods(List<SubscriptionPeriod> periods)
      List tracking the Subscription's periods. Typically, this correlates to the set of periods for which a BillingEvent has been created.
    • setNeedGrantEntitlements

      public void setNeedGrantEntitlements(boolean needGrantEntitlements)
      Whether the system has outstanding entitlements to grant on this subscription
    • setSubscriptionAdjustments

      public void setSubscriptionAdjustments(List<SubscriptionAdjustment> subscriptionAdjustments)
      Adjustments for this subscription. This field is used for creation from an API request and is not persisted with the object
    • setAutoRenewalEnabled

      public void setAutoRenewalEnabled(boolean autoRenewalEnabled)
      Whether this subscription automatically renews at the end of the current subscription term.
    • setStartOfTermDate

      public void setStartOfTermDate(Instant startOfTermDate)
      The start of term date for this subscription.
    • setEndOfTermDate

      public void setEndOfTermDate(Instant endOfTermDate)
      The end of term date for this subscription.
    • setTermDurationLength

      public void setTermDurationLength(Integer termDurationLength)
      The length of the terms, e.g., if this is 36 and termDurationType is MONTHS, then the user should be billed for 36 months.
      See Also:
      • termDurationType
    • setTermDurationType

      public void setTermDurationType(String termDurationType)
      The term duration type, e.g. DAYS, WEEKS, MONTHS, YEARS.
      See Also:
      • termDurationLength
    • setCancellationPolicyRef

      public void setCancellationPolicyRef(String cancellationPolicyRef)
      A reference of the CancellationPolicy that governs how this subscription would be cancelled.
    • setFulfillmentWorkflow

      public void setFulfillmentWorkflow(String fulfillmentWorkflow)
      A reference to the workflow used to fulfill the creation of, & modifications to, this subscription.
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
      Map holding any additional attributes passed in the request not matching any defined properties.
    • setInternalAttributes

      public void setInternalAttributes(Map<String,Object> internalAttributes)
      Miscellaneous internal attributes for this subscription. Distinguished from getAttributes() in that this map is used for attributes that assist in the internal working of Broadleaf.
      Since:
      Order Operation Service 2.2.0, Release Train 2.3.0
    • setVersion

      public void setVersion(Integer version)
      The version of this subscription. Used for checking if the requested version of the subscription is up-to-date before saving changes. This should never be manually decremented/incremented.
    • 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.
    • 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