From b1ba974b449cf7ff53c55ac567ee54332b94e1a0 Mon Sep 17 00:00:00 2001 From: Vlad Date: Sun, 25 May 2025 02:11:35 +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=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B2=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=20?= =?UTF-8?q?OracleDatabase=20=D0=B8=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D1=87=D0=B8=D0=BA=D0=B8=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9=20=D0=B2=20main.py:=20-=20=D0=98=D0=BC=D0=BF?= =?UTF-8?q?=D0=BE=D1=80=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=20=D0=BC?= =?UTF-8?q?=D0=BE=D0=B4=D1=83=D0=BB=D1=8C=20logging=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=BE=D1=82=D0=BB=D0=B0=D0=B4=D0=BA=D0=B8.=20-=20=D0=97?= =?UTF-8?q?=D0=B0=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D1=8B=20=D1=81=D1=82=D1=80=D0=BE=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=B8=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=20=D0=B2=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4?= =?UTF-8?q?=D0=B5=20fetch=5Fvin=5Finfo.=20-=20=D0=94=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D0=B2=D0=B7=D0=B0=D0=B8=D0=BC?= =?UTF-8?q?=D0=BE=D0=B4=D0=B5=D0=B9=D1=81=D1=82=D0=B2=D0=B8=D1=8F=20=D1=81?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5?= =?UTF-8?q?=D0=BB=D0=B5=D0=BC=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D1=83?= =?UTF-8?q?=D1=81=D0=BF=D0=B5=D1=88=D0=BD=D0=BE=D0=B9=20=D0=BE=D0=BF=D0=BB?= =?UTF-8?q?=D0=B0=D1=82=D1=8B.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db.py | 5 +++++ main.py | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/db.py b/db.py index ffd57e1..aafa68c 100644 --- a/db.py +++ b/db.py @@ -1,6 +1,8 @@ # db.py import oracledb from typing import Optional, Tuple +import logging + class OracleDatabase: def __init__(self, user: str, password: str, dsn: str): @@ -75,8 +77,11 @@ class OracleDatabase: where svin = substr(:vin, 1, 10) order by dp.category_level """ + # logging.info(f"Query: {query}") cur.execute(query, {"vin": vin}) results = cur.fetchall() + # logging.info(f"Results: {results}") + # Organize data by categories detailed_info = { diff --git a/main.py b/main.py index 0cdd7f0..2cb9786 100644 --- a/main.py +++ b/main.py @@ -240,7 +240,13 @@ async def successful_payment_handler(message: Message, db: OracleDatabase): report += f"📋 **VIN:** {vin}\n" report += f"💰 **Transaction ID:** {message.successful_payment.telegram_payment_charge_id}" - await message.answer(report, parse_mode="Markdown") + # Create keyboard with action buttons + builder = InlineKeyboardBuilder() + builder.button(text="Try another VIN", callback_data="decode_vin") + builder.button(text="Back to Main Menu", callback_data="main_menu") + builder.adjust(2) # Two buttons on one row + + await message.answer(report, reply_markup=builder.as_markup(), parse_mode="Markdown") else: # No detailed information found - refund the payment try: