ti2-tourplan 1.0.39 → 1.0.41
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 +17 -11
- package/package.json +1 -1
- package/resolvers/product.js +0 -1
package/index.js
CHANGED
|
@@ -104,6 +104,11 @@ class Plugin {
|
|
|
104
104
|
regExp: /.+/,
|
|
105
105
|
},
|
|
106
106
|
});
|
|
107
|
+
this.cacheSettings = {
|
|
108
|
+
bookingsProductSearch: {
|
|
109
|
+
skipTTL: true,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
107
112
|
this.callTourplan = async ({
|
|
108
113
|
model,
|
|
109
114
|
endpoint,
|
|
@@ -437,14 +442,7 @@ class Plugin {
|
|
|
437
442
|
xmlOptions: hostConnectXmlOptions,
|
|
438
443
|
};
|
|
439
444
|
// use cache if we are getting the full list
|
|
440
|
-
const replyObj =
|
|
441
|
-
? await this.callTourplan(payload)
|
|
442
|
-
: await this.cache.getOrExec({
|
|
443
|
-
fnParams: [model],
|
|
444
|
-
fn: () => this.callTourplan(payload),
|
|
445
|
-
ttl: 60 * 60 * 24, // 24 hours
|
|
446
|
-
forceRefresh: Boolean(forceRefresh),
|
|
447
|
-
});
|
|
445
|
+
const replyObj = await this.callTourplan(payload);
|
|
448
446
|
let products = [];
|
|
449
447
|
if (replyObj === 'useFixture') {
|
|
450
448
|
products = require('./__fixtures__/fullacoptionlist.json');
|
|
@@ -748,6 +746,7 @@ class Plugin {
|
|
|
748
746
|
purchaseDateStart,
|
|
749
747
|
purchaseDateEnd,
|
|
750
748
|
bookingId,
|
|
749
|
+
name,
|
|
751
750
|
},
|
|
752
751
|
}) {
|
|
753
752
|
const getPayload = (RequestType, RequestInput) => ({
|
|
@@ -766,11 +765,18 @@ class Plugin {
|
|
|
766
765
|
EnteredDateFrom: purchaseDateStart || moment().subtract(6, 'month').format('YYYY-MM-DD'),
|
|
767
766
|
EnteredDateTo: purchaseDateEnd || moment().format('YYYY-MM-DD'),
|
|
768
767
|
});
|
|
769
|
-
|
|
770
|
-
|
|
768
|
+
let searchCriterias = [];
|
|
769
|
+
if (bookingId) {
|
|
770
|
+
searchCriterias = ['BookingId', 'Ref', 'AgentRef'].map(key => ({ [key]: bookingId }));
|
|
771
|
+
}
|
|
772
|
+
if (name) {
|
|
773
|
+
searchCriterias.push({ NameContains: name });
|
|
774
|
+
}
|
|
775
|
+
const allSearches = searchCriterias.length
|
|
776
|
+
? searchCriterias.map(async keyObj => {
|
|
771
777
|
let reply;
|
|
772
778
|
try {
|
|
773
|
-
reply = await this.callTourplan(getPayload('ListBookingsRequest',
|
|
779
|
+
reply = await this.callTourplan(getPayload('ListBookingsRequest', keyObj));
|
|
774
780
|
} catch (err) {
|
|
775
781
|
if (err.includes && err.includes('Request failed with status code')) {
|
|
776
782
|
throw Error(err);
|
package/package.json
CHANGED
package/resolvers/product.js
CHANGED
|
@@ -123,7 +123,6 @@ const translateTPOption = ({ optionsGroupedBySupplierId, supplierData }) => {
|
|
|
123
123
|
} : null].filter(Boolean);
|
|
124
124
|
}
|
|
125
125
|
if (R.path(['OptGeneral', 'SType'], option) === 'Y' || R.path(['OptGeneral', 'SType'], option) === 'P') {
|
|
126
|
-
console.log('hit here')
|
|
127
126
|
return ['Single', 'Twin', 'Double', 'Quad']
|
|
128
127
|
.map((unitId) => ({
|
|
129
128
|
unitId,
|