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

Add PDF extractor stage for SNCF discount cards

This augments what we get from the barcode, e.g. the owner name and (once
the data model supports that) the validity range.

CCBUG: 453322
parent c7e4dee7
Pipeline #172251 passed with stage
in 3 minutes and 37 seconds
......@@ -500,3 +500,13 @@ function parseSncfCarte(code) {
carte.token = 'aztec:' + code;
return carte.programName != undefined ? carte : undefined;
}
function parseSncfCartePdf(pdf, node, barcode) {
const text = pdf.pages[barcode.location].text;
var carte = node.result[0];
carte.member = JsonLd.newObject("Person");
carte.member.familyName = text.match(/Nom\s*:\s*(.*)/)[1];
carte.member.givenName = text.match(/Prénom\s*:\s*(.*)/)[1];
// TODO validity period, once the data model supports that
return carte;
}
......@@ -123,5 +123,17 @@
"function": "parseSncfCarte",
"mimeType": "text/plain",
"script": "sncf.js"
},
{
"filter": [
{
"match": "^h0FV",
"mimeType": "text/plain",
"scope": "Descendants"
}
],
"function": "parseSncfCartePdf",
"mimeType": "application/pdf",
"script": "sncf.js"
}
]
Supports Markdown
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