Commit 7057e149 authored by Volker Krause's avatar Volker Krause
Browse files

Extract whether DB tickets depend on a BahnCard

parent edce84c5
Pipeline #72347 passed with stage
in 12 minutes and 46 seconds
......@@ -231,7 +231,22 @@ function parsePdf(pdf, node, triggerNode) {
var reservations = parseTicket(page.text, uic918ticket);
for (var i = 0; i < reservations.length; ++i) {
reservations[i].reservedTicket.ticketToken = "aztecbin:" + Barcode.toBase64(triggerNode.content.rawData);
reservations[i].reservationFor.provider.identifier = "uic:" + triggerNode.content.carrierId;
if (triggerNode.mimeType == "internal/uic9183") {
reservations[i].reservationFor.provider.identifier = "uic:" + triggerNode.content.carrierId;
const block = triggerNode.content.block("0080BL").findSubBlock("009")
if (block) {
const bc = block.content.match(/\d+-\d+-(.*)/)[1];
switch (bc) {
case "49":
reservations[i].programMembershipUsed.programName = "BahnCard 25";
break;
case "19":
case "78":
reservations[i].programMembershipUsed.programName = "BahnCard 50";
break;
}
}
}
if (triggerNode.result.length > 0) {
reservations[i].reservedTicket.name = triggerNode.result[0].reservedTicket.name;
reservations[i].underName = triggerNode.result[0].underName;
......
......@@ -236,7 +236,8 @@ QVariant Vendor0080BLBlock::findSubBlock(const QString &str) const
if (str.size() != 3) {
return {};
}
return QVariant::fromValue(findSubBlock(str.toUtf8().constData()));
const auto b = findSubBlock(str.toUtf8().constData());
return b.isNull() ? QVariant() : QVariant::fromValue(b);
}
int Vendor0080BLBlock::subblockOffset(const Uic9183Block& block)
......
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