mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 21:11:14 +00:00
fix(booking-import): read the seat that KItinerary gives
KItinerary writes a flight seat as airplaneSeat and a ticket seat as reservedTicket.ticketedSeat.seatNumber, the schema.org fields, and it removes seat and seatNumber from a script result. segmentDetail read only seat and seatNumber, so an imported booking lost its seat. segmentDetail now also reads airplaneSeat, and then the ticket seat when no other key has a value. seat and seatNumber stay first, so a booking that already has a seat gets the same result.
This commit is contained in:
@@ -709,7 +709,12 @@ function segmentDetail(r: KiReservation): {
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
const seat = pick('seat', 'seatNumber');
|
||||
// KItinerary writes a flight seat as airplaneSeat and a rail seat as
|
||||
// reservedTicket.ticketedSeat.seatNumber, and drops any other seat key.
|
||||
const ticket = r.reservedTicket as { ticketedSeat?: { seatNumber?: unknown } } | undefined;
|
||||
const ticketSeat = ticket?.ticketedSeat?.seatNumber;
|
||||
const seat =
|
||||
pick('seat', 'seatNumber', 'airplaneSeat') ?? (ticketSeat != null && ticketSeat !== '' ? ticketSeat : undefined);
|
||||
const cls = pick('class', 'bookingClass', 'fareClass', 'serviceClass', 'seatingType');
|
||||
const platform = pick('platform', 'departurePlatform');
|
||||
const price = pick('price', 'priceAmount', 'totalPrice', 'total');
|
||||
|
||||
Reference in New Issue
Block a user