Skip to content

Add OrderState Admin API endpoints (CRUD + list + bulk delete) - #260

Closed
PrestaEdit wants to merge 2 commits into
PrestaShop:devfrom
PrestaEdit:add-orderstate-endpoint
Closed

PrestaEdit wants to merge 2 commits into
PrestaShop:devfrom
PrestaEdit:add-orderstate-endpoint

Conversation

@PrestaEdit

Copy link
Copy Markdown
Contributor
Questions Answers
Branch? dev
Description? Exposes the OrderState domain through the Admin API.
- GET /order-states/{orderStateId} (scope order_state_read)
- POST /order-states (scope order_state_write)
- PATCH /order-states/{orderStateId} (scope order_state_write)
- DELETE /order-states/{orderStateId} (scope order_state_write)
- GET /order-states paginated list (scope order_state_read)
- DELETE /order-states/bulk-delete (scope order_state_write)

The status icon upload is intentionally not exposed in this first version (the icon is set through a separate setFileInformation call, not the command constructor) and can be added as a follow-up.
Type? new feature
Category? WS
BC breaks? no
Deprecations? no
Fixed ticket? Part of PrestaShop/PrestaShop#39630
How to test? Run OrderStateEndpointTest. Create an order state via POST /order-states (localized names/templates, color, and the boolean flags), then GET/PATCH/DELETE it, list via GET /order-states, and remove several at once via DELETE /order-states/bulk-delete with { orderStateIds }.
Sponsor company

Adds CRUD, paginated list and bulk-delete API Platform resources for the OrderState domain, mirroring the existing Contact/Title endpoints. Create and update use distinct command mappings (AddOrderStateCommand expects localizedNames/localizedTemplates, EditOrderStateCommand uses name/template setters). All underlying CQRS classes were verified to exist as of tag 9.0.3, so this is compatible with the lower bound of the CI test matrix.

PrestaEdit and others added 2 commits June 23, 2026 13:37
Add CRUD, paginated list and bulk-delete API Platform resources for the
OrderState domain, mirroring the existing Contact/Title endpoints. The
status icon upload is not exposed in this first version (the icon is set
through a separate setFileInformation call on the command, not the
constructor) and can be added as a follow-up.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Order states are soft-deleted (existing orders may reference them), so a
deleted state still resolves on GET. Assert it disappears from the listing
instead of expecting a 404.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@PrestaEdit

Copy link
Copy Markdown
Contributor Author

⚠️ This PR duplicates #226 ("Add OrderState resource"), which predates it. I opened this before spotting the existing PR — apologies for the noise. Priority should go to #226. I'm keeping this open only as a fallback in case it's needed, but please consider #226 first.

@PrestaEdit

Copy link
Copy Markdown
Contributor Author

Superseded by #417, which merges this endpoint with the rest of the domain, following the mutualisation asked for by the core team (one PR per domain rather than one per endpoint).

The consolidated PR is green and lists what changed for this endpoint on the way in. Closing here to keep the review in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants