@things-factory/operato-hub 4.2.12 → 4.3.0

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 (44) hide show
  1. package/client/pages/constants/setting.js +1 -0
  2. package/dist-server/controllers/bizplace-initializer/dataset/codes.js +9 -0
  3. package/dist-server/controllers/bizplace-initializer/dataset/codes.js.map +1 -1
  4. package/dist-server/controllers/bizplace-initializer/dataset/settings.js +10 -0
  5. package/dist-server/controllers/bizplace-initializer/dataset/settings.js.map +1 -1
  6. package/dist-server/routers/api/restful-apis/unstable/add-draft-release-order.js +171 -0
  7. package/dist-server/routers/api/restful-apis/unstable/add-draft-release-order.js.map +1 -0
  8. package/dist-server/routers/api/restful-apis/unstable/add-marketplace-order.js +85 -75
  9. package/dist-server/routers/api/restful-apis/unstable/add-marketplace-order.js.map +1 -1
  10. package/dist-server/routers/api/restful-apis/unstable/add-release-order.js +147 -35
  11. package/dist-server/routers/api/restful-apis/unstable/add-release-order.js.map +1 -1
  12. package/dist-server/routers/api/restful-apis/unstable/index.js +1 -0
  13. package/dist-server/routers/api/restful-apis/unstable/index.js.map +1 -1
  14. package/dist-server/routers/api/restful-apis/v1/add-draft-release-order.js +171 -0
  15. package/dist-server/routers/api/restful-apis/v1/add-draft-release-order.js.map +1 -0
  16. package/dist-server/routers/api/restful-apis/v1/add-marketplace-order.js +85 -75
  17. package/dist-server/routers/api/restful-apis/v1/add-marketplace-order.js.map +1 -1
  18. package/dist-server/routers/api/restful-apis/v1/add-release-order.js +146 -34
  19. package/dist-server/routers/api/restful-apis/v1/add-release-order.js.map +1 -1
  20. package/dist-server/routers/api/restful-apis/v1/index.js +1 -0
  21. package/dist-server/routers/api/restful-apis/v1/index.js.map +1 -1
  22. package/dist-server/routers/api/restful-apis/v2/add-draft-release-order.js +171 -0
  23. package/dist-server/routers/api/restful-apis/v2/add-draft-release-order.js.map +1 -0
  24. package/dist-server/routers/api/restful-apis/v2/add-marketplace-order.js +85 -75
  25. package/dist-server/routers/api/restful-apis/v2/add-marketplace-order.js.map +1 -1
  26. package/dist-server/routers/api/restful-apis/v2/add-release-order.js +149 -34
  27. package/dist-server/routers/api/restful-apis/v2/add-release-order.js.map +1 -1
  28. package/dist-server/routers/api/restful-apis/v2/index.js +1 -0
  29. package/dist-server/routers/api/restful-apis/v2/index.js.map +1 -1
  30. package/package.json +44 -44
  31. package/server/controllers/bizplace-initializer/dataset/codes.ts +9 -0
  32. package/server/controllers/bizplace-initializer/dataset/settings.ts +10 -0
  33. package/server/routers/api/restful-apis/unstable/add-draft-release-order.ts +196 -0
  34. package/server/routers/api/restful-apis/unstable/add-marketplace-order.ts +97 -85
  35. package/server/routers/api/restful-apis/unstable/add-release-order.ts +211 -28
  36. package/server/routers/api/restful-apis/unstable/index.ts +1 -0
  37. package/server/routers/api/restful-apis/v1/add-draft-release-order.ts +196 -0
  38. package/server/routers/api/restful-apis/v1/add-marketplace-order.ts +97 -85
  39. package/server/routers/api/restful-apis/v1/add-release-order.ts +209 -26
  40. package/server/routers/api/restful-apis/v1/index.ts +1 -0
  41. package/server/routers/api/restful-apis/v2/add-draft-release-order.ts +196 -0
  42. package/server/routers/api/restful-apis/v2/add-marketplace-order.ts +97 -85
  43. package/server/routers/api/restful-apis/v2/add-release-order.ts +212 -26
  44. package/server/routers/api/restful-apis/v2/index.ts +1 -0
