File indexing completed on 2024-12-29 04:51:03

0001 /*
0002     SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org>
0003     SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 function parseBarcode(elb, node) {
0007     let res = JsonLd.newTrainReservation();
0008     res.reservationNumber = elb.pnr;
0009     res.reservationFor.departureStation.name = elb.segment1.departureStation;
0010     res.reservationFor.departureStation.identifier = 'benerail:' + elb.segment1.departureStation;
0011     res.reservationFor.arrivalStation.name = elb.segment1.arrivalStation;
0012     res.reservationFor.arrivalStation.identifier = 'benerail:' + elb.segment1.arrivalStation;
0013     res.reservationFor.departureDay = elb.segment1.departureDate(node.contextDateTime);
0014     res.reservationFor.trainNumber = elb.segment1.trainNumber;
0015     res.reservationFor.provider.identifier = 'uic:' + elb.futureUse.substr(1, 4);
0016     res.reservedTicket.ticketNumber = elb.tcnCode;
0017     res.reservedTicket.ticketToken = 'pdf417:' + elb.rawData;
0018     res.reservedTicket.ticketedSeat.seatSection = elb.segment1.coachNumber;
0019     res.reservedTicket.ticketedSeat.seatNumber = elb.segment1.seatNumber;
0020     res.reservedTicket.ticketedSeat.seatingType = elb.segment1.classOfTransport;
0021     return res;
0022 }