ti2-ventrata 1.0.16 → 1.0.18
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 +6 -6
- package/index.test.js +2 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -40,7 +40,7 @@ const doMapCurry = mapObj => item => doMap(item, mapObj);
|
|
|
40
40
|
|
|
41
41
|
const productMapIn = {
|
|
42
42
|
productId: R.path(['id']),
|
|
43
|
-
productName: R.path(['title']),
|
|
43
|
+
productName: o => R.path(['title'], o) || R.prop('internalName', o),
|
|
44
44
|
availableCurrencies: R.path(['availableCurrencies']),
|
|
45
45
|
defaultCurrency: R.path(['defaultCurrency']),
|
|
46
46
|
options: e => R.pathOr(undefined, ['options'], e).map(option => doMap(option, optionMapIn, ['id', 'title'])),
|
|
@@ -48,7 +48,7 @@ const productMapIn = {
|
|
|
48
48
|
|
|
49
49
|
const optionMapIn = {
|
|
50
50
|
optionId: R.path(['id']),
|
|
51
|
-
optionName: R.path(['title']),
|
|
51
|
+
optionName: o => R.path(['title'], o) || R.prop('internalName', o),
|
|
52
52
|
units: option => R.pathOr(undefined, ['units'], option).map(unit => doMap(unit, unitMap)),
|
|
53
53
|
};
|
|
54
54
|
|
|
@@ -101,7 +101,7 @@ const capitalize = sParam => {
|
|
|
101
101
|
|
|
102
102
|
const unitMap = {
|
|
103
103
|
unitId: R.path(['id']),
|
|
104
|
-
unitName: R.path(['title']),
|
|
104
|
+
unitName: o => R.path(['title'], o) || R.prop('internalName', o),
|
|
105
105
|
type: R.path(['type']),
|
|
106
106
|
subtitle: R.path(['subtitle']),
|
|
107
107
|
restrictions: R.path(['restrictions']),
|
|
@@ -201,6 +201,7 @@ const getHeaders = ({
|
|
|
201
201
|
...acceptLanguage ? { 'Accept-Language': acceptLanguage } : {},
|
|
202
202
|
'Content-Type': 'application/json',
|
|
203
203
|
...resellerId ? { Referer: resellerId } : {},
|
|
204
|
+
'Octo-Capabilities': 'octo/pricing',
|
|
204
205
|
});
|
|
205
206
|
|
|
206
207
|
class Plugin {
|
|
@@ -555,9 +556,8 @@ class Plugin {
|
|
|
555
556
|
},
|
|
556
557
|
}) {
|
|
557
558
|
assert(availabilityKey, 'an availability code is required !');
|
|
558
|
-
assert(R.path(['name'], holder), '
|
|
559
|
-
assert(R.path(['surname'], holder), '
|
|
560
|
-
assert(R.path(['emailAddress'], holder), 'a holder\' email address is required');
|
|
559
|
+
assert(R.path(['name'], holder), 'first name is required');
|
|
560
|
+
assert(R.path(['surname'], holder), 'surname is required');
|
|
561
561
|
const headers = getHeaders({
|
|
562
562
|
apiKey,
|
|
563
563
|
endpoint,
|
package/index.test.js
CHANGED
|
@@ -15,7 +15,7 @@ const rnd = arr => arr[Math.floor(Math.random() * arr.length)];
|
|
|
15
15
|
describe('search tests', () => {
|
|
16
16
|
let products;
|
|
17
17
|
let testProduct = {
|
|
18
|
-
productName: 'Pub Crawl Tour',
|
|
18
|
+
productName: 'Edinburgh Pub Crawl Tour',
|
|
19
19
|
};
|
|
20
20
|
const token = {
|
|
21
21
|
apiKey: process.env.ti2_ventrata_apiKey,
|
|
@@ -106,6 +106,7 @@ describe('search tests', () => {
|
|
|
106
106
|
});
|
|
107
107
|
expect(Array.isArray(retVal.products)).toBeTruthy();
|
|
108
108
|
// console.log(retVal.products.filter(({ productName }) => productName === testProduct.productName));
|
|
109
|
+
// console.log(retVal.products.map(p => p.productName))
|
|
109
110
|
expect(retVal.products).toContainObject([{
|
|
110
111
|
productName: testProduct.productName,
|
|
111
112
|
}]);
|