From 54e6c2aaaa3e554fb742baaf3c2dfef7dda83fe7 Mon Sep 17 00:00:00 2001 From: Vladless Date: Fri, 6 Dec 2024 02:25:18 +0300 Subject: [PATCH] back button in custom pay --- handlers/payments/cryprobot_pay.py | 11 ++++++++++- handlers/payments/robokassa_pay.py | 9 ++++++++- handlers/payments/stars_pay.py | 10 +++++++++- handlers/payments/yookassa_pay.py | 10 +++++++++- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/handlers/payments/cryprobot_pay.py b/handlers/payments/cryprobot_pay.py index 9a612586..6c06acb5 100644 --- a/handlers/payments/cryprobot_pay.py +++ b/handlers/payments/cryprobot_pay.py @@ -141,10 +141,19 @@ async def process_crypto_payment(payload): @router.callback_query(F.data == "enter_custom_amount_crypto") async def process_enter_custom_amount(callback_query: types.CallbackQuery, state: FSMContext): - await callback_query.message.answer(text="Введите сумму пополнения:") + + builder = InlineKeyboardBuilder() + builder.row(InlineKeyboardButton(text="🔙 Назад", callback_data="pay_cryptobot")) + + await callback_query.message.answer( + "Пожалуйста, введите сумму пополнения.", + reply_markup=builder.as_markup(), + ) + await state.set_state(ReplenishBalanceState.entering_custom_amount_crypto) + @router.message(ReplenishBalanceState.entering_custom_amount_crypto) async def process_custom_amount_input(message: types.Message, state: FSMContext): if message.text.isdigit(): diff --git a/handlers/payments/robokassa_pay.py b/handlers/payments/robokassa_pay.py index f2e50906..9ae90a29 100644 --- a/handlers/payments/robokassa_pay.py +++ b/handlers/payments/robokassa_pay.py @@ -204,7 +204,14 @@ async def process_custom_amount_selection(callback_query: types.CallbackQuery, s tg_id = callback_query.message.chat.id logger.info(f"User {tg_id} chose to enter a custom amount.") - await callback_query.message.answer(text="Пожалуйста, введите сумму пополнения в рублях (например, 150):") + builder = InlineKeyboardBuilder() + builder.row(InlineKeyboardButton(text="🔙 Назад", callback_data="pay_robokassa")) + + await callback_query.message.answer( + "Пожалуйста, введите сумму пополнения.", + reply_markup=builder.as_markup(), + ) + await state.set_state(ReplenishBalanceState.waiting_for_payment_confirmation_robokassa) diff --git a/handlers/payments/stars_pay.py b/handlers/payments/stars_pay.py index 3bb3136e..698444b8 100644 --- a/handlers/payments/stars_pay.py +++ b/handlers/payments/stars_pay.py @@ -129,7 +129,15 @@ async def process_amount_selection(callback_query: types.CallbackQuery, state: F @router.callback_query(F.data == "enter_custom_amount_stars") async def process_enter_custom_amount(callback_query: types.CallbackQuery, state: FSMContext): - await callback_query.message.answer(text="Введите сумму пополнения:") + + builder = InlineKeyboardBuilder() + builder.row(InlineKeyboardButton(text="🔙 Назад", callback_data="pay_stars")) + + await callback_query.message.answer( + "Пожалуйста, введите сумму пополнения.", + reply_markup=builder.as_markup(), + ) + await state.set_state(ReplenishBalanceState.entering_custom_amount_stars) diff --git a/handlers/payments/yookassa_pay.py b/handlers/payments/yookassa_pay.py index f3b9009a..c1687107 100644 --- a/handlers/payments/yookassa_pay.py +++ b/handlers/payments/yookassa_pay.py @@ -168,7 +168,15 @@ async def yookassa_webhook(request): @router.callback_query(F.data == "enter_custom_amount_yookassa") async def process_enter_custom_amount(callback_query: types.CallbackQuery, state: FSMContext): - await callback_query.message.answer(text="Введите сумму пополнения:") + + builder = InlineKeyboardBuilder() + builder.row(InlineKeyboardButton(text="🔙 Назад", callback_data="pay_yookassa")) + + await callback_query.message.answer( + "Пожалуйста, введите сумму пополнения.", + reply_markup=builder.as_markup(), + ) + await state.set_state(ReplenishBalanceState.entering_custom_amount_yookassa)