mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 21:50:57 +00:00
Fix roundtrip in voucher
This commit is contained in:
@@ -1734,6 +1734,7 @@ export class BookingsService {
|
||||
where: isUuid ? { id: bookingRefOrId } : { bookingRef: bookingRefOrId },
|
||||
include: {
|
||||
schedule: { include: { originStation: true, destinationStation: true, train: true } },
|
||||
returnSchedule: { include: { originStation: true, destinationStation: true, train: true } },
|
||||
seats: { include: { seat: { include: { coach: { include: { coachType: { include: { seatClasses: true } } } } } } } },
|
||||
paymentIntent: true, tickets: true,
|
||||
priceTier: { select: { priceMinor: true } },
|
||||
@@ -1822,6 +1823,16 @@ export class BookingsService {
|
||||
destination: { id: (booking as any).schedule.destinationStation.id, name: (booking as any).schedule.destinationStation.name, code: (booking as any).schedule.destinationStation.code, city: (booking as any).schedule.destinationStation.city },
|
||||
departureAt: (booking as any).schedule.departureAt, arrivalAt: (booking as any).schedule.arrivalAt,
|
||||
},
|
||||
returnSchedule: (booking as any).returnSchedule
|
||||
? {
|
||||
id: (booking as any).returnSchedule.id,
|
||||
trainNumber: (booking as any).returnSchedule.train.number,
|
||||
trainName: (booking as any).returnSchedule.train.name,
|
||||
origin: { id: (booking as any).returnSchedule.originStation.id, name: (booking as any).returnSchedule.originStation.name, code: (booking as any).returnSchedule.originStation.code, city: (booking as any).returnSchedule.originStation.city },
|
||||
destination: { id: (booking as any).returnSchedule.destinationStation.id, name: (booking as any).returnSchedule.destinationStation.name, code: (booking as any).returnSchedule.destinationStation.code, city: (booking as any).returnSchedule.destinationStation.city },
|
||||
departureAt: (booking as any).returnSchedule.departureAt, arrivalAt: (booking as any).returnSchedule.arrivalAt,
|
||||
}
|
||||
: null,
|
||||
passengers: (booking as any).seats?.map((bs: any) => ({
|
||||
fullName: bs.passengerName,
|
||||
category: bs.passengerCategory,
|
||||
@@ -1844,11 +1855,14 @@ export class BookingsService {
|
||||
currency: (booking as any).paymentIntent.currency,
|
||||
}
|
||||
: undefined,
|
||||
// One ticket per passenger — matched on the frontend by passengerName, not array
|
||||
// position, since tickets are grouped/created independently of the passengers array.
|
||||
// One ticket per passenger per leg (round trips have a separate ticket — and
|
||||
// barcode — for the return leg) — matched on the frontend by passengerName +
|
||||
// leg, not array position, since tickets are grouped/created independently of
|
||||
// the passengers array.
|
||||
tickets: (booking as any).tickets?.map((t: any) => ({
|
||||
id: t.id,
|
||||
passengerName: t.passengerName,
|
||||
leg: t.leg ?? 1,
|
||||
qrPayload: t.qrPayload,
|
||||
barcodePayload: t.barcodePayload,
|
||||
status: t.status,
|
||||
|
||||
Reference in New Issue
Block a user