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.
Files changed (2) hide show
  1. package/index.js +37 -32
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -459,38 +459,43 @@ class Plugin {
459
459
  holder,
460
460
  },
461
461
  }) {
462
- assert(availabilityKey, 'an availability code is required !');
463
- assert(R.path(['name'], holder), 'a holder\' first name is required');
464
- assert(R.path(['surname'], holder), 'a holder\' surname is required');
465
- assert(R.path(['emailAddress'], holder), 'a holder\' email address is required');
466
- const headers = getHeaders({
467
- apiKey,
468
- endpoint,
469
- octoEnv,
470
- acceptLanguage,
471
- });
472
- let url = `${endpoint || this.endpoint}/bookings`;
473
- let data = await jwt.verify(availabilityKey, this.jwtKey);
474
- let booking = R.path(['data'], await axios({
475
- method: 'post',
476
- url,
477
- data: { ...data, notes },
478
- headers,
479
- }));
480
- url = `${endpoint || this.endpoint}/bookings/${booking.uuid}/confirm`;
481
- const contact = doMap(holder, contactMap);
482
- data = {
483
- notes,
484
- contact,
485
- resellerReference: reference,
486
- };
487
- booking = R.path(['data'], await axios({
488
- method: 'post',
489
- url,
490
- data,
491
- headers,
492
- }));
493
- return ({ booking: doMap(booking, bookingMap) });
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({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2-ventrata",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Ventrata's TI2 Plugin",
5
5
  "main": "index.js",
6
6
  "scripts": {