feat: implement recurring invoice system for subscription renewals

- Add SUBSCRIPTION_RENEWAL_JOB_NAME and related constants for renewal jobs
- Implement createSubscriptionRenewalInvoice in invoice processor
- Add automatic renewal invoice creation 7 days before subscription expiry
- Handle subscription renewals in payInvoice method with period extension
- Add scheduleNextRenewalJob method for continuous renewal scheduling
- Prevent duplicate renewal invoices and jobs
- Skip renewal jobs for free plans
- Send notifications for renewal opportunities
- Fix duplicate job scheduling issue by removing from subscribeToPlan

Features:
- Automatic renewal invoice creation before expiry
- Subscription period extension on renewal payment
- Continuous renewal cycle scheduling
- Comprehensive error handling and validation
- Integration with existing notification system
This commit is contained in:
mahyargdz
2025-08-17 10:00:12 +03:30
parent ca0510f2c2
commit 72b1edbe25
4 changed files with 144 additions and 7 deletions
@@ -1,6 +1,5 @@
export enum SubscriptionStatus {
ACTIVE = "ACTIVE",
INACTIVE = "INACTIVE",
// CANCELED = "CANCELED",
// EXPIRED = "EXPIRED",
CANCELED = "CANCELED",
}