mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
@@ -1892,20 +1892,32 @@ export class BookingsService {
|
||||
departureAt: returnSegment!.departureAt, arrivalAt: returnSegment!.arrivalAt,
|
||||
}
|
||||
: null,
|
||||
passengers: (booking as any).seats?.map((bs: any) => ({
|
||||
fullName: bs.passengerName,
|
||||
category: bs.passengerCategory,
|
||||
leg: bs.leg ?? 1,
|
||||
fareMinor: bs.fareMinor,
|
||||
verifaydaVerified: bs.verifaydaVerified,
|
||||
seat: {
|
||||
id: bs.seat.id,
|
||||
number: bs.seat.seatNumber,
|
||||
coach: bs.seat.coach.number,
|
||||
coachId: bs.seat.coach.id,
|
||||
seatClass: bs.seat.coach.coachType?.seatClasses?.[0]?.name ?? null,
|
||||
},
|
||||
})),
|
||||
passengers: (booking as any).seats?.map((bs: any) => {
|
||||
// A coach type can have several seat classes (e.g. a VIP Bed coach has separate
|
||||
// Upper/Lower classes) — seatClasses[0] is whichever was seeded first, so it always
|
||||
// showed the SAME class for every seat in the coach regardless of that seat's own
|
||||
// bed position. Match against the seat's actual bedPosition instead (Seat.bedPosition
|
||||
// is lowercase, SeatClass.bedPosition is uppercase — compare case-insensitively).
|
||||
// Falls back to [0] for non-bed seats (bedPosition is null, single class per coach).
|
||||
const classes = bs.seat.coach.coachType?.seatClasses ?? [];
|
||||
const matchedClass = bs.seat.bedPosition
|
||||
? classes.find((sc: any) => sc.bedPosition?.toLowerCase() === bs.seat.bedPosition.toLowerCase())
|
||||
: null;
|
||||
return {
|
||||
fullName: bs.passengerName,
|
||||
category: bs.passengerCategory,
|
||||
leg: bs.leg ?? 1,
|
||||
fareMinor: bs.fareMinor,
|
||||
verifaydaVerified: bs.verifaydaVerified,
|
||||
seat: {
|
||||
id: bs.seat.id,
|
||||
number: bs.seat.seatNumber,
|
||||
coach: bs.seat.coach.number,
|
||||
coachId: bs.seat.coach.id,
|
||||
seatClass: (matchedClass ?? classes[0])?.name ?? null,
|
||||
},
|
||||
};
|
||||
}),
|
||||
payment: (booking as any).paymentIntent
|
||||
? {
|
||||
method: (booking as any).paymentIntent.method,
|
||||
|
||||
Reference in New Issue
Block a user