ti2-ventrata 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +15 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -37,6 +37,8 @@ const doMapCurry = mapObj => item => doMap(item, mapObj);
|
|
|
37
37
|
const productMapIn = {
|
|
38
38
|
productId: R.path(['id']),
|
|
39
39
|
productName: R.path(['title']),
|
|
40
|
+
availableCurrencies: R.path(['availableCurrencies']),
|
|
41
|
+
defaultCurrency: R.path(['defaultCurrency']),
|
|
40
42
|
options: e => R.pathOr(undefined, ['options'], e).map(option => doMap(option, optionMapIn, ['id', 'title'])),
|
|
41
43
|
};
|
|
42
44
|
|
|
@@ -57,6 +59,7 @@ const availabilityMap = {
|
|
|
57
59
|
dateTimeEnd: R.path(['localDateTimeEnd']),
|
|
58
60
|
allDay: R.path(['allDay']),
|
|
59
61
|
pricing: R.path(['pricing']),
|
|
62
|
+
unitPricing: R.path(['unitPricing']),
|
|
60
63
|
offer: avail => (avail.offerCode ? doMap(avail, {
|
|
61
64
|
offerId: R.path(['offerCode']),
|
|
62
65
|
title: R.pathOr(undefined, ['offerTitle']),
|
|
@@ -81,8 +84,9 @@ const capitalize = sParam => {
|
|
|
81
84
|
const unitMap = {
|
|
82
85
|
unitId: R.path(['id']),
|
|
83
86
|
unitName: R.path(['title']),
|
|
87
|
+
subtitle: R.path(['subtitle']),
|
|
84
88
|
restrictions: R.path(['restrictions']),
|
|
85
|
-
pricing: R.path(['pricing']),
|
|
89
|
+
pricing: root => R.path(['pricing'], root) || R.path(['pricingFrom'], root),
|
|
86
90
|
};
|
|
87
91
|
|
|
88
92
|
const itineraryMap = {
|
|
@@ -103,11 +107,13 @@ const itineraryMap = {
|
|
|
103
107
|
|
|
104
108
|
const unitItemMap = {
|
|
105
109
|
unitItemId: R.path(['uuid']),
|
|
110
|
+
unitId: R.path(['unitId']),
|
|
111
|
+
unitName: R.path(['unit', 'title']),
|
|
106
112
|
supplierId: R.path(['supplierReference']),
|
|
107
113
|
status: e => capitalize(R.path(['status'], e)),
|
|
108
114
|
contact: R.path(['contact']),
|
|
109
115
|
pricing: R.path(['pricing']),
|
|
110
|
-
unit:
|
|
116
|
+
unit: root => doMap(root.unit, unitMap),
|
|
111
117
|
};
|
|
112
118
|
|
|
113
119
|
const contactMapOut = {
|
|
@@ -123,11 +129,14 @@ const contactMapOut = {
|
|
|
123
129
|
|
|
124
130
|
const bookingMap = {
|
|
125
131
|
id: R.path(['id']),
|
|
132
|
+
orderId: R.path(['orderReference']),
|
|
133
|
+
bookingId: R.path(['supplierReference']),
|
|
126
134
|
supplierId: R.path(['supplierReference']),
|
|
127
135
|
status: e => capitalize(R.path(['status'], e)),
|
|
128
136
|
productId: R.path(['product', 'id']),
|
|
129
137
|
productName: R.path(['product', 'title']),
|
|
130
138
|
optionId: R.path(['option', 'id']),
|
|
139
|
+
optionName: R.path(['option', 'title']),
|
|
131
140
|
itinerary: ({ option: { itinerary } = {} }) =>
|
|
132
141
|
(isNilOrEmptyArray(itinerary) ? undefined : itinerary.map(doMapCurry(itineraryMap))),
|
|
133
142
|
duration: booking => doMap(booking, {
|
|
@@ -141,7 +150,7 @@ const bookingMap = {
|
|
|
141
150
|
start: R.path(['availability', 'localDateTimeStart']),
|
|
142
151
|
end: R.path(['availability', 'localDateTimeEnd']),
|
|
143
152
|
allDay: R.path(['availability', 'allDay']),
|
|
144
|
-
bookingDate: R.path(['
|
|
153
|
+
bookingDate: R.path(['utcCreatedAt']),
|
|
145
154
|
holder: booking => doMap(R.path(['contact'], booking), contactMapOut),
|
|
146
155
|
telephone: R.pathOr(undefined, ['contact', 'phoneNumber']),
|
|
147
156
|
notes: R.pathOr(undefined, ['notes']),
|
|
@@ -281,6 +290,7 @@ class Plugin {
|
|
|
281
290
|
startDate,
|
|
282
291
|
endDate,
|
|
283
292
|
dateFormat,
|
|
293
|
+
currency,
|
|
284
294
|
},
|
|
285
295
|
}) {
|
|
286
296
|
assert(this.jwtKey, 'JWT secret should be set');
|
|
@@ -323,6 +333,7 @@ class Plugin {
|
|
|
323
333
|
optionId: optionIds[rateIx],
|
|
324
334
|
localDateStart,
|
|
325
335
|
localDateEnd,
|
|
336
|
+
currency,
|
|
326
337
|
units: Object.entries(qtys).map(([id, quantity]) => ({
|
|
327
338
|
id, quantity,
|
|
328
339
|
})),
|
|
@@ -342,6 +353,7 @@ class Plugin {
|
|
|
342
353
|
productId: productIds[availsIx],
|
|
343
354
|
optionId: optionIds[availsIx],
|
|
344
355
|
availabilityId: avail.id,
|
|
356
|
+
currency,
|
|
345
357
|
unitItems: rates[availsIx].map(rate => ({ unitId: rate })),
|
|
346
358
|
}), this.jwtKey),
|
|
347
359
|
...doMap(avail, availabilityMap),
|