ti2-tourplan 1.0.39 → 1.0.40

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
@@ -748,6 +748,7 @@ class Plugin {
748
748
  purchaseDateStart,
749
749
  purchaseDateEnd,
750
750
  bookingId,
751
+ name,
751
752
  },
752
753
  }) {
753
754
  const getPayload = (RequestType, RequestInput) => ({
@@ -766,11 +767,18 @@ class Plugin {
766
767
  EnteredDateFrom: purchaseDateStart || moment().subtract(6, 'month').format('YYYY-MM-DD'),
767
768
  EnteredDateTo: purchaseDateEnd || moment().format('YYYY-MM-DD'),
768
769
  });
769
- const allSearches = bookingId
770
- ? ['BookingId', 'Ref', 'AgentRef'].map(async key => {
770
+ let searchCriterias = [];
771
+ if (bookingId) {
772
+ searchCriterias = ['BookingId', 'Ref', 'AgentRef'].map(key => ({ [key]: bookingId }));
773
+ }
774
+ if (name) {
775
+ searchCriterias.push({ NameContains: name });
776
+ }
777
+ const allSearches = searchCriterias.length
778
+ ? searchCriterias.map(async keyObj => {
771
779
  let reply;
772
780
  try {
773
- reply = await this.callTourplan(getPayload('ListBookingsRequest', { [key]: bookingId }));
781
+ reply = await this.callTourplan(getPayload('ListBookingsRequest', keyObj));
774
782
  } catch (err) {
775
783
  if (err.includes && err.includes('Request failed with status code')) {
776
784
  throw Error(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2-tourplan",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "description": "Tourplan's TI2 Plugin",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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,