@things-factory/operato-mms 4.0.38 → 4.0.42
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/client/pages/order/logistics/request-ro-popup.js +1 -1
- package/client/pages/order/order-by-store.js +1 -1
- package/client/pages/reports/sales-by-platform/lazada-sales-report.js +108 -17
- package/client/pages/reports/sales-by-platform/shopee-sales-report.js +66 -8
- package/config.development.js +54 -0
- package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js +134 -61
- package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js.map +1 -1
- package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js +68 -62
- package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js.map +1 -1
- package/dist-server/routers/etrax-router.js +31 -9
- package/dist-server/routers/etrax-router.js.map +1 -1
- package/package.json +61 -61
- package/server/graphql/resolvers/interface-with-hub/add-release-order.ts +148 -64
- package/server/graphql/resolvers/interface-with-hub/auto-add-release-order.ts +70 -63
- package/server/routers/etrax-router.ts +41 -12
- package/translations/en.json +6 -6
- package/translations/ko.json +6 -6
- package/translations/ms.json +6 -6
- package/translations/zh.json +6 -6
|
@@ -173,7 +173,7 @@ class OrderByStore extends localize(i18next)(PageView) {
|
|
|
173
173
|
props: { searchOper: 'eq' }
|
|
174
174
|
},
|
|
175
175
|
{
|
|
176
|
-
label: i18next.t('field.
|
|
176
|
+
label: i18next.t('field.transporter'),
|
|
177
177
|
name: 'shippingProvider',
|
|
178
178
|
type: 'select',
|
|
179
179
|
props: {
|
|
@@ -142,7 +142,7 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
142
142
|
sortable: false,
|
|
143
143
|
imex: { header: i18next.t('field.order_created_date'), key: 'orderCreatedAt', width: 30, type: 'string' },
|
|
144
144
|
width: 200
|
|
145
|
-
}
|
|
145
|
+
},
|
|
146
146
|
{
|
|
147
147
|
type: 'string',
|
|
148
148
|
name: 'fulfillmentCenter',
|
|
@@ -159,12 +159,44 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
159
159
|
imex: { header: i18next.t('field.status'), key: 'status', width: 50, type: 'string' },
|
|
160
160
|
width: 200
|
|
161
161
|
},
|
|
162
|
+
{
|
|
163
|
+
type: 'string',
|
|
164
|
+
name: 'fullAddress',
|
|
165
|
+
header: i18next.t('field.address'),
|
|
166
|
+
sortable: false,
|
|
167
|
+
imex: { header: i18next.t('field.address'), key: 'fullAddress', width: 30, type: 'string' },
|
|
168
|
+
width: 300
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
type: 'string',
|
|
172
|
+
name: 'city',
|
|
173
|
+
header: i18next.t('field.city'),
|
|
174
|
+
sortable: false,
|
|
175
|
+
imex: { header: i18next.t('field.city'), key: 'city', width: 30, type: 'string' },
|
|
176
|
+
width: 200
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
type: 'string',
|
|
180
|
+
name: 'address3',
|
|
181
|
+
header: i18next.t('field.state'),
|
|
182
|
+
sortable: false,
|
|
183
|
+
imex: { header: i18next.t('field.state'), key: 'address3', width: 30, type: 'string' },
|
|
184
|
+
width: 200
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
type: 'string',
|
|
188
|
+
name: 'postcode',
|
|
189
|
+
header: i18next.t('field.postal_code'),
|
|
190
|
+
sortable: false,
|
|
191
|
+
imex: { header: i18next.t('field.postal_code'), key: 'postcode', width: 30, type: 'string' },
|
|
192
|
+
width: 200
|
|
193
|
+
},
|
|
162
194
|
{
|
|
163
195
|
type: 'string',
|
|
164
196
|
name: 'sku',
|
|
165
|
-
header: i18next.t('field.
|
|
197
|
+
header: i18next.t('field.sku'),
|
|
166
198
|
sortable: false,
|
|
167
|
-
imex: { header: i18next.t('field.
|
|
199
|
+
imex: { header: i18next.t('field.sku'), key: 'sku', width: 50, type: 'string' },
|
|
168
200
|
width: 200
|
|
169
201
|
},
|
|
170
202
|
{
|
|
@@ -178,9 +210,9 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
178
210
|
{
|
|
179
211
|
type: 'string',
|
|
180
212
|
name: 'marketplaceOrderItem',
|
|
181
|
-
header: i18next.t('field.
|
|
213
|
+
header: i18next.t('field.variation_name'),
|
|
182
214
|
sortable: false,
|
|
183
|
-
imex: { header: i18next.t('field.
|
|
215
|
+
imex: { header: i18next.t('field.variation_name'), key: 'marketplaceOrderItem', width: 120, type: 'string' },
|
|
184
216
|
width: 400
|
|
185
217
|
},
|
|
186
218
|
{
|
|
@@ -212,7 +244,12 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
212
244
|
name: 'marketplaceBonus',
|
|
213
245
|
header: i18next.t('field.lazada_bonus_lzd_cofund'),
|
|
214
246
|
sortable: false,
|
|
215
|
-
imex: {
|
|
247
|
+
imex: {
|
|
248
|
+
header: i18next.t('field.lazada_bonus_lzd_cofund'),
|
|
249
|
+
key: 'marketplaceBonus',
|
|
250
|
+
width: 30,
|
|
251
|
+
type: 'float'
|
|
252
|
+
},
|
|
216
253
|
width: 200
|
|
217
254
|
},
|
|
218
255
|
{
|
|
@@ -228,7 +265,12 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
228
265
|
name: 'ordersMarketplaceFeesTotal',
|
|
229
266
|
header: i18next.t('field.orders_lazada_fees_total'),
|
|
230
267
|
sortable: false,
|
|
231
|
-
imex: {
|
|
268
|
+
imex: {
|
|
269
|
+
header: i18next.t('field.orders_lazada_fees_total'),
|
|
270
|
+
key: 'ordersMarketplaceFeesTotal',
|
|
271
|
+
width: 30,
|
|
272
|
+
type: 'float'
|
|
273
|
+
},
|
|
232
274
|
width: 200
|
|
233
275
|
},
|
|
234
276
|
{
|
|
@@ -244,7 +286,12 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
244
286
|
name: 'shippingFeePaidByCustomer',
|
|
245
287
|
header: i18next.t('field.shipping_fee_paid_by_customer'),
|
|
246
288
|
sortable: false,
|
|
247
|
-
imex: {
|
|
289
|
+
imex: {
|
|
290
|
+
header: i18next.t('field.shipping_fee_paid_by_customer'),
|
|
291
|
+
key: 'shippingFeePaidByCustomer',
|
|
292
|
+
width: 30,
|
|
293
|
+
type: 'float'
|
|
294
|
+
},
|
|
248
295
|
width: 200
|
|
249
296
|
},
|
|
250
297
|
{
|
|
@@ -252,7 +299,12 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
252
299
|
name: 'shippingFeeDiscountMarketplace',
|
|
253
300
|
header: i18next.t('field.shipping_fee_voucher_by_lazada'),
|
|
254
301
|
sortable: false,
|
|
255
|
-
imex: {
|
|
302
|
+
imex: {
|
|
303
|
+
header: i18next.t('field.shipping_fee_voucher_by_lazada'),
|
|
304
|
+
key: 'shippingFeeDiscountMarketplace',
|
|
305
|
+
width: 30,
|
|
306
|
+
type: 'float'
|
|
307
|
+
},
|
|
256
308
|
width: 200
|
|
257
309
|
},
|
|
258
310
|
{
|
|
@@ -260,7 +312,12 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
260
312
|
name: 'shippingFeeDiscountSeller',
|
|
261
313
|
header: i18next.t('field.shipping_fee_voucher_by_seller'),
|
|
262
314
|
sortable: false,
|
|
263
|
-
imex: {
|
|
315
|
+
imex: {
|
|
316
|
+
header: i18next.t('field.shipping_fee_voucher_by_seller'),
|
|
317
|
+
key: 'shippingFeeDiscountSeller',
|
|
318
|
+
width: 30,
|
|
319
|
+
type: 'float'
|
|
320
|
+
},
|
|
264
321
|
width: 200
|
|
265
322
|
},
|
|
266
323
|
{
|
|
@@ -268,7 +325,12 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
268
325
|
name: 'autoShippingSubsidyMarketplace',
|
|
269
326
|
header: i18next.t('field.auto_shipping_fee_subsidy_by_lazada'),
|
|
270
327
|
sortable: false,
|
|
271
|
-
imex: {
|
|
328
|
+
imex: {
|
|
329
|
+
header: i18next.t('field.auto_shipping_fee_subsidy_by_lazada'),
|
|
330
|
+
key: 'autoShippingSubsidyMarketplace',
|
|
331
|
+
width: 30,
|
|
332
|
+
type: 'float'
|
|
333
|
+
},
|
|
272
334
|
width: 200
|
|
273
335
|
},
|
|
274
336
|
{
|
|
@@ -276,7 +338,12 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
276
338
|
name: 'ordersLogisticsTotal',
|
|
277
339
|
header: i18next.t('field.orders_logistics_total'),
|
|
278
340
|
sortable: false,
|
|
279
|
-
imex: {
|
|
341
|
+
imex: {
|
|
342
|
+
header: i18next.t('field.orders_logistics_total'),
|
|
343
|
+
key: 'ordersLogisticsTotal',
|
|
344
|
+
width: 30,
|
|
345
|
+
type: 'float'
|
|
346
|
+
},
|
|
280
347
|
width: 200
|
|
281
348
|
},
|
|
282
349
|
{
|
|
@@ -284,7 +351,12 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
284
351
|
name: 'promotionalChargesFlexiCombo',
|
|
285
352
|
header: i18next.t('field.promotional_charges_flexi_combo'),
|
|
286
353
|
sortable: false,
|
|
287
|
-
imex: {
|
|
354
|
+
imex: {
|
|
355
|
+
header: i18next.t('field.promotional_charges_flexi_combo'),
|
|
356
|
+
key: 'promotionalChargesFlexiCombo',
|
|
357
|
+
width: 30,
|
|
358
|
+
type: 'float'
|
|
359
|
+
},
|
|
288
360
|
width: 200
|
|
289
361
|
},
|
|
290
362
|
{
|
|
@@ -292,7 +364,12 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
292
364
|
name: 'promotionalCharges',
|
|
293
365
|
header: i18next.t('field.promotional_charges_vouchers'),
|
|
294
366
|
sortable: false,
|
|
295
|
-
imex: {
|
|
367
|
+
imex: {
|
|
368
|
+
header: i18next.t('field.promotional_charges_vouchers'),
|
|
369
|
+
key: 'promotionalCharges',
|
|
370
|
+
width: 30,
|
|
371
|
+
type: 'float'
|
|
372
|
+
},
|
|
296
373
|
width: 200
|
|
297
374
|
},
|
|
298
375
|
{
|
|
@@ -300,7 +377,12 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
300
377
|
name: 'ordersMarketingFeesTotal',
|
|
301
378
|
header: i18next.t('field.orders_marketing_fees_total'),
|
|
302
379
|
sortable: false,
|
|
303
|
-
imex: {
|
|
380
|
+
imex: {
|
|
381
|
+
header: i18next.t('field.orders_marketing_fees_total'),
|
|
382
|
+
key: 'ordersMarketingFeesTotal',
|
|
383
|
+
width: 30,
|
|
384
|
+
type: 'float'
|
|
385
|
+
},
|
|
304
386
|
width: 200
|
|
305
387
|
},
|
|
306
388
|
{
|
|
@@ -387,6 +469,12 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
387
469
|
fulfillmentCenter
|
|
388
470
|
variationId
|
|
389
471
|
variationName
|
|
472
|
+
address1
|
|
473
|
+
address2
|
|
474
|
+
address3
|
|
475
|
+
city
|
|
476
|
+
state
|
|
477
|
+
postcode
|
|
390
478
|
}
|
|
391
479
|
total
|
|
392
480
|
}
|
|
@@ -401,7 +489,7 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
401
489
|
records: response.data.marketplaceSalesReports.items.map(item => {
|
|
402
490
|
return {
|
|
403
491
|
...item,
|
|
404
|
-
marketplaceOrderItem: `${item.
|
|
492
|
+
marketplaceOrderItem: `${item.variationName}`,
|
|
405
493
|
marketplaceStore: `${item.storeName} ${item.storeDescription ? `(${item.storeDescription})` : ''}`,
|
|
406
494
|
paymentFee: this._getRoundedValue(item.paymentFee),
|
|
407
495
|
itemCommissionFee: this._getRoundedValue(item.itemCommissionFee),
|
|
@@ -420,7 +508,10 @@ class LazadaSalesReport extends connect(store)(PageView) {
|
|
|
420
508
|
autoShippingSubsidyMarketplace: this._getRoundedValue(item.autoShippingSubsidyMarketplace),
|
|
421
509
|
grandTotal: this._getRoundedValue(item.grandTotal),
|
|
422
510
|
originalShippingFee: this._getRoundedValue(item.originalShippingFee),
|
|
423
|
-
taxAmount: this._getRoundedValue(item.taxAmount)
|
|
511
|
+
taxAmount: this._getRoundedValue(item.taxAmount),
|
|
512
|
+
city: item?.city ? item.city.toUpperCase() : item.city,
|
|
513
|
+
address3: item?.address3 ? item.address3.toUpperCase() : item.address3,
|
|
514
|
+
fullAddress: `${item.address1.toUpperCase()}${item.address2 ? `, ${item.address2.toUpperCase()}` : ''}`
|
|
424
515
|
}
|
|
425
516
|
})
|
|
426
517
|
}
|
|
@@ -161,12 +161,44 @@ class ShopeeSalesReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
163
|
type: 'datetime',
|
|
164
|
-
name: '
|
|
165
|
-
header: i18next.t('field.
|
|
164
|
+
name: 'payoutDate',
|
|
165
|
+
header: i18next.t('field.payout_date'),
|
|
166
166
|
sortable: false,
|
|
167
|
-
imex: { header: i18next.t('field.
|
|
167
|
+
imex: { header: i18next.t('field.payout_date'), key: 'payoutDate', width: 20, type: 'string' },
|
|
168
168
|
width: 150
|
|
169
169
|
},
|
|
170
|
+
{
|
|
171
|
+
type: 'string',
|
|
172
|
+
name: 'fullAddress',
|
|
173
|
+
header: i18next.t('field.address'),
|
|
174
|
+
sortable: false,
|
|
175
|
+
imex: { header: i18next.t('field.address'), key: 'fullAddress', width: 30, type: 'string' },
|
|
176
|
+
width: 400
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
type: 'string',
|
|
180
|
+
name: 'city',
|
|
181
|
+
header: i18next.t('field.city'),
|
|
182
|
+
sortable: false,
|
|
183
|
+
imex: { header: i18next.t('field.city'), key: 'city', width: 30, type: 'string' },
|
|
184
|
+
width: 200
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
type: 'string',
|
|
188
|
+
name: 'state',
|
|
189
|
+
header: i18next.t('field.state'),
|
|
190
|
+
sortable: false,
|
|
191
|
+
imex: { header: i18next.t('field.state'), key: 'state', width: 30, type: 'string' },
|
|
192
|
+
width: 200
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
type: 'string',
|
|
196
|
+
name: 'postcode',
|
|
197
|
+
header: i18next.t('field.postal_code'),
|
|
198
|
+
sortable: false,
|
|
199
|
+
imex: { header: i18next.t('field.postal_code'), key: 'postcode', width: 30, type: 'string' },
|
|
200
|
+
width: 200
|
|
201
|
+
},
|
|
170
202
|
{
|
|
171
203
|
type: 'string',
|
|
172
204
|
name: 'sku',
|
|
@@ -276,9 +308,9 @@ class ShopeeSalesReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
276
308
|
{
|
|
277
309
|
type: 'string',
|
|
278
310
|
name: 'shippingProvider',
|
|
279
|
-
header: i18next.t('field.
|
|
311
|
+
header: i18next.t('field.transporter'),
|
|
280
312
|
sortable: false,
|
|
281
|
-
imex: { header: i18next.t('field.
|
|
313
|
+
imex: { header: i18next.t('field.transporter'), key: 'shippingProvider', width: 30, type: 'string' },
|
|
282
314
|
width: 200
|
|
283
315
|
},
|
|
284
316
|
{
|
|
@@ -289,6 +321,14 @@ class ShopeeSalesReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
289
321
|
imex: { header: i18next.t('field.shipping_mode'), key: 'shippingMode', width: 30, type: 'string' },
|
|
290
322
|
width: 200
|
|
291
323
|
},
|
|
324
|
+
{
|
|
325
|
+
type: 'string',
|
|
326
|
+
name: 'trackingNo',
|
|
327
|
+
header: i18next.t('field.tracking_no'),
|
|
328
|
+
sortable: false,
|
|
329
|
+
imex: { header: i18next.t('field.tracking_no'), key: 'trackingNo', width: 30, type: 'string' },
|
|
330
|
+
width: 200
|
|
331
|
+
},
|
|
292
332
|
{
|
|
293
333
|
type: 'float',
|
|
294
334
|
name: 'commissionFee',
|
|
@@ -302,7 +342,7 @@ class ShopeeSalesReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
302
342
|
name: 'serviceFee',
|
|
303
343
|
header: i18next.t('field.service_fee'),
|
|
304
344
|
sortable: false,
|
|
305
|
-
imex: { header: i18next.t('field.
|
|
345
|
+
imex: { header: i18next.t('field.service_fee'), key: 'serviceFee', width: 30, type: 'float' },
|
|
306
346
|
width: 200
|
|
307
347
|
},
|
|
308
348
|
{
|
|
@@ -369,7 +409,7 @@ class ShopeeSalesReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
369
409
|
orderNo
|
|
370
410
|
orderCreatedAt
|
|
371
411
|
buyerUsername
|
|
372
|
-
|
|
412
|
+
payoutDate
|
|
373
413
|
totalAmount
|
|
374
414
|
refundAmount
|
|
375
415
|
shippingProvider
|
|
@@ -391,6 +431,13 @@ class ShopeeSalesReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
391
431
|
marketplaceShippingFeeVoucher
|
|
392
432
|
sellerShippingFeeVoucher
|
|
393
433
|
status
|
|
434
|
+
address1
|
|
435
|
+
address2
|
|
436
|
+
address3
|
|
437
|
+
city
|
|
438
|
+
state
|
|
439
|
+
postcode
|
|
440
|
+
trackingNo
|
|
394
441
|
}
|
|
395
442
|
total
|
|
396
443
|
}
|
|
@@ -411,7 +458,18 @@ class ShopeeSalesReport extends connect(store)(localize(i18next)(PageView)) {
|
|
|
411
458
|
originalPrice: this._getRoundedValue(item.originalPrice),
|
|
412
459
|
productDiscount: this._getRoundedValue(item.productDiscount),
|
|
413
460
|
shippingFee: this._getRoundedValue(item.shippingFee),
|
|
414
|
-
actualShippingFee: this._getRoundedValue(item.actualShippingFee)
|
|
461
|
+
actualShippingFee: this._getRoundedValue(item.actualShippingFee),
|
|
462
|
+
shippingRebate: this._getRoundedValue(item.shippingRebate),
|
|
463
|
+
commissionFee: this._getRoundedValue(item.commissionFee),
|
|
464
|
+
serviceFee: this._getRoundedValue(item.serviceFee),
|
|
465
|
+
transactionFee: this._getRoundedValue(item.transactionFee),
|
|
466
|
+
totalRealeasedAmount: this._getRoundedValue(item.totalRealeasedAmount),
|
|
467
|
+
voucherAmount: this._getRoundedValue(item.voucherAmount),
|
|
468
|
+
city: item?.city ? item.city.toUpperCase() : item.city,
|
|
469
|
+
state: item?.state ? item.state.toUpperCase() : item.state,
|
|
470
|
+
fullAddress: `${item.address1.toUpperCase()}${item.address2 ? `, ${item.address2.toUpperCase()}` : ''}${
|
|
471
|
+
item.address3 ? `, ${item.address3.toUpperCase()}` : ''
|
|
472
|
+
}`
|
|
415
473
|
}
|
|
416
474
|
})
|
|
417
475
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
useVirtualHostBasedDomain: false,
|
|
3
|
+
port: 3000,
|
|
4
|
+
uploads: 'uploads',
|
|
5
|
+
attachmentsPath: 'attachments',
|
|
6
|
+
SECRET: '0xD58F835B69D207A76CC5F84a70a1D0d4C89dfC95',
|
|
7
|
+
logger: {
|
|
8
|
+
file: {
|
|
9
|
+
filename: 'logs/application-%DATE%.log',
|
|
10
|
+
datePattern: 'YYYY-MM-DD-HH',
|
|
11
|
+
zippedArchive: true,
|
|
12
|
+
maxSize: '200m',
|
|
13
|
+
maxFiles: '1m',
|
|
14
|
+
level: 'info'
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
email: {
|
|
18
|
+
host: 'smtp.office365.com',
|
|
19
|
+
port: 587,
|
|
20
|
+
secure: false, // true for 465, false for other ports
|
|
21
|
+
auth: {
|
|
22
|
+
user: 'no-reply@hatiolab.com', // generated ethereal user
|
|
23
|
+
pass: 'h@ti0LAB1008' // generated ethereal password
|
|
24
|
+
},
|
|
25
|
+
secureConnection: false,
|
|
26
|
+
tls: {
|
|
27
|
+
ciphers: 'SSLv3'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
notification: {
|
|
31
|
+
fcm: {
|
|
32
|
+
serviceAccount: {
|
|
33
|
+
project_id: 'operato',
|
|
34
|
+
private_key:
|
|
35
|
+
'-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDYNOfyNjPMSeG9\nzU1qs0cpVK5cVfadcUaw5g+hkQZMOMlAA7uqW2eX4vkayj7MzbYUayH+sei8044Q\nJIyl6f26dNX1VT3UgTmSmCS0v48EBEZHCgusrUGFjduLRN6OS6uvrXW1xKA18k9q\nai1C2EHCXF2AE4PTvf239RC1UIOnVePcMtT7rMTdHRO4s8OKVuSDbzIt8k1cV3Zt\nES0YsJlkELqBisYpV//2/ZSILTt39J9JzrVef03X9kkoo9p+YnNyy6tWsfQPfgJO\nybiRGBNxiyJ/E2pxRo/WqU0go9OzYJlGaSUrUx09heNiRD1b0MAOmyPDJz/6AaTk\nkU/A+kLzAgMBAAECggEADQ5s2gtR53VSujk1V/Xe8e0Di99DwaWUj5w6YhcK7/wX\nPdQRN4Fw6RLeLjL7xeG/rCNSwzm6hKSrQJL5zLnWW7XbMdyQRk6jdmnVAEv3zACi\nFH9+eFK3e+Q214XfgWz/v4p/FZdRLCYni5VBNHcwyWxLLS/V1ynzB3KM1sDiTRmI\npcT7+uTtwrKgJq64sXtFE2pYrFxDdCiyqzkhv/2ed4YIowAjpKBbbcCDKeVxVkoz\nC1P4PAzs9EeUuKSWYrWaUjN17lqtRlYeT1ylR1PIJuWqd4cKfgoEgz+lHwRPDCEX\nAYbk3nofiJIPBhSfCHrXS755wK48mY8vMwFdfCPJeQKBgQDsz4tjYTHdat5A25n5\nekwMxZwFQ5OvMV4eulwZUDMypTAYSz1iB6sDlgwKDm5omZIfuneqCEIvrqxV/kx3\n5wV/DANHO3hYxdp/NV7rM23xmqlaKZhHQbDono1Fm/LP6DEmJiD7N2eFKsXYcPpR\nSAIdCv0X3zkDQ4zRi51yJlCXzQKBgQDpufJBxCoXngiQJ2j14lWVAeOOdQ6zh5Ip\nBcDwF0X67cNSN3Wl40bS4yLFdolhEAyj5m0WPuYYXpjzhHhZ0W3V3ItdBkrmwIvy\nWOWu26qN0ZbwxVS2qVpHuj6iHWJKHuDZZUkFtJg3BeeBSOUHSA8TvjnA0xd83xeb\n8ZJasWoFvwKBgQDFs/gQ/gIdcq0exLfluh5nw0qgcmyHpNWJHdjqITS9IX/nqFkU\n0IYLtmdStf2jQiLmbkydHcvz9wZVvLqml67VBHhwLcwpgPULoskd34/4V0Dvzy4c\nv1Esw8H5zVqIDLeLu+VpFjZMzQrjyl6RIWbyTExEc84rVWfpQYAu3qIGOQKBgAFr\nXatEk7TdAtRNSPflTfu/rTAaSeKROjQBkvBiU8x4US1YpOBDBxUUyAtG8wKh5FHC\nfnsaGq+fM3KXJVv2R6J62mXQOfg4xyDLpWlwcBK4aSBBMoiBcsjouqSlZQlqMpdf\nZBgixqHe6U8BsFJg/6ZxC0y+e3AIss4Bo4/lb+1lAoGAFOexvaBh21K6W3inmRW4\nLlkVYJaBJ20OwokXg5aXjBiHxqmk7VLAuFbkpb5LOKH2xPILRQ0OEkn51yVymS3T\n9lLpHOFTQXt5tF2/F7NW7kaQJNlLr/h5jPi3O9XHeFmuaN2z150ZB6zzgjeGKzr8\ni+1fgTsRfDtNw8xkSH9qL1Y=\n-----END PRIVATE KEY-----\n',
|
|
36
|
+
client_email: 'firebase-adminsdk-xmm2e@operato.iam.gserviceaccount.com'
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
appConfig: {
|
|
40
|
+
apiKey: 'AIzaSyDdTM2BTLHSt2LNS0G5QB8G0i4KBXFiG7U',
|
|
41
|
+
projectId: 'operato',
|
|
42
|
+
messagingSenderId: 79537064975,
|
|
43
|
+
appId: '1:79537064975:web:32f53119e9c8c6ee2a277a'
|
|
44
|
+
},
|
|
45
|
+
serverKey:
|
|
46
|
+
'AAAAEoTHTA8:APA91bGwt-4HT82Dfwf_VwbQaKT0_qHd0Y3tuW41udjWz5Lz0Ko0mEMD6WbHHSILvQpa6yuoGGKCMsrU7VW2qWRrUm3CYpyG9oSwshNm1tIhljAnOuUfwHCoawbVLwf9qlWpHt4dwCoc'
|
|
47
|
+
},
|
|
48
|
+
vapidKey: {
|
|
49
|
+
subject: 'mailto:heartyoh@hatiolab.com',
|
|
50
|
+
publicKey: 'BAkVkITsCXBIsYL1yeaBmx5_dn57we-ZXMjirPPHzC2dan82cdEnAio_53PQ-1_w3ykWCBPrrFAWQ_d9N4cFF0o',
|
|
51
|
+
privateKey: '4pmlt3Wk019u7nqU3Q_oGZE6LbUDjjf8DpmAcn9-iss'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -5,6 +5,7 @@ const typeorm_1 = require("typeorm");
|
|
|
5
5
|
const biz_base_1 = require("@things-factory/biz-base");
|
|
6
6
|
const integration_fulfillment_1 = require("@things-factory/integration-fulfillment");
|
|
7
7
|
const marketplace_base_1 = require("@things-factory/marketplace-base");
|
|
8
|
+
const product_base_1 = require("@things-factory/product-base");
|
|
8
9
|
const shell_1 = require("@things-factory/shell");
|
|
9
10
|
exports.addReleaseOrderResolver = {
|
|
10
11
|
async addReleaseOrder(_, { marketplaceOrderIds, warehouseId }, context) {
|
|
@@ -20,75 +21,147 @@ exports.addReleaseOrderResolver = {
|
|
|
20
21
|
relations: [
|
|
21
22
|
'marketplaceOrderItems',
|
|
22
23
|
'marketplaceOrderItems.marketplaceProductVariation',
|
|
23
|
-
'marketplaceOrderItems.marketplaceOrderShipping'
|
|
24
|
+
'marketplaceOrderItems.marketplaceOrderShipping',
|
|
25
|
+
'marketplaceStore'
|
|
24
26
|
]
|
|
25
27
|
});
|
|
26
|
-
|
|
27
|
-
where: { orderNoRef: marketplaceOrder.orderNo, domain }
|
|
28
|
+
let marketplaceOrderShippings = await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrderShipping).find({
|
|
29
|
+
where: { orderNoRef: marketplaceOrder.orderNo, domain },
|
|
30
|
+
order: { subOrderNoRef: 'ASC' },
|
|
31
|
+
relations: ['marketplaceOrderItems']
|
|
28
32
|
});
|
|
29
33
|
for (var j = 0; j < marketplaceOrderShippings.length; j++) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
? marketplaceOrderShipping.ownTrackingNo
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
34
|
+
let marketplaceOrderShipping = marketplaceOrderShippings[j];
|
|
35
|
+
if (!(marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.releaseOrderId)) {
|
|
36
|
+
const date = new Date();
|
|
37
|
+
const releaseDate = `${date.getFullYear()}-${(date.getMonth() + 1)
|
|
38
|
+
.toString()
|
|
39
|
+
.padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}`;
|
|
40
|
+
const newReleaseOrder = {
|
|
41
|
+
releaseDate,
|
|
42
|
+
type: 'b2c',
|
|
43
|
+
transporter: marketplaceOrder.shippingProvider,
|
|
44
|
+
trackingNo: (marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.ownTrackingNo)
|
|
45
|
+
? marketplaceOrderShipping.ownTrackingNo
|
|
46
|
+
: marketplaceOrderShipping.trackingNo,
|
|
47
|
+
packingOption: true,
|
|
48
|
+
exportOption: false,
|
|
49
|
+
ownTransport: true,
|
|
50
|
+
courierOption: true,
|
|
51
|
+
collectionOrderNo: marketplaceOrder.orderNo,
|
|
52
|
+
refNo: marketplaceOrder.orderNo,
|
|
53
|
+
refNo2: marketplaceOrderShippings.length > 1 ? marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.subOrderNoRef : marketplaceOrder.orderNo,
|
|
54
|
+
deliverTo: {
|
|
55
|
+
deliveryAddress1: marketplaceOrderShipping.address1,
|
|
56
|
+
deliveryAddress2: marketplaceOrderShipping.address2,
|
|
57
|
+
deliveryAddress3: marketplaceOrderShipping.address3,
|
|
58
|
+
deliveryAddress4: marketplaceOrderShipping.address4,
|
|
59
|
+
deliveryAddress5: marketplaceOrderShipping.address5,
|
|
60
|
+
attentionTo: marketplaceOrderShipping.attentionTo,
|
|
61
|
+
city: marketplaceOrderShipping.city,
|
|
62
|
+
postalCode: marketplaceOrderShipping.postCode,
|
|
63
|
+
country: marketplaceOrderShipping.country,
|
|
64
|
+
state: marketplaceOrderShipping.state,
|
|
65
|
+
phone1: marketplaceOrderShipping.phone1,
|
|
66
|
+
phone2: (marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.phone2) ? marketplaceOrderShipping.phone2 : null
|
|
67
|
+
},
|
|
68
|
+
marketplaceOrderStatus: marketplaceOrder.status,
|
|
69
|
+
airwayBill: (marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.airwayBill) ? marketplaceOrderShipping.airwayBill : null,
|
|
70
|
+
invoice: (marketplaceOrderShipping === null || marketplaceOrderShipping === void 0 ? void 0 : marketplaceOrderShipping.invoice) ? marketplaceOrderShipping.invoice : null,
|
|
71
|
+
orderInventories: marketplaceOrder.marketplaceOrderItems
|
|
72
|
+
.filter(item => {
|
|
73
|
+
if (item.marketplaceOrderShipping.id === marketplaceOrderShipping.id) {
|
|
74
|
+
return item;
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
.map((orderItem) => {
|
|
78
|
+
const { marketplaceProductVariation: productVariation } = orderItem;
|
|
79
|
+
return {
|
|
80
|
+
product: {
|
|
81
|
+
sku: productVariation.sku
|
|
82
|
+
},
|
|
83
|
+
releaseQty: orderItem.qty
|
|
84
|
+
};
|
|
85
|
+
})
|
|
86
|
+
};
|
|
87
|
+
var releaseOrder = await integration_fulfillment_1.FulfillmentAPI.createOutboundOrder(fulfilmentCenter, {
|
|
88
|
+
customerBizplaceId,
|
|
89
|
+
releaseOrder: newReleaseOrder
|
|
90
|
+
});
|
|
91
|
+
var invoiceProducts = await Promise.all(newReleaseOrder.orderInventories.map(async (oi) => {
|
|
92
|
+
let product = await (0, typeorm_1.getRepository)(product_base_1.Product).findOne({
|
|
93
|
+
where: { domain, sku: oi.product.sku }
|
|
94
|
+
});
|
|
95
|
+
if (!product) {
|
|
96
|
+
product = await (0, typeorm_1.getRepository)(product_base_1.ProductBundle).findOne({
|
|
97
|
+
where: { domain, sku: oi.product.sku }
|
|
98
|
+
});
|
|
72
99
|
}
|
|
73
|
-
|
|
74
|
-
.map((orderItem) => {
|
|
75
|
-
const { marketplaceProductVariation: productVariation } = orderItem;
|
|
100
|
+
let moi = marketplaceOrder.marketplaceOrderItems.find(moi => moi.marketplaceProductVariation.sku === product.sku);
|
|
76
101
|
return {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
102
|
+
sku: product.sku,
|
|
103
|
+
name: product.name,
|
|
104
|
+
description: product.description,
|
|
105
|
+
product: { sku: product.sku },
|
|
106
|
+
qty: oi.releaseQty,
|
|
107
|
+
unitPrice: moi.originalPrice / moi.qty,
|
|
108
|
+
paidPrice: moi.paidPrice / moi.qty
|
|
81
109
|
};
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
110
|
+
}));
|
|
111
|
+
let newInvoice = {
|
|
112
|
+
invoiceProducts,
|
|
113
|
+
releaseGood: { id: releaseOrder.id, name: releaseOrder.name },
|
|
114
|
+
refNo1: newReleaseOrder.refNo.toString(),
|
|
115
|
+
refNo2: newReleaseOrder.refNo2.toString(),
|
|
116
|
+
issuedOn: new Date(),
|
|
117
|
+
from: marketplaceOrder.marketplaceStore.storeName,
|
|
118
|
+
fromContactPhone: '-',
|
|
119
|
+
fromAddress1: '-',
|
|
120
|
+
fromAddress2: null,
|
|
121
|
+
fromAddress3: null,
|
|
122
|
+
fromAddress4: null,
|
|
123
|
+
fromAddress5: null,
|
|
124
|
+
fromPostcode: null,
|
|
125
|
+
fromCity: null,
|
|
126
|
+
fromState: null,
|
|
127
|
+
fromCountry: null,
|
|
128
|
+
deliverTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
129
|
+
deliverToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
130
|
+
deliveryAddress1: newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
131
|
+
deliveryAddress2: newReleaseOrder.deliverTo.deliveryAddress2,
|
|
132
|
+
deliveryAddress3: newReleaseOrder.deliverTo.deliveryAddress3,
|
|
133
|
+
deliveryAddress4: newReleaseOrder.deliverTo.deliveryAddress4,
|
|
134
|
+
deliveryAddress5: newReleaseOrder.deliverTo.deliveryAddress5,
|
|
135
|
+
deliveryPostcode: newReleaseOrder.deliverTo.postalCode || '-',
|
|
136
|
+
deliveryCity: newReleaseOrder.deliverTo.city || '-',
|
|
137
|
+
deliveryState: newReleaseOrder.deliverTo.state || '-',
|
|
138
|
+
deliveryCountry: newReleaseOrder.deliverTo.country || '-',
|
|
139
|
+
billTo: newReleaseOrder.deliverTo.attentionTo || '-',
|
|
140
|
+
billToPhone: newReleaseOrder.deliverTo.phone1 || '-',
|
|
141
|
+
billingAddress1: releaseOrder.billingAddress || newReleaseOrder.deliverTo.deliveryAddress1 || '-',
|
|
142
|
+
billingAddress2: null,
|
|
143
|
+
billingAddress3: null,
|
|
144
|
+
billingAddress4: null,
|
|
145
|
+
billingAddress5: null,
|
|
146
|
+
billingPostcode: '-',
|
|
147
|
+
billingCity: '-',
|
|
148
|
+
billingState: '-',
|
|
149
|
+
billingCountry: '-'
|
|
150
|
+
};
|
|
151
|
+
var invoice = await integration_fulfillment_1.FulfillmentAPI.createSalesInvoice(fulfilmentCenter, {
|
|
152
|
+
customerBizplaceId,
|
|
153
|
+
invoice: newInvoice
|
|
154
|
+
});
|
|
155
|
+
marketplaceOrderShipping.releaseOrderId = releaseOrder.id;
|
|
156
|
+
marketplaceOrderShipping.fulfillmentCenter = fulfilmentCenter;
|
|
157
|
+
await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrderShipping).save(marketplaceOrderShipping);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (releaseOrder && (releaseOrder === null || releaseOrder === void 0 ? void 0 : releaseOrder.id)) {
|
|
161
|
+
marketplaceOrder.releaseOrderId = releaseOrder.id;
|
|
162
|
+
marketplaceOrder.fulfillmentCenter = fulfilmentCenter;
|
|
163
|
+
await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrder).save(marketplaceOrder);
|
|
88
164
|
}
|
|
89
|
-
marketplaceOrder.releaseOrderId = releaseOrder.id;
|
|
90
|
-
marketplaceOrder.fulfillmentCenter = fulfilmentCenter;
|
|
91
|
-
await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrder).save(marketplaceOrder);
|
|
92
165
|
}
|
|
93
166
|
}
|
|
94
167
|
};
|