Class SubscriptionItemAdjustmentPriceDetail

java.lang.Object
com.broadleafcommerce.subscriptionoperation.domain.SubscriptionItemAdjustmentPriceDetail
All Implemented Interfaces:
Serializable

public class SubscriptionItemAdjustmentPriceDetail extends Object implements Serializable
Represent the details of the price adjustment for a subscription item.
Author:
Sunny Yu
See Also:
  • Constructor Details

    • SubscriptionItemAdjustmentPriceDetail

      public SubscriptionItemAdjustmentPriceDetail()
  • Method Details

    • 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.
    • getAdjustmentRef

      public String getAdjustmentRef()
      See Also:
    • getSubscriptionItemAdjustmentRef

      public String getSubscriptionItemAdjustmentRef()
    • getExistingItemAdjustmentQuantity

      public Integer getExistingItemAdjustmentQuantity()
      The quantity of the item impacted by the adjustment prior to the subscription modification.

      It is important to keep track because the impacted quantity may change after the modification, and this is used to calculate the credited and prior unbilled amounts. For example, if the quantity is reduced from 10 to 5 from the modification, the discount amount to deduct from the credited amount should be calculated based on the original quantity of 10, whereas the discount amount to deduct from the prorated amount should be calculated based on the new quantity of 5.

      This is only relevant for subscription modification flows.

    • getAdjustmentQuantity

      public Integer getAdjustmentQuantity()
      The quantity of the item impacted by the adjustment after the subscription modification.

      For DefaultSubscriptionActionFlow.CREATE, this is just the item adjustment's quantity.

    • getExistingFullSubscriptionPeriodUnitDiscountAmount

      public javax.money.MonetaryAmount getExistingFullSubscriptionPeriodUnitDiscountAmount()
      The existing, un-prorated unit discount amount prior to the subscription modification. This is only relevant for adjustments that were applied prior to the modification, and can be helpful to determine whether the discount has changed due to the modification.

      This serves an informational purpose for downstream services.

    • getFullSubscriptionPeriodUnitDiscountAmount

      public javax.money.MonetaryAmount getFullSubscriptionPeriodUnitDiscountAmount()
      The unit adjustment amount for this event item for the length of a full subscription period. This serves an informational purpose for downstream services.

      For DefaultSubscriptionActionFlow.CREATE, this is just the non-prorated unit discount amount for the applied adjustment.

    • getExistingProratedUnitAmountBetweenPeriodStartAndActionDate

      public javax.money.MonetaryAmount getExistingProratedUnitAmountBetweenPeriodStartAndActionDate()
      Similar to SubscriptionItemPriceDetail.getProratedUnitAmountBetweenPeriodStartAndActionDate(), this is the existingFullSubscriptionPeriodUnitDiscountAmount prorated for the period between the period start date and the action date and the regardless of the subscription action being taken or the payment strategy. This serves as informational purposes for downstream services.
    • getExistingProratedUnitAmountBetweenActionAndNextBillDate

      public javax.money.MonetaryAmount getExistingProratedUnitAmountBetweenActionAndNextBillDate()
      Similar to SubscriptionItemPriceDetail.getProratedUnitAmountBetweenActionAndNextBillDate(), this is the existingFullSubscriptionPeriodUnitDiscountAmount prorated for the period between the action date and the next bill date and the regardless of the subscription action being taken or the payment strategy. This serves as informational purposes for downstream services.
    • getProratedUnitAmountBetweenPeriodStartAndActionDate

      public javax.money.MonetaryAmount getProratedUnitAmountBetweenPeriodStartAndActionDate()
      Similar to SubscriptionItemPriceDetail.getProratedUnitAmountBetweenPeriodStartAndActionDate(), this is the fullSubscriptionPeriodUnitDiscountAmount prorated for the period between the period start date and the action date after subscription action, regardless of the subscription action being taken or the payment strategy. This serves as informational purposes for downstream services.
    • getProratedUnitAmountBetweenActionAndNextBillDate

      public javax.money.MonetaryAmount getProratedUnitAmountBetweenActionAndNextBillDate()
      Similar to SubscriptionItemPriceDetail.getProratedUnitAmountBetweenActionAndNextBillDate(), this is the fullSubscriptionPeriodUnitDiscountAmount prorated for the period between the action date and the next bill date after subscription action, regardless of the subscription action being taken or the payment strategy. This serves as informational purposes for downstream services.
    • isApplicableForThisPeriod

      public boolean isApplicableForThisPeriod()
      Whether this adjustment is applicable for the period that this detail is built for. This is useful for downstream services to determine whether the adjustment detail need to be considered for a certain period.
    • getProratedUnitDiscountAmount

      public javax.money.MonetaryAmount getProratedUnitDiscountAmount()
      Similar to SubscriptionItemPriceDetail.getProratedUnitAmount(), this is the original discount amount prorated relative to the next invoice date. For a new purchase, this reflects the full date range. For edits, upgrades, & downgrades, this reflects the prorated price between the action & the end of the billing period.
    • getCreditedUnitDiscountAmount

      public javax.money.MonetaryAmount getCreditedUnitDiscountAmount()
      The subscription item discount per unit to be deducted from the SubscriptionItemPriceDetail.getCreditedUnitAmount().

      Similar to SubscriptionItemPriceDetail.getCreditedUnitAmount(), the customer had the full discount applied in their previous payment, so when it needs to be credited due to an edit, upgrade, or downgrade, the discount amount needs to be prorated and deducted from the credited amount.

    • getPriorUnbilledUnitDiscountAmount

      public javax.money.MonetaryAmount getPriorUnbilledUnitDiscountAmount()
      The subscription item discount per unit to be deducted from the SubscriptionItemPriceDetail.getPriorUnbilledUnitAmount().

      Note: This typically only impacts the first period in the estimatedFuturePayments list.

      Similar to SubscriptionItemPriceDetail.getPriorUnbilledUnitAmount(), the discount amount also needs to be prorated and deducted from the prior unbilled amount, since the discount was applied prior to the edit, upgrade, or downgrade.

    • getUnitDiscountAmountForRemainderOfTerms

      public javax.money.MonetaryAmount getUnitDiscountAmountForRemainderOfTerms()
      The unit discount amount that is to be applied for the remainder of terms if the remainder of terms is being charged.
    • getUnitChargeForPreviouslyDiscountedPeriods

      public javax.money.MonetaryAmount getUnitChargeForPreviouslyDiscountedPeriods()
      The unit discount amount to charge for previously discounted periods.

      Note that this does not include the amount to charge for the current period. Rather, the amount to charge for the current period is included in getPriorUnbilledUnitDiscountAmount() and is negative to represent a charge.

    • 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()
      Map holding any additional attributes passed in the request not matching any defined properties.
    • getAdditionalAttributes

      public Map<String,Object> getAdditionalAttributes()
      Miscellaneous attributes that can be set to this request in order to inform business logic
    • setAdjustmentRef

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

      public void setSubscriptionItemAdjustmentRef(String subscriptionItemAdjustmentRef)
    • setExistingItemAdjustmentQuantity

      public void setExistingItemAdjustmentQuantity(Integer existingItemAdjustmentQuantity)
      The quantity of the item impacted by the adjustment prior to the subscription modification.

      It is important to keep track because the impacted quantity may change after the modification, and this is used to calculate the credited and prior unbilled amounts. For example, if the quantity is reduced from 10 to 5 from the modification, the discount amount to deduct from the credited amount should be calculated based on the original quantity of 10, whereas the discount amount to deduct from the prorated amount should be calculated based on the new quantity of 5.

      This is only relevant for subscription modification flows.

    • setAdjustmentQuantity

      public void setAdjustmentQuantity(Integer adjustmentQuantity)
      The quantity of the item impacted by the adjustment after the subscription modification.

      For DefaultSubscriptionActionFlow.CREATE, this is just the item adjustment's quantity.

    • setExistingFullSubscriptionPeriodUnitDiscountAmount

      public void setExistingFullSubscriptionPeriodUnitDiscountAmount(javax.money.MonetaryAmount existingFullSubscriptionPeriodUnitDiscountAmount)
      The existing, un-prorated unit discount amount prior to the subscription modification. This is only relevant for adjustments that were applied prior to the modification, and can be helpful to determine whether the discount has changed due to the modification.

      This serves an informational purpose for downstream services.

    • setFullSubscriptionPeriodUnitDiscountAmount

      public void setFullSubscriptionPeriodUnitDiscountAmount(javax.money.MonetaryAmount fullSubscriptionPeriodUnitDiscountAmount)
      The unit adjustment amount for this event item for the length of a full subscription period. This serves an informational purpose for downstream services.

      For DefaultSubscriptionActionFlow.CREATE, this is just the non-prorated unit discount amount for the applied adjustment.

    • setExistingProratedUnitAmountBetweenPeriodStartAndActionDate

      public void setExistingProratedUnitAmountBetweenPeriodStartAndActionDate(javax.money.MonetaryAmount existingProratedUnitAmountBetweenPeriodStartAndActionDate)
      Similar to SubscriptionItemPriceDetail.getProratedUnitAmountBetweenPeriodStartAndActionDate(), this is the existingFullSubscriptionPeriodUnitDiscountAmount prorated for the period between the period start date and the action date and the regardless of the subscription action being taken or the payment strategy. This serves as informational purposes for downstream services.
    • setExistingProratedUnitAmountBetweenActionAndNextBillDate

      public void setExistingProratedUnitAmountBetweenActionAndNextBillDate(javax.money.MonetaryAmount existingProratedUnitAmountBetweenActionAndNextBillDate)
      Similar to SubscriptionItemPriceDetail.getProratedUnitAmountBetweenActionAndNextBillDate(), this is the existingFullSubscriptionPeriodUnitDiscountAmount prorated for the period between the action date and the next bill date and the regardless of the subscription action being taken or the payment strategy. This serves as informational purposes for downstream services.
    • setProratedUnitAmountBetweenPeriodStartAndActionDate

      public void setProratedUnitAmountBetweenPeriodStartAndActionDate(javax.money.MonetaryAmount proratedUnitAmountBetweenPeriodStartAndActionDate)
      Similar to SubscriptionItemPriceDetail.getProratedUnitAmountBetweenPeriodStartAndActionDate(), this is the fullSubscriptionPeriodUnitDiscountAmount prorated for the period between the period start date and the action date after subscription action, regardless of the subscription action being taken or the payment strategy. This serves as informational purposes for downstream services.
    • setProratedUnitAmountBetweenActionAndNextBillDate

      public void setProratedUnitAmountBetweenActionAndNextBillDate(javax.money.MonetaryAmount proratedUnitAmountBetweenActionAndNextBillDate)
      Similar to SubscriptionItemPriceDetail.getProratedUnitAmountBetweenActionAndNextBillDate(), this is the fullSubscriptionPeriodUnitDiscountAmount prorated for the period between the action date and the next bill date after subscription action, regardless of the subscription action being taken or the payment strategy. This serves as informational purposes for downstream services.
    • setApplicableForThisPeriod

      public void setApplicableForThisPeriod(boolean applicableForThisPeriod)
      Whether this adjustment is applicable for the period that this detail is built for. This is useful for downstream services to determine whether the adjustment detail need to be considered for a certain period.
    • setProratedUnitDiscountAmount

      public void setProratedUnitDiscountAmount(javax.money.MonetaryAmount proratedUnitDiscountAmount)
      Similar to SubscriptionItemPriceDetail.getProratedUnitAmount(), this is the original discount amount prorated relative to the next invoice date. For a new purchase, this reflects the full date range. For edits, upgrades, & downgrades, this reflects the prorated price between the action & the end of the billing period.
    • setCreditedUnitDiscountAmount

      public void setCreditedUnitDiscountAmount(javax.money.MonetaryAmount creditedUnitDiscountAmount)
      The subscription item discount per unit to be deducted from the SubscriptionItemPriceDetail.getCreditedUnitAmount().

      Similar to SubscriptionItemPriceDetail.getCreditedUnitAmount(), the customer had the full discount applied in their previous payment, so when it needs to be credited due to an edit, upgrade, or downgrade, the discount amount needs to be prorated and deducted from the credited amount.

    • setPriorUnbilledUnitDiscountAmount

      public void setPriorUnbilledUnitDiscountAmount(javax.money.MonetaryAmount priorUnbilledUnitDiscountAmount)
      The subscription item discount per unit to be deducted from the SubscriptionItemPriceDetail.getPriorUnbilledUnitAmount().

      Note: This typically only impacts the first period in the estimatedFuturePayments list.

      Similar to SubscriptionItemPriceDetail.getPriorUnbilledUnitAmount(), the discount amount also needs to be prorated and deducted from the prior unbilled amount, since the discount was applied prior to the edit, upgrade, or downgrade.

    • setUnitDiscountAmountForRemainderOfTerms

      public void setUnitDiscountAmountForRemainderOfTerms(javax.money.MonetaryAmount unitDiscountAmountForRemainderOfTerms)
      The unit discount amount that is to be applied for the remainder of terms if the remainder of terms is being charged.
    • setUnitChargeForPreviouslyDiscountedPeriods

      public void setUnitChargeForPreviouslyDiscountedPeriods(javax.money.MonetaryAmount unitChargeForPreviouslyDiscountedPeriods)
      The unit discount amount to charge for previously discounted periods.

      Note that this does not include the amount to charge for the current period. Rather, the amount to charge for the current period is included in getPriorUnbilledUnitDiscountAmount() and is negative to represent a charge.

    • 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)
      Map holding any additional attributes passed in the request not matching any defined properties.
    • setAdditionalAttributes

      public void setAdditionalAttributes(Map<String,Object> additionalAttributes)
      Miscellaneous attributes that can be set to this request in order to inform business logic
    • 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