From 3e976d996007a069ae82377cc32579cac0ec5266 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 30 Nov 2025 16:41:40 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D1=83=20=D1=81=20id=20?= =?UTF-8?q?=D0=B8=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB=20call=5Fap?= =?UTF-8?q?i=20=D1=87=D1=82=D0=BE=20=D0=B1=D1=8B=20=D0=BE=D0=BD=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=BB=20=D1=81=20billing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handlers/profile.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/handlers/profile.py b/handlers/profile.py index 79fe1a1..ce70e17 100644 --- a/handlers/profile.py +++ b/handlers/profile.py @@ -24,11 +24,11 @@ router = Router() logger = logging.getLogger(__name__) -async def call_api(method, endpoint, data=None): +async def call_api(method, endpoint, data=None,base_url = BASE_URL_FASTAPI): """ Выполняет HTTP-запрос к FastAPI. """ - url = f"{BASE_URL_FASTAPI}{endpoint}" + url = f"{base_url}{endpoint}" logger.info(f"Инициализация запроса: {method} {url} с данными {data}") try: @@ -71,7 +71,7 @@ async def profile_callback_handler(callback: CallbackQuery): # Последняя подписка пользователя sub_data = await call_api( - "GET", f"/subscription/{user_data['id']}/last" + "GET", f"/subscription/{user_data['telegram_id']}/last" ) if sub_data == "ERROR" or not isinstance(sub_data, dict): sub_data = None @@ -171,7 +171,7 @@ async def tranhist_callback_handler(callback: CallbackQuery): try: transactions = await call_api( - "GET", f"/user/{user_data['id']}/transactions" + "GET", f"/user/{user_data['telegram_id']}/transactions" ) if not transactions: await callback.message.edit_text( @@ -251,7 +251,7 @@ async def method_ykassa_handler(callback: CallbackQuery): """ amount = callback.data.split("_")[-1] data = {"user_id": callback.from_user.id, "amount": amount, "provider": "yookassa"} - result = await call_api("POST", "billing/payments/init", data) + result = await call_api("POST", "billing/payments/init", data,"http://billing:8000") payment_url = result.get("confirmation_url", "#") payment_id = result.get("payment_id", "") @@ -276,7 +276,7 @@ async def method_crypto_handler(callback: CallbackQuery): """ amount = callback.data.split("_")[-1] data = {"user_id": callback.from_user.id, "amount": amount, "provider": "cryptobot"} - result = await call_api("POST", "billing/payments/init", data) + result = await call_api("POST", "billing/payments/init", data,"http://billing:8000") payment_url = result.get("confirmation_url", "#") payment_id = result.get("payment_id", "")