Class AbstractSubscriptionNextBillDateProcessor

java.lang.Object
com.broadleafcommerce.subscription.service.AbstractSubscriptionNextBillDateProcessor
All Implemented Interfaces:
SubscriptionNextBillDateProcessor
Direct Known Subclasses:
AnnualSubscriptionNextBillDateProcessor, BiannualSubscriptionNextBillDateProcessor, Every30DaysSubscriptionNextBillDateProcessor, ManualSubscriptionNextBillDateProcessor, MonthlySubscriptionNextBillDateProcessor, NonRenewingSubscriptionNextBillDateProcessor, QuarterlySubscriptionNextBillDateProcessor, WeeklySubscriptionNextBillDateProcessor

public abstract class AbstractSubscriptionNextBillDateProcessor extends Object implements SubscriptionNextBillDateProcessor
  • Constructor Details

    • AbstractSubscriptionNextBillDateProcessor

      public AbstractSubscriptionNextBillDateProcessor()
  • Method Details

    • canCalculateNextBillDate

      public boolean canCalculateNextBillDate(Subscription subscription)
      Description copied from interface: SubscriptionNextBillDateProcessor
      Determine if this processor can calculate the next bill date for the Subscription
      Specified by:
      canCalculateNextBillDate in interface SubscriptionNextBillDateProcessor
    • calculateNextBillDate

      public Date calculateNextBillDate(Subscription subscription, Date startDate)
      Description copied from interface: SubscriptionNextBillDateProcessor
      Calculate the next bill date for the Subscription
      Specified by:
      calculateNextBillDate in interface SubscriptionNextBillDateProcessor
    • convertToZonedDateTime

      protected ZonedDateTime convertToZonedDateTime(Subscription subscription, Date date)
      Convert the given date to a ZonedDateTime in the customer's timezone. If the customer timezone is blank, UTC is used.

      This is particularly important when calculating the next bill date from a date that has daylight savings time inactive and then going into a date that is active. For example, if a customer is in Pacific/Auckland timezone, whose daylight savings time active date range is September 28th to April 5th of next year. Let's say the customer purchased a subscription on 9/3/2025, which means the subscription has a billing date range of 9/3/2025 00:00:00 - 10/2/2025 23:59:59 in Auckland time (equivalent to 9/2/2025 12:00:00 - 10/2/2025 10:59:59 UTC). If the subscription is monthly, the next bill date calculating should be 10/3/2025 00:00:00 in Auckland time (equivalent to 10/2/2025 11:00:00 UTC). If instead of converting to Auckland time, we simply add one month to the UTC date, we would get 10/2/2025 12:00:00 UTC, which is 10/3/2025 01:00:00 in Auckland time, which is incorrect. Even though the next bill date is only off by one hour, it would still cause issues when determining the bill date.

      Parameters:
      subscription - the Subscription to get the customer timezone from
      date - the Date to convert
      Returns:
      the converted ZonedDateTime