@things-factory/integration-sellercraft 4.2.7 → 4.2.8
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 +5 -1
- package/dist-server/constants/order-status-mapping.js.map +1 -1
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.js +5 -2
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.js.map +1 -1
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js +1 -1
- package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js.map +1 -1
- package/dist-server/routers/sellercraft-router.js +24 -16
- package/dist-server/routers/sellercraft-router.js.map +1 -1
- package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js +272 -236
- package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js.map +1 -1
- package/package.json +3 -3
- package/server/constants/order-status-mapping.ts +5 -0
- package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.ts +6 -2
- package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.ts +1 -1
- package/server/routers/sellercraft-router.ts +21 -16
- package/server/service/marketplace-channel/marketplace-channel-order-mutation.ts +324 -285
package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.ts
CHANGED
@@ -38,10 +38,10 @@ export function ingestChannelOrderPackage() {
|
|
38
38
|
name: shipper_last_mile.name
|
39
39
|
}
|
40
40
|
|
41
|
-
|
41
|
+
let newOrderPackage: any = {
|
42
42
|
channel_shop_id,
|
43
43
|
native_order_id,
|
44
|
-
native_package_id,
|
44
|
+
native_package_id: native_package_id.toString(),
|
45
45
|
shipping_tracking_code,
|
46
46
|
shipping_type_value,
|
47
47
|
warehouse_code,
|
@@ -50,6 +50,10 @@ export function ingestChannelOrderPackage() {
|
|
50
50
|
shipper_last_mile,
|
51
51
|
order_item_ids
|
52
52
|
}
|
53
|
+
|
54
|
+
return {
|
55
|
+
payload: { ...newOrderPackage }
|
56
|
+
}
|
53
57
|
},
|
54
58
|
normalize(res) {
|
55
59
|
return res
|
@@ -13,7 +13,7 @@ export function ingestChannelOrder() {
|
|
13
13
|
return {
|
14
14
|
organisation_id: order.organisationId,
|
15
15
|
channel_shop_id: order.channelShopId,
|
16
|
-
native_order_id: order.id,
|
16
|
+
native_order_id: order.id.toString(),
|
17
17
|
ordered_at_date: new Date(order.createdAt).toISOString(),
|
18
18
|
ordered_at_time: new Date(order.createdAt).toISOString(),
|
19
19
|
updated_at_date: new Date(order.updatedAt).toISOString(),
|
@@ -2,6 +2,7 @@ import Router from 'koa-router'
|
|
2
2
|
|
3
3
|
import { config } from '@things-factory/env'
|
4
4
|
import { StoreAPI } from '@things-factory/integration-marketplace'
|
5
|
+
|
5
6
|
import { PLATFORM } from '../constants'
|
6
7
|
|
7
8
|
const debug = require('debug')('things-factory:integration-sellercraft:sellercraft-router')
|
@@ -36,11 +37,12 @@ sellercraftRouter.post('/sellercraft/store/update-product-price', async (context
|
|
36
37
|
}
|
37
38
|
|
38
39
|
let mappedStore: any = {
|
39
|
-
accessKey: store.shop
|
40
|
-
accessSecret: store.shop
|
41
|
-
storeURL: store.shop
|
40
|
+
accessKey: store.shop?.credential?.consumer_key || '',
|
41
|
+
accessSecret: store.shop?.credential?.consumer_secret || '',
|
42
|
+
storeURL: store.shop?.credential?.store_url,
|
42
43
|
platform: PLATFORM[`${store.shop.org_prefix}`],
|
43
|
-
accessToken: store.shop
|
44
|
+
accessToken: store.shop?.credential?.access_token,
|
45
|
+
channelShopId: store.shop?.channel_shop_id
|
44
46
|
}
|
45
47
|
|
46
48
|
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
@@ -95,11 +97,12 @@ sellercraftRouter.post('/sellercraft/store/update-product-stock', async (context
|
|
95
97
|
}
|
96
98
|
|
97
99
|
let mappedStore: any = {
|
98
|
-
accessKey: store.shop
|
99
|
-
accessSecret: store.shop
|
100
|
-
storeURL: store.shop
|
100
|
+
accessKey: store.shop?.credential?.consumer_key || '',
|
101
|
+
accessSecret: store.shop?.credential?.consumer_secret || '',
|
102
|
+
storeURL: store.shop?.credential?.store_url,
|
101
103
|
platform: PLATFORM[`${store.shop.org_prefix}`],
|
102
|
-
accessToken: store.shop
|
104
|
+
accessToken: store.shop?.credential?.access_token,
|
105
|
+
channelShopId: store.shop?.channel_shop_id
|
103
106
|
}
|
104
107
|
|
105
108
|
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
@@ -152,11 +155,12 @@ sellercraftRouter.post('/sellercraft/store/update-order-status', async (context,
|
|
152
155
|
}
|
153
156
|
|
154
157
|
let mappedStore: any = {
|
155
|
-
accessKey: store.shop
|
156
|
-
accessSecret: store.shop
|
157
|
-
storeURL: store.shop
|
158
|
+
accessKey: store.shop?.credential?.consumer_key || '',
|
159
|
+
accessSecret: store.shop?.credential?.consumer_secret || '',
|
160
|
+
storeURL: store.shop?.credential?.store_url,
|
158
161
|
platform: PLATFORM[`${store.shop.org_prefix}`],
|
159
|
-
accessToken: store.shop
|
162
|
+
accessToken: store.shop?.credential?.access_token,
|
163
|
+
channelShopId: store.shop?.channel_shop_id
|
160
164
|
}
|
161
165
|
|
162
166
|
const reqBody = {
|
@@ -198,11 +202,12 @@ sellercraftRouter.post('/sellercraft/store/update-product-attribute', async (con
|
|
198
202
|
}
|
199
203
|
|
200
204
|
let mappedStore: any = {
|
201
|
-
accessKey: store.shop
|
202
|
-
accessSecret: store.shop
|
203
|
-
storeURL: store.shop
|
205
|
+
accessKey: store.shop?.credential?.consumer_key || '',
|
206
|
+
accessSecret: store.shop?.credential?.consumer_secret || '',
|
207
|
+
storeURL: store.shop?.credential?.store_url,
|
204
208
|
platform: PLATFORM[`${store.shop.org_prefix}`],
|
205
|
-
accessToken: store.shop
|
209
|
+
accessToken: store.shop?.credential?.access_token,
|
210
|
+
channelShopId: store.shop?.channel_shop_id
|
206
211
|
}
|
207
212
|
|
208
213
|
let { product_sku: productSku, native_product_id: itemId, variants } = requestBody
|