Request the cancellation of every group that is not yet locked (creates a cancellation request)
POST/orders/:orderId/cancellations
CancelOrder is a request (G12, G25). Every group still PROMISED (no node locked yet) moves to CANCELLATION_REQUESTED and CustomerOrderCancelled is published through the outbox with those groupNos; locked, shipped and delivered groups are untouched. order-sourcing decides: FulfillmentCancelled makes the group CANCELLED (the order is CANCELLED once every group is), FulfillmentCancelRefused returns the group to fulfilment (the vendor ships; the shopper path becomes a return). Refused with 409 cancel-after-lock (ErrCancelAfterLock) when no group is unlocked. Repeating the request, or cancelling a CANCELLED order, returns the order unchanged and publishes nothing.
Request
Responses
- 200
- 400
- 404
- 409
- 422
The order after the request.
Response Headers
"true" when the answer is the stored one of an earlier request with the same Idempotency-Key (a stored 2xx or a stored final 4xx answer, replayed with its original status and body); absent on the first execution. A refusal that a retry could pass (a RETRYABLE problem type, see the Idempotency-Key parameter) and a 5xx are never stored.
The request is not valid JSON, has an unknown field contains a NUL character or is larger than 64 KiB (malformed-request; there is no 413), or the Idempotency-Key header is missing (idempotency-key-required) or is not 1 to 128 printable ASCII characters (idempotency-key-invalid).
No order with this id (not-found). Not stored under the Idempotency-Key, because the order may be created by another request; a retry with the same key runs again.
cancel-after-lock (ErrCancelAfterLock), status-regression (ErrStatusRegression), concurrent-update, or the Idempotency-Key was already used with a different request (idempotency-key-reused). status-regression is stored under the key; cancel-after-lock and concurrent-update are not (a locked group can still be cancelled by an event): retry with the same key.
The body is well-formed JSON but breaks a value-object rule, or names a shopper or a saved address that does not exist (validation-failed). Not stored under the Idempotency-Key, so a retry with the same key runs again.