fix: read yookassa_service directly in auto-renew instead of broken local import

This commit is contained in:
3252a8
2026-05-17 09:58:39 +03:00
parent 8382fa9232
commit d4b7da3a54
@@ -30,12 +30,12 @@ class RenewalMixin:
logging.info(f"Auto-renew skipped: no saved payment method for user {sub.user_id}") logging.info(f"Auto-renew skipped: no saved payment method for user {sub.user_id}")
return False return False
try: # ``yookassa_service`` is wired onto the subscription service via
from .yookassa_service import YooKassaService # local import to avoid cycles # ``build_core_services`` (setattr). Read it directly — the previous
# ``from .yookassa_service import …`` pointed at a non-existent module
yk: YooKassaService = self.yookassa_service # type: ignore[attr-defined] # inside this package, the ImportError got swallowed, and every
except Exception: # auto-renew silently returned False.
yk = None # type: ignore yk = getattr(self, "yookassa_service", None)
if not yk or not getattr(yk, "configured", False): if not yk or not getattr(yk, "configured", False):
logging.warning("YooKassa unavailable for auto-renew") logging.warning("YooKassa unavailable for auto-renew")
return False return False