Commit 19053cce authored by Volker Krause's avatar Volker Krause
Browse files

Extract CartaFRECCIA details from Trenitalia barcodes

parent e6335453
Pipeline #72774 passed with stage
in 12 minutes and 29 seconds
...@@ -53,12 +53,16 @@ function parsePdf(pdf) { ...@@ -53,12 +53,16 @@ function parsePdf(pdf) {
} }
// see https://community.kde.org/KDE_PIM/KItinerary/Trenitalia_Barcode // see https://community.kde.org/KDE_PIM/KItinerary/Trenitalia_Barcode
var ssb = Barcode.decodeEraSsbTicket(barcode) const ssb = Barcode.decodeEraSsbTicket(barcode)
personalRes.reservationFor.departureStation.identifier = "uic:" + (ssb.departureStationNum % 10000000) personalRes.reservationFor.departureStation.identifier = "uic:" + (ssb.departureStationNum % 10000000)
if (ssb.departureStationNum != ssb.arrivalStationNum) { if (ssb.departureStationNum != ssb.arrivalStationNum) {
personalRes.reservationFor.arrivalStation.identifier = "uic:" + (ssb.arrivalStationNum % 10000000) personalRes.reservationFor.arrivalStation.identifier = "uic:" + (ssb.arrivalStationNum % 10000000)
} }
personalRes.reservationFor.provider.identifier = "uic:" + ssb.issuerCode; personalRes.reservationFor.provider.identifier = "uic:" + ssb.issuerCode;
if (ssb.customerNumber > 0) {
personalRes.programMembershipUsed.membershipNumber = ssb.customerNumber;
personalRes.programMembershipUsed.programName = "CartaFRECCIA";
}
var bitArray = Barcode.toBitArray(barcode); var bitArray = Barcode.toBitArray(barcode);
var seatNum = bitArray.readNumberMSB(31*8 + 2, 7); var seatNum = bitArray.readNumberMSB(31*8 + 2, 7);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment