Class SubscriptionDiscount

java.lang.Object
com.broadleafcommerce.promotion.offer.domain.SubscriptionDiscount
All Implemented Interfaces:
Serializable

public class SubscriptionDiscount extends Object implements Serializable
Encapsulates all of the fields relevant to an Offer.getSubscriptionDiscount() offer's subscription compatibility}. A subscription is an item that has a recurring billing cycle based on a frequency and period. applyToFuturePeriods must be true for the other fields to be considered. When set to true, this requires the Discount.getTargetType() offer's discount target type} to be DiscountTargetType.ORDER_ITEM or DiscountTargetType.FULFILLMENT_GROUP_ITEM. In addition, the Offer#targetsCanBeTargets must be false so that this is the only offer that can apply to the subscription order item.
Author:
Chad Harchar (charchar)
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
     
    boolean
     
    int
    The beginning period for which this offer should be applied.
    The ending period for which this offer should be applied.
    int
     
    boolean
    Whether an offer should be applied to items' future periods, i.e., items that have a recurring billing cycle based on a frequency and a period.
    boolean
    Deprecated.
    No longer relevant with the introduction of LineItem.getStandardRecurringPrice().
    void
    setApplyToFuturePeriods(boolean applyToFuturePeriods)
    Whether an offer should be applied to items' future periods, i.e., items that have a recurring billing cycle based on a frequency and a period.
    void
    setBeginPeriod(int beginPeriod)
    The beginning period for which this offer should be applied.
    void
    setDiscountCurrentOrder(boolean discountCurrentOrder)
    Deprecated.
    No longer relevant with the introduction of LineItem.getStandardRecurringPrice().
    void
    setEndPeriod(Integer endPeriod)
    The ending period for which this offer should be applied.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SubscriptionDiscount

      public SubscriptionDiscount()
  • Method Details

    • isApplyToFuturePeriods

      public boolean isApplyToFuturePeriods()
      Whether an offer should be applied to items' future periods, i.e., items that have a recurring billing cycle based on a frequency and a period. If this is false, none of the other fields on this class will be considered. Default to false.
      Returns:
      Whether an offer should be applied to items' future periods, i.e., items that have a recurring billing cycle based on a frequency and a period.
    • isDiscountCurrentOrder

      @Deprecated public boolean isDiscountCurrentOrder()
      Deprecated.
      No longer relevant with the introduction of LineItem.getStandardRecurringPrice(). The distinction between price types allows more granular control for subscription discounts.
      Whether to apply this discount to the current provided order. Otherwise, it will only apply to future billing cycles resulting from the current order. Default to true.
      Returns:
      Whether to apply this discount to the current provided order. Otherwise, it will only apply to future billing cycles resulting from the current order.
    • getBeginPeriod

      public int getBeginPeriod()
      The beginning period for which this offer should be applied. 1 refers to the first recurring billing period, and so on.
      Returns:
      The beginning period for which this offer should be applied.
    • getEndPeriod

      public Integer getEndPeriod()
      The ending period for which this offer should be applied. 1 refers to the first recurring billing period, and so on. Null and 0 indicate no end.
      Returns:
      The ending period for which this offer should be applied.
    • setApplyToFuturePeriods

      public void setApplyToFuturePeriods(boolean applyToFuturePeriods)
      Whether an offer should be applied to items' future periods, i.e., items that have a recurring billing cycle based on a frequency and a period. If this is false, none of the other fields on this class will be considered. Default to false.
      Parameters:
      applyToFuturePeriods - Whether an offer should be applied to items' future periods, i.e., items that have a recurring billing cycle based on a frequency and a period.
    • setDiscountCurrentOrder

      @Deprecated public void setDiscountCurrentOrder(boolean discountCurrentOrder)
      Deprecated.
      No longer relevant with the introduction of LineItem.getStandardRecurringPrice(). The distinction between price types allows more granular control for subscription discounts.
      Whether to apply this discount to the current provided order. Otherwise, it will only apply to future billing cycles resulting from the current order. Default to true.
      Parameters:
      discountCurrentOrder - Whether to apply this discount to the current provided order. Otherwise, it will only apply to future billing cycles resulting from the current order.
    • setBeginPeriod

      public void setBeginPeriod(int beginPeriod)
      The beginning period for which this offer should be applied. 1 refers to the first recurring billing period, and so on.
      Parameters:
      beginPeriod - The beginning period for which this offer should be applied.
    • setEndPeriod

      public void setEndPeriod(Integer endPeriod)
      The ending period for which this offer should be applied. 1 refers to the first recurring billing period, and so on. Null and 0 indicate no end.
      Parameters:
      endPeriod - The ending period for which this offer should be applied.
    • 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