Add per-quantity TPago payment links for multi-ticket checkout.

Each ticket quantity (1-5) can have its own TPago link so checkout, emails, and admin config use the correct fixed-amount URL.
This commit is contained in:
Michilis
2026-06-18 23:59:17 +00:00
parent 1b2463f4bc
commit fc4af38e8a
11 changed files with 195 additions and 21 deletions
+10
View File
@@ -631,11 +631,21 @@ ticketsRouter.get('/:id', async (c) => {
(db as any).select().from(payments).where(eq((payments as any).ticketId, id))
);
// Count how many tickets belong to this booking (for per-quantity payment links)
let bookingTicketCount = 1;
if (ticket.bookingId) {
const bookingTickets = await dbAll<any>(
(db as any).select().from(tickets).where(eq((tickets as any).bookingId, ticket.bookingId))
);
bookingTicketCount = bookingTickets.length || 1;
}
return c.json({
ticket: {
...ticket,
event,
payment,
bookingTicketCount,
},
});
});