Cancel an order and revoke its reservations
DELETE/orders/:id
The CancelOrder use case. Revokes every allocated line's reservation on inventory-storage via DELETE /reservations/{id}, then cancels every line. Publishes OrderCancelled.
BR6 — the cancellation boundary: this is legal ONLY while no line has reached Released. The boundary is checked BEFORE any reservation is revoked, so a rejected cancellation leaves inventory-storage completely untouched. Once any line is released, v1 does NOT claw back the released work — a deliberate, documented gap (see ADR 0004), not an oversight.
A failed revoke fails the whole cancellation and leaves the order untouched, so retrying is safe.
Request
Responses
- 204
- 400
- 404
- 409
- 500
- 503
Order cancelled; every allocated reservation was revoked.
The request body or path parameter is malformed or invalid — including a body whose JSON is syntactically valid but shape-invalid: an explicitly null value on a non-nullable field (e.g. "giftWrap": null) is rejected here rather than silently coerced to that field's zero value.
No order has this id.
At least one line has already been released (BR6, order-already-released), or the write lost an optimistic-concurrency race (concurrent-modification).
An unexpected internal error occurred.
inventory-storage could not be reached (transport error, timeout, open circuit breaker), answered with an unexpected status, or is wired in permissive (no-op) mode, or reported insufficient usable stock. Problem type is downstream-unavailable for an infrastructure failure, downstream-not-configured for permissive mode and insufficient-stock for the latter. Never papered over with a 2xx: allocating real stock must not appear to succeed when it did not.