ti2-tourplan 1.0.47 → 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 +28 -5
- package/package.json +1 -1
- package/resolvers/product.js +11 -0
package/index.js
CHANGED
|
@@ -474,9 +474,13 @@ class Plugin {
|
|
|
474
474
|
const products = R.call(R.compose(
|
|
475
475
|
R.map(optionsGroupedBySupplierId => {
|
|
476
476
|
const OptGeneral = R.pathOr({}, [0, 'OptGeneral'], optionsGroupedBySupplierId);
|
|
477
|
+
let supplierName = R.path(['SupplierName'], OptGeneral);
|
|
478
|
+
if (R.path(['SupplierName'], OptGeneral).toLocaleLowerCase() === 'transfers') {
|
|
479
|
+
supplierName = `${R.path(['VoucherName'], OptGeneral)} (${R.path(['SupplierName'], OptGeneral)})`;
|
|
480
|
+
}
|
|
477
481
|
const supplierData = {
|
|
478
482
|
supplierId: R.path(['SupplierId'], OptGeneral),
|
|
479
|
-
supplierName:
|
|
483
|
+
supplierName: supplierName,
|
|
480
484
|
supplierAddress: `${R.pathOr('', ['Address1'], OptGeneral)}, ${R.pathOr('', ['Address2'], OptGeneral)}, ${R.pathOr('', ['Address3'], OptGeneral)}, ${R.pathOr('', ['Address4'], OptGeneral)}, ${R.pathOr('', ['Address5'], OptGeneral)}`,
|
|
481
485
|
serviceTypes: R.uniq(optionsGroupedBySupplierId.map(R.path(['OptGeneral', 'ButtonName']))),
|
|
482
486
|
};
|
|
@@ -677,9 +681,6 @@ class Plugin {
|
|
|
677
681
|
notes,
|
|
678
682
|
},
|
|
679
683
|
}) {
|
|
680
|
-
const extraText = extras && extras.length
|
|
681
|
-
? extras.map((e, i) => `Extra ${i + 1}: ${e.name} x ${e.quantity}`).join(`\n`)
|
|
682
|
-
: '';
|
|
683
684
|
const model = {
|
|
684
685
|
AddServiceRequest: {
|
|
685
686
|
AgentID: hostConnectAgentID,
|
|
@@ -712,7 +713,15 @@ class Plugin {
|
|
|
712
713
|
${doInfo.flightDetails ? `Flight: ${doInfo.flightDetails || 'NA'},` : ''}
|
|
713
714
|
`),
|
|
714
715
|
} : {}),
|
|
715
|
-
|
|
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),
|
|
716
725
|
Opt: optionId,
|
|
717
726
|
DateFrom: startDate,
|
|
718
727
|
RateId: 'Default',
|
|
@@ -809,6 +818,20 @@ class Plugin {
|
|
|
809
818
|
console.log('error in searchBooking', err);
|
|
810
819
|
reply = { ListBookingsReply: { BookingHeaders: { BookingHeader: [] } } };
|
|
811
820
|
}
|
|
821
|
+
|
|
822
|
+
// {"ListBookingsReply":
|
|
823
|
+
// {"BookingHeaders":
|
|
824
|
+
// {"BookingHeader":[
|
|
825
|
+
// {"AgentRef":"2399181","BookingId":"314164","BookingStatus":"Quotation","BookingType":"F",
|
|
826
|
+
// "Consult":null,"Currency":"GBP","EnteredDate":"2024-05-23","IsInternetBooking":"Y",
|
|
827
|
+
// "Name":"Mr. Robert Slavonia x2 2399181","QB":"Q","Ref":"ALFI393309","TotalPrice":"583143",
|
|
828
|
+
// "TravelDate":"2024-07-09"},{"AgentRef":"666666/1","BookingId":"315357",
|
|
829
|
+
// "BookingStatus":"Quotation","BookingType":"F","Consult":null,"Currency":"GBP",
|
|
830
|
+
// "EnteredDate":"2024-06-04","IsInternetBooking":"Y","Name":"Robert Guerrerio x3 2413898",
|
|
831
|
+
// "QB":"Q","Ref":"ALFI393503","TotalPrice":"2309452","TravelDate":"2024-08-31"
|
|
832
|
+
// }
|
|
833
|
+
// ]}
|
|
834
|
+
// }}
|
|
812
835
|
return reply;
|
|
813
836
|
})
|
|
814
837
|
: [this.callTourplan(listBookingPayload)];
|
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
|