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

0001 /*
0002    SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org>
0003    SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 function parseConfirmation(html) {
0007     let res = JsonLd.newLodgingReservation();
0008     const text = html.root.recursiveContent;
0009     const addr = text.match(/Hoteladresse:\n(.*)\n(.*)\n(.*)\n\s+(.*)\n/);
0010     res.reservationFor.name = addr[1];
0011     res.reservationFor.address.streetAddress = addr[2];
0012     res.reservationFor.address.postalCode = addr[3];
0013     res.reservationFor.address.addressLocality = addr[4];
0014     const dt = text.match(/Anreise\/Abreise: .* (\d\d\.\d\d\.\d{4})\n\s+\/\s*\n.* (\d\d\.\d\d\.\d{4})/);
0015     res.checkinTime = JsonLd.toDateTime(dt[1], "dd.MM.yyyy", "de");
0016     res.checkoutTime = JsonLd.toDateTime(dt[2], "dd.MM.yyyy", "de");
0017     res.reservationNumber = text.match(/Buchungsnummer: (.*)\n/)[1];
0018     res.cancelReservationUrl = html.eval('//a[contains(@href,"showBookingCancelPage")]')[0].attribute('href');
0019     return res;
0020 }