Commit 9a7be742 authored by Volker Krause's avatar Volker Krause
Browse files

Add caesar-data hotel booking extractor script

parent 1f8aa6c9
Pipeline #276239 passed with stage
in 4 minutes and 13 seconds
/*
SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function parseConfirmationEmail(content) {
const text = content.root.recursiveContent;
let res = JsonLd.newLodgingReservation();
res.reservationNumber = text.match(/Buchungs-Nr.: (.*?)[\s\n]/)[1];
const timeRange = text.match(/Ankunft: (.*?) - Abreise: (.*)\n/);
res.checkinDate = JsonLd.toDateTime(timeRange[1], 'dd. MMMM yyyy', 'de');
res.checkoutDate = JsonLd.toDateTime(timeRange[2], 'dd. MMMM yyyy', 'de');
res.underName.name = text.match(/Daten des Bestellers:\n(?:Herr|Frau) (.*)\n/)[1];
const addr = text.match(/(.*)\n(.*)\n(.*)\nTel.: (.*)\nFax: .*\n(http.*)\n(.*@.*)\n/);
res.reservationFor.name = addr[1];
res.reservationFor.address.streetAddress = addr[2];
res.reservationFor.address.addressLocality = addr[3];
res.reservationFor.telephone = addr[4];
res.reservationFor.url = addr[5];
res.reservationFor.email = addr[6];
return res;
}
{
"filter": [
{
"field": "From",
"match": "@caesar-data.com",
"mimeType": "message/rfc822",
"scope": "Ancestors"
}
],
"function": "parseConfirmationEmail",
"mimeType": "text/html",
"script": "caesar-data.js"
}
......@@ -43,6 +43,8 @@
<file>brusselsairlines-receipt.js</file>
<file>bvg.json</file>
<file>bvg.js</file>
<file>caesar-data.json</file>
<file>caesar-data.js</file>
<file>chaos-communication-congress.json</file>
<file>chaos-communication-congress.js</file>
<file>czechrailways.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