@@ -0,0 +1,196 @@
1
+ import gql from 'graphql-tag'
2
+ import { EntityManager, getConnection } from 'typeorm'
3
+
4
+ import { restfulApiRouter as router } from '@things-factory/api'
5
+ import { Bizplace } from '@things-factory/biz-base'
6
+ import { OrderInventory } from '@things-factory/sales-base'
7
+
8
+ import { businessMiddleware } from '../../../../middlewares/business-middleware'
9
+ import { warehouseMiddleware } from '../../../../middlewares/warehouse-middleware'
10
+
11
+ const debug = require('debug')('things-factory:operato-hub:restful-api:unstable:add-draft-release-order')
12
+
13
+ router.post(
14
+ '/v2/warehouse/:warehouseId/add-draft-release-order',
15
+ businessMiddleware,
16
+ warehouseMiddleware,
17
+ async (context, next) => {
18
+ return await getConnection().transaction(async (tx: EntityManager) => {
19
+ const { client, domain } = context.state
20
+ const { warehouseId: customerBizplaceId } = context.params
21
+ const { t } = context
22
+
23
+ if (!customerBizplaceId) context.throw(404, t('error.warehouse id not found'))
24
+
25
+ let bodyReq = context.request.body
26
+ if (typeof bodyReq === undefined || !Object.keys(bodyReq)?.length) {
27
+ context.throw(400, t('error.invalid body request format'))
28
+ }
29
+ debug('post:/add-draft-release-order request.body', bodyReq)
30
+ await checkMandatoryKey(context, bodyReq)
31
+
32
+ // get customer company's bizplace
33
+ const customerBizplace: Bizplace = await tx.getRepository(Bizplace).findOne({
34
+ where: { id: customerBizplaceId }
35
+ })
36
+
37
+ const orderInventories: OrderInventory[] = bodyReq.orderInventories
38
+
39
+ context.body = {
40
+ result: (
41
+ await client.mutate({
42
+ mutation: gql`
43
+ mutation upsertDraftReleaseGood(
44
+ $draftReleaseGood: DraftReleaseGoodPatch!
45
+ $orderProducts: [OrderProductPatch!]!
46
+ $files: [Upload!]
47
+ ) {
48
+ upsertDraftReleaseGood(
49
+ draftReleaseGood: $draftReleaseGood
50
+ orderProducts: $orderProducts
51
+ files: $files
52
+ ) {
53
+ id
54
+ name
55
+ refNo
56
+ refNo2
57
+ refNo3
58
+ status
59
+ truckNo
60
+ ownTransport
61
+ marketplaceOrderStatus
62
+ billingAddress
63
+ deliveryAddress1
64
+ deliveryAddress2
65
+ deliveryAddress3
66
+ deliveryAddress4
67
+ deliveryAddress5
68
+ attentionTo
69
+ attentionCompany
70
+ city
71
+ state
72
+ postalCode
73
+ country
74
+ phone1
75
+ phone2
76
+ email
77
+ type
78
+ exportOption
79
+ releaseDate
80
+ collectionOrderNo
81
+ bizplace {
82
+ name
83
+ }
84
+ orderProducts {
85
+ product {
86
+ sku
87
+ name
88
+ description
89
+ }
90
+ packingType
91
+ packingSize
92
+ releaseQty
93
+ }
94
+ }
95
+ }
96
+ `,
97
+ variables: {
98
+ draftReleaseGood: {
99
+ bizplace: {
100
+ id: customerBizplace.id
101
+ },
102
+ courierOption: bodyReq.courierOption,
103
+ collectionOrderNo: bodyReq.collectionOrderNo,
104
+ exportOption: bodyReq.exportOption,
105
+ ownTransport: bodyReq.ownTransport,
106
+ packingOption: bodyReq.packingOption,
107
+ refNo: bodyReq.refNo,
108
+ refNo2: bodyReq?.refNo2,
109
+ refNo3: bodyReq?.refNo3,
110
+ releaseDate: bodyReq.releaseDate,
111
+ type: bodyReq.type,
112
+ marketplaceOrderStatus: bodyReq?.marketplaceOrderStatus,
113
+ remark: bodyReq?.remark || null,
114
+ billingAddress: bodyReq?.billTo?.billingAddress || null,
115
+ deliveryAddress1: bodyReq?.deliverTo?.deliveryAddress1 || null,
116
+ deliveryAddress2: bodyReq?.deliverTo?.deliveryAddress2 || null,
117
+ deliveryAddress3: bodyReq?.deliverTo?.deliveryAddress3 || null,
118
+ deliveryAddress4: bodyReq?.deliverTo?.deliveryAddress4 || null,
119
+ deliveryAddress5: bodyReq?.deliverTo?.deliveryAddress5 || null,
120
+ attentionTo: bodyReq?.deliverTo?.attentionTo || null,
121
+ attentionCompany: bodyReq?.deliverTo?.attentionCompany || null,
122
+ city: bodyReq?.deliverTo?.city || null,
123
+ state: bodyReq?.deliverTo?.state || null,
124
+ postalCode: bodyReq?.deliverTo?.postalCode || null,
125
+ country: bodyReq?.deliverTo?.country || null,
126
+ phone1: bodyReq?.deliverTo?.phone1 || null,
127
+ phone2: bodyReq?.deliverTo?.phone2 || null,
128
+ email: bodyReq?.deliverTo?.email || null
129
+ },
130
+ orderProducts: orderInventories,
131
+ files: []
132
+ },
133
+ context: {
134
+ ...context,
135
+ hasUpload: true,
136
+ state: {
137
+ ...context.state,
138
+ customerBizplace,
139
+ domain,
140
+ type: 'api'
141
+ }
142
+ }
143
+ } as any)
144
+ ).data
145
+ }
146
+ })
147
+ }
148
+ )
149
+
150
+ export async function checkMandatoryKey(context, params) {
151
+ let noparams = ['releaseDate', 'exportOption'].filter(param => !(param in params))
152
+
153
+ if ('ownTransport' in params) {
154
+ if (params.ownTransport == true) {
155
+ if (!params.hasOwnProperty('collectionOrderNo')) {
156
+ noparams.push('collectionOrderNo')
157
+ }
158
+ }
159
+ } else {
160
+ noparams.push('ownTransport')
161
+ }
162
+
163
+ if ('exportOption' in params) {
164
+ if (params.exportOption === true) {
165
+ if (
166
+ params.exportOption.filter(
167
+ record =>
168
+ !record.containerNo || !record.containerArrivalDate || !record.containerLeavingDate || !record.shipName
169
+ ).length
170
+ ) {
171
+ noparams.push('exportOption')
172
+ }
173
+ }
174
+ }
175
+
176
+ if ('orderInventories' in params) {
177
+ params.orderInventories.forEach((param, key) => {
178
+ let noSubParams = []
179
+
180
+ if (!param?.releaseQty) noSubParams.push('releaseQty')
181
+
182
+ if (!param?.product) noSubParams.push('product')
183
+
184
+ if (noSubParams?.length)
185
+ context.throw(400, context.t('error.required param x not found', { x: `${noSubParams.join(', ')}` }))
186
+ })
187
+ } else {
188
+ noparams.push('orderInventories')
189
+ }
190
+
191
+ if (noparams?.length) {
192
+ context.throw(400, context.t('error.required param x not found', { x: `${noparams.join(', ')}` }))
193
+ }
194
+
195
+ return params
196
+ }
@@ -5,6 +5,8 @@
5
5
  import gql from 'graphql-tag'
