ti2-tourplan 1.0.61 → 1.0.63

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 (3) hide show
  1. package/index.js +47 -46
  2. package/index.test.js +1 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -544,7 +544,8 @@ class BuyerPlugin {
544
544
  Password: hostConnectAgentPassword,
545
545
  },
546
546
  });
547
- const [SCheck, ACheck] = await Promise.map(['S', 'A'], async checkType => {
547
+ // const [SCheck, ACheck] = await Promise.map(['S', 'A'], async checkType => {
548
+ const [SCheck] = await Promise.map(['S'], async checkType => {
548
549
  const replyObj = await this.callTourplan({
549
550
  model: getModel(checkType),
550
551
  endpoint: hostConnectEndpoint,
@@ -597,54 +598,54 @@ class BuyerPlugin {
597
598
  }
598
599
  */
599
600
  const SCheckPass = Boolean(SCheck);
600
- const ACheckPass = (() => {
601
- /*
602
- FROM TP DOCS:
603
- Each integer in the list gives the availability for one of the days in the range requested,
604
- from the start date through to the end date. The integer values are to be interpreted as
605
- follows:
606
- Greater than 0 means that inventory is available, with the integer specifying the
607
- number of units available. For options with a service type of Y , the inventory is in
608
- units of rooms. For other service types, the inventory is in units of pax.
609
- -1 Not available.
610
- -2 Available on free sell.
611
- -3 Available on request.
612
- Note: A return value of 0 or something less than -3 is impossible.
613
- */
614
- const optAvail = parseInt(R.pathOr('-4', ['OptAvail'], ACheck), 10);
615
- if (optAvail === -1) {
616
- return {
617
- available: false,
618
- };
619
- }
620
- if (optAvail === -2) {
621
- return {
622
- available: true,
623
- type: 'free sell',
624
- };
625
- }
626
- if (optAvail === -3) {
627
- return {
628
- available: true,
629
- type: 'on request',
630
- };
631
- }
632
- if (optAvail > 0) {
633
- return {
634
- available: true,
635
- type: 'inventory',
636
- quantity: optAvail,
637
- };
638
- }
639
- return {
640
- available: false,
641
- };
642
- })();
601
+ // const ACheckPass = (() => {
602
+ // /*
603
+ // FROM TP DOCS:
604
+ // Each integer in the list gives the availability for one of the days in the range requested,
605
+ // from the start date through to the end date. The integer values are to be interpreted as
606
+ // follows:
607
+ // Greater than 0 means that inventory is available, with the integer specifying the
608
+ // number of units available. For options with a service type of Y , the inventory is in
609
+ // units of rooms. For other service types, the inventory is in units of pax.
610
+ // -1 Not available.
611
+ // -2 Available on free sell.
612
+ // -3 Available on request.
613
+ // Note: A return value of 0 or something less than -3 is impossible.
614
+ // */
615
+ // const optAvail = parseInt(R.pathOr('-4', ['OptAvail'], ACheck), 10);
616
+ // if (optAvail === -1) {
617
+ // return {
618
+ // available: false,
619
+ // };
620
+ // }
621
+ // if (optAvail === -2) {
622
+ // return {
623
+ // available: true,
624
+ // type: 'free sell',
625
+ // };
626
+ // }
627
+ // if (optAvail === -3) {
628
+ // return {
629
+ // available: true,
630
+ // type: 'on request',
631
+ // };
632
+ // }
633
+ // if (optAvail > 0) {
634
+ // return {
635
+ // available: true,
636
+ // type: 'inventory',
637
+ // quantity: optAvail,
638
+ // };
639
+ // }
640
+ // return {
641
+ // available: false,
642
+ // };
643
+ // })();
643
644
  let OptStayResults = R.pathOr([], ['OptStayResults'], SCheck);
644
645
  if (!Array.isArray(OptStayResults)) OptStayResults = [OptStayResults];
645
646
  return {
646
- bookable: Boolean(SCheckPass || ACheckPass.available),
647
- type: ACheckPass.type,
647
+ bookable: Boolean(SCheckPass),
648
+ type: 'inventory',
648
649
  rates: OptStayResults.map(rate => {
649
650
  let externalRateText = R.pathOr('', ['ExternalRateDetails', 'ExtOptionDescr'], rate);
650
651
  const extRatePlanDescr = R.pathOr('', ['ExternalRateDetails', 'ExtRatePlanDescr'], rate);
package/index.test.js CHANGED
@@ -235,7 +235,7 @@ describe('search tests', () => {
235
235
  expect(retVal.rates.length).toBeGreaterThan(0);
236
236
  expect(retVal.type).toBe('inventory');
237
237
  });
238
- it('searchAvailabilityForItinerary - bookable - on request', async () => {
238
+ it.skip('searchAvailabilityForItinerary - bookable - on request', async () => {
239
239
  axios.mockImplementation(getFixture);
240
240
  const retVal = await app.searchAvailabilityForItinerary({
241
241
  axios,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2-tourplan",
3
- "version": "1.0.61",
3
+ "version": "1.0.63",
4
4
  "description": "Tourplan's TI2 Plugin",
5
5
  "main": "index.js",
6
6
  "scripts": {