Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KItinerary
Commits
1864c3e2
Commit
1864c3e2
authored
Sep 10, 2021
by
Nicolas Fella
Browse files
Add extractor for onepagebooking
parent
1cf310b4
Pipeline
#79852
passed with stage
in 13 minutes and 50 seconds
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/lib/scripts/extractors.qrc
View file @
1864c3e2
...
...
@@ -96,6 +96,8 @@
<file>np4.js</file>
<file>oebb.json</file>
<file>oebb.js</file>
<file>onepagebooking.json</file>
<file>onepagebooking.js</file>
<file>regiojet.json</file>
<file>regiojet.js</file>
<file>regiondo.json</file>
...
...
src/lib/scripts/onepagebooking.js
0 → 100644
View file @
1864c3e2
/*
SPDX-FileCopyrightText: 2021 Nicolas Fella <nicolas.fella@gmx.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function
main
(
content
)
{
const
resId
=
content
.
match
(
/Buchungsnummer:
(
.+
)
/
)[
1
]
const
arrivalDate
=
content
.
match
(
/Anreisetag:
(
.+
)
/
)[
1
]
const
departureDate
=
content
.
match
(
/Abreisetag:
(
.+
)
/
)[
1
]
const
guestName
=
content
.
match
(
/Gastname:
(
Herr|Frau
)
(
.+
)
/
)[
2
]
const
addressBlock
=
content
.
match
(
/Ihr
\n(
.*
)\n(
.*
)\n(
.*
)
/
)
const
hotelName
=
addressBlock
[
1
]
const
street
=
addressBlock
[
2
]
const
cityLine
=
addressBlock
[
3
].
match
(
/
([
0-9
]
+
)
(
.*
)
/
)
const
address
=
JsonLd
.
newObject
(
"
PostalAddress
"
)
address
.
addressCountry
=
"
DE
"
address
.
addressLocality
=
cityLine
[
2
]
address
.
postalCode
=
cityLine
[
1
]
address
.
streetAddress
=
street
const
telephone
=
content
.
match
(
/Tel.:
(
.*
)
/
)[
1
]
const
email
=
content
.
match
(
/E-Mail:
(
.*
)
/
)[
1
]
const
price
=
content
.
match
(
/Gesamtpreis:
(
.*
)
EUR/
)[
1
].
replace
(
'
,
'
,
'
.
'
)
const
numberAdults
=
content
.
match
(
/Anzahl der Erwachsener:
([
0-9
]
+
)
/
)[
1
]
const
numberChildren
=
content
.
match
(
/Anzahl der Kinder:
([
0-9
]
+
)
/
)[
1
]
var
res
=
JsonLd
.
newLodgingReservation
()
res
.
reservationFor
.
name
=
addressBlock
[
1
]
res
.
reservationNumber
=
resId
res
.
checkinTime
=
JsonLd
.
toDateTime
(
arrivalDate
,
"
dd.MM.yyyy
"
,
"
de
"
)
res
.
checkoutTime
=
JsonLd
.
toDateTime
(
departureDate
,
"
dd.MM.yyyy
"
,
"
de
"
)
res
.
reservationFor
.
telephone
=
telephone
res
.
reservationFor
.
email
=
email
res
.
reservationFor
.
address
=
address
res
.
underName
.
name
=
guestName
res
.
totalPrice
=
price
res
.
priceCurrency
=
"
EUR
"
res
.
reservationFor
.
numAdults
=
numberAdults
res
.
reservationFor
.
numChildren
=
numberChildren
return
res
}
src/lib/scripts/onepagebooking.json
0 → 100644
View file @
1864c3e2
{
"filter"
:
[
{
"field"
:
"From"
,
"match"
:
"@onepagebooking.com"
,
"mimeType"
:
"message/rfc822"
,
"scope"
:
"Ancestors"
}
],
"function"
:
"main"
,
"mimeType"
:
"text/plain"
,
"script"
:
"onepagebooking.js"
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment