Class AbstractSubscriptionNextBillDateProcessor
- All Implemented Interfaces:
SubscriptionNextBillDateProcessor
- Direct Known Subclasses:
AnnualSubscriptionNextBillDateProcessor,BiannualSubscriptionNextBillDateProcessor,Every30DaysSubscriptionNextBillDateProcessor,ManualSubscriptionNextBillDateProcessor,MonthlySubscriptionNextBillDateProcessor,NonRenewingSubscriptionNextBillDateProcessor,QuarterlySubscriptionNextBillDateProcessor,WeeklySubscriptionNextBillDateProcessor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateNextBillDate(Subscription subscription, Date startDate) Calculate the next bill date for theSubscriptionbooleancanCalculateNextBillDate(Subscription subscription) Determine if this processor can calculate the next bill date for theSubscriptionprotected ZonedDateTimeconvertToZonedDateTime(Subscription subscription, Date date) Convert the given date to a ZonedDateTime in the customer's timezone.
-
Constructor Details
-
AbstractSubscriptionNextBillDateProcessor
public AbstractSubscriptionNextBillDateProcessor()
-
-
Method Details
-
canCalculateNextBillDate
Description copied from interface:SubscriptionNextBillDateProcessorDetermine if this processor can calculate the next bill date for theSubscription- Specified by:
canCalculateNextBillDatein interfaceSubscriptionNextBillDateProcessor
-
calculateNextBillDate
Description copied from interface:SubscriptionNextBillDateProcessorCalculate the next bill date for theSubscription- Specified by:
calculateNextBillDatein interfaceSubscriptionNextBillDateProcessor
-
convertToZonedDateTime
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- theSubscriptionto get the customer timezone fromdate- theDateto convert- Returns:
- the converted
ZonedDateTime
-