Skip to content

fix(js-sdk): add missing admin order archive and complete methods #12944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

anteprimorac
Copy link
Contributor

@anteprimorac anteprimorac commented Jul 14, 2025

This PR adds two missing methods to the admin.order module of the JS SDK: archive and complete.

The SDK previously lacked support for the POST /admin/orders/{id}/archive and POST /admin/orders/{id}/complete endpoints, even though these endpoints exist in the Medusa backend. Adding them fills this gap and ensures developers have access to the full order lifecycle directly from the SDK.

The implementation introduces two new methods:

  • archive(id, queryParams?, headers?) — sends a POST request to archive the order.
  • complete(id, body, queryParams?, headers?) — sends a POST request to complete the order, including optional additional data.

Both methods follow the existing patterns used in the SDK for consistency, with full TypeScript support and inline documentation.

Since the SDK currently does not have automated tests, these methods have to be manually tested. You can do so by calling them from an initialized SDK instance:

await sdk.admin.order.archive("order_123");
await sdk.admin.order.complete("order_123");

These calls should correctly interact with the Medusa Admin API and return a typed AdminOrderResponse.

@anteprimorac anteprimorac requested a review from a team as a code owner July 14, 2025 09:51
Copy link

changeset-bot bot commented Jul 14, 2025

🦋 Changeset detected

Latest commit: b5e8298

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 69 packages
Name Type
@medusajs/js-sdk Patch
@medusajs/dashboard Patch
@medusajs/admin-bundler Patch
@medusajs/medusa Patch
@medusajs/test-utils Patch
@medusajs/medusa-oas-cli Patch
integration-tests-http Patch
@medusajs/analytics Patch
@medusajs/api-key Patch
@medusajs/auth Patch
@medusajs/cart Patch
@medusajs/currency Patch
@medusajs/customer Patch
@medusajs/file Patch
@medusajs/fulfillment Patch
@medusajs/index Patch
@medusajs/inventory Patch
@medusajs/link-modules Patch
@medusajs/locking Patch
@medusajs/notification Patch
@medusajs/order Patch
@medusajs/payment Patch
@medusajs/pricing Patch
@medusajs/product Patch
@medusajs/promotion Patch
@medusajs/region Patch
@medusajs/sales-channel Patch
@medusajs/stock-location Patch
@medusajs/store Patch
@medusajs/tax Patch
@medusajs/user Patch
@medusajs/workflow-engine-inmemory Patch
@medusajs/workflow-engine-redis Patch
@medusajs/oas-github-ci Patch
@medusajs/cache-inmemory Patch
@medusajs/cache-redis Patch
@medusajs/event-bus-local Patch
@medusajs/event-bus-redis Patch
@medusajs/analytics-local Patch
@medusajs/analytics-posthog Patch
@medusajs/auth-emailpass Patch
@medusajs/auth-github Patch
@medusajs/auth-google Patch
@medusajs/file-local Patch
@medusajs/file-s3 Patch
@medusajs/fulfillment-manual Patch
@medusajs/locking-postgres Patch
@medusajs/locking-redis Patch
@medusajs/notification-local Patch
@medusajs/notification-sendgrid Patch
@medusajs/payment-stripe Patch
@medusajs/core-flows Patch
@medusajs/framework Patch
@medusajs/modules-sdk Patch
@medusajs/orchestration Patch
@medusajs/types Patch
@medusajs/utils Patch
@medusajs/workflows-sdk Patch
@medusajs/cli Patch
@medusajs/telemetry Patch
@medusajs/admin-sdk Patch
@medusajs/admin-shared Patch
@medusajs/admin-vite-plugin Patch
@medusajs/icons Patch
@medusajs/toolbox Patch
@medusajs/ui-preset Patch
create-medusa-app Patch
medusa-dev-cli Patch
@medusajs/ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jul 14, 2025

@anteprimorac is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM <3

Copy link
Member

@adrien2p adrien2p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution, could you update the pr description please :)

@anteprimorac
Copy link
Contributor Author

@adrien2p, the PR description is updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants