invoices, order handling, db updates
This commit is contained in:
29
handlers/client/invoices.py
Normal file
29
handlers/client/invoices.py
Normal file
@@ -0,0 +1,29 @@
|
||||
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
|
||||
Reference in New Issue
Block a user