@things-factory/integration-sellercraft 4.2.8 → 4.2.11
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/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-categories.js +3 -2
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-categories.js.map +1 -1
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js +9 -2
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js.map +1 -1
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js +0 -15
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js.map +1 -1
- package/dist-server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.js +1 -1
- package/dist-server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.js.map +1 -1
- package/dist-server/routers/sellercraft-router.js +165 -78
- package/dist-server/routers/sellercraft-router.js.map +1 -1
- package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js +8 -6
- package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js.map +1 -1
- package/dist-server/service/marketplace-channel/marketplace-channel-product-mutation.js +27 -3
- package/dist-server/service/marketplace-channel/marketplace-channel-product-mutation.js.map +1 -1
- package/dist-server/service/marketplace-channel/marketplace-channel.js +5 -0
- package/dist-server/service/marketplace-channel/marketplace-channel.js.map +1 -1
- package/package.json +3 -3
- package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-categories.ts +3 -2
- package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.ts +9 -2
- package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.ts +0 -16
- package/server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.ts +1 -1
- package/server/routers/sellercraft-router.ts +170 -80
- package/server/service/marketplace-channel/marketplace-channel-order-mutation.ts +8 -7
- package/server/service/marketplace-channel/marketplace-channel-product-mutation.ts +29 -3
- package/server/service/marketplace-channel/marketplace-channel.ts +4 -0
package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-categories.js
CHANGED
@@ -23,14 +23,15 @@ function mapCategories(categories) {
|
|
23
23
|
if (!categories)
|
24
24
|
return null;
|
25
25
|
categories = categories.map(category => {
|
26
|
+
let children_categories = mapCategories(category.childrenCategories);
|
26
27
|
return {
|
27
28
|
native_category_id: category.categoryId.toString(),
|
28
29
|
channel_code: category.channelCode,
|
29
30
|
channel_country: category.countryCode,
|
30
31
|
category_name: category.categoryName,
|
31
|
-
is_leaf:
|
32
|
+
is_leaf: children_categories.length == 0 ? true : false,
|
32
33
|
is_active: category.isActive,
|
33
|
-
children_categories
|
34
|
+
children_categories
|
34
35
|
};
|
35
36
|
});
|
36
37
|
return categories;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ingest-channel-categories.js","sourceRoot":"","sources":["../../../../server/controllers/sellercraft-channel-integration/apis/ingest-channel-categories.ts"],"names":[],"mappings":";AAAA,+FAA+F;;;AAE/F,SAAgB,uBAAuB;IACrC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,0BAA0B;QAChC,WAAW,CAAC,GAAG;YACb,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAA;YAE1B,IAAI,aAAa,GAAG,aAAa,CAAC,UAAU,CAAC,CAAA;YAE7C,OAAO;gBACL,OAAO,EAAE,CAAC,GAAG,aAAa,CAAC;aAC5B,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC;AAjBD,0DAiBC;AAED,SAAS,aAAa,CAAC,UAAU;IAC/B,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAA;IAC5B,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QACrC,OAAO;YACL,kBAAkB,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE;YAClD,YAAY,EAAE,QAAQ,CAAC,WAAW;YAClC,eAAe,EAAE,QAAQ,CAAC,WAAW;YACrC,aAAa,EAAE,QAAQ,CAAC,YAAY;YACpC,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"ingest-channel-categories.js","sourceRoot":"","sources":["../../../../server/controllers/sellercraft-channel-integration/apis/ingest-channel-categories.ts"],"names":[],"mappings":";AAAA,+FAA+F;;;AAE/F,SAAgB,uBAAuB;IACrC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,0BAA0B;QAChC,WAAW,CAAC,GAAG;YACb,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAA;YAE1B,IAAI,aAAa,GAAG,aAAa,CAAC,UAAU,CAAC,CAAA;YAE7C,OAAO;gBACL,OAAO,EAAE,CAAC,GAAG,aAAa,CAAC;aAC5B,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC;AAjBD,0DAiBC;AAED,SAAS,aAAa,CAAC,UAAU;IAC/B,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAA;IAC5B,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QACrC,IAAI,mBAAmB,GAAG,aAAa,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAA;QACpE,OAAO;YACL,kBAAkB,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE;YAClD,YAAY,EAAE,QAAQ,CAAC,WAAW;YAClC,eAAe,EAAE,QAAQ,CAAC,WAAW;YACrC,aAAa,EAAE,QAAQ,CAAC,YAAY;YACpC,OAAO,EAAE,mBAAmB,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;YACvD,SAAS,EAAE,QAAQ,CAAC,QAAQ;YAC5B,mBAAmB;SACpB,CAAA;IACH,CAAC,CAAC,CAAA;IACF,OAAO,UAAU,CAAA;AACnB,CAAC"}
|
package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js
CHANGED
@@ -20,7 +20,13 @@ function ingestChannelOrder() {
|
|
20
20
|
updated_at_time: new Date(order.updatedAt).toISOString(),
|
21
21
|
customer_first_name: order.custFirstName,
|
22
22
|
customer_last_name: order.custLastName,
|
23
|
-
charges:
|
23
|
+
charges: order.charges.map(charge => {
|
24
|
+
return {
|
25
|
+
charge_type_value: charge.name,
|
26
|
+
amount_gross: parseFloat(charge.grossAmount) || 0,
|
27
|
+
amount_nett: parseFloat(charge.nettAmount) || 0
|
28
|
+
};
|
29
|
+
}),
|
24
30
|
address_shipping: {
|
25
31
|
first_name: order.shipFirstName,
|
26
32
|
last_name: order.shipLastName,
|
@@ -68,7 +74,8 @@ function ingestChannelOrder() {
|
|
68
74
|
}),
|
69
75
|
order_status_value: constants_1.ORDER_STATUS[`${order.status}`]
|
70
76
|
};
|
71
|
-
})
|
77
|
+
}),
|
78
|
+
seller_logistics: order === null || order === void 0 ? void 0 : order.isSOF
|
72
79
|
};
|
73
80
|
});
|
74
81
|
return {
|
package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ingest-channel-order.js","sourceRoot":"","sources":["../../../../server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.ts"],"names":[],"mappings":";AAAA,4FAA4F;;;AAE5F,kDAAiD;AAEjD,SAAgB,kBAAkB;IAChC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,uBAAuB;QAC7B,WAAW,CAAC,GAAG;YACb,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAA;YAEtB,IAAI,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACjC,OAAO;oBACL,eAAe,EAAE,KAAK,CAAC,cAAc;oBACrC,eAAe,EAAE,KAAK,CAAC,aAAa;oBACpC,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE;oBACpC,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,mBAAmB,EAAE,KAAK,CAAC,aAAa;oBACxC,kBAAkB,EAAE,KAAK,CAAC,YAAY;oBACtC,OAAO,EAAE,EAAE;
|
1
|
+
{"version":3,"file":"ingest-channel-order.js","sourceRoot":"","sources":["../../../../server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.ts"],"names":[],"mappings":";AAAA,4FAA4F;;;AAE5F,kDAAiD;AAEjD,SAAgB,kBAAkB;IAChC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,uBAAuB;QAC7B,WAAW,CAAC,GAAG;YACb,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAA;YAEtB,IAAI,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;gBACjC,OAAO;oBACL,eAAe,EAAE,KAAK,CAAC,cAAc;oBACrC,eAAe,EAAE,KAAK,CAAC,aAAa;oBACpC,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE;oBACpC,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;oBACxD,eAAe,EAAE,IAAI,IAAI,CAAC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M,EAAE,CAAC;yBACpD,CAAA;oBACH,CAAC,CAAC;oBACF,gBAAgB,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK;iBAC/B,CAAA;YACH,CAAC,CAAC,CAAA;YAEF,OAAO;gBACL,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;aACxB,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC;AArFD,gDAqFC"}
|
package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js
CHANGED
@@ -76,21 +76,6 @@ function ingestChannelProduct() {
|
|
76
76
|
has_all_variants: product.channelCode == 'MGT' ? false : true
|
77
77
|
};
|
78
78
|
});
|
79
|
-
if (products[0].channelCode == 'MGT') {
|
80
|
-
let newList = [];
|
81
|
-
for (let np of newProducts) {
|
82
|
-
if (np.native_product_id == np.variants[0].native_variant_id) {
|
83
|
-
let vars = newProducts
|
84
|
-
.filter(e => e.native_product_id == np.native_product_id)
|
85
|
-
.map(e => {
|
86
|
-
return e.variants[0];
|
87
|
-
});
|
88
|
-
np.variants = vars;
|
89
|
-
newList.push(np);
|
90
|
-
}
|
91
|
-
}
|
92
|
-
newProducts = newList;
|
93
|
-
}
|
94
79
|
return {
|
95
80
|
payload: [...newProducts]
|
96
81
|
};
|
package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ingest-channel-product.js","sourceRoot":"","sources":["../../../../server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.ts"],"names":[],"mappings":";AAAA,+FAA+F;;;AAE/F,SAAgB,oBAAoB;IAClC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,yBAAyB;QAC/B,WAAW,CAAC,GAAG;YACb,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAA;YAExB,IAAI,WAAW,GAAG,QAAQ,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C,eAAe,EAAE,OAAO,CAAC,cAAc;oBACvC,kBAAkB,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE;oBACjD,iBAAiB,EAAE,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE;oBAC/C,KAAK,EAAE,OAAO,CAAC,IAAI;oBACnB,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;oBAC1B,WAAW,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;oBACvC,mBAAmB,EAAE,OAAO,CAAC,WAAW,IAAI,KAAK,IAAI,OAAO,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;oBAChG,MAAM,EACJ,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,0CAAE,GAAG,CAAC,KAAK,CAAC,EAAE;wBAC3B,OAAO;4BACL,QAAQ,EAAE,KAAK,CAAC,GAAG;yBACpB,CAAA;oBACH,CAAC,CAAC,KAAI,EAAE;oBACV,kBAAkB,EAChB,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,0CAAE,GAAG,CAAC,SAAS,CAAC,EAAE;wBACnC,uCACK,SAAS,KACZ,mBAAmB,EAAE,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAC9D;oBACH,CAAC,CAAC,KAAI,EAAE;oBACV,QAAQ,EAAE,iBAAiB;oBAC3B,gBAAgB,EAAE,OAAO,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;iBAC9D,CAAA;YACH,CAAC,CAAC,CAAA;YAEF,
|
1
|
+
{"version":3,"file":"ingest-channel-product.js","sourceRoot":"","sources":["../../../../server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.ts"],"names":[],"mappings":";AAAA,+FAA+F;;;AAE/F,SAAgB,oBAAoB;IAClC,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EA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,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC;AA5FD,oDA4FC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sellercraft-channel-integration.js","sourceRoot":"","sources":["../../../server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA8B;AAC9B,iDAA0B;AAE1B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,oDAAoD,CAAC,CAAA;AAMpF,MAAa,6BAA6B;IAGxC,YAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,qBACN,MAAM,CACV,CAAA;IACH,CAAC;IAED,UAAU;QACR,OAAO,gCAAgC,CAAA;IACzC,CAAC;IAED,iBAAiB;QACf,OAAO,IAAA,YAAI,GAAE,CAAA;IACf,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,OAAY,EAAE;QACrC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9B,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAEnB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;QACrC,MAAM,SAAS,GAAW,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAClD,MAAM,QAAQ,GAAW,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,IAAI,EAAE,CAAA;QAEtD,MAAM,QAAQ,GAAQ,MAAM,IAAA,oBAAK,EAAC,QAAQ,EAAE;YAC1C,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,UAAU,EAAE,SAAS;gBACrB,WAAW,EAAE,MAAM;aACpB;YACD,IAAI,EAAE,QAAQ;SACf,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,EAAE,EAAE;YACf,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YACpC,OAAO,MAAM,CAAA;SACd;aAAM;YACL,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YACpC,MAAM,IAAI,KAAK,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,MAAM,CAAC,
|
1
|
+
{"version":3,"file":"sellercraft-channel-integration.js","sourceRoot":"","sources":["../../../server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA8B;AAC9B,iDAA0B;AAE1B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,oDAAoD,CAAC,CAAA;AAMpF,MAAa,6BAA6B;IAGxC,YAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,qBACN,MAAM,CACV,CAAA;IACH,CAAC;IAED,UAAU;QACR,OAAO,gCAAgC,CAAA;IACzC,CAAC;IAED,iBAAiB;QACf,OAAO,IAAA,YAAI,GAAE,CAAA;IACf,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,OAAY,EAAE;QACrC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9B,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAEnB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;QACrC,MAAM,SAAS,GAAW,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAClD,MAAM,QAAQ,GAAW,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,IAAI,EAAE,CAAA;QAEtD,MAAM,QAAQ,GAAQ,MAAM,IAAA,oBAAK,EAAC,QAAQ,EAAE;YAC1C,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,UAAU,EAAE,SAAS;gBACrB,WAAW,EAAE,MAAM;aACpB;YACD,IAAI,EAAE,QAAQ;SACf,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,EAAE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GAAG,IAAI,CAAC,MAAM,CAAA;QAE9B,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;aAC5B,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aACxD,IAAI,CAAC,GAAG,CAAC,CAAA;QAEZ,MAAM,QAAQ,GAAW,GAAG,IAAI,CAAC,UAAU,EAAE,GAAG,IAAI,EAAE,CAAA;QACtD,MAAM,QAAQ,GAAG,GAAG,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;QACnD,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;QAE3B,MAAM,SAAS,GAAW,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAElD,MAAM,QAAQ,GAAQ,MAAM,IAAA,oBAAK,EAAC,QAAQ,EAAE;YAC1C,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,UAAU,EAAE,SAAS;gBACrB,WAAW,EAAE,MAAM;aACpB;SACF,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAC,EAAE,EAAE;YACf,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;SAC7B;aAAM;YACL,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YACpC,MAAM,IAAI,KAAK,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;SAC1D;IACH,CAAC;CACF;AApGD,sEAoGC"}
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.sellercraftRouter = void 0;
|
7
7
|
const koa_router_1 = __importDefault(require("koa-router"));
|
8
|
+
const v4_1 = __importDefault(require("uuid/v4"));
|
8
9
|
const env_1 = require("@things-factory/env");
|
9
10
|
const integration_marketplace_1 = require("@things-factory/integration-marketplace");
|
10
11
|
const constants_1 = require("../constants");
|
@@ -41,28 +42,37 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-price', async
|
|
41
42
|
accessToken: (_h = (_g = store.shop) === null || _g === void 0 ? void 0 : _g.credential) === null || _h === void 0 ? void 0 : _h.access_token,
|
42
43
|
channelShopId: (_j = store.shop) === null || _j === void 0 ? void 0 : _j.channel_shop_id
|
43
44
|
};
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
try {
|
46
|
+
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
47
|
+
const req = {
|
48
|
+
costPrice: requestBody[i].full_price,
|
49
|
+
sellPrice: requestBody[i].sale_price,
|
50
|
+
productId: requestBody[i].native_product_id,
|
51
|
+
variationId: requestBody[i].native_variant_id,
|
52
|
+
variationSku: requestBody[i].sku
|
53
|
+
};
|
54
|
+
result = await integration_marketplace_1.StoreAPI.updateStoreProductVariationPrice(mappedStore, req);
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
const req = {
|
58
|
+
costPrice: requestBody[i].full_price,
|
59
|
+
sellPrice: requestBody[i].sale_price,
|
60
|
+
productId: requestBody[i].native_product_id,
|
61
|
+
variationSku: requestBody[i].sku
|
62
|
+
};
|
63
|
+
result = await integration_marketplace_1.StoreAPI.updateStoreProductPrice(mappedStore, req);
|
64
|
+
}
|
65
|
+
debug(result);
|
66
|
+
context.type = 'application/json';
|
67
|
+
context.status = 200;
|
68
|
+
context.body = 'Succeeded';
|
53
69
|
}
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
productId: requestBody[i].native_product_id,
|
59
|
-
variationSku: requestBody[i].sku
|
60
|
-
};
|
61
|
-
result = await integration_marketplace_1.StoreAPI.updateStoreProductPrice(mappedStore, req);
|
70
|
+
catch (e) {
|
71
|
+
context.type = 'application/json';
|
72
|
+
context.status = 500;
|
73
|
+
context.body = e.message;
|
62
74
|
}
|
63
|
-
debug(result);
|
64
75
|
}
|
65
|
-
context.status = 200;
|
66
76
|
});
|
67
77
|
exports.sellercraftRouter.post('/sellercraft/store/update-product-stock', async (context, next) => {
|
68
78
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
@@ -95,69 +105,137 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-stock', async
|
|
95
105
|
accessToken: (_h = (_g = store.shop) === null || _g === void 0 ? void 0 : _g.credential) === null || _h === void 0 ? void 0 : _h.access_token,
|
96
106
|
channelShopId: (_j = store.shop) === null || _j === void 0 ? void 0 : _j.channel_shop_id
|
97
107
|
};
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
108
|
+
try {
|
109
|
+
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
110
|
+
const req = {
|
111
|
+
qty: requestBody[i].stock,
|
112
|
+
itemId: requestBody[i].native_product_id,
|
113
|
+
variationId: requestBody[i].native_variant_id,
|
114
|
+
distributors: requestBody[i].distributors || [],
|
115
|
+
variationSku: requestBody[i].sku
|
116
|
+
};
|
117
|
+
result = await integration_marketplace_1.StoreAPI.updateStoreProductVariationStock(mappedStore, req);
|
118
|
+
}
|
119
|
+
else {
|
120
|
+
const req = {
|
121
|
+
qty: requestBody[i].stock,
|
122
|
+
itemId: requestBody[i].native_product_id,
|
123
|
+
distributors: requestBody[i].distributors || [],
|
124
|
+
variationSku: requestBody[i].sku
|
125
|
+
};
|
126
|
+
result = await integration_marketplace_1.StoreAPI.updateStoreProductStock(mappedStore, req);
|
127
|
+
}
|
128
|
+
debug(result);
|
129
|
+
context.type = 'application/json';
|
130
|
+
context.status = 200;
|
131
|
+
context.body = 'Succeeded';
|
107
132
|
}
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
distributors: requestBody[i].distributors || [],
|
113
|
-
variationSku: requestBody[i].sku
|
114
|
-
};
|
115
|
-
result = await integration_marketplace_1.StoreAPI.updateStoreProductStock(mappedStore, req);
|
133
|
+
catch (e) {
|
134
|
+
context.type = 'application/json';
|
135
|
+
context.status = 500;
|
136
|
+
context.body = e.message;
|
116
137
|
}
|
117
|
-
debug(result);
|
118
138
|
}
|
119
|
-
context.status = 200;
|
120
139
|
});
|
121
140
|
exports.sellercraftRouter.post('/sellercraft/store/update-order-status', async (context, next) => {
|
122
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
141
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
142
|
+
try {
|
143
|
+
const sellercraftChannelIntegrationConfig = env_1.config.get('sellercraftChannelIntegrationConfig', {});
|
144
|
+
const { tokenCraftApiKey: apiKey, tokenCraftUrl } = sellercraftChannelIntegrationConfig;
|
145
|
+
const xApiKey = context.headers['x-api-key'];
|
146
|
+
if (apiKey !== xApiKey)
|
147
|
+
context.throw(400, 'api key validation failed');
|
148
|
+
const requestBody = context.request.body;
|
149
|
+
var result;
|
150
|
+
var store = {};
|
151
|
+
// https://staging-tokencraft.sellercraft.co/v1/get-shop?channel_id=4bfb3362-d57c-47f8-8781-007316d179bf&shop_id=dd9cf3b7-114f-4d74-a7e2-7b524ae086f2
|
152
|
+
var fullPath = `${tokenCraftUrl}?channel_id=${requestBody.channel_id}&shop_id=${requestBody.shop_id}`;
|
153
|
+
const response = await fetch(fullPath, {
|
154
|
+
method: 'get',
|
155
|
+
headers: {
|
156
|
+
'Content-Type': 'application/json',
|
157
|
+
'x-api-key': apiKey
|
158
|
+
}
|
159
|
+
});
|
160
|
+
if (response.ok) {
|
161
|
+
store = await response.json();
|
162
|
+
}
|
163
|
+
let mappedStore = {
|
164
|
+
accessKey: ((_b = (_a = store.shop) === null || _a === void 0 ? void 0 : _a.credential) === null || _b === void 0 ? void 0 : _b.consumer_key) || '',
|
165
|
+
accessSecret: ((_d = (_c = store.shop) === null || _c === void 0 ? void 0 : _c.credential) === null || _d === void 0 ? void 0 : _d.consumer_secret) || '',
|
166
|
+
storeURL: (_f = (_e = store.shop) === null || _e === void 0 ? void 0 : _e.credential) === null || _f === void 0 ? void 0 : _f.store_url,
|
167
|
+
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
|
168
|
+
accessToken: (_h = (_g = store.shop) === null || _g === void 0 ? void 0 : _g.credential) === null || _h === void 0 ? void 0 : _h.access_token,
|
169
|
+
channelShopId: (_j = store.shop) === null || _j === void 0 ? void 0 : _j.channel_shop_id
|
170
|
+
};
|
171
|
+
const reqBody = {
|
172
|
+
orderId: requestBody.native_order_id,
|
173
|
+
status: requestBody.order_status,
|
174
|
+
carrier: requestBody === null || requestBody === void 0 ? void 0 : requestBody.shipper_last_mile,
|
175
|
+
trackingNo: requestBody === null || requestBody === void 0 ? void 0 : requestBody.tracking_number,
|
176
|
+
orderItems: requestBody === null || requestBody === void 0 ? void 0 : requestBody.order_item_ids,
|
177
|
+
isSOF: requestBody === null || requestBody === void 0 ? void 0 : requestBody.seller_logistics
|
178
|
+
};
|
179
|
+
let responseBody = { operation_id: (0, v4_1.default)() };
|
180
|
+
try {
|
181
|
+
result = await integration_marketplace_1.StoreAPI.updateOrderStatus(mappedStore, reqBody);
|
182
|
+
debug(result);
|
183
|
+
if (result === null || result === void 0 ? void 0 : result.requiredDocument) {
|
184
|
+
// call document api and ingest channel order package
|
185
|
+
const order = await integration_marketplace_1.StoreAPI.getStoreOrder(mappedStore, { orderId: reqBody.orderId });
|
186
|
+
let orderPackage = order ? (((_k = order[0]) === null || _k === void 0 ? void 0 : _k.orderPackage) ? order[0].orderPackage : {}) : {};
|
187
|
+
if (orderPackage) {
|
188
|
+
const packageId = orderPackage.packageId;
|
189
|
+
let orderDocument = orderPackage.orderDocument;
|
190
|
+
if ((orderDocument === null || orderDocument === void 0 ? void 0 : orderDocument.length) == 0) {
|
191
|
+
let hasDocument = false;
|
192
|
+
while (!hasDocument) {
|
193
|
+
orderDocument = await integration_marketplace_1.StoreAPI.getStoreOrderDocument(mappedStore, { packageId, documentType: 1 });
|
194
|
+
if ((orderDocument === null || orderDocument === void 0 ? void 0 : orderDocument.length) > 0) {
|
195
|
+
hasDocument = true;
|
196
|
+
break;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
}
|
200
|
+
// Order Package Payload
|
201
|
+
let newOrderPackage = {
|
202
|
+
channel_shop_id: mappedStore.channelShopId,
|
203
|
+
native_order_id: reqBody.orderId,
|
204
|
+
native_package_id: orderPackage.packageId,
|
205
|
+
shipping_tracking_code: orderPackage.trackingNumber,
|
206
|
+
shipping_type_value: (orderPackage === null || orderPackage === void 0 ? void 0 : orderPackage.shippingType) ? orderPackage.shippingType : constants_1.SHIPPING_TYPE.DROP_SHIPPING,
|
207
|
+
warehouse_code: constants_1.SHIPPING_TYPE.DROP_SHIPPING,
|
208
|
+
shipper: {
|
209
|
+
name: orderPackage.shippingProvider,
|
210
|
+
is_cod_supported: (orderPackage === null || orderPackage === void 0 ? void 0 : orderPackage.isCodSupport) ? orderPackage.isCodSupport : false
|
211
|
+
},
|
212
|
+
documents: orderDocument || [],
|
213
|
+
shipper_last_mile: {
|
214
|
+
name: orderPackage.shippingProvider,
|
215
|
+
is_cod_supported: (orderPackage === null || orderPackage === void 0 ? void 0 : orderPackage.isCodSupport) ? orderPackage.isCodSupport : false
|
216
|
+
},
|
217
|
+
order_item_ids: (orderPackage === null || orderPackage === void 0 ? void 0 : orderPackage.orderListIdList) ? orderPackage.orderListIdList : reqBody.orderItems
|
218
|
+
} || {};
|
219
|
+
responseBody.package = newOrderPackage;
|
220
|
+
}
|
221
|
+
responseBody.response_code = 'E0';
|
222
|
+
responseBody.message = 'Success';
|
223
|
+
}
|
224
|
+
responseBody.time = Math.floor(new Date(new Date().toUTCString()).getTime() / 1000);
|
225
|
+
context.type = 'application/json';
|
226
|
+
context.status = 200;
|
227
|
+
context.body = responseBody;
|
228
|
+
await next();
|
229
|
+
}
|
230
|
+
catch (e) {
|
231
|
+
responseBody.response_code = 'E1';
|
232
|
+
responseBody.message = e.message;
|
233
|
+
context.type = 'application/json';
|
234
|
+
context.status = 500;
|
235
|
+
context.body = responseBody;
|
138
236
|
}
|
139
|
-
});
|
140
|
-
if (response.ok) {
|
141
|
-
store = await response.json();
|
142
237
|
}
|
143
|
-
|
144
|
-
accessKey: ((_b = (_a = store.shop) === null || _a === void 0 ? void 0 : _a.credential) === null || _b === void 0 ? void 0 : _b.consumer_key) || '',
|
145
|
-
accessSecret: ((_d = (_c = store.shop) === null || _c === void 0 ? void 0 : _c.credential) === null || _d === void 0 ? void 0 : _d.consumer_secret) || '',
|
146
|
-
storeURL: (_f = (_e = store.shop) === null || _e === void 0 ? void 0 : _e.credential) === null || _f === void 0 ? void 0 : _f.store_url,
|
147
|
-
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
|
148
|
-
accessToken: (_h = (_g = store.shop) === null || _g === void 0 ? void 0 : _g.credential) === null || _h === void 0 ? void 0 : _h.access_token,
|
149
|
-
channelShopId: (_j = store.shop) === null || _j === void 0 ? void 0 : _j.channel_shop_id
|
150
|
-
};
|
151
|
-
const reqBody = {
|
152
|
-
orderId: requestBody.native_order_id,
|
153
|
-
status: requestBody.order_status,
|
154
|
-
carrier: requestBody === null || requestBody === void 0 ? void 0 : requestBody.shipper_last_mile,
|
155
|
-
trackingNo: requestBody === null || requestBody === void 0 ? void 0 : requestBody.tracking_number,
|
156
|
-
orderItems: requestBody === null || requestBody === void 0 ? void 0 : requestBody.order_item_ids
|
157
|
-
};
|
158
|
-
result = await integration_marketplace_1.StoreAPI.updateOrderStatus(mappedStore, reqBody);
|
159
|
-
debug(result);
|
160
|
-
context.status = 200;
|
238
|
+
catch (e) { }
|
161
239
|
});
|
162
240
|
exports.sellercraftRouter.post('/sellercraft/store/update-product-attribute', async (context, next) => {
|
163
241
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
@@ -206,9 +284,18 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-attribute', as
|
|
206
284
|
};
|
207
285
|
});
|
208
286
|
for (var i = 0; i < variants.length; i++) {
|
209
|
-
|
210
|
-
|
287
|
+
try {
|
288
|
+
let variant = variants[i];
|
289
|
+
await integration_marketplace_1.StoreAPI.updateProductAttribute(mappedStore, { productSku, itemId, variant });
|
290
|
+
context.type = 'application/json';
|
291
|
+
context.status = 200;
|
292
|
+
context.body = 'Succeeded';
|
293
|
+
}
|
294
|
+
catch (e) {
|
295
|
+
context.type = 'application/json';
|
296
|
+
context.status = 500;
|
297
|
+
context.body = e.message;
|
298
|
+
}
|
211
299
|
}
|
212
|
-
context.status = 200;
|
213
300
|
});
|
214
301
|
//# sourceMappingURL=sellercraft-router.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sellercraft-router.js","sourceRoot":"","sources":["../../server/routers/sellercraft-router.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAE/B,6CAA4C;AAC5C,qFAAkE;AAElE,4CAAuC;AAEvC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,2DAA2D,CAAC,CAAA;AAE9E,QAAA,iBAAiB,GAAG,IAAI,oBAAM,EAAE,CAAA;AAE7C,yBAAiB,CAAC,IAAI,CAAC,yCAAyC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;;IACxF,MAAM,mCAAmC,GAAG,YAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE,EAAE,CAAC,CAAA;IACjG,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,mCAAmC,CAAA;IAEvF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AAW,CAAA;SAC3B;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAA;YACjC,OAAO,CAAC,MAAM,GAAG,GAAG,CAAA;YACpB,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,OAAO,CAAA;SACzB;KACF;AACH,CAAC,CAAC,CAAA"}
|
@@ -25,7 +25,7 @@ let MarketplaceChannelOrderMutation = class MarketplaceChannelOrderMutation {
|
|
25
25
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
26
26
|
const sellercraftChannelIntegrationConfig = env_1.config.get('sellercraftChannelIntegrationConfig', {});
|
27
27
|
const { tokenCraftApiKey: apiKey, getShopsTokenCraftUrl } = sellercraftChannelIntegrationConfig;
|
28
|
-
const channels = await (0, typeorm_1.getRepository)(marketplace_channel_1.MarketplaceChannel).find();
|
28
|
+
const channels = await (0, typeorm_1.getRepository)(marketplace_channel_1.MarketplaceChannel).find({ where: { isActive: true } });
|
29
29
|
for (var i = 0; i < channels.length; i++) {
|
30
30
|
try {
|
31
31
|
const channel = channels[i];
|
@@ -57,7 +57,7 @@ let MarketplaceChannelOrderMutation = class MarketplaceChannelOrderMutation {
|
|
57
57
|
let organisationId = shops[j].account_id;
|
58
58
|
let channelShopId = shops[j].channel_shop_id;
|
59
59
|
let orderResult = [];
|
60
|
-
let page = 1;
|
60
|
+
let page = store.platform == 'magento' ? 1 : 0;
|
61
61
|
let hasMorePage = true;
|
62
62
|
let lastOrderId;
|
63
63
|
let cursor;
|
@@ -283,7 +283,9 @@ let MarketplaceChannelOrderMutation = class MarketplaceChannelOrderMutation {
|
|
283
283
|
};
|
284
284
|
});
|
285
285
|
if (mappedOrderResult.length > 0) {
|
286
|
-
await sellercraft_channel_integration_api_1.SellercraftChannelIntegrationAPI.ingestChannelOrder(sellercraftStore, {
|
286
|
+
await sellercraft_channel_integration_api_1.SellercraftChannelIntegrationAPI.ingestChannelOrder(sellercraftStore, {
|
287
|
+
orders: mappedOrderResult
|
288
|
+
});
|
287
289
|
await Promise.all(mappedOrderResult.map(async (result) => {
|
288
290
|
var _a;
|
289
291
|
if (!(result === null || result === void 0 ? void 0 : result.isSOF) && ((_a = result === null || result === void 0 ? void 0 : result.orderPackage) === null || _a === void 0 ? void 0 : _a.packageId)) {
|
@@ -317,10 +319,10 @@ let MarketplaceChannelOrderMutation = class MarketplaceChannelOrderMutation {
|
|
317
319
|
}
|
318
320
|
catch (e) { }
|
319
321
|
}
|
320
|
-
return true;
|
321
322
|
}
|
322
323
|
catch (e) { }
|
323
324
|
}
|
325
|
+
return true;
|
324
326
|
}
|
325
327
|
};
|
326
328
|
__decorate([
|
@@ -343,8 +345,8 @@ function getOrderCharges(mappedOrderItems) {
|
|
343
345
|
let charge = mappedOrderItems[i].charges[j];
|
344
346
|
let foundCharge = chargesList.find(cl => cl.name == charge.name);
|
345
347
|
if (foundCharge) {
|
346
|
-
foundCharge.grossAmount = foundCharge.grossAmount + charge.grossAmount;
|
347
|
-
foundCharge.nettAmount = foundCharge.nettAmount + charge.nettAmount;
|
348
|
+
foundCharge.grossAmount = parseFloat(foundCharge.grossAmount) + parseFloat(charge.grossAmount);
|
349
|
+
foundCharge.nettAmount = parseFloat(foundCharge.nettAmount) + parseFloat(charge.nettAmount);
|
348
350
|
chargesList = chargesList.filter(cl => cl.name != charge.name);
|
349
351
|
}
|
350
352
|
else {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marketplace-channel-order-mutation.js","sourceRoot":"","sources":["../../../server/service/marketplace-channel/marketplace-channel-order-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAA2D;AAC3D,qCAAuC;AAEvC,6CAA4C;AAC5C,qFAAkE;AAElE,+CAA+C;AAC/C,+GAAwG;AACxG,+DAA0D;AAG1D,IAAa,+BAA+B,GAA5C,MAAa,+BAA+B;IAE1C,KAAK,CAAC,+BAA+B,CAClB,QAAgB,EAClB,MAAc,EACtB,OAAY;;QAEnB,MAAM,mCAAmC,GAAG,YAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE,EAAE,CAAC,CAAA;QACjG,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,qBAAqB,EAAE,GAAG,mCAAmC,CAAA;QAE/F,MAAM,QAAQ,GAAyB,MAAM,IAAA,uBAAa,EAAC,wCAAkB,CAAC,CAAC,IAAI,EAAE,CAAA;
|
1
|
+
{"version":3,"file":"marketplace-channel-order-mutation.js","sourceRoot":"","sources":["../../../server/service/marketplace-channel/marketplace-channel-order-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAA2D;AAC3D,qCAAuC;AAEvC,6CAA4C;AAC5C,qFAAkE;AAElE,+CAA+C;AAC/C,+GAAwG;AACxG,+DAA0D;AAG1D,IAAa,+BAA+B,GAA5C,MAAa,+BAA+B;IAE1C,KAAK,CAAC,+BAA+B,CAClB,QAAgB,EAClB,MAAc,EACtB,OAAY;;QAEnB,MAAM,mCAAmC,GAAG,YAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE,EAAE,CAAC,CAAA;QACjG,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,qBAAqB,EAAE,GAAG,mCAAmC,CAAA;QAE/F,MAAM,QAAQ,GAAyB,MAAM,IAAA,uBAAa,EAAC,wCAAkB,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;QAElH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI;gBACF,MAAM,OAAO,GAAuB,QAAQ,CAAC,CAAC,CAAC,CAAA;gBAC/C,IAAI,gBAAgB,GAAG,qBAAqB,GAAG,cAAc,GAAG,OAAO,CAAC,SAAS,CAAA;gBACjF,MAAM,eAAe,GAAQ,MAAM,KAAK,CAAC,gBAAgB,EAAE;oBACzD,MAAM,EAAE,KAAK;oBACb,O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AI,WAAW,EAAE;gBACf,WAAW,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;gBAC9F,WAAW,CAAC,UAAU,GAAG,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;gBAC3F,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAA;aAC/D;iBAAM;gBACL,WAAW,GAAG;oBACZ,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,WAAW,EAAE,MAAM,CAAC,WAAW;oBAC/B,UAAU,EAAE,MAAM,CAAC,UAAU;iBAC9B,CAAA;aACF;YACD,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;SAC9B;KACF;IACD,OAAO,WAAW,CAAA;AACpB,CAAC"}
|
@@ -24,7 +24,7 @@ let MarketplaceChannelProductMutation = class MarketplaceChannelProductMutation
|
|
24
24
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
25
25
|
const sellercraftChannelIntegrationConfig = env_1.config.get('sellercraftChannelIntegrationConfig', {});
|
26
26
|
const { tokenCraftApiKey: apiKey, getShopsTokenCraftUrl } = sellercraftChannelIntegrationConfig;
|
27
|
-
const channels = await (0, typeorm_1.getRepository)(marketplace_channel_1.MarketplaceChannel).find();
|
27
|
+
const channels = await (0, typeorm_1.getRepository)(marketplace_channel_1.MarketplaceChannel).find({ where: { isActive: true } });
|
28
28
|
for (var i = 0; i < channels.length; i++) {
|
29
29
|
var channelsFullPath = getShopsTokenCraftUrl + '?channel_id=' + channels[i].channelId;
|
30
30
|
const channelResponse = await fetch(channelsFullPath, {
|
@@ -137,20 +137,44 @@ let MarketplaceChannelProductMutation = class MarketplaceChannelProductMutation
|
|
137
137
|
categoryId,
|
138
138
|
categoryName,
|
139
139
|
parent,
|
140
|
-
isLeaf: parent == 0 ? false : true,
|
141
140
|
isActive: isActive || true,
|
142
141
|
channelCode,
|
143
142
|
countryCode,
|
144
143
|
childrenCategories: []
|
145
144
|
};
|
146
145
|
});
|
146
|
+
if (store.platform == 'magento') {
|
147
|
+
let newList = [];
|
148
|
+
for (let np of mappedProducts) {
|
149
|
+
if (np.productId == np.variations[0].variationId) {
|
150
|
+
let vars = mappedProducts
|
151
|
+
.filter(e => e.productId == np.productId)
|
152
|
+
.map(e => {
|
153
|
+
return e.variations[0];
|
154
|
+
});
|
155
|
+
np.variations = vars;
|
156
|
+
if (np.variations.length > 1) {
|
157
|
+
np.variations = np.variations.filter(v => v.variationId != np.productId);
|
158
|
+
}
|
159
|
+
newList.push(np);
|
160
|
+
}
|
161
|
+
}
|
162
|
+
mappedProducts = newList;
|
163
|
+
}
|
147
164
|
try {
|
165
|
+
let filterList = [];
|
148
166
|
mappedCategories = mappedCategories.map(category => {
|
149
167
|
if (mappedCategories.filter(e => e.parent == category.categoryId).length > 0) {
|
150
168
|
category.childrenCategories = mappedCategories.filter(e => e.parent == category.categoryId);
|
169
|
+
filterList.push(...mappedCategories.filter(e => e.parent == category.categoryId));
|
151
170
|
}
|
152
171
|
return category;
|
153
172
|
});
|
173
|
+
mappedCategories = mappedCategories.map(mc => {
|
174
|
+
if (filterList.indexOf(mc) == -1) {
|
175
|
+
return mc;
|
176
|
+
}
|
177
|
+
}).filter(e => e);
|
154
178
|
await sellercraft_channel_integration_api_1.SellercraftChannelIntegrationAPI.ingestChannelCategories(sellercraftStore, {
|
155
179
|
categories: mappedCategories
|
156
180
|
});
|
@@ -165,8 +189,8 @@ let MarketplaceChannelProductMutation = class MarketplaceChannelProductMutation
|
|
165
189
|
}
|
166
190
|
catch (e) { }
|
167
191
|
}
|
168
|
-
return true;
|
169
192
|
}
|
193
|
+
return true;
|
170
194
|
}
|
171
195
|
};
|
172
196
|
__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marketplace-channel-product-mutation.js","sourceRoot":"","sources":["../../../server/service/marketplace-channel/marketplace-channel-product-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsD;AACtD,qCAAuC;AAEvC,6CAA4C;AAC5C,qFAAkE;AAElE,+GAAwG;AACxG,+DAA0D;AAG1D,IAAa,iCAAiC,GAA9C,MAAa,iCAAiC;IAE5C,KAAK,CAAC,iCAAiC,CAAQ,OAAY;;QACzD,MAAM,mCAAmC,GAAG,YAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE,EAAE,CAAC,CAAA;QACjG,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,qBAAqB,EAAE,GAAG,mCAAmC,CAAA;QAE/F,MAAM,QAAQ,GAAyB,MAAM,IAAA,uBAAa,EAAC,wCAAkB,CAAC,CAAC,IAAI,EAAE,CAAA;
|
1
|
+
{"version":3,"file":"marketplace-channel-product-mutation.js","sourceRoot":"","sources":["../../../server/service/marketplace-channel/marketplace-channel-product-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsD;AACtD,qCAAuC;AAEvC,6CAA4C;AAC5C,qFAAkE;AAElE,+GAAwG;AACxG,+DAA0D;AAG1D,IAAa,iCAAiC,GAA9C,MAAa,iCAAiC;IAE5C,KAAK,CAAC,iCAAiC,CAAQ,OAAY;;QACzD,MAAM,mCAAmC,GAAG,YAAM,CAAC,GAAG,CAAC,qCAAqC,EAAE,EAAE,CAAC,CAAA;QACjG,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,qBAAqB,EAAE,GAAG,mCAAmC,CAAA;QAE/F,MAAM,QAAQ,GAAyB,MAAM,IAAA,uBAAa,EAAC,wCAAkB,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;QAElH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAA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3C,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE;4BAChC,OAAO,EAAE,CAAA;yBACV;oBACH,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;oBAEjB,MAAM,sEAAgC,CAAC,uBAAuB,CAAC,gBAAgB,EAAE;wBAC/E,UAAU,EAAE,gBAAgB;qBAC7B,CAAC,CAAA;iBACH;gBAAC,OAAO,CAAC,EAAE,GAAE;gBAEd,IAAI;oBACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;wBACrD,MAAM,sEAAgC,CAAC,oBAAoB,CAAC,gBAAgB,EAAE;4BAC5E,QAAQ,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;yBAC9B,CAAC,CAAA;qBACH;iBACF;gBAAC,OAAO,CAAC,EAAE,GAAE;aACf;SAEF;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA;AA7MC;IADC,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC;IACY,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;0FA4M7C;AA9MU,iCAAiC;IAD7C,IAAA,uBAAQ,GAAE;GACE,iCAAiC,CA+M7C;AA/MY,8EAAiC"}
|
@@ -46,6 +46,11 @@ __decorate([
|
|
46
46
|
(0, type_graphql_1.Field)(),
|
47
47
|
__metadata("design:type", String)
|
48
48
|
], MarketplaceChannel.prototype, "channelId", void 0);
|
49
|
+
__decorate([
|
50
|
+
(0, typeorm_1.Column)({ default: true }),
|
51
|
+
(0, type_graphql_1.Field)(),
|
52
|
+
__metadata("design:type", Boolean)
|
53
|
+
], MarketplaceChannel.prototype, "isActive", void 0);
|
49
54
|
__decorate([
|
50
55
|
(0, typeorm_1.CreateDateColumn)(),
|
51
56
|
(0, type_graphql_1.Field)({ nullable: true }),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"marketplace-channel.js","sourceRoot":"","sources":["../../../server/service/marketplace-channel/marketplace-channel.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAAoD;AACpD,qCASgB;AAEhB,yDAAgD;AAChD,iDAA8C;AAK9C,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;
|
1
|
+
{"version":3,"file":"marketplace-channel.js","sourceRoot":"","sources":["../../../server/service/marketplace-channel/marketplace-channel.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAAoD;AACpD,qCASgB;AAEhB,yDAAgD;AAChD,iDAA8C;AAK9C,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;CAiD9B,CAAA;AA9CC;IAFC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;8CACC;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDACjB,cAAM,oBAAN,cAAM;kDAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,kBAAsC,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC;;oDACjE;AAIjB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,GAAE;;gDACI;AAIZ;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,GAAE;;uDACW;AAInB;IAFC,IAAA,gBAAM,GAAE;IACR,IAAA,oBAAK,GAAE;;qDACS;AAIjB;IAFC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACzB,IAAA,oBAAK,GAAE;;oDACS;AAIjB;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAA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
|
5
5
|
"browser": "client/index.js",
|
6
6
|
"things-factory": true,
|
@@ -31,7 +31,7 @@
|
|
31
31
|
"@things-factory/context-ui": "^4.1.40",
|
32
32
|
"@things-factory/grist-ui": "^4.1.40",
|
33
33
|
"@things-factory/i18n-base": "^4.1.40",
|
34
|
-
"@things-factory/integration-marketplace": "^4.2.
|
34
|
+
"@things-factory/integration-marketplace": "^4.2.11",
|
35
35
|
"@things-factory/integration-ui": "^4.1.40",
|
36
36
|
"@things-factory/more-ui": "^4.1.40",
|
37
37
|
"@things-factory/resource-ui": "^4.1.40",
|
@@ -51,5 +51,5 @@
|
|
51
51
|
"nock": "^13.0.2",
|
52
52
|
"should": "^13.2.3"
|
53
53
|
},
|
54
|
-
"gitHead": "
|
54
|
+
"gitHead": "dd17e7cfd9d66ec54cc108501185557bd4bded7c"
|
55
55
|
}
|
package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-categories.ts
CHANGED
@@ -22,14 +22,15 @@ export function ingestChannelCategories() {
|
|
22
22
|
function mapCategories(categories) {
|
23
23
|
if (!categories) return null
|
24
24
|
categories = categories.map(category => {
|
25
|
+
let children_categories = mapCategories(category.childrenCategories)
|
25
26
|
return {
|
26
27
|
native_category_id: category.categoryId.toString(),
|
27
28
|
channel_code: category.channelCode,
|
28
29
|
channel_country: category.countryCode,
|
29
30
|
category_name: category.categoryName,
|
30
|
-
is_leaf:
|
31
|
+
is_leaf: children_categories.length == 0 ? true : false,
|
31
32
|
is_active: category.isActive,
|
32
|
-
children_categories
|
33
|
+
children_categories
|
33
34
|
}
|
34
35
|
})
|
35
36
|
return categories
|
@@ -20,7 +20,13 @@ export function ingestChannelOrder() {
|
|
20
20
|
updated_at_time: new Date(order.updatedAt).toISOString(),
|
21
21
|
customer_first_name: order.custFirstName,
|
22
22
|
customer_last_name: order.custLastName,
|
23
|
-
charges:
|
23
|
+
charges: order.charges.map(charge => {
|
24
|
+
return {
|
25
|
+
charge_type_value: charge.name,
|
26
|
+
amount_gross: parseFloat(charge.grossAmount) || 0,
|
27
|
+
amount_nett: parseFloat(charge.nettAmount) || 0
|
28
|
+
}
|
29
|
+
}),
|
24
30
|
address_shipping: {
|
25
31
|
first_name: order.shipFirstName,
|
26
32
|
last_name: order.shipLastName,
|
@@ -68,7 +74,8 @@ export function ingestChannelOrder() {
|
|
68
74
|
}),
|
69
75
|
order_status_value: ORDER_STATUS[`${order.status}`]
|
70
76
|
}
|
71
|
-
})
|
77
|
+
}),
|
78
|
+
seller_logistics: order?.isSOF
|
72
79
|
}
|
73
80
|
})
|
74
81
|
|
@@ -84,22 +84,6 @@ export function ingestChannelProduct() {
|
|
84
84
|
}
|
85
85
|
})
|
86
86
|
|
87
|
-
if (products[0].channelCode == 'MGT') {
|
88
|
-
let newList = []
|
89
|
-
for (let np of newProducts) {
|
90
|
-
if (np.native_product_id == np.variants[0].native_variant_id) {
|
91
|
-
let vars = newProducts
|
92
|
-
.filter(e => e.native_product_id == np.native_product_id)
|
93
|
-
.map(e => {
|
94
|
-
return e.variants[0]
|
95
|
-
})
|
96
|
-
np.variants = vars
|
97
|
-
newList.push(np)
|
98
|
-
}
|
99
|
-
}
|
100
|
-
newProducts = newList
|
101
|
-
}
|
102
|
-
|
103
87
|
return {
|
104
88
|
payload: [...newProducts]
|
105
89
|
}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import Router from 'koa-router'
|
2
|
+
import uuid from 'uuid/v4'
|
2
3
|
|
3
4
|
import { config } from '@things-factory/env'
|
4
5
|
import { StoreAPI } from '@things-factory/integration-marketplace'
|
5
6
|
|
6
|
-
import { PLATFORM } from '../constants'
|
7
|
+
import { PLATFORM, SHIPPING_TYPE } from '../constants'
|
7
8
|
|
8
9
|
const debug = require('debug')('things-factory:integration-sellercraft:sellercraft-router')
|
9
10
|
|
@@ -45,29 +46,37 @@ sellercraftRouter.post('/sellercraft/store/update-product-price', async (context
|
|
45
46
|
channelShopId: store.shop?.channel_shop_id
|
46
47
|
}
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
try {
|
50
|
+
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
51
|
+
const req = {
|
52
|
+
costPrice: requestBody[i].full_price,
|
53
|
+
sellPrice: requestBody[i].sale_price,
|
54
|
+
productId: requestBody[i].native_product_id,
|
55
|
+
variationId: requestBody[i].native_variant_id,
|
56
|
+
variationSku: requestBody[i].sku
|
57
|
+
}
|
58
|
+
result = await StoreAPI.updateStoreProductVariationPrice(mappedStore, req)
|
59
|
+
} else {
|
60
|
+
const req = {
|
61
|
+
costPrice: requestBody[i].full_price,
|
62
|
+
sellPrice: requestBody[i].sale_price,
|
63
|
+
productId: requestBody[i].native_product_id,
|
64
|
+
variationSku: requestBody[i].sku
|
65
|
+
}
|
66
|
+
result = await StoreAPI.updateStoreProductPrice(mappedStore, req)
|
55
67
|
}
|
56
|
-
result = await StoreAPI.updateStoreProductVariationPrice(mappedStore, req)
|
57
|
-
} else {
|
58
|
-
const req = {
|
59
|
-
costPrice: requestBody[i].full_price,
|
60
|
-
sellPrice: requestBody[i].sale_price,
|
61
|
-
productId: requestBody[i].native_product_id,
|
62
|
-
variationSku: requestBody[i].sku
|
63
|
-
}
|
64
|
-
result = await StoreAPI.updateStoreProductPrice(mappedStore, req)
|
65
|
-
}
|
66
68
|
|
67
|
-
|
68
|
-
}
|
69
|
+
debug(result)
|
69
70
|
|
70
|
-
|
71
|
+
context.type = 'application/json'
|
72
|
+
context.status = 200
|
73
|
+
context.body = 'Succeeded'
|
74
|
+
} catch (e) {
|
75
|
+
context.type = 'application/json'
|
76
|
+
context.status = 500
|
77
|
+
context.body = e.message
|
78
|
+
}
|
79
|
+
}
|
71
80
|
})
|
72
81
|
|
73
82
|
sellercraftRouter.post('/sellercraft/store/update-product-stock', async (context, next) => {
|
@@ -105,76 +114,150 @@ sellercraftRouter.post('/sellercraft/store/update-product-stock', async (context
|
|
105
114
|
channelShopId: store.shop?.channel_shop_id
|
106
115
|
}
|
107
116
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
117
|
+
try {
|
118
|
+
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
119
|
+
const req = {
|
120
|
+
qty: requestBody[i].stock,
|
121
|
+
itemId: requestBody[i].native_product_id,
|
122
|
+
variationId: requestBody[i].native_variant_id,
|
123
|
+
distributors: requestBody[i].distributors || [], // for Magento
|
124
|
+
variationSku: requestBody[i].sku
|
125
|
+
}
|
126
|
+
result = await StoreAPI.updateStoreProductVariationStock(mappedStore, req)
|
127
|
+
} else {
|
128
|
+
const req = {
|
129
|
+
qty: requestBody[i].stock,
|
130
|
+
itemId: requestBody[i].native_product_id,
|
131
|
+
distributors: requestBody[i].distributors || [], // for Magento
|
132
|
+
variationSku: requestBody[i].sku
|
133
|
+
}
|
134
|
+
result = await StoreAPI.updateStoreProductStock(mappedStore, req)
|
123
135
|
}
|
124
|
-
result = await StoreAPI.updateStoreProductStock(mappedStore, req)
|
125
|
-
}
|
126
136
|
|
127
|
-
|
137
|
+
debug(result)
|
138
|
+
|
139
|
+
context.type = 'application/json'
|
140
|
+
context.status = 200
|
141
|
+
context.body = 'Succeeded'
|
142
|
+
} catch (e) {
|
143
|
+
context.type = 'application/json'
|
144
|
+
context.status = 500
|
145
|
+
context.body = e.message
|
146
|
+
}
|
128
147
|
}
|
129
|
-
context.status = 200
|
130
148
|
})
|
131
149
|
|
132
150
|
sellercraftRouter.post('/sellercraft/store/update-order-status', async (context, next) => {
|
133
|
-
|
134
|
-
|
151
|
+
try {
|
152
|
+
const sellercraftChannelIntegrationConfig = config.get('sellercraftChannelIntegrationConfig', {})
|
153
|
+
const { tokenCraftApiKey: apiKey, tokenCraftUrl } = sellercraftChannelIntegrationConfig
|
135
154
|
|
136
|
-
|
155
|
+
const xApiKey = context.headers['x-api-key']
|
137
156
|
|
138
|
-
|
157
|
+
if (apiKey !== xApiKey) context.throw(400, 'api key validation failed')
|
139
158
|
|
140
|
-
|
141
|
-
|
142
|
-
|
159
|
+
const requestBody = context.request.body
|
160
|
+
var result
|
161
|
+
var store: any = {}
|
143
162
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
163
|
+
// https://staging-tokencraft.sellercraft.co/v1/get-shop?channel_id=4bfb3362-d57c-47f8-8781-007316d179bf&shop_id=dd9cf3b7-114f-4d74-a7e2-7b524ae086f2
|
164
|
+
var fullPath = `${tokenCraftUrl}?channel_id=${requestBody.channel_id}&shop_id=${requestBody.shop_id}`
|
165
|
+
const response: any = await fetch(fullPath, {
|
166
|
+
method: 'get',
|
167
|
+
headers: {
|
168
|
+
'Content-Type': 'application/json',
|
169
|
+
'x-api-key': apiKey
|
170
|
+
}
|
171
|
+
})
|
172
|
+
if (response.ok) {
|
173
|
+
store = await response.json()
|
151
174
|
}
|
152
|
-
})
|
153
|
-
if (response.ok) {
|
154
|
-
store = await response.json()
|
155
|
-
}
|
156
175
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
176
|
+
let mappedStore: any = {
|
177
|
+
accessKey: store.shop?.credential?.consumer_key || '',
|
178
|
+
accessSecret: store.shop?.credential?.consumer_secret || '',
|
179
|
+
storeURL: store.shop?.credential?.store_url,
|
180
|
+
platform: PLATFORM[`${store.shop.org_prefix}`],
|
181
|
+
accessToken: store.shop?.credential?.access_token,
|
182
|
+
channelShopId: store.shop?.channel_shop_id
|
183
|
+
}
|
165
184
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
185
|
+
const reqBody = {
|
186
|
+
orderId: requestBody.native_order_id,
|
187
|
+
status: requestBody.order_status,
|
188
|
+
carrier: requestBody?.shipper_last_mile,
|
189
|
+
trackingNo: requestBody?.tracking_number,
|
190
|
+
orderItems: requestBody?.order_item_ids,
|
191
|
+
isSOF: requestBody?.seller_logistics
|
192
|
+
}
|
173
193
|
|
174
|
-
|
175
|
-
|
194
|
+
let responseBody: any = { operation_id: uuid() }
|
195
|
+
try {
|
196
|
+
result = await StoreAPI.updateOrderStatus(mappedStore, reqBody)
|
197
|
+
debug(result)
|
198
|
+
|
199
|
+
if (result?.requiredDocument) {
|
200
|
+
// call document api and ingest channel order package
|
201
|
+
const order: any = await StoreAPI.getStoreOrder(mappedStore, { orderId: reqBody.orderId })
|
202
|
+
let orderPackage: any = order ? (order[0]?.orderPackage ? order[0].orderPackage : {}) : {}
|
203
|
+
if (orderPackage) {
|
204
|
+
const packageId: string = orderPackage.packageId
|
205
|
+
|
206
|
+
let orderDocument: any = orderPackage.orderDocument
|
207
|
+
if (orderDocument?.length == 0) {
|
208
|
+
let hasDocument: boolean = false
|
209
|
+
while (!hasDocument) {
|
210
|
+
orderDocument = await StoreAPI.getStoreOrderDocument(mappedStore, { packageId, documentType: 1 })
|
211
|
+
if (orderDocument?.length > 0) {
|
212
|
+
hasDocument = true
|
213
|
+
break
|
214
|
+
}
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
// Order Package Payload
|
219
|
+
let newOrderPackage: any =
|
220
|
+
{
|
221
|
+
channel_shop_id: mappedStore.channelShopId,
|
222
|
+
native_order_id: reqBody.orderId,
|
223
|
+
native_package_id: orderPackage.packageId,
|
224
|
+
shipping_tracking_code: orderPackage.trackingNumber,
|
225
|
+
shipping_type_value: orderPackage?.shippingType ? orderPackage.shippingType : SHIPPING_TYPE.DROP_SHIPPING,
|
226
|
+
warehouse_code: SHIPPING_TYPE.DROP_SHIPPING,
|
227
|
+
shipper: {
|
228
|
+
name: orderPackage.shippingProvider,
|
229
|
+
is_cod_supported: orderPackage?.isCodSupport ? orderPackage.isCodSupport : false
|
230
|
+
},
|
231
|
+
documents: orderDocument || [],
|
232
|
+
shipper_last_mile: {
|
233
|
+
name: orderPackage.shippingProvider,
|
234
|
+
is_cod_supported: orderPackage?.isCodSupport ? orderPackage.isCodSupport : false
|
235
|
+
},
|
236
|
+
order_item_ids: orderPackage?.orderListIdList ? orderPackage.orderListIdList : reqBody.orderItems
|
237
|
+
} || {}
|
238
|
+
|
239
|
+
responseBody.package = newOrderPackage
|
240
|
+
}
|
241
|
+
responseBody.response_code = 'E0'
|
242
|
+
responseBody.message = 'Success'
|
243
|
+
}
|
244
|
+
|
245
|
+
responseBody.time = Math.floor(new Date(new Date().toUTCString()).getTime() / 1000)
|
246
|
+
|
247
|
+
context.type = 'application/json'
|
248
|
+
context.status = 200
|
249
|
+
context.body = responseBody
|
250
|
+
|
251
|
+
await next()
|
252
|
+
} catch (e) {
|
253
|
+
responseBody.response_code = 'E1'
|
254
|
+
responseBody.message = e.message
|
176
255
|
|
177
|
-
|
256
|
+
context.type = 'application/json'
|
257
|
+
context.status = 500
|
258
|
+
context.body = responseBody
|
259
|
+
}
|
260
|
+
} catch (e) {}
|
178
261
|
})
|
179
262
|
|
180
263
|
sellercraftRouter.post('/sellercraft/store/update-product-attribute', async (context, next) => {
|
@@ -233,9 +316,16 @@ sellercraftRouter.post('/sellercraft/store/update-product-attribute', async (con
|
|
233
316
|
})
|
234
317
|
|
235
318
|
for (var i = 0; i < variants.length; i++) {
|
236
|
-
|
237
|
-
|
319
|
+
try {
|
320
|
+
let variant = variants[i]
|
321
|
+
await StoreAPI.updateProductAttribute(mappedStore, { productSku, itemId, variant })
|
322
|
+
context.type = 'application/json'
|
323
|
+
context.status = 200
|
324
|
+
context.body = 'Succeeded'
|
325
|
+
} catch (e) {
|
326
|
+
context.type = 'application/json'
|
327
|
+
context.status = 500
|
328
|
+
context.body = e.message
|
329
|
+
}
|
238
330
|
}
|
239
|
-
|
240
|
-
context.status = 200
|
241
331
|
})
|
@@ -19,7 +19,7 @@ export class MarketplaceChannelOrderMutation {
|
|
19
19
|
const sellercraftChannelIntegrationConfig = config.get('sellercraftChannelIntegrationConfig', {})
|
20
20
|
const { tokenCraftApiKey: apiKey, getShopsTokenCraftUrl } = sellercraftChannelIntegrationConfig
|
21
21
|
|
22
|
-
const channels: MarketplaceChannel[] = await getRepository(MarketplaceChannel).find()
|
22
|
+
const channels: MarketplaceChannel[] = await getRepository(MarketplaceChannel).find({ where: { isActive: true } })
|
23
23
|
|
24
24
|
for (var i = 0; i < channels.length; i++) {
|
25
25
|
try {
|
@@ -56,7 +56,7 @@ export class MarketplaceChannelOrderMutation {
|
|
56
56
|
let channelShopId = shops[j].channel_shop_id
|
57
57
|
|
58
58
|
let orderResult = []
|
59
|
-
let page: number = 1
|
59
|
+
let page: number = store.platform == 'magento' ? 1 : 0
|
60
60
|
let hasMorePage: boolean = true
|
61
61
|
let lastOrderId: string
|
62
62
|
let cursor: string
|
@@ -343,7 +343,9 @@ export class MarketplaceChannelOrderMutation {
|
|
343
343
|
})
|
344
344
|
|
345
345
|
if (mappedOrderResult.length > 0) {
|
346
|
-
await SellercraftChannelIntegrationAPI.ingestChannelOrder(sellercraftStore, {
|
346
|
+
await SellercraftChannelIntegrationAPI.ingestChannelOrder(sellercraftStore, {
|
347
|
+
orders: mappedOrderResult
|
348
|
+
})
|
347
349
|
|
348
350
|
await Promise.all(
|
349
351
|
mappedOrderResult.map(async result => {
|
@@ -379,10 +381,9 @@ export class MarketplaceChannelOrderMutation {
|
|
379
381
|
}
|
380
382
|
} catch (e) {}
|
381
383
|
}
|
382
|
-
|
383
|
-
return true
|
384
384
|
} catch (e) {}
|
385
385
|
}
|
386
|
+
return true
|
386
387
|
}
|
387
388
|
}
|
388
389
|
|
@@ -394,8 +395,8 @@ function getOrderCharges(mappedOrderItems) {
|
|
394
395
|
let charge = mappedOrderItems[i].charges[j]
|
395
396
|
let foundCharge = chargesList.find(cl => cl.name == charge.name)
|
396
397
|
if (foundCharge) {
|
397
|
-
foundCharge.grossAmount = foundCharge.grossAmount + charge.grossAmount
|
398
|
-
foundCharge.nettAmount = foundCharge.nettAmount + charge.nettAmount
|
398
|
+
foundCharge.grossAmount = parseFloat(foundCharge.grossAmount) + parseFloat(charge.grossAmount)
|
399
|
+
foundCharge.nettAmount = parseFloat(foundCharge.nettAmount) + parseFloat(charge.nettAmount)
|
399
400
|
chargesList = chargesList.filter(cl => cl.name != charge.name)
|
400
401
|
} else {
|
401
402
|
foundCharge = {
|
@@ -14,7 +14,7 @@ export class MarketplaceChannelProductMutation {
|
|
14
14
|
const sellercraftChannelIntegrationConfig = config.get('sellercraftChannelIntegrationConfig', {})
|
15
15
|
const { tokenCraftApiKey: apiKey, getShopsTokenCraftUrl } = sellercraftChannelIntegrationConfig
|
16
16
|
|
17
|
-
const channels: MarketplaceChannel[] = await getRepository(MarketplaceChannel).find()
|
17
|
+
const channels: MarketplaceChannel[] = await getRepository(MarketplaceChannel).find({ where: { isActive: true } })
|
18
18
|
|
19
19
|
for (var i = 0; i < channels.length; i++) {
|
20
20
|
var channelsFullPath = getShopsTokenCraftUrl + '?channel_id=' + channels[i].channelId
|
@@ -156,7 +156,6 @@ export class MarketplaceChannelProductMutation {
|
|
156
156
|
categoryId,
|
157
157
|
categoryName,
|
158
158
|
parent,
|
159
|
-
isLeaf: parent == 0 ? false : true,
|
160
159
|
isActive: isActive || true,
|
161
160
|
channelCode,
|
162
161
|
countryCode,
|
@@ -164,14 +163,41 @@ export class MarketplaceChannelProductMutation {
|
|
164
163
|
}
|
165
164
|
})
|
166
165
|
|
166
|
+
if (store.platform == 'magento') {
|
167
|
+
let newList = []
|
168
|
+
for (let np of mappedProducts) {
|
169
|
+
if (np.productId == np.variations[0].variationId) {
|
170
|
+
let vars = mappedProducts
|
171
|
+
.filter(e => e.productId == np.productId)
|
172
|
+
.map(e => {
|
173
|
+
return e.variations[0]
|
174
|
+
})
|
175
|
+
np.variations = vars
|
176
|
+
if (np.variations.length > 1) {
|
177
|
+
np.variations = np.variations.filter(v => v.variationId != np.productId)
|
178
|
+
}
|
179
|
+
newList.push(np)
|
180
|
+
}
|
181
|
+
}
|
182
|
+
mappedProducts = newList
|
183
|
+
}
|
184
|
+
|
167
185
|
try {
|
186
|
+
let filterList = []
|
168
187
|
mappedCategories = mappedCategories.map(category => {
|
169
188
|
if (mappedCategories.filter(e => e.parent == category.categoryId).length > 0) {
|
170
189
|
category.childrenCategories = mappedCategories.filter(e => e.parent == category.categoryId)
|
190
|
+
filterList.push(...mappedCategories.filter(e => e.parent == category.categoryId))
|
171
191
|
}
|
172
192
|
return category
|
173
193
|
})
|
174
194
|
|
195
|
+
mappedCategories = mappedCategories.map(mc => {
|
196
|
+
if (filterList.indexOf(mc) == -1) {
|
197
|
+
return mc
|
198
|
+
}
|
199
|
+
}).filter(e => e)
|
200
|
+
|
175
201
|
await SellercraftChannelIntegrationAPI.ingestChannelCategories(sellercraftStore, {
|
176
202
|
categories: mappedCategories
|
177
203
|
})
|
@@ -186,7 +212,7 @@ export class MarketplaceChannelProductMutation {
|
|
186
212
|
} catch (e) {}
|
187
213
|
}
|
188
214
|
|
189
|
-
return true
|
190
215
|
}
|
216
|
+
return true
|
191
217
|
}
|
192
218
|
}
|