- Added billing models and repository for handling bills. - Introduced BillingService to manage payment initiation and bill creation. - Updated user service to remove ticket-related functionality. - Refactored settings to include new billing-related fields. - Removed ticket-related handlers and schemas. - Added new billing handlers for processing payments. - Updated database schema with new bills table and status enum. - Enhanced utility functions to calculate prices considering discounts. - Introduced prehandling for non-private messages. - Updated main application to initialize new billing services and repositories.
31 lines
961 B
Python
31 lines
961 B
Python
from aiogram import F, Router
|
|
from aiogram.fsm.context import FSMContext
|
|
from aiogram.types import CallbackQuery
|
|
from aiogram.utils.deep_linking import create_start_link
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from keyboards.client import referals_kb
|
|
from misc.utils import format_share_deep_link
|
|
from schemas.di import DependenciesDTO
|
|
from texts import (
|
|
REFERALS_MENU,
|
|
)
|
|
|
|
router = Router()
|
|
|
|
|
|
@router.callback_query(F.data == "referal")
|
|
async def referal_menu(
|
|
cb: CallbackQuery, state: FSMContext, session: AsyncSession, deps: DependenciesDTO
|
|
):
|
|
await state.clear()
|
|
|
|
user = await deps.user_repository.get_user_by_id(session, cb.from_user.id)
|
|
referal_link = await create_start_link(cb.bot, f"ref_{user.id}", encode=True)
|
|
share_link = format_share_deep_link(referal_link)
|
|
|
|
await cb.message.edit_text(
|
|
REFERALS_MENU.format(balance=user.balance, link=referal_link),
|
|
reply_markup=referals_kb(share_link),
|
|
)
|