feat(medusa): Implement premises of order edit retrieval (#2183)
**What** - Implements the admin/store retrieval end point - Service implementation of the retrieve method - Service implementation of the computeLineItems method which aggregates the right line item based on the changes that are made - client - medusa-js api - medusa-react queries hooks **Tests** - Unit tests of the retrieval end points - Unit tests of the service retrieve method and computeLineItems - Integration tests for admin/store - client - medusa-js tests - medusa-react hooks tests FIXES CORE-492
This commit is contained in:
@@ -7,6 +7,7 @@ import CollectionsResource from "./resources/collections"
|
||||
import CustomersResource from "./resources/customers"
|
||||
import GiftCardsResource from "./resources/gift-cards"
|
||||
import OrdersResource from "./resources/orders"
|
||||
import OrderEditsResource from "./resources/order-edits"
|
||||
import PaymentMethodsResource from "./resources/payment-methods"
|
||||
import ProductsResource from "./resources/products"
|
||||
import RegionsResource from "./resources/regions"
|
||||
@@ -24,6 +25,7 @@ class Medusa {
|
||||
public customers: CustomersResource
|
||||
public errors: MedusaError
|
||||
public orders: OrdersResource
|
||||
public orderEdits: OrderEditsResource
|
||||
public products: ProductsResource
|
||||
public regions: RegionsResource
|
||||
public returnReasons: ReturnReasonsResource
|
||||
@@ -44,6 +46,7 @@ class Medusa {
|
||||
this.customers = new CustomersResource(this.client)
|
||||
this.errors = new MedusaError()
|
||||
this.orders = new OrdersResource(this.client)
|
||||
this.orderEdits = new OrderEditsResource(this.client)
|
||||
this.products = new ProductsResource(this.client)
|
||||
this.regions = new RegionsResource(this.client)
|
||||
this.returnReasons = new ReturnReasonsResource(this.client)
|
||||
|
||||
@@ -12,6 +12,7 @@ import AdminInvitesResource from "./invites"
|
||||
import AdminNotesResource from "./notes"
|
||||
import AdminNotificationsResource from "./notifications"
|
||||
import AdminOrdersResource from "./orders"
|
||||
import AdminOrderEditsResource from "./order-edits"
|
||||
import AdminPriceListResource from "./price-lists"
|
||||
import AdminProductTagsResource from "./product-tags"
|
||||
import AdminProductTypesResource from "./product-types"
|
||||
@@ -48,6 +49,7 @@ class Admin extends BaseResource {
|
||||
public users = new AdminUsersResource(this.client)
|
||||
public returns = new AdminReturnsResource(this.client)
|
||||
public orders = new AdminOrdersResource(this.client)
|
||||
public orderEdits = new AdminOrderEditsResource(this.client)
|
||||
public returnReasons = new AdminReturnReasonsResource(this.client)
|
||||
public variants = new AdminVariantsResource(this.client)
|
||||
public salesChannels = new AdminSalesChannelsResource(this.client)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { AdminOrdersEditsRes } from "@medusajs/medusa"
|
||||
import { ResponsePromise } from "../../typings"
|
||||
import BaseResource from "../base"
|
||||
|
||||
class AdminOrderEditsResource extends BaseResource {
|
||||
retrieve(
|
||||
id: string,
|
||||
customHeaders: Record<string, any> = {}
|
||||
): ResponsePromise<AdminOrdersEditsRes> {
|
||||
const path = `/admin/order-edits/${id}`
|
||||
return this.client.request("GET", path, undefined, {}, customHeaders)
|
||||
}
|
||||
}
|
||||
|
||||
export default AdminOrderEditsResource
|
||||
@@ -0,0 +1,15 @@
|
||||
import { StoreOrderEditsRes } from "@medusajs/medusa"
|
||||
import { ResponsePromise } from "../typings"
|
||||
import BaseResource from "./base"
|
||||
|
||||
class OrderEditsResource extends BaseResource {
|
||||
retrieve(
|
||||
id: string,
|
||||
customHeaders: Record<string, any> = {}
|
||||
): ResponsePromise<StoreOrderEditsRes> {
|
||||
const path = `/store/order-edits/${id}`
|
||||
return this.client.request("GET", path, undefined, {}, customHeaders)
|
||||
}
|
||||
}
|
||||
|
||||
export default OrderEditsResource
|
||||
Reference in New Issue
Block a user