From 00aa2c13bc37223029e40b38f3e2bedd8ed1e816 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Mon, 1 Dec 2025 13:28:08 +0200 Subject: [PATCH] fix(js-sdk,types,medusa): add HTTP types for update order change API route (#14169) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary **What** — What changes are introduced in this PR? - Add HTTP type for update order API route payload + use it in the JS SDK and API route - other: add `since` tag **Why** — Why are these changes relevant or necessary? *Please provide answer here* **How** — How have these changes been implemented? *Please provide answer here* **Testing** — How have these changes been tested, or how can the reviewer test the feature? *Please provide answer here* --- ## Examples Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice. This helps with documentation and ensures maintainers can quickly understand and verify the change. ```ts // Example usage ``` --- ## Checklist Please ensure the following before requesting a review: - [ ] I have added a **changeset** for this PR - Every non-breaking change should be marked as a **patch** - To add a changeset, run `yarn changeset` and follow the prompts - [ ] The changes are covered by relevant **tests** - [ ] I have verified the code works as intended locally - [ ] I have linked the related issue(s) if applicable --- ## Additional Context Add any additional context, related issues, or references that might help the reviewer understand this PR. --- .changeset/pink-sites-visit.md | 7 +++++++ packages/core/js-sdk/src/admin/order.ts | 6 ++++-- packages/core/types/src/http/order/admin/payload.ts | 7 +++++++ .../medusa/src/api/admin/order-changes/[id]/route.ts | 9 +++++++-- 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 .changeset/pink-sites-visit.md diff --git a/.changeset/pink-sites-visit.md b/.changeset/pink-sites-visit.md new file mode 100644 index 0000000000..eee95e6324 --- /dev/null +++ b/.changeset/pink-sites-visit.md @@ -0,0 +1,7 @@ +--- +"@medusajs/js-sdk": patch +"@medusajs/types": patch +"@medusajs/medusa": patch +--- + +fix(js-sdk,types,medusa): add HTTP types for update order change API route diff --git a/packages/core/js-sdk/src/admin/order.ts b/packages/core/js-sdk/src/admin/order.ts index 63ae9ce5e2..969bd8c602 100644 --- a/packages/core/js-sdk/src/admin/order.ts +++ b/packages/core/js-sdk/src/admin/order.ts @@ -638,6 +638,8 @@ export class Order { * This method updates an order change. It sends a request to the * [Update Order Change](https://docs.medusajs.com/api/admin#order-changes_postorder-changesid) * API route. + * + * @since v2.11.4 * * @param id - The order change's ID. * @param body - The update details. @@ -658,8 +660,8 @@ export class Order { */ async updateOrderChange( id: string, - body: { carry_over_promotions: boolean }, - query?: SelectParams, + body: HttpTypes.AdminUpdateOrderChange, + query?: HttpTypes.AdminOrderChangesFilters, headers?: ClientHeaders ) { return await this.client.fetch( diff --git a/packages/core/types/src/http/order/admin/payload.ts b/packages/core/types/src/http/order/admin/payload.ts index 83675df2cf..9f60f9a851 100644 --- a/packages/core/types/src/http/order/admin/payload.ts +++ b/packages/core/types/src/http/order/admin/payload.ts @@ -188,4 +188,11 @@ export interface AdminCreateOrderCreditLine { * Key-value pairs of custom data. */ metadata?: Record | null +} + +export interface AdminUpdateOrderChange { + /** + * Whether to carry over promotions to outbound exchange items. + */ + carry_over_promotions?: boolean } \ No newline at end of file diff --git a/packages/medusa/src/api/admin/order-changes/[id]/route.ts b/packages/medusa/src/api/admin/order-changes/[id]/route.ts index 5e9c571685..186bef23a4 100644 --- a/packages/medusa/src/api/admin/order-changes/[id]/route.ts +++ b/packages/medusa/src/api/admin/order-changes/[id]/route.ts @@ -4,11 +4,16 @@ import { AuthenticatedMedusaRequest, MedusaResponse, } from "@medusajs/framework/http" -import { AdminPostOrderChangesReqSchemaType } from "../validators" import { ContainerRegistrationKeys } from "@medusajs/framework/utils" +/** + * @since v2.11.4 + */ export const POST = async ( - req: AuthenticatedMedusaRequest, + req: AuthenticatedMedusaRequest< + HttpTypes.AdminUpdateOrderChange, + HttpTypes.AdminOrderChangesFilters + >, res: MedusaResponse ) => { const { id } = req.params