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 authored and GitHub committed 2022-09-16 08:29:40 +00:00
1 parent 6132711eef
commit f7177c9033
20 files changed
+745 -115

No files matched your search

@@ -1,6 +1,7 @@
import {
AdminOrdersEditsRes,
AdminOrderEditDeleteRes
AdminOrderEditDeleteRes,
AdminOrderEditsRes,
AdminPostOrderEditsReq,
} from "@medusajs/medusa"
import { ResponsePromise } from "../../typings"
import BaseResource from "../base"
@@ -9,11 +10,19 @@ class AdminOrderEditsResource extends BaseResource {
retrieve(
id: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrdersEditsRes> {
): ResponsePromise<AdminOrderEditsRes> {
const path = `/admin/order-edits/${id}`
return this.client.request("GET", path, undefined, {}, customHeaders)
}
create(
payload: AdminPostOrderEditsReq,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminOrderEditsRes> {
const path = `/admin/order-edits`
return this.client.request("POST", path, payload, {}, customHeaders)
}
delete(
id: string,
customHeaders: Record<string, any> = {}