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:
@@ -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,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user