ti2-ventrata 1.0.9 → 1.0.10
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 +37 -32
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -459,38 +459,43 @@ class Plugin {
|
|
|
459
459
|
holder,
|
|
460
460
|
},
|
|
461
461
|
}) {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
462
|
+
try {
|
|
463
|
+
assert(availabilityKey, 'an availability code is required !');
|
|
464
|
+
assert(R.path(['name'], holder), 'a holder\' first name is required');
|
|
465
|
+
assert(R.path(['surname'], holder), 'a holder\' surname is required');
|
|
466
|
+
assert(R.path(['emailAddress'], holder), 'a holder\' email address is required');
|
|
467
|
+
const headers = getHeaders({
|
|
468
|
+
apiKey,
|
|
469
|
+
endpoint,
|
|
470
|
+
octoEnv,
|
|
471
|
+
acceptLanguage,
|
|
472
|
+
});
|
|
473
|
+
let url = `${endpoint || this.endpoint}/bookings`;
|
|
474
|
+
let data = await jwt.verify(availabilityKey, this.jwtKey);
|
|
475
|
+
let booking = R.path(['data'], await axios({
|
|
476
|
+
method: 'post',
|
|
477
|
+
url,
|
|
478
|
+
data: { ...data, notes },
|
|
479
|
+
headers,
|
|
480
|
+
}));
|
|
481
|
+
url = `${endpoint || this.endpoint}/bookings/${booking.uuid}/confirm`;
|
|
482
|
+
const contact = doMap(holder, contactMap);
|
|
483
|
+
data = {
|
|
484
|
+
notes,
|
|
485
|
+
contact,
|
|
486
|
+
resellerReference: reference,
|
|
487
|
+
};
|
|
488
|
+
booking = R.path(['data'], await axios({
|
|
489
|
+
method: 'post',
|
|
490
|
+
url,
|
|
491
|
+
data,
|
|
492
|
+
headers,
|
|
493
|
+
}));
|
|
494
|
+
return ({ booking: doMap(booking, bookingMap) });
|
|
495
|
+
} catch (err) {
|
|
496
|
+
console.log('createBooking-ventrata', err);
|
|
497
|
+
throw Error(err);
|
|
498
|
+
}
|
|
494
499
|
}
|
|
495
500
|
|
|
496
501
|
async cancelBooking({
|