@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.
Files changed (28) hide show
  1. package/dist-server/constants/order-status-mapping.js +5 -1
  2. package/dist-server/constants/order-status-mapping.js.map +1 -1
  3. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.js +5 -2
  4. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.js.map +1 -1
  5. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js +10 -3
  6. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.js.map +1 -1
  7. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js +0 -15
  8. package/dist-server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.js.map +1 -1
  9. package/dist-server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.js +1 -1
  10. package/dist-server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.js.map +1 -1
  11. package/dist-server/routers/sellercraft-router.js +136 -88
  12. package/dist-server/routers/sellercraft-router.js.map +1 -1
  13. package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js +273 -237
  14. package/dist-server/service/marketplace-channel/marketplace-channel-order-mutation.js.map +1 -1
  15. package/dist-server/service/marketplace-channel/marketplace-channel-product-mutation.js +19 -1
  16. package/dist-server/service/marketplace-channel/marketplace-channel-product-mutation.js.map +1 -1
  17. package/dist-server/service/marketplace-channel/marketplace-channel.js +5 -0
  18. package/dist-server/service/marketplace-channel/marketplace-channel.js.map +1 -1
  19. package/package.json +3 -3
  20. package/server/constants/order-status-mapping.ts +5 -0
  21. package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-order-package.ts +6 -2
  22. package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-order.ts +10 -3
  23. package/server/controllers/sellercraft-channel-integration/apis/ingest-channel-product.ts +0 -16
  24. package/server/controllers/sellercraft-channel-integration/sellercraft-channel-integration.ts +1 -1
  25. package/server/routers/sellercraft-router.ts +131 -91
  26. package/server/service/marketplace-channel/marketplace-channel-order-mutation.ts +325 -286
  27. package/server/service/marketplace-channel/marketplace-channel-product-mutation.ts +20 -1
  28. package/server/service/marketplace-channel/marketplace-channel.ts +4 -0
@@ -17,6 +17,7 @@ const type_graphql_1 = require("type-graphql");
17
17
  const typeorm_1 = require("typeorm");
18
18
  const env_1 = require("@things-factory/env");
19
19
  const integration_marketplace_1 = require("@things-factory/integration-marketplace");
20
+ const constants_1 = require("../../constants");
20
21
  const sellercraft_channel_integration_api_1 = require("../../controllers/sellercraft-channel-integration-api");
21
22
  const marketplace_channel_1 = require("./marketplace-channel");
