Commit 69549b51 authored by Volker Krause's avatar Volker Krause
Browse files

Add DB BahnCard extractor

This is useful for importing a digital representation from preliminary
PDFs or DB Navigator into Itinerary.
parent 19053cce
......@@ -270,3 +270,16 @@ function parseCancellation(html) {
res.reservationFor = 1;
return res;
}
function parseBahncard(code, node) {
if (code.ticketLayout.type != "RCT2" || !code.ticketLayout.text(0, 12, 40, 1).match(/BAHNCARD/i)) {
return;
}
var bc = JsonLd.newObject("ProgramMembership");
bc.programName = code.ticketLayout.text(1, 12, 40, 1);
bc.membershipNumber = code.ticketLayout.text(14, 11, 16, 1);
bc.member = node.result[0].underName;
bc.token = node.result[0].reservedTicket.ticketToken;
return bc.programName != undefined ? bc : undefined;
}
......@@ -56,5 +56,18 @@
"function": "parseCancellation",
"mimeType": "text/html",
"script": "deutschebahn.js"
},
{
"filter": [
{
"field": "carrierId",
"match": "80",
"mimeType": "internal/uic9183",
"scope": "Current"
}
],
"function": "parseBahncard",
"mimeType": "internal/uic9183",
"script": "deutschebahn.js"
}
]
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