Feat(medusa, medusa-js, medusa-react): order edit item update (#2246)

**what**
Support `updateLineItem` which does the following:
- If no item change exist then create a new one and attaches the clone item with the adjustments and tax lines
- if an item change exists then delete/create adjustments and tax lines and update the cloned item quantity

**Tests**
- Unit tests core + client
- integration tests
  - When no item change already exists
  - When an item change already exists

FIXES CORE-497
This commit is contained in:
Adrien de Peretti authored and GitHub committed 2022-09-28 09:09:33 +00:00
1 parent 1807bff029
commit 474e97252c
24 files changed
+1247 -63

No files matched your search

+17 -1
View File
@@ -1712,7 +1712,7 @@ export const adminHandlers = [
order_edit: {
...fixtures.get("order_edit"),
requested_at: new Date(),
status: "requested"
status: "requested",
},
})
)
@@ -1742,6 +1742,22 @@ export const adminHandlers = [
)
}),
rest.post("/admin/order-edits/:id/items/:item_id", (req, res, ctx) => {
return res(
ctx.status(200),
ctx.json({
order_edit: {
...fixtures.get("order_edit"),
changes: [
{
quantity: (req.body as any).quantity,
},
],
},
})
)
}),
rest.get("/admin/auth", (req, res, ctx) => {
return res(
ctx.status(200),