30 lines
781 B
Python
30 lines
781 B
Python
import logging
|
|
|
|
from aiogram import Router
|
|
from aiogram.filters import CommandObject, CommandStart
|
|
from aiogram.types import (
|
|
Message,
|
|
)
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from repositories.invoices import InvoiceRepository
|
|
|
|
router = Router()
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@router.message(CommandStart(deep_link=True, deep_link_encoded=True))
|
|
async def activate_invoice(
|
|
msg: Message,
|
|
command: CommandObject,
|
|
session: AsyncSession,
|
|
invoice_repo: InvoiceRepository,
|
|
):
|
|
payload = command.args
|
|
|
|
invoice_id = int(payload.split(":")[1])
|
|
invoice = await invoice_repo.get_invoice_by_id(session, invoice_id)
|
|
await msg.answer(
|
|
f"<b>🟢 Получен счёт на {invoice.amount}₽</b>"
|
|
) # TODO: Process payment
|