From 4add298aab633540033385c815f4a5a5746434d7 Mon Sep 17 00:00:00 2001 From: Vysokostnyi Date: Tue, 16 Dec 2025 02:41:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D1=87=D0=B0?= =?UTF-8?q?=20telegram=5Fuser=5Fid=20=D0=B2=20=D0=BE=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=BB=D0=B0=D1=82=D0=B5=D0=B6?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/config.py | 12 ++++++++++-- app/handlers/admin/bot_configuration.py | 2 +- app/handlers/balance/yookassa.py | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/config.py b/app/config.py index 9a3ee4e9..caf4b638 100644 --- a/app/config.py +++ b/app/config.py @@ -1326,10 +1326,18 @@ class Settings(BaseSettings): except (ValueError, AttributeError): return [30, 90, 180] - def get_balance_payment_description(self, amount_kopeks: int) -> str: + def get_balance_payment_description(self, amount_kopeks: int, telegram_user_id: Optional[int] = None) -> str: + # Базовое описание + description = f"{self.PAYMENT_BALANCE_DESCRIPTION} на {self.format_price(amount_kopeks)}" + + # Если передан user_id, добавляем его + if telegram_user_id is not None: + description += f" (ID {telegram_user_id})" + + # Формируем финальную строку по шаблону return self.PAYMENT_BALANCE_TEMPLATE.format( service_name=self.PAYMENT_SERVICE_NAME, - description=f"{self.PAYMENT_BALANCE_DESCRIPTION} на {self.format_price(amount_kopeks)}" + description=description ) def get_subscription_payment_description(self, period_days: int, amount_kopeks: int) -> str: diff --git a/app/handlers/admin/bot_configuration.py b/app/handlers/admin/bot_configuration.py index 3237fa10..3123e6fc 100644 --- a/app/handlers/admin/bot_configuration.py +++ b/app/handlers/admin/bot_configuration.py @@ -1984,7 +1984,7 @@ async def test_payment_provider( return amount_kopeks = 10 * 100 - description = settings.get_balance_payment_description(amount_kopeks) + description = settings.get_balance_payment_description(amount_kopeks, telegram_user_id=db_user.telegram_id), payment_result = await payment_service.create_yookassa_payment( db=db, user_id=db_user.id, diff --git a/app/handlers/balance/yookassa.py b/app/handlers/balance/yookassa.py index 2ee88ef0..fb7626ba 100644 --- a/app/handlers/balance/yookassa.py +++ b/app/handlers/balance/yookassa.py @@ -175,7 +175,7 @@ async def process_yookassa_payment_amount( db=db, user_id=db_user.id, amount_kopeks=amount_kopeks, - description=settings.get_balance_payment_description(amount_kopeks), + description=settings.get_balance_payment_description(amount_kopeks, telegram_user_id=db_user.telegram_id), receipt_email=None, receipt_phone=None, metadata={ @@ -321,7 +321,7 @@ async def process_yookassa_sbp_payment_amount( db=db, user_id=db_user.id, amount_kopeks=amount_kopeks, - description=settings.get_balance_payment_description(amount_kopeks), + description=settings.get_balance_payment_description(amount_kopeks, telegram_user_id=db_user.telegram_id), receipt_email=None, receipt_phone=None, metadata={