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'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 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.
    int
    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
    Whether to apply this discount to the current provided order.
    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)
    Whether to apply this discount to the current provided order.
    void
    setEndPeriod(int 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

      public boolean isDiscountCurrentOrder()
      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 int getEndPeriod()
      The ending period for which this offer should be applied. 1 refers to the first recurring billing period, and so on.
      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

      public void setDiscountCurrentOrder(boolean 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. 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(int endPeriod)
      The ending period for which this offer should be applied. 1 refers to the first recurring billing period, and so on.
      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