Refactor subscription renewal process to utilize panel webhook
- Removed the recurring billing task from the bot, shifting the auto-renew functionality to the panel webhook service, which now triggers renewals 24 hours before expiry. - Updated service dependencies to wire the subscription service with the panel webhook for seamless renewal handling. - Adjusted the Subscription model to enable auto-renew by default, enhancing subscription management.
This commit is contained in:
@@ -54,6 +54,15 @@ def build_core_services(
|
||||
settings_obj=settings,
|
||||
)
|
||||
|
||||
# Wire services that depend on each other
|
||||
try:
|
||||
# Attach YooKassa to subscription service for auto-renew charges
|
||||
setattr(subscription_service, "yookassa_service", yookassa_service)
|
||||
# Allow panel webhook to trigger renewals through subscription service
|
||||
setattr(panel_webhook_service, "subscription_service", subscription_service)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return {
|
||||
"panel_service": panel_service,
|
||||
"subscription_service": subscription_service,
|
||||
|
||||
Reference in New Issue
Block a user