fix(core-flows): fixes duplicate fulfillment issue (#8581)

what:

- fixes a bug where fulfilling an outbound item was throwing an error due to the entire order being processed for fulfillment

RESOLVES CC-298
This commit is contained in:
Riqwan Thamir
2024-08-13 12:40:46 +02:00
committed by GitHub
parent 1c8aeb9735
commit 6f50e376a9
3 changed files with 40 additions and 14 deletions
@@ -297,7 +297,13 @@ export const createOrderFulfillmentWorkflow = createWorkflow(
const fulfillment = createFulfillmentWorkflow.runAsStep(fulfillmentData)
const registerOrderFulfillmentData = transform(
{ order, fulfillment, input, inputItemsMap, itemsList: input.items_list },
{
order,
fulfillment,
input,
inputItemsMap,
itemsList: input.items ?? input.items_list,
},
prepareRegisterOrderFulfillmentData
)
@@ -67,7 +67,7 @@ function prepareRegisterShipmentData({
reference: Modules.FULFILLMENT,
reference_id: fulfillment.id,
created_by: input.created_by,
items: order.items!.map((i) => {
items: (input.items ?? order.items)!.map((i) => {
return {
id: i.id,
quantity: i.quantity,