feat(promo): Enhance promo code functionality and discount consumption logic

- Integrated promo code service into subscription service to streamline discount consumption during payment processing.
- Improved error handling and logging for promo code activation and usage increment.
- Updated payment services to handle discount calculations more robustly, including fallback mechanisms for invalid discount scenarios.
- Added new methods for managing promo code activations and usage in the database layer.
This commit is contained in:
kavore
2026-02-01 19:29:31 +03:00
parent 9b4a58f82f
commit 484327a032
10 changed files with 319 additions and 98 deletions
+2
View File
@@ -81,6 +81,8 @@ def build_core_services(
# Wire services that depend on each other
try:
# Allow subscription service to consume promo codes
setattr(subscription_service, "promo_code_service", promo_code_service)
# 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