22
23
  let MarketplaceChannelOrderMutation = class MarketplaceChannelOrderMutation {
@@ -24,10 +25,11 @@ let MarketplaceChannelOrderMutation = class MarketplaceChannelOrderMutation {
24
25
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
25
26
  const sellercraftChannelIntegrationConfig = env_1.config.get('sellercraftChannelIntegrationConfig', {});
26
27
  const { tokenCraftApiKey: apiKey, getShopsTokenCraftUrl } = sellercraftChannelIntegrationConfig;
27
- 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 } });
28
29
  for (var i = 0; i < channels.length; i++) {
29
30
  try {
30
- var channelsFullPath = getShopsTokenCraftUrl + '?channel_id=' + channels[i].channelId;
31
+ const channel = channels[i];
32
+ var channelsFullPath = getShopsTokenCraftUrl + '?channel_id=' + channel.channelId;
31
33
  const channelResponse = await fetch(channelsFullPath, {
32
34
  method: 'get',
33
35
  headers: {
@@ -41,249 +43,283 @@ let MarketplaceChannelOrderMutation = class MarketplaceChannelOrderMutation {
41
43
  var shopsResponse = await channelResponse.json();
42
44
  var shops = shopsResponse.shops;
43
45
  for (var j = 0; j < shops.length; j++) {
44
- var store = {
45
- accessKey: ((_b = (_a = shops[j]) === null || _a === void 0 ? void 0 : _a.credential) === null || _b === void 0 ? void 0 : _b.consumer_key) || '',
46
- accessSecret: ((_d = (_c = shops[j]) === null || _c === void 0 ? void 0 : _c.credential) === null || _d === void 0 ? void 0 : _d.consumer_secret) || '',
47
- storeURL: ((_f = (_e = shops[j]) === null || _e === void 0 ? void 0 : _e.credential) === null || _f === void 0 ? void 0 : _f.store_url) || '',
48
- platform: channels[i].name,
49
- accessToken: (_h = (_g = shops[j]) === null || _g === void 0 ? void 0 : _g.credential) === null || _h === void 0 ? void 0 : _h.access_token,
50
- channelShopId: (_j = shops[j]) === null || _j === void 0 ? void 0 : _j.channel_shop_id
51
- };
52
- // let countryCode = shops[j].country_code
53
- // let channelCode = shops[j].org_prefix
54
- let organisationId = shops[j].account_id;
55
- let channelShopId = shops[j].channel_shop_id;
56
- let orderResult = [];
57
- let page = 1;
58
- let hasMorePage = true;
59
- let lastOrderId;
60
- let nextCursor;
61
- var limit = 50;
62
- while (hasMorePage) {
63
- const { results: marketplaceOrders, more, nextCursor } = await integration_marketplace_1.StoreAPI.getStoreOrders(store, {
64
- fromDate,
65
- toDate,
66
- pagination: { page, limit },
67
- lastOrderId,
68
- nextCursor: lastOrderId
69
- });
70
- orderResult.push(...marketplaceOrders);
71
- if (more)
72
- page++;
73
- hasMorePage = more;
74
- lastOrderId = nextCursor;
75
- }
76
- var sellercraftStore = Object.assign(Object.assign({}, store), { platform: 'sellercraftChannelIntegration' });
77
- let mappedOrderResult = orderResult.map(order => {
78
- let { firstName: custFirstName, lastName: custLastName, orderCreatedAt: createdAt, orderUpdatedAt: updatedAt, orderNo: id, status } = order;
79
- 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;
80
- 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;
81
- let orderItems = order.orderItems.map(item => {
82
- let { name: id, variationId: variationId, slaExpiresAt, total, totalTax, subtotal, subtotalTax, qty } = item;
46
+ try {
47
+ var store = {
48
+ accessKey: ((_b = (_a = shops[j]) === null || _a === void 0 ? void 0 : _a.credential) === null || _b === void 0 ? void 0 : _b.consumer_key) || '',
49
+ accessSecret: ((_d = (_c = shops[j]) === null || _c === void 0 ? void 0 : _c.credential) === null || _d === void 0 ? void 0 : _d.consumer_secret) || '',
50
+ storeURL: ((_f = (_e = shops[j]) === null || _e === void 0 ? void 0 : _e.credential) === null || _f === void 0 ? void 0 : _f.store_url) || '',
51
+ platform: channel.name,
52
+ accessToken: (_h = (_g = shops[j]) === null || _g === void 0 ? void 0 : _g.credential) === null || _h === void 0 ? void 0 : _h.access_token,
53
+ channelShopId: (_j = shops[j]) === null || _j === void 0 ? void 0 : _j.channel_shop_id
54
+ };
55
+ // let countryCode = shops[j].country_code
56
+ // let channelCode = shops[j].org_prefix
57
+ let organisationId = shops[j].account_id;
58
+ let channelShopId = shops[j].channel_shop_id;
59
+ let orderResult = [];
60
+ let page = 1;
61
+ let hasMorePage = true;
62
+ let lastOrderId;
63
+ let cursor;
64
+ var limit = 50;
65
+ while (hasMorePage) {
66
+ const { results: marketplaceOrders, more, nextCursor } = await integration_marketplace_1.StoreAPI.getStoreOrders(store, {
67
+ fromDate,
68
+ toDate,
69
+ pagination: { page, limit },
70
+ lastOrderId,
71
+ nextCursor: cursor
72
+ });
73
+ orderResult.push(...marketplaceOrders);
74
+ if (more)
75
+ page++;
76
+ hasMorePage = more;
77
+ cursor = nextCursor;
78
+ }
79
+ var sellercraftStore = Object.assign(Object.assign({}, store), { platform: 'sellercraftChannelIntegration' });
80
+ let mappedOrderResult = orderResult.map(order => {
81
+ let id = store.platform == 'magento' ? order.name : order.orderNo;
82
+ let { firstName: custFirstName, lastName: custLastName, orderCreatedAt: createdAt, orderUpdatedAt: updatedAt, status, isSOF } = order;
83
+ 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;
84
+ 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;
85
+ let orderPackage = (order === null || order === void 0 ? void 0 : order.orderPackage) || {};
86
+ let orderItems = order.orderItems.map(item => {
87
+ let { name: id, variationId: variationId, slaExpiresAt, total, totalTax, subtotal, subtotalTax, qty } = item;
88
+ return {
89
+ id,
90
+ variationId,
91
+ currency: order.orderShipping.collectionCurrency,
92
+ createdAt: order.orderCreatedAt,
93
+ updatedAt: order.orderUpdatedAt,
94
+ charges: [
95
+ {
96
+ name: 'CHARGES_MARKETING',
97
+ grossAmount: 0,
98
+ nettAmount: 0
99
+ },
100
+ {
101
+ name: 'CLAIMS_DAMAGE',
102
+ grossAmount: 0,
103
+ nettAmount: 0
104
+ },
105
+ {
106
+ name: 'CLAIMS_LOST',
107
+ grossAmount: 0,
108
+ nettAmount: 0
109
+ },
110
+ {
111
+ name: 'COMMISSION_PLATFORM',
112
+ grossAmount: 0,
113
+ nettAmount: 0
114
+ },
115
+ {
116
+ name: 'DEPOSIT_PRESALE',
117
+ grossAmount: 0,
118
+ nettAmount: 0
119
+ },
120
+ {
121
+ name: 'FEE_MISCELLANEOUS',
122
+ grossAmount: 0,
123
+ nettAmount: 0
124
+ },
125
+ {
126
+ name: 'FEE_TRANSACTION',
127
+ grossAmount: 0,
128
+ nettAmount: 0
129
+ },
130
+ {
131
+ name: 'PRICE_NORMAL_SELLING',
132
+ grossAmount: total,
133
+ nettAmount: subtotal
134
+ },
135
+ {
136
+ name: 'PRICE_RECOMMENDED_RETAIL',
137
+ grossAmount: 0,
138
+ nettAmount: 0
139
+ },
140
+ {
141
+ name: 'PROMOTIONS_CUSTOMER_RECEIVED',
142
+ grossAmount: 0,
143
+ nettAmount: 0
144
+ },
145
+ {
146
+ name: 'PROMOTIONS_REBATE_PLATFORM',
147
+ grossAmount: 0,
148
+ nettAmount: 0
149
+ },
150
+ {
151
+ name: 'PROMOTIONS_REBATE_SELLER',
152
+ grossAmount: 0,
153
+ nettAmount: 0
154
+ },
155
+ {
156
+ name: 'REVERSAL_CHARGES_MARKETING',
157
+ grossAmount: 0,
158
+ nettAmount: 0
159
+ },
160
+ {
161
+ name: 'REVERSAL_COMMISSION',
162
+ grossAmount: 0,
163
+ nettAmount: 0
164
+ },
165
+ {
166
+ name: 'REVERSAL_FEE_MISCELLANEOUS',
167
+ grossAmount: 0,
168
+ nettAmount: 0
169
+ },
170
+ {
171
+ name: 'REVERSAL_PROMOTIONS_CUSTOMER_RECEIVED',
172
+ grossAmount: 0,
173
+ nettAmount: 0
174
+ },
175
+ {
176
+ name: 'REVERSAL_SELLER_RETURN_REFUND_AMOUNT',
177
+ grossAmount: 0,
178
+ nettAmount: 0
179
+ },
180
+ {
181
+ name: 'REVERSAL_SHIPPING_CUSTOMER_PAID',
182
+ grossAmount: 0,
183
+ nettAmount: 0
184
+ },
185
+ {
186
+ name: 'REVERSAL_SHIPPING_REBATE_PLATFORM',
187
+ grossAmount: 0,
188
+ nettAmount: 0
189
+ },
190
+ {
191
+ name: 'REVERSAL_SHIPPING_SELLER_PAID',
192
+ grossAmount: 0,
193
+ nettAmount: 0
194
+ },
195
+ {
196
+ name: 'SHIPPING_COST_TOTAL',
197
+ grossAmount: 0,
198
+ nettAmount: 0
199
+ },
200
+ {
201
+ name: 'SHIPPING_CUSTOMER_PAID',
202
+ grossAmount: 0,
203
+ nettAmount: 0
204
+ },
205
+ {
206
+ name: 'SHIPPING_REBATE_PLATFORM',
207
+ grossAmount: 0,
208
+ nettAmount: 0
209
+ },
210
+ {
211
+ name: 'SHIPPING_SELLER_PAID',
212
+ grossAmount: 0,
213
+ nettAmount: 0
214
+ },
215
+ {
216
+ name: 'TAXES',
217
+ grossAmount: totalTax,
218
+ nettAmount: subtotalTax
219
+ },
220
+ {
221
+ name: 'VOUCHERS_CUSTOMER_RECEIVED',
222
+ grossAmount: 0,
223
+ nettAmount: 0
224
+ },
225
+ {
226
+ name: 'VOUCHERS_REBATE_PLATFORM',
227
+ grossAmount: 0,
228
+ nettAmount: 0
229
+ },
230
+ {
231
+ name: 'VOUCHERS_REBATE_SELLER',
232
+ grossAmount: 0,
233
+ nettAmount: 0
234
+ }
235
+ ],
236
+ slaExpiresAt,
237
+ qty
238
+ };
239
+ });
240
+ let mappedOrderItems = [];
241
+ orderItems.map(oi => {
242
+ for (let i = 0; i < oi.qty; i++) {
243
+ mappedOrderItems.push(Object.assign(Object.assign({}, oi), { id: `${oi.id}-${i + 1}` }));
244
+ }
245
+ });
83
246
  return {
247
+ custFirstName,
248
+ custLastName,
249
+ createdAt,
250
+ updatedAt,
84
251
  id,
85
- variationId,
86
- currency: order.orderShipping.collectionCurrency,
87
- createdAt: order.orderCreatedAt,
88
- updatedAt: order.orderUpdatedAt,
89
- charges: [
90
- {
91
- name: 'CHARGES_MARKETING',
92
- grossAmount: 0,
93
- nettAmount: 0
94
- },
95
- {
96
- name: 'CLAIMS_DAMAGE',
97
- grossAmount: 0,
98
- nettAmount: 0
99
- },
100
- {
101
- name: 'CLAIMS_LOST',
102
- grossAmount: 0,
103
- nettAmount: 0
104
- },
105
- {
106
- name: 'COMMISSION_PLATFORM',
107
- grossAmount: 0,
108
- nettAmount: 0
109
- },
110
- {
111
- name: 'DEPOSIT_PRESALE',
112
- grossAmount: 0,
113
- nettAmount: 0
114
- },
115
- {
116
- name: 'FEE_MISCELLANEOUS',
117
- grossAmount: 0,
118
- nettAmount: 0
119
- },
120
- {
121
- name: 'FEE_TRANSACTION',
122
- grossAmount: 0,
123
- nettAmount: 0
124
- },
125
- {
126
- name: 'PRICE_NORMAL_SELLING',
127
- grossAmount: total,
128
- nettAmount: subtotal
129
- },
130
- {
131
- name: 'PRICE_RECOMMENDED_RETAIL',
132
- grossAmount: 0,
133
- nettAmount: 0
134
- },
135
- {
136
- name: 'PROMOTIONS_CUSTOMER_RECEIVED',
137
- grossAmount: 0,
138
- nettAmount: 0
139
- },
140
- {
141
- name: 'PROMOTIONS_REBATE_PLATFORM',
142
- grossAmount: 0,
143
- nettAmount: 0
144
- },
145
- {
146
- name: 'PROMOTIONS_REBATE_SELLER',
147
- grossAmount: 0,
148
- nettAmount: 0
149
- },
150
- {
151
- name: 'REVERSAL_CHARGES_MARKETING',
152
- grossAmount: 0,
153
- nettAmount: 0
154
- },
155
- {
156
- name: 'REVERSAL_COMMISSION',
157
- grossAmount: 0,
158
- nettAmount: 0
159
- },
160
- {
161
- name: 'REVERSAL_FEE_MISCELLANEOUS',
162
- grossAmount: 0,
163
- nettAmount: 0
164
- },
165
- {
166
- name: 'REVERSAL_PROMOTIONS_CUSTOMER_RECEIVED',
167
- grossAmount: 0,
168
- nettAmount: 0
169
- },
170
- {
171
- name: 'REVERSAL_SELLER_RETURN_REFUND_AMOUNT',
172
- grossAmount: 0,
173
- nettAmount: 0
174
- },
175
- {
176
- name: 'REVERSAL_SHIPPING_CUSTOMER_PAID',
177
- grossAmount: 0,
178
- nettAmount: 0
179
- },
180
- {
181
- name: 'REVERSAL_SHIPPING_REBATE_PLATFORM',
182
- grossAmount: 0,
183
- nettAmount: 0
184
- },
185
- {
186
- name: 'REVERSAL_SHIPPING_SELLER_PAID',
187
- grossAmount: 0,
188
- nettAmount: 0
189
- },
190
- {
191
- name: 'SHIPPING_COST_TOTAL',
192
- grossAmount: 0,
193
- nettAmount: 0
194
- },
195
- {
196
- name: 'SHIPPING_CUSTOMER_PAID',
197
- grossAmount: 0,
198
- nettAmount: 0
199
- },
200
- {
201
- name: 'SHIPPING_REBATE_PLATFORM',
202
- grossAmount: 0,
203
- nettAmount: 0
204
- },
205
- {
206
- name: 'SHIPPING_SELLER_PAID',
207
- grossAmount: 0,
208
- nettAmount: 0
209
- },
210
- {
211
- name: 'TAXES',
212
- grossAmount: totalTax,
213
- nettAmount: subtotalTax
214
- },
215
- {
216
- name: 'VOUCHERS_CUSTOMER_RECEIVED',
217
- grossAmount: 0,
218
- nettAmount: 0
219
- },
220
- {
221
- name: 'VOUCHERS_REBATE_PLATFORM',
222
- grossAmount: 0,
223
- nettAmount: 0
224
- },
225
- {
226
- name: 'VOUCHERS_REBATE_SELLER',
227
- grossAmount: 0,
228
- nettAmount: 0
229
- }
230
- ],
231
- slaExpiresAt,
232
- qty
252
+ billFirstName,
253
+ billLastName,
254
+ billAddress1: billAddress1.toString() || shipAddress1.toString(),
255
+ billAddress2: billAddress2 || shipAddress2,
256
+ billAddress3: billAddress3 || shipAddress3,
257
+ billAddress4: billAddress4 || shipAddress4,
258
+ billAddress5: billAddress5 || shipAddress5,
259
+ billCity: billCity || shipCity,
260
+ billPostalCode: billPostalCode || shipPostalCode,
261
+ billCountry: billCountry || shipCountry,
262
+ billPhone1: billPhone1 || shipPhone1,
263
+ billPhone2: billPhone2 || shipPhone2,
264
+ shipFirstName,
265
+ shipLastName,
266
+ shipAddress1: shipAddress1.toString(),
267
+ shipAddress2,
268
+ shipAddress3,
269
+ shipAddress4,
270
+ shipAddress5,
271
+ shipCity,
272
+ shipPostalCode,
273
+ shipCountry,
274
+ shipPhone1,
275
+ shipPhone2,
276
+ mappedOrderItems,
277
+ channelShopId,
278
+ organisationId,
279
+ status,
280
+ isSOF: isSOF ? isSOF : false,
281
+ orderPackage,
282
+ charges: getOrderCharges(mappedOrderItems)
233
283
  };
234
284
  });
235
- let mappedOrderItems = [];
236
- orderItems.map(oi => {
237
- for (let i = 0; i < oi.qty; i++) {
238
- mappedOrderItems.push(Object.assign(Object.assign({}, oi), { id: `${oi.id}-${i + 1}` }));
239
- }
240
- });
241
- return {
242
- custFirstName,
243
- custLastName,
244
- createdAt,
245
- updatedAt,
246
- id,
247
- billFirstName,
248
- billLastName,
249
- billAddress1: billAddress1.toString() || shipAddress1.toString(),
250
- billAddress2: billAddress2 || shipAddress2,
251
- billAddress3: billAddress3 || shipAddress3,
252
- billAddress4: billAddress4 || shipAddress4,
253
- billAddress5: billAddress5 || shipAddress5,
254
- billCity: billCity || shipCity,
255
- billPostalCode: billPostalCode || shipPostalCode,
256
- billCountry: billCountry || shipCountry,
257
- billPhone1: billPhone1 || shipPhone1,
258
- billPhone2: billPhone2 || shipPhone2,
259
- shipFirstName,
260
- shipLastName,
261
- shipAddress1: shipAddress1.toString(),
262
- shipAddress2,
263
- shipAddress3,
264
- shipAddress4,
265
- shipAddress5,
266
- shipCity,
267
- shipPostalCode,
268
- shipCountry,
269
- shipPhone1,
270
- shipPhone2,
271
- mappedOrderItems,
272
- channelShopId,
273
- organisationId,
274
- status,
275
- charges: getOrderCharges(mappedOrderItems)
276
- };
277
- });
278
- if (mappedOrderResult.length > 0) {
279
- await sellercraft_channel_integration_api_1.SellercraftChannelIntegrationAPI.ingestChannelOrder(sellercraftStore, { orders: mappedOrderResult });
285
+ if (mappedOrderResult.length > 0) {
286
+ await sellercraft_channel_integration_api_1.SellercraftChannelIntegrationAPI.ingestChannelOrder(sellercraftStore, { orders: mappedOrderResult });
287
+ await Promise.all(mappedOrderResult.map(async (result) => {
288
+ var _a;
289
+ 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)) {
290
+ let orderPackage = result.orderPackage;
291
+ let newOrderPackage = {
292
+ channelShopId,
293
+ nativeOrderId: result.id,
294
+ nativePackageId: orderPackage.packageId,
295
+ shippingTrackingCode: orderPackage.trackingNumber,
296
+ shippingTypeValue: (orderPackage === null || orderPackage === void 0 ? void 0 : orderPackage.shippingType)
297
+ ? orderPackage.shippingType
298
+ : constants_1.SHIPPING_TYPE.DROP_SHIPPING,
299
+ warehouseCode: constants_1.SHIPPING_TYPE.DROP_SHIPPING,
300
+ shipper: {
301
+ name: orderPackage.shippingProvider,
302
+ isCodSupported: (orderPackage === null || orderPackage === void 0 ? void 0 : orderPackage.isCodSupport) ? orderPackage.isCodSupport : false
303
+ },
304
+ documents: (orderPackage === null || orderPackage === void 0 ? void 0 : orderPackage.orderDocument) || [],
305
+ shipperLastMile: {
306
+ name: orderPackage.shippingProvider,
307
+ isCodSupported: (orderPackage === null || orderPackage === void 0 ? void 0 : orderPackage.isCodSupport) ? orderPackage.isCodSupport : false
308
+ },
309
+ orderItemIds: (orderPackage === null || orderPackage === void 0 ? void 0 : orderPackage.orderListIdList)
310
+ ? orderPackage.orderListIdList
311
+ : result.mappedOrderItems.map(orderItem => orderItem.id)
312
+ };
313
+ await sellercraft_channel_integration_api_1.SellercraftChannelIntegrationAPI.ingestChannelOrderPackage(sellercraftStore, newOrderPackage);
314
+ }
315
+ }));
316
+ }
280
317
  }
318
+ catch (e) { }
281
319
  }
282
320
  return true;
283
321
  }
284
- catch (e) {
285
- debugger;
286
- }
322
+ catch (e) { }
287
323
  }
288
324
  }
289
325
  };
@@ -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,+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,EA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AU,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"}
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,gBAAg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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"}
@@ -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, {
@@ -144,6 +144,24 @@ let MarketplaceChannelProductMutation = class MarketplaceChannelProductMutation
144
144
  childrenCategories: []
145
145
  };
146
146
  });
147
+ if (store.platform == 'magento') {
148
+ let newList = [];
149
+ for (let np of mappedProducts) {
150
+ if (np.productId == np.variations[0].variationId) {
151
+ let vars = mappedProducts
152
+ .filter(e => e.productId == np.productId)
153
+ .map(e => {
154
+ return e.variations[0];
155
+ });
156
+ np.variations = vars;
157
+ if (np.variations.length > 1) {
158
+ np.variations = np.variations.filter(v => v.variationId != np.productId);
159
+ }
160
+ newList.push(np);
161
+ }
162
+ }
163
+ mappedProducts = newList;
164
+ }
147
165
  try {
148
166
  mappedCategories = mappedCategories.map(category => {
149
167
  if (mappedCategories.filter(e => e.parent == category.categoryId).length > 0) {