6
6
 
7
7
  import { restfulApiRouter as router } from '@things-factory/api'
8
+ import { EntityManager, getConnection } from 'typeorm'
9
+ import { MarketplaceOrder } from '@things-factory/marketplace-base'
8
10
 
9
11
  import { businessMiddleware } from '../../../../middlewares/business-middleware'
10
12
  import { storeMiddleware } from '../../../../middlewares/store-middleware'
@@ -16,99 +18,109 @@ router.post(
16
18
  businessMiddleware,
17
19
  storeMiddleware,
18
20
  async (context, next) => {
19
- const { client, marketplaceStore, domain } = context.state
20
- const { t } = context
21
- const bodyReq = context.request.body
22
-
23
- if (typeof bodyReq === undefined || !Object.keys(bodyReq)?.length) {
24
- context.throw(400, t('error.invalid body request format'))
25
- }
26
-
27
- await checkMandatoryKey(context, bodyReq)
28
- debug('post:/add-marketplace-order body request', bodyReq)
29
-
30
- context.body = {
31
- result: (
32
- await client.mutate({
33
- mutation: gql`
34
- mutation generateMarketplaceOrder($marketplaceOrder: NewMarketplaceOrder!) {
35
- generateMarketplaceOrder(marketplaceOrder: $marketplaceOrder) {
36
- id
37
- orderNo
38
- currency
39
- itemCount
40
- totalAmount
41
- paymentMethod
42
- remark
43
- giftOption
44
- orderCreatedAt
45
- orderUpdatedAt
46
- marketplaceStore {
47
- storeId
48
- }
49
- marketplaceOrderItems {
21
+ return await getConnection().transaction(async (tx: EntityManager) => {
22
+ const { client, marketplaceStore, domain } = context.state
23
+ const { t } = context
24
+ const bodyReq = context.request.body
25
+
26
+ if (typeof bodyReq === undefined || !Object.keys(bodyReq)?.length) {
27
+ context.throw(400, t('error.invalid body request format'))
28
+ }
29
+
30
+ await checkMandatoryKey(context, bodyReq)
31
+ debug('post:/add-marketplace-order body request', bodyReq)
32
+
33
+ let existingMarketplaceOrder: MarketplaceOrder = await tx.getRepository(MarketplaceOrder).findOne({
34
+ where: { name: bodyReq.name, domain, marketplaceStore }
35
+ })
36
+
37
+ if (existingMarketplaceOrder) {
38
+ context.throw(400, `error.duplicate entry for order ${bodyReq.name}`)
39
+ }
40
+
41
+ context.body = {
42
+ result: (
43
+ await client.mutate({
44
+ mutation: gql`
45
+ mutation generateMarketplaceOrder($marketplaceOrder: NewMarketplaceOrder!) {
46
+ generateMarketplaceOrder(marketplaceOrder: $marketplaceOrder) {
50
47
  id
51
- name
52
- qty
53
- cancelBy
54
- returnStatus
55
- paidPrice
56
- packageId
57
- invoiceNo
58
- status
59
- marketplaceOrderShippingItems {
60
- marketplaceOrderShipping {
61
- attentionTo
62
- address1
63
- address2
64
- address3
65
- address4
66
- address5
67
- state
68
- city
69
- postCode
70
- country
71
- phone1
72
- phone2
73
- email
74
- orderType
75
- freightType
76
- parcelType
77
- goodsType
78
- deliveryMethod
79
- totalWeight
80
- totalVolume
81
- transporter
82
- }
48
+ orderNo
49
+ currency
50
+ itemCount
51
+ totalAmount
52
+ paymentMethod
53
+ remark
54
+ giftOption
55
+ orderCreatedAt
56
+ orderUpdatedAt
57
+ marketplaceStore {
58
+ storeId
83
59
  }
84
- marketplaceProductVariation {
60
+ marketplaceOrderItems {
85
61
  id
86
- sku
87
- variationId
88
- variationSku
89
- channelSku
90
62
  name
91
- costPrice
92
- sellPrice
93
- marketplaceStatus
63
+ qty
64
+ cancelBy
65
+ returnStatus
66
+ paidPrice
67
+ packageId
68
+ invoiceNo
69
+ status
70
+ marketplaceOrderShippingItems {
71
+ marketplaceOrderShipping {
72
+ attentionTo
73
+ address1
74
+ address2
75
+ address3
76
+ address4
77
+ address5
78
+ state
79
+ city
80
+ postCode
81
+ country
82
+ phone1
83
+ phone2
84
+ email
85
+ orderType
86
+ freightType
87
+ parcelType
88
+ goodsType
89
+ deliveryMethod
90
+ totalWeight
91
+ totalVolume
92
+ transporter
93
+ }
94
+ }
95
+ marketplaceProductVariation {
96
+ id
97
+ sku
98
+ variationId
99
+ variationSku
100
+ channelSku
101
+ name
102
+ costPrice
103
+ sellPrice
104
+ marketplaceStatus
105
+ }
94
106
  }
95
107
  }
96
108
  }
109
+ `,
110
+ variables: { marketplaceOrder: bodyReq },
111
+ context: {
112
+ ...context,
113
+ state: {
114
+ ...context.state,
115
+ marketplaceStore,
116
+ domain,
117
+ type: 'api'
118
+ }
97
119
  }
98
- `,
99
- variables: { marketplaceOrder: bodyReq },
100
- context: {
101
- ...context,
102
- state: {
103
- ...context.state,
104
- marketplaceStore,
105
- domain,
106
- type: 'api'
107
- }
108
- }
109
- } as any)
110
- ).data
111
- }
120
+ } as any)
121
+ ).data
122
+ }
123
+ })
112
124
  }
