ti2-tourplan 1.0.49 → 1.0.50

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
@@ -681,9 +681,6 @@ class Plugin {
681
681
  notes,
682
682
  },
683
683
  }) {
684
- const extraText = extras && extras.length
685
- ? extras.map((e, i) => `Extra ${i + 1}: ${e.name} x ${e.quantity}`).join(`\n`)
686
- : '';
687
684
  const model = {
688
685
  AddServiceRequest: {
689
686
  AgentID: hostConnectAgentID,
@@ -716,7 +713,15 @@ class Plugin {
716
713
  ${doInfo.flightDetails ? `Flight: ${doInfo.flightDetails || 'NA'},` : ''}
717
714
  `),
718
715
  } : {}),
719
- Remarks: this.escapeInvalidXmlChars(`${notes || ''} ${extraText ? `\nExtras: ${extraText}` : ''}`).slice(0, 220),
716
+ ...(extras && extras.filter(e => e.selectedExtra && e.selectedExtra.id).length ? {
717
+ ExtraQuantities: {
718
+ ExtraQuantityItem: extras.filter(e => e.selectedExtra && e.selectedExtra.id).map(e => ({
719
+ SequenceNumber: e.selectedExtra.id,
720
+ ExtraQuantity: e.quantity,
721
+ })),
722
+ },
723
+ } : {}),
724
+ Remarks: this.escapeInvalidXmlChars(notes).slice(0, 220),
720
725
  Opt: optionId,
721
726
  DateFrom: startDate,
722
727
  RateId: 'Default',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2-tourplan",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "Tourplan's TI2 Plugin",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -44,6 +44,10 @@ const translateTPOption = ({ optionsGroupedBySupplierId, supplierData }) => {
44
44
  options: optionsGroupedBySupplierId.map(option => {
45
45
  const comment = R.path(['OptGeneral', 'Comment'], option);
46
46
  const st = R.pathOr('', ['OptGeneral', 'ButtonName'], option);
47
+ // when only one extra is present, it is not an array
48
+ let OptExtras = R.pathOr([], ['OptGeneral', 'OptExtras', 'OptExtra'], option);
49
+ // console.log({ OptExtras })
50
+ if (!Array.isArray(OptExtras)) OptExtras = [OptExtras];
47
51
  const keyData = {
48
52
  optionId: R.path(['Opt'], option),
49
53
  optionName: `${R.path(['OptGeneral', 'Description'], option)}${
@@ -83,6 +87,13 @@ const translateTPOption = ({ optionsGroupedBySupplierId, supplierData }) => {
83
87
  };
84
88
  }, {}),
85
89
  },
90
+ extras: OptExtras.map(obj => ({
91
+ id: R.path(['SequenceNumber'], obj),
92
+ name: R.path(['Description'], obj),
93
+ chargeBasis: R.path(['ChargeBasis'], obj),
94
+ isCompulsory: R.path(['IsCompulsory'], obj),
95
+ isPricePerPerson: R.path(['IsPricePerPerson'], obj),
96
+ })),
86
97
  };
87
98
  /*
88
99
  SType: One character that specifies the service type of the