ti2-tourplan 1.0.69 → 1.0.71
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 +25 -28
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -463,7 +463,7 @@ class BuyerPlugin {
|
|
|
463
463
|
let serviceCodes = R.pathOr([], ['GetServicesReply', 'TPLServices', 'TPLService'], getServicesReply);
|
|
464
464
|
if (!Array.isArray(serviceCodes)) serviceCodes = [serviceCodes];
|
|
465
465
|
serviceCodes = serviceCodes.map(s => s.Code);
|
|
466
|
-
let
|
|
466
|
+
let options = [];
|
|
467
467
|
await Promise.each(serviceCodes, async serviceCode => {
|
|
468
468
|
const getOptionsModel = {
|
|
469
469
|
OptionInfoRequest: {
|
|
@@ -482,36 +482,33 @@ class BuyerPlugin {
|
|
|
482
482
|
axios,
|
|
483
483
|
xmlOptions: hostConnectXmlOptions,
|
|
484
484
|
});
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
// instead of an array
|
|
492
|
-
if (!Array.isArray(options)) options = [options];
|
|
493
|
-
console.log(`got ${options.length} options for serviceCode ${serviceCode}`);
|
|
494
|
-
return options;
|
|
495
|
-
},
|
|
496
|
-
), getOptionsReply);
|
|
497
|
-
const productsForServiceCode = await Promise.map(
|
|
498
|
-
arrayOfOptionsGroupedBySupplierId,
|
|
499
|
-
optionsGroupedBySupplierId => translateTPOption({
|
|
500
|
-
rootValue: {
|
|
501
|
-
optionsGroupedBySupplierId,
|
|
502
|
-
},
|
|
503
|
-
typeDefs: itineraryProductTypeDefs,
|
|
504
|
-
query: itineraryProductQuery,
|
|
505
|
-
}),
|
|
506
|
-
{
|
|
507
|
-
concurrency: 10,
|
|
508
|
-
},
|
|
509
|
-
);
|
|
510
|
-
products = products.concat(productsForServiceCode);
|
|
485
|
+
let thisOptions = R.pathOr([], ['OptionInfoReply', 'Option'], getOptionsReply);
|
|
486
|
+
// due to the new parser, single option will be returned as an object
|
|
487
|
+
// instead of an array
|
|
488
|
+
if (!Array.isArray(thisOptions)) thisOptions = [thisOptions];
|
|
489
|
+
console.log(`got ${thisOptions.length} options for serviceCode ${serviceCode}`);
|
|
490
|
+
options = options.concat(thisOptions);
|
|
511
491
|
});
|
|
512
|
-
if (!(
|
|
492
|
+
if (!(options && options.length)) {
|
|
513
493
|
throw new Error('No products found');
|
|
514
494
|
}
|
|
495
|
+
const arrayOfOptionsGroupedBySupplierId = R.call(R.compose(
|
|
496
|
+
R.values,
|
|
497
|
+
R.groupBy(R.path(['OptGeneral', 'SupplierId'])),
|
|
498
|
+
), options);
|
|
499
|
+
const products = await Promise.map(
|
|
500
|
+
arrayOfOptionsGroupedBySupplierId,
|
|
501
|
+
optionsGroupedBySupplierId => translateTPOption({
|
|
502
|
+
rootValue: {
|
|
503
|
+
optionsGroupedBySupplierId,
|
|
504
|
+
},
|
|
505
|
+
typeDefs: itineraryProductTypeDefs,
|
|
506
|
+
query: itineraryProductQuery,
|
|
507
|
+
}),
|
|
508
|
+
{
|
|
509
|
+
concurrency: 10,
|
|
510
|
+
},
|
|
511
|
+
);
|
|
515
512
|
return {
|
|
516
513
|
products,
|
|
517
514
|
productFields: [],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ti2-tourplan",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.71",
|
|
4
4
|
"description": "Tourplan's TI2 Plugin",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"jsonwebtoken": "^8.5.1",
|
|
37
37
|
"moment": "^2.29.1",
|
|
38
38
|
"ramda": "^0.27.1",
|
|
39
|
-
"ti2": "^1.0.
|
|
39
|
+
"ti2": "^1.0.90",
|
|
40
40
|
"underscore": "^1.13.4",
|
|
41
41
|
"xml-js": "^1.6.11",
|
|
42
42
|
"xml2js": "^0.4.23"
|