feat(order): fulfillment workflow (#7385)

FIXES: CORE-2162 CORE-2167 CORE-2041
This commit is contained in:
Carlos R. L. Rodrigues
2024-05-27 12:49:33 +00:00
committed by GitHub
parent 639758ffec
commit 62ef82f497
43 changed files with 1730 additions and 195 deletions
@@ -2149,35 +2149,12 @@ export default class OrderModuleService<
): Promise<void> {
let shippingMethodId
if (!isString(data.shipping_method)) {
const methods = await this.createShippingMethods(
data.order_id,
data.shipping_method as any,
sharedContext
)
shippingMethodId = methods[0].id
} else {
shippingMethodId = data.shipping_method
}
const method = await this.shippingMethodService_.retrieve(
shippingMethodId,
{
relations: ["tax_lines", "adjustments"],
},
sharedContext
)
const calculatedAmount = getShippingMethodsTotals([method as any], {})[
method.id
]
const actions: CreateOrderChangeActionDTO[] = data.items.map((item) => {
return {
action: ChangeActionType.SHIP_ITEM,
internal_note: item.internal_note,
reference: data.reference,
reference_id: shippingMethodId,
reference_id: data.reference_id,
details: {
reference_id: item.id,
quantity: item.quantity,
@@ -2191,7 +2168,6 @@ export default class OrderModuleService<
action: ChangeActionType.SHIPPING_ADD,
reference: data.reference,
reference_id: shippingMethodId,
amount: calculatedAmount.total,
})
}