@things-factory/integration-sellercraft 4.2.1 → 4.2.5
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/constants/order-status-mapping.js +6 -2
- package/dist-server/constants/order-status-mapping.js.map +1 -1
- package/dist-server/constants/platform.js +2 -1
- package/dist-server/constants/platform.js.map +1 -1
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js +25 -7
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js.map +1 -1
- package/dist-server/routers/sellercraft-router.js +25 -9
- package/dist-server/routers/sellercraft-router.js.map +1 -1
- package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js +18 -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 +18 -7
- package/dist-server/service/marketplace-channel/marketplace-channel-product-mutation.js.map +1 -1
- package/package.json +3 -3
- package/server/constants/order-status-mapping.ts +6 -2
- package/server/constants/platform.ts +2 -1
- package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-categories.ts +1 -1
- package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.ts +29 -10
- package/server/routers/sellercraft-router.ts +26 -10
- package/server/service/marketplace-channel/marketplace-channel-order-mutation.ts +19 -5
- package/server/service/marketplace-channel/marketplace-channel-product-mutation.ts +28 -9
@@ -2,9 +2,13 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.ORDER_STATUS = void 0;
|
4
4
|
exports.ORDER_STATUS = {
|
5
|
-
pending: '
|
5
|
+
pending: 'CONFIRMED',
|
6
6
|
processing: 'CONFIRMED',
|
7
7
|
completed: 'DELIVERED',
|
8
|
-
cancelled: 'CANCELLED'
|
8
|
+
cancelled: 'CANCELLED',
|
9
|
+
canceled: 'CANCELLED',
|
10
|
+
refunded: 'REFUND_COMPLETE',
|
11
|
+
failed: 'SHIPMENT_LOST_OR_DAMAGED',
|
12
|
+
refund: 'REFUND_COMPLETE'
|
9
13
|
};
|
10
14
|
//# sourceMappingURL=order-status-mapping.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"order-status-mapping.js","sourceRoot":"","sources":["../../server/constants/order-status-mapping.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"order-status-mapping.js","sourceRoot":"","sources":["../../server/constants/order-status-mapping.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE,WAAW;IACpB,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,WAAW;IACrB,QAAQ,EAAE,iBAAiB;IAC3B,MAAM,EAAE,0BAA0B;IAClC,MAAM,EAAE,iBAAiB;CAC1B,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../server/constants/platform.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACtB,GAAG,EAAE,aAAa;
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../server/constants/platform.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACtB,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,SAAS;CACf,CAAA"}
|
package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js
CHANGED
@@ -17,9 +17,11 @@ function ingestChannelProduct() {
|
|
17
17
|
is_enabled: variant.isEnabled || true,
|
18
18
|
is_sellable: variant.isSellable || true,
|
19
19
|
is_deleted: false,
|
20
|
-
variant_attributes: (variant === null || variant === void 0 ? void 0 : variant.attributes
|
21
|
-
|
22
|
-
|
20
|
+
variant_attributes: (variant === null || variant === void 0 ? void 0 : variant.attributes)
|
21
|
+
? variant === null || variant === void 0 ? void 0 : variant.attributes.map(attribute => {
|
22
|
+
return Object.assign(Object.assign({}, attribute), { native_attribute_id: attribute.native_attribute_id.toString() });
|
23
|
+
})
|
24
|
+
: [],
|
23
25
|
stock_locked: (variant === null || variant === void 0 ? void 0 : variant.stockLocked) ? variant.stockLocked : 0,
|
24
26
|
native_stock_reported: (variant === null || variant === void 0 ? void 0 : variant.stockReported) ? variant.stockReported : 0,
|
25
27
|
price_full: variant.fullPrice || 0,
|
@@ -27,7 +29,7 @@ function ingestChannelProduct() {
|
|
27
29
|
inventory_products: (variant === null || variant === void 0 ? void 0 : variant.inventoryProducts)
|
28
30
|
? variant.inventoryProducts.map(inventoryProduct => {
|
29
31
|
return {
|
30
|
-
quantity: inventoryProduct.qty ||
|
32
|
+
quantity: inventoryProduct.qty || 0,
|
31
33
|
name: inventoryProduct.name,
|
32
34
|
inventory_sku: inventoryProduct.sku,
|
33
35
|
product_versions: (inventoryProduct === null || inventoryProduct === void 0 ? void 0 : inventoryProduct.productVersions)
|
@@ -41,7 +43,7 @@ function ingestChannelProduct() {
|
|
41
43
|
package_weight_gram: (productVersion === null || productVersion === void 0 ? void 0 : productVersion.packageWeightGram)
|
42
44
|
? productVersion.packageWeightGram
|
43
45
|
: 0,
|
44
|
-
stock_available: productVersion.qty
|
46
|
+
stock_available: productVersion.qty
|
45
47
|
};
|
46
48
|
})
|
47
49
|
: []
|
@@ -60,7 +62,7 @@ function ingestChannelProduct() {
|
|
60
62
|
label: product.name,
|
61
63
|
brand: product.brand || '',
|
62
64
|
is_verified: product.isVerified || true,
|
63
|
-
flexible_attributes: product.channelCode == 'WCM' ? true : false,
|
65
|
+
flexible_attributes: product.channelCode == 'WCM' || product.channelCode == 'MGT' ? true : false,
|
64
66
|
images: product === null || product === void 0 ? void 0 : product.images.map(image => {
|
65
67
|
return {
|
66
68
|
file_url: image.url
|
@@ -69,9 +71,25 @@ function ingestChannelProduct() {
|
|
69
71
|
product_attributes: product === null || product === void 0 ? void 0 : product.attributes.map(attribute => {
|
70
72
|
return Object.assign(Object.assign({}, attribute), { native_attribute_id: attribute.native_attribute_id.toString() });
|
71
73
|
}),
|
72
|
-
variants: productVariations
|
74
|
+
variants: productVariations,
|
75
|
+
has_all_variants: product.channelCode == 'MGT' ? false : true
|
73
76
|
};
|
74
77
|
});
|
78
|
+
if (products[0].channelCode == 'MGT') {
|
79
|
+
let newList = [];
|
80
|
+
for (let np of newProducts) {
|
81
|
+
if (np.native_product_id == np.variants[0].native_variant_id) {
|
82
|
+
let vars = newProducts
|
83
|
+
.filter(e => e.native_product_id == np.native_product_id)
|
84
|
+
.map(e => {
|
85
|
+
return e.variants[0];
|
86
|
+
});
|
87
|
+
np.variants = vars;
|
88
|
+
newList.push(np);
|
89
|
+
}
|
90
|
+
}
|
91
|
+
newProducts = newList;
|
92
|
+
}
|
75
93
|
return {
|
76
94
|
payload: [...newProducts]
|
77
95
|
};
|
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,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;gBACvC,IAAI,iBAAiB,GAAU,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;oBAC9D,OAAO;wBACL,UAAU,EAAE,OAAO,CAAC,YAAY;wBAChC,iBAAiB,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE;wBACjD,KAAK,EAAE,OAAO,CAAC,IAAI;wBACnB,UAAU,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI;wBACrC,WAAW,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;wBACvC,UAAU,EAAE,KAAK;wBACjB,kBAAkB,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;
|
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,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;gBACvC,IAAI,iBAAiB,GAAU,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;oBAC9D,OAAO;wBACL,UAAU,EAAE,OAAO,CAAC,YAAY;wBAChC,iBAAiB,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE;wBACjD,KAAK,EAAE,OAAO,CAAC,IAAI;wBACnB,UAAU,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI;wBACrC,WAAW,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;wBACvC,UAAU,EAAE,KAAK;wBACjB,kBAAkB,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU;4BACrC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;gCAClC,uCACK,SAAS,KACZ,mBAAmB,EAAE,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAC9D;4BACH,CAAC,CAAC;4BACJ,CAAC,CAAC,EAAE;wBACN,YAAY,EAAE,CAAA,OAAO,aAAP,OA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,mBAAmB,EAAE,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAC9D;oBACH,CAAC,CAAC;oBACF,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,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,KAAK,EAAE;gBACpC,IAAI,OAAO,GAAG,EAAE,CAAA;gBAChB,KAAK,IAAI,EAAE,IAAI,WAAW,EAAE;oBAC1B,IAAI,EAAE,CAAC,iBAAiB,IAAI,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE;wBAC5D,IAAI,IAAI,GAAG,WAAW;6BACnB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,IAAI,EAAE,CAAC,iBAAiB,CAAC;6BACxD,GAAG,CAAC,CAAC,CAAC,EAAE;4BACP,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;wBACtB,CAAC,CAAC,CAAA;wBACJ,EAAE,CAAC,QAAQ,GAAG,IAAI,CAAA;wBAClB,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;qBACjB;iBACF;gBACD,WAAW,GAAG,OAAO,CAAA;aACtB;YAED,OAAO;gBACL,OAAO,EAAE,CAAC,GAAG,WAAW,CAAC;aAC1B,CAAA;QACH,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC;AA1GD,oDA0GC"}
|
@@ -36,14 +36,16 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-price', async
|
|
36
36
|
accessKey: store.shop.credential.consumer_key,
|
37
37
|
accessSecret: store.shop.credential.consumer_secret,
|
38
38
|
storeURL: store.shop.credential.store_url,
|
39
|
-
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`]
|
39
|
+
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
|
40
|
+
accessToken: store.shop.credential.access_token
|
40
41
|
};
|
41
42
|
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
42
43
|
const req = {
|
43
44
|
costPrice: requestBody[i].full_price,
|
44
45
|
sellPrice: requestBody[i].sale_price,
|
45
46
|
productId: requestBody[i].native_product_id,
|
46
|
-
variationId: requestBody[i].native_variant_id
|
47
|
+
variationId: requestBody[i].native_variant_id,
|
48
|
+
variationSku: requestBody[i].sku
|
47
49
|
};
|
48
50
|
result = await integration_marketplace_1.StoreAPI.updateStoreProductVariationPrice(mappedStore, req);
|
49
51
|
}
|
@@ -51,7 +53,8 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-price', async
|
|
51
53
|
const req = {
|
52
54
|
costPrice: requestBody[i].full_price,
|
53
55
|
sellPrice: requestBody[i].sale_price,
|
54
|
-
productId: requestBody[i].native_product_id
|
56
|
+
productId: requestBody[i].native_product_id,
|
57
|
+
variationSku: requestBody[i].sku
|
55
58
|
};
|
56
59
|
result = await integration_marketplace_1.StoreAPI.updateStoreProductPrice(mappedStore, req);
|
57
60
|
}
|
@@ -85,20 +88,25 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-stock', async
|
|
85
88
|
accessKey: store.shop.credential.consumer_key,
|
86
89
|
accessSecret: store.shop.credential.consumer_secret,
|
87
90
|
storeURL: store.shop.credential.store_url,
|
88
|
-
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`]
|
91
|
+
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
|
92
|
+
accessToken: store.shop.credential.access_token
|
89
93
|
};
|
90
94
|
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
91
95
|
const req = {
|
92
96
|
qty: requestBody[i].stock,
|
93
97
|
itemId: requestBody[i].native_product_id,
|
94
|
-
variationId: requestBody[i].native_variant_id
|
98
|
+
variationId: requestBody[i].native_variant_id,
|
99
|
+
distributors: requestBody[i].distributors || [],
|
100
|
+
variationSku: requestBody[i].sku
|
95
101
|
};
|
96
102
|
result = await integration_marketplace_1.StoreAPI.updateStoreProductVariationStock(mappedStore, req);
|
97
103
|
}
|
98
104
|
else {
|
99
105
|
const req = {
|
100
106
|
qty: requestBody[i].stock,
|
101
|
-
itemId: requestBody[i].native_product_id
|
107
|
+
itemId: requestBody[i].native_product_id,
|
108
|
+
distributors: requestBody[i].distributors || [],
|
109
|
+
variationSku: requestBody[i].sku
|
102
110
|
};
|
103
111
|
result = await integration_marketplace_1.StoreAPI.updateStoreProductStock(mappedStore, req);
|
104
112
|
}
|
@@ -131,9 +139,16 @@ exports.sellercraftRouter.post('/sellercraft/store/update-order-status', async (
|
|
131
139
|
accessKey: store.shop.credential.consumer_key,
|
132
140
|
accessSecret: store.shop.credential.consumer_secret,
|
133
141
|
storeURL: store.shop.credential.store_url,
|
134
|
-
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`]
|
142
|
+
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
|
143
|
+
accessToken: store.shop.credential.access_token
|
144
|
+
};
|
145
|
+
const reqBody = {
|
146
|
+
orderId: requestBody.native_order_id,
|
147
|
+
status: requestBody.order_status,
|
148
|
+
carrier: requestBody === null || requestBody === void 0 ? void 0 : requestBody.shipper_last_mile,
|
149
|
+
trackingNo: requestBody === null || requestBody === void 0 ? void 0 : requestBody.tracking_number,
|
150
|
+
orderItems: requestBody === null || requestBody === void 0 ? void 0 : requestBody.order_item_ids
|
135
151
|
};
|
136
|
-
const reqBody = { orderId: requestBody.native_order_id, status: requestBody.order_status };
|
137
152
|
result = await integration_marketplace_1.StoreAPI.updateOrderStatus(mappedStore, reqBody);
|
138
153
|
debug(result);
|
139
154
|
context.status = 200;
|
@@ -162,7 +177,8 @@ exports.sellercraftRouter.post('/sellercraft/store/update-product-attribute', as
|
|
162
177
|
accessKey: store.shop.credential.consumer_key,
|
163
178
|
accessSecret: store.shop.credential.consumer_secret,
|
164
179
|
storeURL: store.shop.credential.store_url,
|
165
|
-
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`]
|
180
|
+
platform: constants_1.PLATFORM[`${store.shop.org_prefix}`],
|
181
|
+
accessToken: store.shop.credential.access_token
|
166
182
|
};
|
167
183
|
let { product_sku: productSku, native_product_id: itemId, variants } = requestBody;
|
168
184
|
variants.map(variant => {
|
@@ -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;AAClE,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,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAE5C,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,2BAA2B,CAAC,CAAA;IAEvE,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAA;IAExC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC3C,IAAI,KAAK,GAAQ,EAAE,CAAA,CAAC,sBAAsB;QAC1C,IAAI,MAAM,CAAA;QAEV,qJAAqJ;QACrJ,IA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AC,UAAU,CAAC,SAAS;QACzC,QAAQ,EAAE,oBAAQ,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;QAC9C,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY;KAChD,CAAA;IAED,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAA;IAElF,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QACrB,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,OAAO,CAAA;QAEnF,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YACzB,IAAI,EAAE,mBAAmB,EAAE,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,SAAS,CAAA;YAExF,OAAO;gBACL,EAAE;gBACF,IAAI;gBACJ,KAAK;aACN,CAAA;QACH,CAAC,CAAC,CAAA;QAEF,OAAO;YACL,UAAU;YACV,SAAS;YACT,UAAU;SACX,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,IAAI,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;QACzB,MAAM,kCAAQ,CAAC,sBAAsB,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAA;KACpF;IAED,OAAO,CAAC,MAAM,GAAG,GAAG,CAAA;AACtB,CAAC,CAAC,CAAA"}
|
@@ -50,13 +50,25 @@ let MarketplaceChannelOrderMutation = class MarketplaceChannelOrderMutation {
|
|
50
50
|
// let channelCode = shops[j].org_prefix
|
51
51
|
let organisationId = shops[j].account_id;
|
52
52
|
let channelShopId = shops[j].channel_shop_id;
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
53
|
+
let orderResult = [];
|
54
|
+
let page = 1;
|
55
|
+
let hasMorePage = true;
|
56
|
+
let lastOrderId;
|
57
|
+
var limit = 100;
|
58
|
+
while (hasMorePage) {
|
59
|
+
const { results: marketplaceOrders, more } = await integration_marketplace_1.StoreAPI.getStoreOrders(store, {
|
60
|
+
fromDate,
|
61
|
+
toDate,
|
62
|
+
pagination: { page, limit },
|
63
|
+
lastOrderId
|
64
|
+
});
|
65
|
+
orderResult.push(...marketplaceOrders);
|
66
|
+
if (more)
|
67
|
+
page++;
|
68
|
+
hasMorePage = more;
|
69
|
+
}
|
58
70
|
var sellercraftStore = Object.assign(Object.assign({}, store), { platform: 'sellercraftChannelIntegration' });
|
59
|
-
let mappedOrderResult = orderResult.
|
71
|
+
let mappedOrderResult = orderResult.map(order => {
|
60
72
|
let { firstName: custFirstName, lastName: custLastName, orderCreatedAt: createdAt, orderUpdatedAt: updatedAt, orderNo: id, status } = order;
|
61
73
|
let { first_name: billFirstName, last_name: billLastName, address_1: billAddress1, address_2: billAddress2, address_3: billAddress3, address_4: billAddress4, address_5: billAddress5, city: billCity, postcode: billPostalCode, country: billCountry, phone: billPhone1, phone_2: billPhone2 } = order === null || order === void 0 ? void 0 : order.billing;
|
62
74
|
let { first_name: shipFirstName, last_name: shipLastName, address_1: shipAddress1, address_2: shipAddress2, address_3: shipAddress3, address_4: shipAddress4, address_5: shipAddress5, city: shipCity, postcode: shipPostalCode, country: shipCountry, phone: shipPhone1, phone_2: shipPhone2 } = order.shipping;
|
@@ -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,+DAA0D;AAE1D,6CAA4C;AAC5C,qFAAkE;AAClE,+GAAwG;AAG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AAC,CAAC,UAAU,CAAC,SAAS;oBACvC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI;oBAC1B,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,WAAW;iBAC1D,CAAA;gBAED,0CAA0C;gBAC1C,wCAAwC;gBACxC,IAAI,cAAc,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAA;gBACxC,IAAI,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,eAAe,CAAA;gBAE5C,
|
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,+DAA0D;AAE1D,6CAA4C;AAC5C,qFAAkE;AAClE,+GAAwG;AAGxG,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;QAErF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,gBAAgB,GAAG,qBAAqB,GAAG,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YACrF,MAAM,eAAe,GAAQ,MAAM,KAAK,CAAC,gBAAgB,EAAE;gBACzD,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE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AAgB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC3D,IAAI,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;YAC3C,IAAI,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAA;YAChE,IAAI,WAAW,EAAE;gBACf,WAAW,CAAC,WAAW,GAAG,WAAW,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAA;gBACtE,WAAW,CAAC,UAAU,GAAG,WAAW,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAA;gBACnE,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"}
|
@@ -53,16 +53,27 @@ let MarketplaceChannelProductMutation = class MarketplaceChannelProductMutation
|
|
53
53
|
var sellercraftStore = Object.assign(Object.assign({}, store), { platform: 'sellercraftChannelIntegration' });
|
54
54
|
const productResult = [];
|
55
55
|
let totalPages = 1;
|
56
|
-
|
56
|
+
let limit = 50;
|
57
|
+
let parentLinks = [];
|
57
58
|
for (let page = 0; page < totalPages; page++) {
|
58
|
-
const { results, total } = await integration_marketplace_1.StoreAPI.getStoreProducts(store, {
|
59
|
+
const { results, total, parentLinkList } = await integration_marketplace_1.StoreAPI.getStoreProducts(store, {
|
59
60
|
pagination: { page, limit }
|
60
61
|
});
|
61
62
|
totalPages = Math.ceil(total / limit);
|
62
63
|
productResult.push(...results);
|
64
|
+
if (store.platform == 'magento')
|
65
|
+
parentLinks.push(...parentLinkList);
|
66
|
+
}
|
67
|
+
const categoryResult = [];
|
68
|
+
let totalPagesCategory = 1;
|
69
|
+
let limitCategory = 100;
|
70
|
+
for (let page = 0; page < totalPagesCategory; page++) {
|
71
|
+
const { results, total } = await integration_marketplace_1.StoreAPI.getStoreProductCategories(store, { pagination: { page, limitCategory } });
|
72
|
+
totalPagesCategory = Math.ceil(total / limitCategory);
|
73
|
+
categoryResult.push(...results);
|
63
74
|
}
|
64
|
-
const categoryResult = await integration_marketplace_1.StoreAPI.getStoreProductCategories(store, {});
|
65
75
|
let mappedProducts = productResult.map(item => {
|
76
|
+
var _a;
|
66
77
|
let { categoryId, itemId: productId, name, brand, isVerified, images, attributes, variations } = item;
|
67
78
|
variations = variations.map(variation => {
|
68
79
|
let { variationSku, variationId, name, isEnabled: isEnabled, isEnabled: isSellable, attributes, stockLocked, qty: stockReported, costPrice: fullPrice, sellPrice: priceDiscounted, length, width, height, weight } = variation;
|
@@ -79,7 +90,7 @@ let MarketplaceChannelProductMutation = class MarketplaceChannelProductMutation
|
|
79
90
|
priceDiscounted,
|
80
91
|
inventoryProducts: [
|
81
92
|
{
|
82
|
-
qty:
|
93
|
+
qty: 1,
|
83
94
|
name: `${name} - ${variationSku}`,
|
84
95
|
sku: variationSku,
|
85
96
|
productVersions: [
|
@@ -89,7 +100,7 @@ let MarketplaceChannelProductMutation = class MarketplaceChannelProductMutation
|
|
89
100
|
packageWidthMM: width,
|
90
101
|
packageHeightMM: height,
|
91
102
|
packageWeightGram: weight,
|
92
|
-
qty:
|
103
|
+
qty: stockReported
|
93
104
|
}
|
94
105
|
]
|
95
106
|
}
|
@@ -107,7 +118,7 @@ let MarketplaceChannelProductMutation = class MarketplaceChannelProductMutation
|
|
107
118
|
channelCode: channels[i].channelCode,
|
108
119
|
channelCountry: shops[j].country_code,
|
109
120
|
categoryId,
|
110
|
-
productId,
|
121
|
+
productId: ((_a = parentLinks.find(e => e.children.includes(productId))) === null || _a === void 0 ? void 0 : _a.id) || productId,
|
111
122
|
name,
|
112
123
|
brand,
|
113
124
|
isVerified,
|
@@ -116,7 +127,7 @@ let MarketplaceChannelProductMutation = class MarketplaceChannelProductMutation
|
|
116
127
|
variations
|
117
128
|
};
|
118
129
|
});
|
119
|
-
let mappedCategories = categoryResult.
|
130
|
+
let mappedCategories = categoryResult.map(category => {
|
120
131
|
let { id: categoryId, name: categoryName, parent, isActive } = category;
|
121
132
|
return {
|
122
133
|
categoryId,
|
@@ -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,+DAA0D;AAE1D,6CAA4C;AAC5C,qFAAkE;AAClE,+GAAwG;AAGxG,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;QAErF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,gBAAgB,GAAG,qBAAqB,GAAG,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YACrF,MAAM,eAAe,GAAQ,MAAM,KAAK,CAAC,gBAAgB,EAAE;gBAC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I,KAAK,GAAW,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,+DAA0D;AAE1D,6CAA4C;AAC5C,qFAAkE;AAClE,+GAAwG;AAGxG,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;QAErF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,gBAAgB,GAAG,qBAAqB,GAAG,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;YACrF,MAAM,eAAe,GAAQ,MAAM,KAAK,CAAC,gBAAgB,EAAE;gBACzD,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,WAAW,EAAE,MAAM;iBACpB;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,eAAe,CAAC,EAAE,EAAE;gBACvB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;aACjC;YACD,IAAI,aAAa,GAAG,MAAM,eAAe,CAAC,IAAI,EAAE,CAAA;YAChD,IAAI,KAAK,GAAG,aAAa,CAAC,KAAK,CAAA;YAE/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,E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things-factory/integration-sellercraft",
|
3
|
-
"version": "4.2.
|
3
|
+
"version": "4.2.5",
|
4
4
|
"main": "dist-server/index.js",
|
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.5",
|
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": "e1447c2e0c5c1ad9375e84291f688b7ecdbeee40"
|
55
55
|
}
|
@@ -1,6 +1,10 @@
|
|
1
1
|
export const ORDER_STATUS = {
|
2
|
-
pending: '
|
2
|
+
pending: 'CONFIRMED',
|
3
3
|
processing: 'CONFIRMED',
|
4
4
|
completed: 'DELIVERED',
|
5
|
-
cancelled: 'CANCELLED'
|
5
|
+
cancelled: 'CANCELLED',
|
6
|
+
canceled: 'CANCELLED',
|
7
|
+
refunded: 'REFUND_COMPLETE',
|
8
|
+
failed: 'SHIPMENT_LOST_OR_DAMAGED',
|
9
|
+
refund: 'REFUND_COMPLETE'
|
6
10
|
}
|
@@ -16,12 +16,14 @@ export function ingestChannelProduct() {
|
|
16
16
|
is_enabled: variant.isEnabled || true,
|
17
17
|
is_sellable: variant.isSellable || true,
|
18
18
|
is_deleted: false, // default
|
19
|
-
variant_attributes: variant?.attributes
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
variant_attributes: variant?.attributes
|
20
|
+
? variant?.attributes.map(attribute => {
|
21
|
+
return {
|
22
|
+
...attribute,
|
23
|
+
native_attribute_id: attribute.native_attribute_id.toString()
|
24
|
+
}
|
25
|
+
})
|
26
|
+
: [],
|
25
27
|
stock_locked: variant?.stockLocked ? variant.stockLocked : 0,
|
26
28
|
native_stock_reported: variant?.stockReported ? variant.stockReported : 0,
|
27
29
|
price_full: variant.fullPrice || 0,
|
@@ -29,7 +31,7 @@ export function ingestChannelProduct() {
|
|
29
31
|
inventory_products: variant?.inventoryProducts
|
30
32
|
? variant.inventoryProducts.map(inventoryProduct => {
|
31
33
|
return {
|
32
|
-
quantity: inventoryProduct.qty ||
|
34
|
+
quantity: inventoryProduct.qty || 0,
|
33
35
|
name: inventoryProduct.name,
|
34
36
|
inventory_sku: inventoryProduct.sku,
|
35
37
|
product_versions: inventoryProduct?.productVersions
|
@@ -43,7 +45,7 @@ export function ingestChannelProduct() {
|
|
43
45
|
package_weight_gram: productVersion?.packageWeightGram
|
44
46
|
? productVersion.packageWeightGram
|
45
47
|
: 0,
|
46
|
-
stock_available: productVersion.qty
|
48
|
+
stock_available: productVersion.qty
|
47
49
|
}
|
48
50
|
})
|
49
51
|
: []
|
@@ -63,7 +65,7 @@ export function ingestChannelProduct() {
|
|
63
65
|
label: product.name,
|
64
66
|
brand: product.brand || '',
|
65
67
|
is_verified: product.isVerified || true,
|
66
|
-
flexible_attributes: product.channelCode == 'WCM' ? true : false, // add channels that do not support category_attributes ingestion
|
68
|
+
flexible_attributes: product.channelCode == 'WCM' || product.channelCode == 'MGT' ? true : false, // add channels that do not support category_attributes ingestion
|
67
69
|
images: product?.images.map(image => {
|
68
70
|
return {
|
69
71
|
file_url: image.url
|
@@ -75,10 +77,27 @@ export function ingestChannelProduct() {
|
|
75
77
|
native_attribute_id: attribute.native_attribute_id.toString()
|
76
78
|
}
|
77
79
|
}),
|
78
|
-
variants: productVariations
|
80
|
+
variants: productVariations,
|
81
|
+
has_all_variants: product.channelCode == 'MGT' ? false : true
|
79
82
|
}
|
80
83
|
})
|
81
84
|
|
85
|
+
if (products[0].channelCode == 'MGT') {
|
86
|
+
let newList = []
|
87
|
+
for (let np of newProducts) {
|
88
|
+
if (np.native_product_id == np.variants[0].native_variant_id) {
|
89
|
+
let vars = newProducts
|
90
|
+
.filter(e => e.native_product_id == np.native_product_id)
|
91
|
+
.map(e => {
|
92
|
+
return e.variants[0]
|
93
|
+
})
|
94
|
+
np.variants = vars
|
95
|
+
newList.push(np)
|
96
|
+
}
|
97
|
+
}
|
98
|
+
newProducts = newList
|
99
|
+
}
|
100
|
+
|
82
101
|
return {
|
83
102
|
payload: [...newProducts]
|
84
103
|
}
|
@@ -39,7 +39,8 @@ sellercraftRouter.post('/sellercraft/store/update-product-price', async (context
|
|
39
39
|
accessKey: store.shop.credential.consumer_key,
|
40
40
|
accessSecret: store.shop.credential.consumer_secret,
|
41
41
|
storeURL: store.shop.credential.store_url,
|
42
|
-
platform: PLATFORM[`${store.shop.org_prefix}`]
|
42
|
+
platform: PLATFORM[`${store.shop.org_prefix}`],
|
43
|
+
accessToken: store.shop.credential.access_token
|
43
44
|
}
|
44
45
|
|
45
46
|
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
@@ -47,14 +48,16 @@ sellercraftRouter.post('/sellercraft/store/update-product-price', async (context
|
|
47
48
|
costPrice: requestBody[i].full_price,
|
48
49
|
sellPrice: requestBody[i].sale_price,
|
49
50
|
productId: requestBody[i].native_product_id,
|
50
|
-
variationId: requestBody[i].native_variant_id
|
51
|
+
variationId: requestBody[i].native_variant_id,
|
52
|
+
variationSku: requestBody[i].sku
|
51
53
|
}
|
52
54
|
result = await StoreAPI.updateStoreProductVariationPrice(mappedStore, req)
|
53
55
|
} else {
|
54
56
|
const req = {
|
55
57
|
costPrice: requestBody[i].full_price,
|
56
58
|
sellPrice: requestBody[i].sale_price,
|
57
|
-
productId: requestBody[i].native_product_id
|
59
|
+
productId: requestBody[i].native_product_id,
|
60
|
+
variationSku: requestBody[i].sku
|
58
61
|
}
|
59
62
|
result = await StoreAPI.updateStoreProductPrice(mappedStore, req)
|
60
63
|
}
|
@@ -95,20 +98,25 @@ sellercraftRouter.post('/sellercraft/store/update-product-stock', async (context
|
|
95
98
|
accessKey: store.shop.credential.consumer_key,
|
96
99
|
accessSecret: store.shop.credential.consumer_secret,
|
97
100
|
storeURL: store.shop.credential.store_url,
|
98
|
-
platform: PLATFORM[`${store.shop.org_prefix}`]
|
101
|
+
platform: PLATFORM[`${store.shop.org_prefix}`],
|
102
|
+
accessToken: store.shop.credential.access_token
|
99
103
|
}
|
100
104
|
|
101
105
|
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
102
106
|
const req = {
|
103
107
|
qty: requestBody[i].stock,
|
104
108
|
itemId: requestBody[i].native_product_id,
|
105
|
-
variationId: requestBody[i].native_variant_id
|
109
|
+
variationId: requestBody[i].native_variant_id,
|
110
|
+
distributors: requestBody[i].distributors || [], // for Magento
|
111
|
+
variationSku: requestBody[i].sku
|
106
112
|
}
|
107
113
|
result = await StoreAPI.updateStoreProductVariationStock(mappedStore, req)
|
108
114
|
} else {
|
109
115
|
const req = {
|
110
116
|
qty: requestBody[i].stock,
|
111
|
-
itemId: requestBody[i].native_product_id
|
117
|
+
itemId: requestBody[i].native_product_id,
|
118
|
+
distributors: requestBody[i].distributors || [], // for Magento
|
119
|
+
variationSku: requestBody[i].sku
|
112
120
|
}
|
113
121
|
result = await StoreAPI.updateStoreProductStock(mappedStore, req)
|
114
122
|
}
|
@@ -147,10 +155,17 @@ sellercraftRouter.post('/sellercraft/store/update-order-status', async (context,
|
|
147
155
|
accessKey: store.shop.credential.consumer_key,
|
148
156
|
accessSecret: store.shop.credential.consumer_secret,
|
149
157
|
storeURL: store.shop.credential.store_url,
|
150
|
-
platform: PLATFORM[`${store.shop.org_prefix}`]
|
158
|
+
platform: PLATFORM[`${store.shop.org_prefix}`],
|
159
|
+
accessToken: store.shop.credential.access_token
|
151
160
|
}
|
152
161
|
|
153
|
-
const reqBody = {
|
162
|
+
const reqBody = {
|
163
|
+
orderId: requestBody.native_order_id,
|
164
|
+
status: requestBody.order_status,
|
165
|
+
carrier: requestBody?.shipper_last_mile,
|
166
|
+
trackingNo: requestBody?.tracking_number,
|
167
|
+
orderItems: requestBody?.order_item_ids
|
168
|
+
}
|
154
169
|
|
155
170
|
result = await StoreAPI.updateOrderStatus(mappedStore, reqBody)
|
156
171
|
debug(result)
|
@@ -186,9 +201,10 @@ sellercraftRouter.post('/sellercraft/store/update-product-attribute', async (con
|
|
186
201
|
accessKey: store.shop.credential.consumer_key,
|
187
202
|
accessSecret: store.shop.credential.consumer_secret,
|
188
203
|
storeURL: store.shop.credential.store_url,
|
189
|
-
platform: PLATFORM[`${store.shop.org_prefix}`]
|
204
|
+
platform: PLATFORM[`${store.shop.org_prefix}`],
|
205
|
+
accessToken: store.shop.credential.access_token
|
190
206
|
}
|
191
|
-
|
207
|
+
|
192
208
|
let { product_sku: productSku, native_product_id: itemId, variants } = requestBody
|
193
209
|
|
194
210
|
variants.map(variant => {
|
@@ -50,15 +50,29 @@ export class MarketplaceChannelOrderMutation {
|
|
50
50
|
let organisationId = shops[j].account_id
|
51
51
|
let channelShopId = shops[j].channel_shop_id
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
let orderResult = []
|
54
|
+
let page: number = 1
|
55
|
+
let hasMorePage: boolean = true
|
56
|
+
let lastOrderId: string
|
57
|
+
var limit: number = 100
|
58
|
+
|
59
|
+
while (hasMorePage) {
|
60
|
+
const { results: marketplaceOrders, more } = await StoreAPI.getStoreOrders(store, {
|
61
|
+
fromDate,
|
62
|
+
toDate,
|
63
|
+
pagination: { page, limit },
|
64
|
+
lastOrderId
|
65
|
+
})
|
66
|
+
|
67
|
+
orderResult.push(...marketplaceOrders)
|
68
|
+
|
69
|
+
if (more) page++
|
70
|
+
hasMorePage = more
|
56
71
|
}
|
57
|
-
const orderResult = await StoreAPI.getStoreOrders(store, orderReq)
|
58
72
|
|
59
73
|
var sellercraftStore = { ...store, platform: 'sellercraftChannelIntegration' }
|
60
74
|
|
61
|
-
let mappedOrderResult = orderResult.
|
75
|
+
let mappedOrderResult = orderResult.map(order => {
|
62
76
|
let {
|
63
77
|
firstName: custFirstName,
|
64
78
|
lastName: custLastName,
|
@@ -50,20 +50,39 @@ export class MarketplaceChannelProductMutation {
|
|
50
50
|
|
51
51
|
const productResult = []
|
52
52
|
let totalPages: number = 1
|
53
|
-
|
54
|
-
|
53
|
+
let limit: number = 50
|
54
|
+
let parentLinks = []
|
55
|
+
|
55
56
|
for (let page = 0; page < totalPages; page++) {
|
56
|
-
const { results, total } = await StoreAPI.getStoreProducts(store, {
|
57
|
+
const { results, total, parentLinkList } = await StoreAPI.getStoreProducts(store, {
|
57
58
|
pagination: { page, limit }
|
58
59
|
})
|
59
60
|
totalPages = Math.ceil(total / limit)
|
60
61
|
productResult.push(...results)
|
62
|
+
if (store.platform == 'magento') parentLinks.push(...parentLinkList)
|
61
63
|
}
|
62
64
|
|
63
|
-
const categoryResult =
|
65
|
+
const categoryResult = []
|
66
|
+
let totalPagesCategory: number = 1
|
67
|
+
let limitCategory: number = 100
|
68
|
+
|
69
|
+
for (let page = 0; page < totalPagesCategory; page++) {
|
70
|
+
const { results, total } = await StoreAPI.getStoreProductCategories(store, { pagination: { page, limitCategory } })
|
71
|
+
totalPagesCategory = Math.ceil(total / limitCategory)
|
72
|
+
categoryResult.push(...results)
|
73
|
+
}
|
64
74
|
|
65
75
|
let mappedProducts = productResult.map(item => {
|
66
|
-
let {
|
76
|
+
let {
|
77
|
+
categoryId,
|
78
|
+
itemId: productId,
|
79
|
+
name,
|
80
|
+
brand,
|
81
|
+
isVerified,
|
82
|
+
images,
|
83
|
+
attributes,
|
84
|
+
variations
|
85
|
+
} = item
|
67
86
|
|
68
87
|
variations = variations.map(variation => {
|
69
88
|
let {
|
@@ -96,7 +115,7 @@ export class MarketplaceChannelProductMutation {
|
|
96
115
|
priceDiscounted,
|
97
116
|
inventoryProducts: [
|
98
117
|
{
|
99
|
-
qty:
|
118
|
+
qty: 1,
|
100
119
|
name: `${name} - ${variationSku}`,
|
101
120
|
sku: variationSku,
|
102
121
|
productVersions: [
|
@@ -106,7 +125,7 @@ export class MarketplaceChannelProductMutation {
|
|
106
125
|
packageWidthMM: width,
|
107
126
|
packageHeightMM: height,
|
108
127
|
packageWeightGram: weight,
|
109
|
-
qty:
|
128
|
+
qty: stockReported
|
110
129
|
}
|
111
130
|
]
|
112
131
|
}
|
@@ -126,7 +145,7 @@ export class MarketplaceChannelProductMutation {
|
|
126
145
|
channelCode: channels[i].channelCode,
|
127
146
|
channelCountry: shops[j].country_code,
|
128
147
|
categoryId,
|
129
|
-
productId,
|
148
|
+
productId: parentLinks.find(e => e.children.includes(productId))?.id || productId,
|
130
149
|
name,
|
131
150
|
brand,
|
132
151
|
isVerified,
|
@@ -136,7 +155,7 @@ export class MarketplaceChannelProductMutation {
|
|
136
155
|
}
|
137
156
|
})
|
138
157
|
|
139
|
-
let mappedCategories = categoryResult.
|
158
|
+
let mappedCategories = categoryResult.map(category => {
|
140
159
|
let { id: categoryId, name: categoryName, parent, isActive } = category
|
141
160
|
|
142
161
|
return {
|