ti2-tourplan 1.0.49 → 1.0.51
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 +38 -10
- package/package.json +1 -1
- package/resolvers/product.js +11 -0
package/index.js
CHANGED
|
@@ -590,11 +590,22 @@ class Plugin {
|
|
|
590
590
|
RateText: 'Std'
|
|
591
591
|
}
|
|
592
592
|
},
|
|
593
|
-
RateId: '
|
|
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,11 +703,9 @@ class Plugin {
|
|
|
679
703
|
puInfo,
|
|
680
704
|
doInfo,
|
|
681
705
|
notes,
|
|
706
|
+
directHeaderPayload,
|
|
682
707
|
},
|
|
683
708
|
}) {
|
|
684
|
-
const extraText = extras && extras.length
|
|
685
|
-
? extras.map((e, i) => `Extra ${i + 1}: ${e.name} x ${e.quantity}`).join(`\n`)
|
|
686
|
-
: '';
|
|
687
709
|
const model = {
|
|
688
710
|
AddServiceRequest: {
|
|
689
711
|
AgentID: hostConnectAgentID,
|
|
@@ -694,11 +716,9 @@ class Plugin {
|
|
|
694
716
|
NewBookingInfo: {
|
|
695
717
|
Name: this.escapeInvalidXmlChars(quoteName),
|
|
696
718
|
QB: 'Q',
|
|
719
|
+
...(directHeaderPayload || {}),
|
|
697
720
|
},
|
|
698
721
|
}),
|
|
699
|
-
...(rateId ? {
|
|
700
|
-
RateId: rateId,
|
|
701
|
-
} : {}),
|
|
702
722
|
...(puInfo && (puInfo.time || puInfo.location || puInfo.flightDetails) ? {
|
|
703
723
|
...(puInfo.time && puInfo.time.replace(/\D/g, '') ? {
|
|
704
724
|
puTime: puInfo.time.replace(/\D/g, ''),
|
|
@@ -716,10 +736,18 @@ class Plugin {
|
|
|
716
736
|
${doInfo.flightDetails ? `Flight: ${doInfo.flightDetails || 'NA'},` : ''}
|
|
717
737
|
`),
|
|
718
738
|
} : {}),
|
|
719
|
-
|
|
739
|
+
...(extras && extras.filter(e => e.selectedExtra && e.selectedExtra.id).length ? {
|
|
740
|
+
ExtraQuantities: {
|
|
741
|
+
ExtraQuantityItem: extras.filter(e => e.selectedExtra && e.selectedExtra.id).map(e => ({
|
|
742
|
+
SequenceNumber: e.selectedExtra.id,
|
|
743
|
+
ExtraQuantity: e.quantity,
|
|
744
|
+
})),
|
|
745
|
+
},
|
|
746
|
+
} : {}),
|
|
747
|
+
Remarks: this.escapeInvalidXmlChars(notes).slice(0, 220),
|
|
720
748
|
Opt: optionId,
|
|
721
749
|
DateFrom: startDate,
|
|
722
|
-
RateId: 'Default',
|
|
750
|
+
RateId: rateId || 'Default',
|
|
723
751
|
SCUqty: (() => {
|
|
724
752
|
const num = parseInt(chargeUnitQuanity, 10);
|
|
725
753
|
if (isNaN(num) || num < 1) return 1;
|
package/package.json
CHANGED
package/resolvers/product.js
CHANGED
|
@@ -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
|