113
125
  )
114
126
 
@@ -257,17 +257,37 @@ router.post(
257
257
 
258
258
  if (!response.errors) {
259
259
  const items = response.data.inventoriesByPallet.items || []
260
- if (!items?.length)
261
- context.throw(
262
- 404,
263
- t(
264
- `error.no inventories found for ${orderInventory.product?.sku} with batch ID ${orderInventory?.batchId}`
260
+ if (!items?.length) {
261
+ context.body = {
262
+ result: await createDraftOrder(
263
+ client,
264
+ customerBizplace,
265
+ bodyReq,
266
+ bundleInfo,
267
+ domain,
268
+ context,
269
+ orderInventories,
270
+ tx
265
271
  )
266
- )
272
+ }
273
+ return
274
+ }
267
275
 
268
- items.forEach(item => {
276
+ items.forEach(async item => {
269
277
  if (orderInventory.releaseQty > item.remainQty || orderInventory.releaseQty <= 0) {
270
- context.throw(404, t(`error.invalid release qty for ${orderInventory.product?.sku}`))
278
+ context.body = {
279
+ result: await createDraftOrder(
280
+ client,
281
+ customerBizplace,
282
+ bodyReq,
283
+ bundleInfo,
284
+ domain,
285
+ context,
286
+ orderInventories,
287
+ tx
288
+ )
289
+ }
290
+ return
271
291
  }
272
292
 
273
293
  // 3. add more information to orderInventory
@@ -280,7 +300,21 @@ router.post(
280
300
  })
281
301
 
282
302
  return orderInventory
283
- } else context.throw(404, t('error.failed to fetch inventory'))
303
+ } else {
304
+ context.body = {
305
+ result: await createDraftOrder(
306
+ client,
307
+ customerBizplace,
308
+ bodyReq,
309
+ bundleInfo,
310
+ domain,
311
+ context,
312
+ orderInventories,
313
+ tx
314
+ )
315
+ }
316
+ return
317
+ }
284
318
  })
285
319
  )
286
320
  } else {
@@ -365,8 +399,21 @@ router.post(
365
399
  }
366
400
 
367
401
  let inventories: Inventory[] = await qb.getMany()
368
- if (!inventories?.length) context.throw(404, t(`error.no inventories found for ${product.sku}`))
369
-
402
+ if (!inventories?.length) {
403
+ context.body = {
404
+ result: await createDraftOrder(
405
+ client,
406
+ customerBizplace,
407
+ bodyReq,
408
+ bundleInfo,
409
+ domain,
410
+ context,
411
+ orderInventories,
412
+ tx
413
+ )
414
+ }
415
+ return
416
+ }
370
417
  inventories = inventories
371
418
  .map(inventory => {
372
419
  return {
@@ -377,12 +424,27 @@ router.post(
377
424
  })
378
425
  .filter(inventory => inventory.remainQty > 0)
379
426
 
380
- const targetInventories: WorksheetDetail[] = _composeTargetInventories(
381
- context,
382
- product,
383
- orderInventory,
384
- inventories
385
- )
427
+ let targetInventories: WorksheetDetail[]
428
+ try {
429
+ targetInventories = _composeTargetInventories(context, product, orderInventory, inventories)
430
+ } catch (e) {
431
+ context.body = {
432
+ result: await createDraftOrder(
433
+ client,
434
+ customerBizplace,
435
+ bodyReq,
436
+ bundleInfo,
437
+ domain,
438
+ context,
439
+ orderInventories,
440
+ tx
441
+ )
442
+ }
443
+ return
444
+ }
445
+ targetInventories.map(item => {
446
+ finalOrderInventories.push(item.targetInventory)
447
+ })
386
448
  targetInventories.map(item => {
387
449
  finalOrderInventories.push(item.targetInventory)
388
450
  })
@@ -431,17 +493,37 @@ router.post(
431
493
 
432
494
  if (!response.errors) {
433
495
  const items = response.data.inventoryProductGroup.items || []
434
- if (!items?.length)
435
- context.throw(
436
- 404,
437
- t(
438
- `error.no inventories found for ${orderInventory.product?.sku} with batch ID ${orderInventory?.batchId}`
496
+ if (!items?.length) {
497
+ context.body = {
498
+ result: await createDraftOrder(
499
+ client,
500
+ customerBizplace,
501
+ bodyReq,
502
+ bundleInfo,
503
+ domain,
504
+ context,
505
+ orderInventories,
506
+ tx
439
507
  )
440
- )
508
+ }
509
+ return
510
+ }
441
511
 
442
- items.forEach(item => {
512
+ items.forEach(async item => {
443
513
  if (orderInventory.releaseQty > item.remainQty || orderInventory.releaseQty <= 0) {
444
- context.throw(404, t(`error.invalid release qty for ${orderInventory.product?.sku}`))
514
+ context.body = {
515
+ result: await createDraftOrder(
516
+ client,
517
+ customerBizplace,
518
+ bodyReq,
519
+ bundleInfo,
520
+ domain,
521
+ context,
522
+ orderInventories,
523
+ tx
524
+ )
525
+ }
526
+ return
445
527
  }
446
528
 
447
529
  // 3. add more information to orderInventory
@@ -455,7 +537,21 @@ router.post(
455
537
 
456
538
  delete orderInventory.uomValue
457
539
  finalOrderInventories.push(orderInventory)
458
- } else context.throw(404, t('error.failed to fetch inventory'))
540
+ } else {
541
+ context.body = {
542
+ result: await createDraftOrder(
543
+ client,
544
+ customerBizplace,
545
+ bodyReq,
546
+ bundleInfo,
547
+ domain,
548
+ context,
549
+ orderInventories,
550
+ tx
551
+ )
552
+ }
553
+ return
554
+ }
459
555
  }
460
556
  }
461
557
  }
@@ -729,3 +825,93 @@ function combineItems(inventoryList) {
729
825
 
730
826
  return mappedList
731
827
  }
828
+
829
+ async function createDraftOrder(client, customerBizplace, bodyReq, bundleInfo, domain, context, orderInventories, tx) {
830
+ return (
831
+ await client.mutate({
832
+ mutation: gql`
833
+ mutation upsertDraftReleaseGood(
834
+ $draftReleaseGood: DraftReleaseGoodPatch!
835
+ $orderProducts: [OrderProductPatch!]!
836
+ ) {
837
+ upsertDraftReleaseGood(draftReleaseGood: $draftReleaseGood, orderProducts: $orderProducts) {
838
+ id
839
+ name
840
+ refNo
841
+ refNo2
842
+ status
843
+ truckNo
844
+ ownTransport
845
+ marketplaceOrderStatus
846
+ billingAddress
847
+ deliveryAddress1
848
+ deliveryAddress2
849
+ deliveryAddress3
850
+ deliveryAddress4
851
+ deliveryAddress5
852
+ attentionTo
853
+ attentionCompany
854
+ city
855
+ state
856
+ postalCode
857
+ country
858
+ phone1
859
+ phone2
860
+ email
861
+ type
862
+ exportOption
863
+ releaseDate
864
+ collectionOrderNo
865
+ bizplace {
866
+ name
867
+ }
868
+ }
869
+ }
870
+ `,
871
+ variables: {
872
+ draftReleaseGood: {
873
+ bizplace: {
874
+ id: customerBizplace.id
875
+ },
876
+ courierOption: bodyReq.courierOption,
877
+ collectionOrderNo: bodyReq.collectionOrderNo,
878
+ exportOption: bodyReq.exportOption,
879
+ ownTransport: bodyReq.ownTransport,
880
+ packingOption: bodyReq.packingOption,
881
+ refNo: bodyReq.refNo,
882
+ refNo2: bodyReq?.refNo2,
883
+ releaseDate: bodyReq.releaseDate,
884
+ type: bodyReq.type,
885
+ marketplaceOrderStatus: bodyReq?.marketplaceOrderStatus,
886
+ remark: bodyReq?.remark || null,
887
+ billingAddress: bodyReq?.billTo?.billingAddress || null,
888
+ deliveryAddress1: bodyReq?.deliverTo?.deliveryAddress1 || null,
889
+ deliveryAddress2: bodyReq?.deliverTo?.deliveryAddress2 || null,
890
+ deliveryAddress3: bodyReq?.deliverTo?.deliveryAddress3 || null,
891
+ deliveryAddress4: bodyReq?.deliverTo?.deliveryAddress4 || null,
892
+ deliveryAddress5: bodyReq?.deliverTo?.deliveryAddress5 || null,
893
+ attentionTo: bodyReq?.deliverTo?.attentionTo || null,
894
+ attentionCompany: bodyReq?.deliverTo?.attentionCompany || null,
895
+ city: bodyReq?.deliverTo?.city || null,
896
+ state: bodyReq?.deliverTo?.state || null,
897
+ postalCode: bodyReq?.deliverTo?.postalCode || null,
898
+ country: bodyReq?.deliverTo?.country || null,
899
+ phone1: bodyReq?.deliverTo?.phone1 || null,
900
+ phone2: bodyReq?.deliverTo?.phone2 || null,
901
+ email: bodyReq?.deliverTo?.email || null
902
+ },
903
+ orderProducts: orderInventories
904
+ },
905
+ context: {
906
+ ...context,
907
+ hasUpload: true,
908
+ state: {
909
+ ...context.state,
910
+ customerBizplace,
911
+ domain,
912
+ type: 'api'
913
+ }
914
+ }
915
+ } as any)
916
+ ).data
917
+ }
@@ -2,6 +2,7 @@ import './add-contact-point'
2
2
  import './add-inbound-order'
3
3
  import './add-marketplace-order'
4
4
  import './add-products'
5
+ import './add-draft-release-order'
5
6
  import './add-release-order'
6
7
  import './bizplace'
7
8
  import './reject-inbound-order'