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.
- package/index.js +47 -46
- package/index.test.js +1 -1
- 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
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
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
|
|
647
|
-
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,
|