Commit 6b87ead4 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Add extractor for Aegean Airlines pkpass

Extracts prettier passenger name as well as departure and arrival times
parent 8bd895d3
Pipeline #256061 passed with stage
in 7 minutes and 8 seconds
/*
SPDX-FileCopyrightText: 2022 Kai Uwe Broulik <kde@broulik.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function main(pass, node)
{
let res = node.result[0];
const passenger = pass.field["passenger"].value.split("/").reverse();
if (passenger.length === 2) {
res.underName = JsonLd.newObject("Person");
res.underName.givenName = passenger[0];
res.underName.familyName = passenger[1];
}
const departureTime = JsonLd.toDateTime(pass.field["departuretime"].value, "hh:mm", "en");
if (!isNaN(departureTime.getTime())) {
res.reservationFor.departureTime = departureTime;
}
const arrivalTime = JsonLd.toDateTime(pass.field["arrivaltime"].value, "hh:mm", "en");
if (!isNaN(arrivalTime.getTime())) {
res.reservationFor.arrivalTime = arrivalTime;
}
return res;
}
[{
"mimeType": "application/vnd.apple.pkpass",
"filter": [ { "field": "passTypeIdentifier", "match": "pass.com.aegeanair.mbp", "mimeType": "application/vnd.apple.pkpass", "scope": "Current" } ],
"script": "aegean.js"
}]
......@@ -8,6 +8,8 @@
<file>accor.js</file>
<file>acprail.json</file>
<file>acprail.js</file>
<file>aegean.json</file>
<file>aegean.js</file>
<file>aerlingus.json</file>
<file>aerlingus.js</file>
<file>agoda.json</file>
......
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