some yookassa changes

This commit is contained in:
machka pasla
2025-12-09 22:32:10 +03:00
parent 7b650a74a6
commit 8eba23574b
7 changed files with 26 additions and 20 deletions
+2 -5
View File
@@ -501,10 +501,7 @@ class SubscriptionService:
)
auto_renew_should_enable = False
if (
provider == "yookassa"
and getattr(self.settings, "YOOKASSA_AUTOPAYMENTS_ENABLED", False)
):
if provider == "yookassa" and self.settings.yookassa_autopayments_active:
auto_renew_should_enable = await user_billing_dal.user_has_saved_payment_method(
session, user_id
)
@@ -829,7 +826,7 @@ class SubscriptionService:
if not sub.auto_renew_enabled:
return True
# If autopayments are disabled globally, skip charging attempts
if not getattr(self.settings, 'YOOKASSA_AUTOPAYMENTS_ENABLED', False):
if not self.settings.yookassa_autopayments_active:
return True
if sub.provider == "tribute":
# Tribute is paid externally; we do not auto-charge here
+4 -1
View File
@@ -21,7 +21,10 @@ class YooKassaService:
self.settings = settings_obj
if not shop_id or not secret_key:
if self.settings and not self.settings.YOOKASSA_ENABLED:
logging.warning("YooKassa is disabled via YOOKASSA_ENABLED flag. Payment functionality will be DISABLED.")
self.configured = False
elif not shop_id or not secret_key:
logging.warning(
"YooKassa SHOP_ID or SECRET_KEY not configured in settings. "
"Payment functionality will be DISABLED.")