@things-factory/integration-sellercraft 4.2.7 → 4.2.10
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 +10 -3
- 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 +136 -88
- package/dist-server/routers/sellercraft-router.js.map +1 -1
- package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js +273 -237
- 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 +19 -1
- 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/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 +10 -3
- 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 +131 -91
- package/server/service/marketplace-channel/marketplace-channel-order-mutation.ts +325 -286
- package/server/service/marketplace-channel/marketplace-channel-product-mutation.ts +20 -1
- package/server/service/marketplace-channel/marketplace-channel.ts +4 -0
@@ -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,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B,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;YAED,OAAO,IAAI,CAAA;SACZ;IACH,CAAC;CACF,CAAA;AAtMC;IADC,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC;IACY,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;0FAqM7C;AAvMU,iCAAiC;IAD7C,IAAA,uBAAQ,GAAE;GACE,iCAAiC,CAwM7C;AAxMY,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,IAAI,EAAE,CAAC;8BACd,IAAI;qDAAA;AAIhB;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACd,IAAI;qDAAA;AAIhB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDAChB,gBAAI,oBAAJ,gBAAI;mDAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,kBAAsC,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC;;qDACjE;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDAChB,gBAAI,oBAAJ,gBAAI;mDAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,kBAAsC,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC;;qDACjE;AAhDP,kBAAkB;IAH9B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,2BAA2B,EAAE,CAAC,kBAAsC,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACtJ,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;GACjD,kBAAkB,CAiD9B;AAjDY,gDAAkB"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/integration-sellercraft",
|
3
|
-
"version": "4.2.
|
3
|
+
"version": "4.2.10",
|
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.10",
|
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": "b1d15d7774552b3f576bfeaf1c685ea67238c379"
|
55
55
|
}
|
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,14 +13,20 @@ 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(),
|
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
|
}
|
@@ -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,36 +37,45 @@ 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
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
48
|
+
try {
|
49
|
+
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
50
|
+
const req = {
|
51
|
+
costPrice: requestBody[i].full_price,
|
52
|
+
sellPrice: requestBody[i].sale_price,
|
53
|
+
productId: requestBody[i].native_product_id,
|
54
|
+
variationId: requestBody[i].native_variant_id,
|
55
|
+
variationSku: requestBody[i].sku
|
56
|
+
}
|
57
|
+
result = await StoreAPI.updateStoreProductVariationPrice(mappedStore, req)
|
58
|
+
} else {
|
59
|
+
const req = {
|
60
|
+
costPrice: requestBody[i].full_price,
|
61
|
+
sellPrice: requestBody[i].sale_price,
|
62
|
+
productId: requestBody[i].native_product_id,
|
63
|
+
variationSku: requestBody[i].sku
|
64
|
+
}
|
65
|
+
result = await StoreAPI.updateStoreProductPrice(mappedStore, req)
|
61
66
|
}
|
62
|
-
result = await StoreAPI.updateStoreProductPrice(mappedStore, req)
|
63
|
-
}
|
64
67
|
|
65
|
-
|
66
|
-
}
|
68
|
+
debug(result)
|
67
69
|
|
68
|
-
|
70
|
+
context.type = 'application/json'
|
71
|
+
context.status = 200
|
72
|
+
context.body = 'Succeeded'
|
73
|
+
} catch (e) {
|
74
|
+
context.type = 'application/json'
|
75
|
+
context.status = 500
|
76
|
+
context.body = e.message
|
77
|
+
}
|
78
|
+
}
|
69
79
|
})
|
70
80
|
|
71
81
|
sellercraftRouter.post('/sellercraft/store/update-product-stock', async (context, next) => {
|
@@ -95,82 +105,104 @@ sellercraftRouter.post('/sellercraft/store/update-product-stock', async (context
|
|
95
105
|
}
|
96
106
|
|
97
107
|
let mappedStore: any = {
|
98
|
-
accessKey: store.shop
|
99
|
-
accessSecret: store.shop
|
100
|
-
storeURL: store.shop
|
108
|
+
accessKey: store.shop?.credential?.consumer_key || '',
|
109
|
+
accessSecret: store.shop?.credential?.consumer_secret || '',
|
110
|
+
storeURL: store.shop?.credential?.store_url,
|
101
111
|
platform: PLATFORM[`${store.shop.org_prefix}`],
|
102
|
-
accessToken: store.shop
|
112
|
+
accessToken: store.shop?.credential?.access_token,
|
113
|
+
channelShopId: store.shop?.channel_shop_id
|
103
114
|
}
|
104
115
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
116
|
+
try {
|
117
|
+
if (requestBody[i].native_variant_id != requestBody[i].native_product_id) {
|
118
|
+
const req = {
|
119
|
+
qty: requestBody[i].stock,
|
120
|
+
itemId: requestBody[i].native_product_id,
|
121
|
+
variationId: requestBody[i].native_variant_id,
|
122
|
+
distributors: requestBody[i].distributors || [], // for Magento
|
123
|
+
variationSku: requestBody[i].sku
|
124
|
+
}
|
125
|
+
result = await StoreAPI.updateStoreProductVariationStock(mappedStore, req)
|
126
|
+
} else {
|
127
|
+
const req = {
|
128
|
+
qty: requestBody[i].stock,
|
129
|
+
itemId: requestBody[i].native_product_id,
|
130
|
+
distributors: requestBody[i].distributors || [], // for Magento
|
131
|
+
variationSku: requestBody[i].sku
|
132
|
+
}
|
133
|
+
result = await StoreAPI.updateStoreProductStock(mappedStore, req)
|
120
134
|
}
|
121
|
-
result = await StoreAPI.updateStoreProductStock(mappedStore, req)
|
122
|
-
}
|
123
135
|
|
124
|
-
|
136
|
+
debug(result)
|
137
|
+
|
138
|
+
context.type = 'application/json'
|
139
|
+
context.status = 200
|
140
|
+
context.body = 'Succeeded'
|
141
|
+
} catch (e) {
|
142
|
+
context.type = 'application/json'
|
143
|
+
context.status = 500
|
144
|
+
context.body = e.message
|
145
|
+
}
|
125
146
|
}
|
126
|
-
context.status = 200
|
127
147
|
})
|
128
148
|
|
129
149
|
sellercraftRouter.post('/sellercraft/store/update-order-status', async (context, next) => {
|
130
|
-
|
131
|
-
|
150
|
+
try {
|
151
|
+
const sellercraftChannelIntegrationConfig = config.get('sellercraftChannelIntegrationConfig', {})
|
152
|
+
const { tokenCraftApiKey: apiKey, tokenCraftUrl } = sellercraftChannelIntegrationConfig
|
132
153
|
|
133
|
-
|
154
|
+
const xApiKey = context.headers['x-api-key']
|
134
155
|
|
135
|
-
|
156
|
+
if (apiKey !== xApiKey) context.throw(400, 'api key validation failed')
|
136
157
|
|
137
|
-
|
138
|
-
|
139
|
-
|
158
|
+
const requestBody = context.request.body
|
159
|
+
var result
|
160
|
+
var store: any = {}
|
140
161
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
162
|
+
// https://staging-tokencraft.sellercraft.co/v1/get-shop?channel_id=4bfb3362-d57c-47f8-8781-007316d179bf&shop_id=dd9cf3b7-114f-4d74-a7e2-7b524ae086f2
|
163
|
+
var fullPath = `${tokenCraftUrl}?channel_id=${requestBody.channel_id}&shop_id=${requestBody.shop_id}`
|
164
|
+
const response: any = await fetch(fullPath, {
|
165
|
+
method: 'get',
|
166
|
+
headers: {
|
167
|
+
'Content-Type': 'application/json',
|
168
|
+
'x-api-key': apiKey
|
169
|
+
}
|
170
|
+
})
|
171
|
+
if (response.ok) {
|
172
|
+
store = await response.json()
|
148
173
|
}
|
149
|
-
})
|
150
|
-
if (response.ok) {
|
151
|
-
store = await response.json()
|
152
|
-
}
|
153
174
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
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
|
-
}
|
175
|
+
let mappedStore: any = {
|
176
|
+
accessKey: store.shop?.credential?.consumer_key || '',
|
177
|
+
accessSecret: store.shop?.credential?.consumer_secret || '',
|
178
|
+
storeURL: store.shop?.credential?.store_url,
|
179
|
+
platform: PLATFORM[`${store.shop.org_prefix}`],
|
180
|
+
accessToken: store.shop?.credential?.access_token,
|
181
|
+
channelShopId: store.shop?.channel_shop_id
|
182
|
+
}
|
169
183
|
|
170
|
-
|
171
|
-
|
184
|
+
const reqBody = {
|
185
|
+
orderId: requestBody.native_order_id,
|
186
|
+
status: requestBody.order_status,
|
187
|
+
carrier: requestBody?.shipper_last_mile,
|
188
|
+
trackingNo: requestBody?.tracking_number,
|
189
|
+
orderItems: requestBody?.order_item_ids,
|
190
|
+
isSOF: requestBody?.seller_logistics
|
191
|
+
}
|
172
192
|
|
173
|
-
|
193
|
+
try {
|
194
|
+
result = await StoreAPI.updateOrderStatus(mappedStore, reqBody)
|
195
|
+
debug(result)
|
196
|
+
|
197
|
+
context.type = 'application/json'
|
198
|
+
context.status = 200
|
199
|
+
context.body = 'Succeeded'
|
200
|
+
} catch (e) {
|
201
|
+
context.type = 'application/json'
|
202
|
+
context.status = 500
|
203
|
+
context.body = e.message
|
204
|
+
}
|
205
|
+
} catch (e) {}
|
174
206
|
})
|
175
207
|
|
176
208
|
sellercraftRouter.post('/sellercraft/store/update-product-attribute', async (context, next) => {
|
@@ -198,11 +230,12 @@ sellercraftRouter.post('/sellercraft/store/update-product-attribute', async (con
|
|
198
230
|
}
|
199
231
|
|
200
232
|
let mappedStore: any = {
|
201
|
-
accessKey: store.shop
|
202
|
-
accessSecret: store.shop
|
203
|
-
storeURL: store.shop
|
233
|
+
accessKey: store.shop?.credential?.consumer_key || '',
|
234
|
+
accessSecret: store.shop?.credential?.consumer_secret || '',
|
235
|
+
storeURL: store.shop?.credential?.store_url,
|
204
236
|
platform: PLATFORM[`${store.shop.org_prefix}`],
|
205
|
-
accessToken: store.shop
|
237
|
+
accessToken: store.shop?.credential?.access_token,
|
238
|
+
channelShopId: store.shop?.channel_shop_id
|
206
239
|
}
|
207
240
|
|
208
241
|
let { product_sku: productSku, native_product_id: itemId, variants } = requestBody
|
@@ -228,9 +261,16 @@ sellercraftRouter.post('/sellercraft/store/update-product-attribute', async (con
|
|
228
261
|
})
|
229
262
|
|
230
263
|
for (var i = 0; i < variants.length; i++) {
|
231
|
-
|
232
|
-
|
264
|
+
try {
|
265
|
+
let variant = variants[i]
|
266
|
+
await StoreAPI.updateProductAttribute(mappedStore, { productSku, itemId, variant })
|
267
|
+
context.type = 'application/json'
|
268
|
+
context.status = 200
|
269
|
+
context.body = 'Succeeded'
|
270
|
+
} catch (e) {
|
271
|
+
context.type = 'application/json'
|
272
|
+
context.status = 500
|
273
|
+
context.body = e.message
|
274
|
+
}
|
233
275
|
}
|
234
|
-
|
235
|
-
context.status = 200
|
236
276
|
})
|