ti2-tourplan 1.0.50 → 1.0.52

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 (2) hide show
  1. package/index.js +31 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -590,11 +590,22 @@ class Plugin {
590
590
  RateText: 'Std'
591
591
  }
592
592
  },
593
- RateId: 'Default',
593
+ RateId: '$NZD2016b81f44793096,4,DOUB,C5 A1INF KGB DOUB RONL',
594
594
  RateName: 'Std-Mon Sun',
595
595
  RateText: 'Std',
596
596
  SaleFrom: '2023-12-20',
597
- TotalPrice: '51175'
597
+ TotalPrice: '51175',
598
+ ExternalRateDetails: {
599
+ ExtSupplierId: 'NZ000021',
600
+ ExtOptionId: 'DOUB',
601
+ ExtOptionDescr: 'Superior Room, 1 King Bed',
602
+ ExtRatePlanCode: 'C5 A1INF KGB DOUB RONL',
603
+ ExtRatePlanDescr: 'Room Only',
604
+ ExtGuarantee: 'N',
605
+ },
606
+ RoomList: {
607
+ RoomType: 'DB',
608
+ }
598
609
  },
599
610
  OptionNumber: '70461'
600
611
  }
@@ -602,8 +613,21 @@ class Plugin {
602
613
  }
603
614
  */
604
615
  const optionInfoReply = R.path(['OptionInfoReply'], replyObj);
616
+ let OptStayResults = R.pathOr([], ['Option', 'OptStayResults'], optionInfoReply);
617
+ if (!Array.isArray(OptStayResults)) OptStayResults = [OptStayResults];
605
618
  return {
606
619
  bookable: Boolean(optionInfoReply),
620
+ rates: OptStayResults.map(rate => {
621
+ let externalRateText = R.pathOr('', ['ExternalRateDetails', 'ExtOptionDescr'], rate);
622
+ const extRatePlanDescr = R.pathOr('', ['ExternalRateDetails', 'ExtRatePlanDescr'], rate);
623
+ if (extRatePlanDescr && !externalRateText.includes(extRatePlanDescr)) {
624
+ externalRateText = `${externalRateText} (${extRatePlanDescr})`;
625
+ }
626
+ return {
627
+ rateId: R.path(['RateId'], rate),
628
+ externalRateText,
629
+ };
630
+ }),
607
631
  };
608
632
  // THE BELOW CODE is for A check, might still need it on user's future request
609
633
  // const optAvail = parseInt(R.pathOr('-4', ['OptionInfoReply', 'Option', 'OptAvail'], replyObj), 10);
@@ -679,6 +703,8 @@ class Plugin {
679
703
  puInfo,
680
704
  doInfo,
681
705
  notes,
706
+ directHeaderPayload,
707
+ directLinePayload,
682
708
  },
683
709
  }) {
684
710
  const model = {
@@ -691,11 +717,9 @@ class Plugin {
691
717
  NewBookingInfo: {
692
718
  Name: this.escapeInvalidXmlChars(quoteName),
693
719
  QB: 'Q',
720
+ ...(directHeaderPayload || {}),
694
721
  },
695
722
  }),
696
- ...(rateId ? {
697
- RateId: rateId,
698
- } : {}),
699
723
  ...(puInfo && (puInfo.time || puInfo.location || puInfo.flightDetails) ? {
700
724
  ...(puInfo.time && puInfo.time.replace(/\D/g, '') ? {
701
725
  puTime: puInfo.time.replace(/\D/g, ''),
@@ -724,7 +748,7 @@ class Plugin {
724
748
  Remarks: this.escapeInvalidXmlChars(notes).slice(0, 220),
725
749
  Opt: optionId,
726
750
  DateFrom: startDate,
727
- RateId: 'Default',
751
+ RateId: rateId || 'Default',
728
752
  SCUqty: (() => {
729
753
  const num = parseInt(chargeUnitQuanity, 10);
730
754
  if (isNaN(num) || num < 1) return 1;
@@ -732,6 +756,7 @@ class Plugin {
732
756
  })(),
733
757
  AgentRef: reference,
734
758
  RoomConfigs: this.getRoomConfigs(paxConfigs),
759
+ ...(directLinePayload || {}),
735
760
  },
736
761
  };
737
762
  const replyObj = await this.callTourplan({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2-tourplan",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
4
4
  "description": "Tourplan's TI2 Plugin",
5
5
  "main": "index.js",
6
6
  "scripts": {