Commit f20f8063 authored by Volker Krause's avatar Volker Krause
Browse files

Parse the carrier code from UIC 918.3 ticket tokens

parent 03049271
......@@ -2,6 +2,7 @@
{
"@context": "http://schema.org",
"@type": "",
"carrierId": "0080",
"person": {
"@type": "Person",
"familyName": "häöür Räß",
......
[
{
"type": "pdf",
"filter": [ { "header": "From", "match": "buchungsbestaetigung@bahn.de" } ],
"filter": [
{ "header": "From", "match": "buchungsbestaetigung@bahn.de" },
{ "header": "provider", "match": "0080" }
],
"script": "deutschebahn.js",
"function": "parsePdf"
},
......
......@@ -424,7 +424,7 @@ void Uic9183Parser::parse(const QByteArray &data)
// 3x header
// 2x version
// 4x issuer UIC carrier code
// 4x UIC code of the signing carrier
// 5x signature key id
// 50x ASN.1 signature
......@@ -488,6 +488,15 @@ QString Uic9183Parser::pnr() const
return QString::fromUtf8(b.data() + 16, 6);
}
QString Uic9183Parser::carrierId() const
{
const auto b = d->findBlock("U_HEAD");
if (b.isNull() || b.version() != 1 || b.size() != 53) {
return {};
}
return QString::fromUtf8(b.data() + 12, 4);
}
Person Uic9183Parser::person() const
{
// Deutsche Bahn vendor block
......
......@@ -87,6 +87,7 @@ class KITINERARY_EXPORT Uic9183Parser
{
Q_GADGET
Q_PROPERTY(QString pnr READ pnr)
Q_PROPERTY(QString carrierId READ carrierId)
Q_PROPERTY(KItinerary::Person person READ person)
Q_PROPERTY(QString outboundDepartureStationId READ outboundDepartureStationId)
Q_PROPERTY(QString outboundArrivalStationId READ outboundArrivalStationId)
......@@ -104,6 +105,8 @@ public:
/** The booking reference. */
QString pnr() const;
/** The UIC carrier code. */
QString carrierId() const;
/** The person this ticket is issued to. */
Person person() const;
......
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