File indexing completed on 2024-12-29 04:51:03

0001 /*
0002    SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
0003    SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 function parseConfirmationEmail(content) {
0007     const text = content.root.recursiveContent;
0008 
0009     let res = JsonLd.newLodgingReservation();
0010     res.reservationNumber = text.match(/Buchungs-Nr.: (.*?)[\s\n]/)[1];
0011     const timeRange = text.match(/Ankunft: (.*?) - Abreise: (.*)\n/);
0012     res.checkinDate = JsonLd.toDateTime(timeRange[1], 'dd. MMMM yyyy', 'de');
0013     res.checkoutDate = JsonLd.toDateTime(timeRange[2], 'dd. MMMM yyyy', 'de');
0014     res.underName.name = text.match(/Daten des Bestellers:\n(?:Herr|Frau) (.*)\n/)[1];
0015     const addr = text.match(/(.*)\n(.*)\n(.*)\nTel.: (.*)\nFax: .*\n(http.*)\n(.*@.*)\n/);
0016     res.reservationFor.name = addr[1];
0017     res.reservationFor.address.streetAddress = addr[2];
0018     res.reservationFor.address.addressLocality = addr[3];
0019     res.reservationFor.telephone = addr[4];
0020     res.reservationFor.url = addr[5];
0021     res.reservationFor.email = addr[6];
0022     return res;
0023 }