feat(medusa): Implement premises of the creation flow of an order edit (#2187)

**What**
- Implements the admin create end point 
- Service implementation of the create method and the retrieveActive as well as the totals computation
- Improve compute line items
- client
  - medusa-js api
  - medusa-react mutations hooks

**Tests**
- Unit tests of the create end points
- Unit tests of the service create method
- Integration tests for admin that also take into account totals computations
- client
  - medusa-js tests
  - medusa-react hooks tests

FIXES CORE-491
This commit is contained in:
Adrien de Peretti
2022-09-16 08:29:40 +00:00
committed by GitHub
parent 6132711eef
commit f7177c9033
20 changed files with 745 additions and 115 deletions
@@ -114,14 +114,16 @@ describe("[MEDUSA_FF_ORDER_EDITING] /store/order-edits", () => {
await simpleLineItemFactory(dbConnection, {
id: lineItemUpdateId,
order_id: orderEdit.order_id,
order_id: null,
variant_id: product1.variants[0].id,
unit_price: 1000,
quantity: 2,
})
await simpleLineItemFactory(dbConnection, {
id: lineItemCreateId,
order_id: orderEdit.order_id,
order_id: null,
variant_id: product3.variants[0].id,
unit_price: 100,
quantity: 2,
})
@@ -168,6 +170,13 @@ describe("[MEDUSA_FF_ORDER_EDITING] /store/order-edits", () => {
removed_items: expect.arrayContaining([
expect.objectContaining({ id: lineItemId2, quantity: 1 }),
]),
shipping_total: 0,
gift_card_total: 0,
gift_card_tax_total: 0,
discount_total: 0,
tax_total: 0,
total: 2200,
subtotal: 2200,
})
)