ti2-ventrata 1.0.31 → 1.0.33

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 CHANGED
@@ -17,13 +17,13 @@ const getHeaders = ({
17
17
  apiKey,
18
18
  acceptLanguage,
19
19
  octoEnv,
20
- resellerId,
20
+ // resellerId,
21
21
  }) => ({
22
22
  Authorization: `Bearer ${apiKey}`,
23
23
  ...octoEnv ? { 'Octo-Env': octoEnv } : {},
24
24
  ...acceptLanguage ? { 'Accept-Language': acceptLanguage } : {},
25
25
  'Content-Type': 'application/json',
26
- ...resellerId ? { Referer: resellerId } : {},
26
+ // ...resellerId ? { Referer: resellerId } : {},+
27
27
  'Octo-Capabilities': 'octo/pricing,octo/pickups,octo/cart,octo/offers',
28
28
  // 'Octo-Capabilities': 'octo/pricing',
29
29
  });
@@ -332,7 +332,6 @@ class Plugin {
332
332
  endpoint,
333
333
  octoEnv,
334
334
  acceptLanguage,
335
- resellerId,
336
335
  },
337
336
  payload: {
338
337
  rebookingId,
@@ -355,14 +354,13 @@ class Plugin {
355
354
  endpoint,
356
355
  octoEnv,
357
356
  acceptLanguage,
358
- resellerId,
359
357
  });
360
358
  const dataForCreateBooking = await jwt.verify(availabilityKey, this.jwtKey);
361
359
  let booking = R.path(['data'], await axios({
362
360
  method: rebookingId ? 'patch' : 'post',
363
361
  url: `${endpoint || this.endpoint}/bookings${rebookingId ? `/${rebookingId}` : ''}`,
364
362
  data: {
365
- settlementMethod: 'DEFERRED',
363
+ settlementMethod: reference ? 'VOUCHER' : 'DEFERRED',
366
364
  ...dataForCreateBooking,
367
365
  notes,
368
366
  ...(pickupPoint ? { pickupRequested: true, pickupPointId: pickupPoint } : {}),
@@ -381,7 +379,7 @@ class Plugin {
381
379
  },
382
380
  notes,
383
381
  resellerReference: reference,
384
- settlementMethod: reference && octoEnv !== 'test' ? 'VOUCHER' : 'DEFERRED',
382
+ settlementMethod: reference ? 'VOUCHER' : 'DEFERRED',
385
383
  };
386
384
  booking = R.path(['data'], await axios({
387
385
  method: 'post',
@@ -578,6 +576,15 @@ class Plugin {
578
576
  })),
579
577
  };
580
578
  }
579
+
580
+ // eslint-disable-next-line class-methods-use-this
581
+ async getCreateBookingFields() {
582
+ const customFields = [];
583
+ return {
584
+ fields: [],
585
+ customFields,
586
+ };
587
+ }
581
588
  }
582
589
 
583
590
  module.exports = Plugin;
package/index.test.js CHANGED
@@ -175,12 +175,12 @@ describe('search tests', () => {
175
175
  endDate: moment().add(6, 'M').add(2, 'd').format(dateFormat),
176
176
  dateFormat,
177
177
  productIds: [
178
- '28ca088b-bc7b-4746-ab06-5971f1ed5a5e',
178
+ '20ef1799-7020-484b-9fb5-905ec5bb5444',
179
179
  '3465143f-4902-447a-9c1e-8e5598666663',
180
180
  ],
181
181
  optionIds: ['DEFAULT', 'dbe73645-2dd9-4cde-ade0-4faa95668d01'],
182
182
  units: [
183
- [{ unitId: 'unit_c1709f42-297e-4f7e-bd6b-3e77d4622d8a', quantity: 2 }],
183
+ [{ unitId: 'unit_3e987c7b-b87e-47bf-8638-148cdaf700af', quantity: 2 }],
184
184
  [{ unitId: 'unit_d49f8d25-5b37-4365-b67d-daa0594d021e', quantity: 2 }],
185
185
  ],
186
186
  },
@@ -207,12 +207,13 @@ describe('search tests', () => {
207
207
  holder: {
208
208
  name: fullName[0],
209
209
  surname: fullName[1],
210
- phoneNumber: faker.phone.phoneNumber(),
210
+ phone: faker.phone.phoneNumber(),
211
211
  emailAddress: `salvador+tests_${faker.lorem.slug()}@tourconnect.com`,
212
212
  country: faker.address.countryCode(),
213
213
  locales: ['en-US', 'en', 'es'],
214
214
  },
215
- reference,
215
+ // our api key doesn't allow us to set the reference and settlementMethod as VOUCHER
216
+ // reference,
216
217
  },
217
218
  });
218
219
  expect(retVal.booking).toBeTruthy();
@@ -307,12 +308,12 @@ describe('search tests', () => {
307
308
  holder: {
308
309
  name: fullName[0],
309
310
  surname: fullName[1],
310
- phoneNumber: faker.phone.phoneNumber(),
311
+ phone: faker.phone.phoneNumber(),
311
312
  emailAddress: `salvador+tests_${faker.lorem.slug()}@tourconnect.com`,
312
313
  country: faker.address.countryCode(),
313
314
  locales: ['en-US', 'en', 'es'],
314
315
  },
315
- reference,
316
+ // reference,
316
317
  referrer: 'referrerforapitest',
317
318
  settlementMethod: 'DEFERRED',
318
319
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2-ventrata",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "Ventrata's TI2 Plugin",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -28,7 +28,7 @@ const resolvers = {
28
28
  dateTimeEnd: root => R.path(['localDateTimeEnd'], root) || R.path(['localDate'], root),
29
29
  allDay: R.path(['allDay']),
30
30
  vacancies: R.prop('vacancies'),
31
- available: root => root.status !== 'SOLD_OUT',
31
+ available: root => root.status !== 'SOLD_OUT' && root.vacancies > 0,
32
32
  offers: root => R.pathOr([], ['offers'], root).map(o => ({
33
33
  offerId: o.code,
34
34
  title: o.title,