Commit d7d9b968 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇 Committed by Volker Krause
Browse files

Add extractor for Feratel cards

This seems to be a popular infrastructure provider for tourism
discount cards in Austria.
parent 8585200e
......@@ -54,6 +54,8 @@
<file>eventbrite.js</file>
<file>fcmtravel.json</file>
<file>fcmtravel.js</file>
<file>feratel-card.json</file>
<file>feratel-card.js</file>
<file>flixbus.json</file>
<file>flixbus.js</file>
<file>hertz.js</file>
......
/*
SPDX-FileCopyrightText: 2021 Kai Uwe Broulik <kde@broulik.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function parseReservation(pass, node) {
let res = node.result[0];
const secondary = pass.secondaryFields;
const cardName = secondary.find(item => item.key === "cardName");
const ausgabestelleName = secondary.find(item => item.key === "ausgabestelleName");
if (cardName) {
res.underName = JsonLd.newObject("Person");
res.underName.name = cardName.value;
}
if (ausgabestelleName) {
res.reservationFor.name = ausgabestelleName.value;
}
const aux = pass.auxiliaryFields;
const cardValidFrom = aux.find(item => item.key === "cardValidFrom");
const cardValidTo = aux.find(item => item.key === "cardValidTo");
if (cardValidFrom) {
res.reservationFor.startDate = cardValidFrom.value;
}
if (cardValidTo) {
res.reservationFor.endDate = cardValidTo.value;
}
const back = pass.backFields;
const web = back.find(item => item.key === "web");
if (web) {
res.reservationFor.url = web.value;
}
return res;
}
{
"filter": [
{
"field": "passTypeIdentifier",
"match": "pass\\.com\\.feratel\\.card\\.mobile\\..*",
"mimeType": "application/vnd.apple.pkpass",
"scope": "Current"
}
],
"function": "parseReservation",
"mimeType": "application/vnd.apple.pkpass",
"script": "feratel-card.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