feat: implement subscription management and billing enhancements

This commit is contained in:
2026-04-29 20:10:26 +07:00
parent 120e19e667
commit db2dabed58
12 changed files with 223 additions and 28 deletions

View File

@@ -8,8 +8,10 @@ from bot.states.deposit import DepositStorage
from bot.texts import (
CHECKOUT_PAYMENT_CHOICE,
DEPOSIT_AMOUNT,
DEPOSIT_AMOUNT_BELOW_MINIMAL,
DEPOSIT_AMOUNT_FALLBACK,
)
from config import settings
from schemas.billing import BillingContext
from schemas.common import GeneralMessageContext
@@ -22,7 +24,7 @@ async def deposit_init(cb: CallbackQuery, state: FSMContext):
await cb.message.edit_text(DEPOSIT_AMOUNT, reply_markup=return_to_menu)
ctx = GeneralMessageContext(cb.message)
ctx = GeneralMessageContext(msg=cb.message)
await state.set_state(DepositStorage.amount)
await state.set_data({"ctx": ctx})
@@ -40,6 +42,15 @@ async def deposit_amount(msg: Message, state: FSMContext):
await state.set_data(data)
return
if int(msg.text) < settings.deposit_threshold:
await ctx.msg.edit_text(
DEPOSIT_AMOUNT_BELOW_MINIMAL.format(threshold=settings.deposit_threshold),
reply_markup=return_to_menu,
)
await state.set_state(DepositStorage.amount)
await state.set_data(data)
return
await ctx.msg.edit_text(CHECKOUT_PAYMENT_CHOICE, reply_markup=payment_gateways)
await state.set_state(BillingStorage.pending)
billing_context = BillingContext(amount=int(msg.text))