Добавлено логирование в класс OracleDatabase и обновлены обработчики сообщений в main.py:
- Импортирован модуль logging для отладки. - Закомментированы строки логирования запросов и результатов в методе fetch_vin_info. - Добавлены кнопки для взаимодействия с пользователем после успешной оплаты.
This commit is contained in:
parent
fa11d2f0df
commit
b1ba974b44
5
db.py
5
db.py
@ -1,6 +1,8 @@
|
|||||||
# db.py
|
# db.py
|
||||||
import oracledb
|
import oracledb
|
||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
class OracleDatabase:
|
class OracleDatabase:
|
||||||
def __init__(self, user: str, password: str, dsn: str):
|
def __init__(self, user: str, password: str, dsn: str):
|
||||||
@ -75,8 +77,11 @@ class OracleDatabase:
|
|||||||
where svin = substr(:vin, 1, 10)
|
where svin = substr(:vin, 1, 10)
|
||||||
order by dp.category_level
|
order by dp.category_level
|
||||||
"""
|
"""
|
||||||
|
# logging.info(f"Query: {query}")
|
||||||
cur.execute(query, {"vin": vin})
|
cur.execute(query, {"vin": vin})
|
||||||
results = cur.fetchall()
|
results = cur.fetchall()
|
||||||
|
# logging.info(f"Results: {results}")
|
||||||
|
|
||||||
|
|
||||||
# Organize data by categories
|
# Organize data by categories
|
||||||
detailed_info = {
|
detailed_info = {
|
||||||
|
|||||||
8
main.py
8
main.py
@ -240,7 +240,13 @@ async def successful_payment_handler(message: Message, db: OracleDatabase):
|
|||||||
report += f"📋 **VIN:** {vin}\n"
|
report += f"📋 **VIN:** {vin}\n"
|
||||||
report += f"💰 **Transaction ID:** {message.successful_payment.telegram_payment_charge_id}"
|
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:
|
else:
|
||||||
# No detailed information found - refund the payment
|
# No detailed information found - refund the payment
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user