feat(core-flows): request return on order exchanges and claims (#8107)

FIXES: CC-92, CC-87
This commit is contained in:
Carlos R. L. Rodrigues authored and GitHub committed 2024-07-12 15:48:24 +00:00
1 parent 136da3f3ce
commit 4321241553
25 files changed
+695 -69

No files matched your search

@@ -1932,9 +1932,28 @@ export default class OrderModuleService<
return await this.orderChangeService_.create(input, sharedContext)
}
async previewOrderChange(orderChangeId: string, sharedContext?: Context) {
@InjectManager("baseRepository_")
async previewOrderChange(orderId: string, sharedContext?: Context) {
const order = await this.retrieveOrder(
orderId,
{
select: ["id", "version", "items.detail", "summary", "total"],
relations: [
"transactions",
"items",
"items.detail",
"shipping_methods",
],
},
sharedContext
)
if (!order.order_change) {
return order
}
const orderChange = await super.retrieveOrderChange(
orderChangeId,
order.order_change.id,
{ relations: ["actions"] },
sharedContext
)
@@ -1950,20 +1969,6 @@ export default class OrderModuleService<
}
})
const order = await this.retrieveOrder(
orderChange.order_id,
{
select: ["id", "version", "items.detail", "summary", "total"],
relations: [
"transactions",
"items",
"items.detail",
"shipping_methods",
],
},
sharedContext
)
const calculated = calculateOrderChange({
order: order as any,
actions: orderChange.actions,