Update UpcomingNotificationCronJob to handle multiple periods, i.e. 90/60/45/30/1 day cadence

Problem

Currently, the UpcomingNotificationCronJob only sends renewal notifications at a single fixed period (15 days) before subscription renewal. This limited approach doesn't provide customers with sufficient notice about upcoming renewals at different stages of their subscription lifecycle. We need to enhance this job to support multiple notification periods (90, 60, 45, 30, 15, and 1 day before renewal) to improve customer communication and reduce renewal surprises.

Proposal

Modify the UpcomingNotificationCronJob to support multiple notification periods by:

  1. Replacing the single NOTIFICATION_PERIOD constant with a configuration for multiple periods (90, 60, 45, 30, 15, and 1 day)
  2. Updating the perform method to iterate through each period and find applicable orders for each specific timeframe
  3. Modifying the order selection logic to consider precise date ranges for each period
  4. Implementing this behind a feature flag to allow for controlled rollout

Result

  • Customers will receive notifications at multiple points before their subscription renewal

Next steps (if any)

  1. Update the SendUpcomingNotificationService to handle the different notification types
  2. Create appropriate default renewal email template
Edited by Minahil Nichols