Authorize a return (open an RMA)
POST/returns
Authorizes returning quantity units of one order line. The line must
be allocated (order-management's local copy; the SKU of the RMA is
taken from that copy, the request's sku is accepted and ignored) and
manifested (a work unit {order_id}-line-{line_no} in the
fulfillment-execution local copy), and now must be inside the policy's
return window. A refusal is 409 return-not-authorizable whose
detail starts with the rejection code ORDER_LINE_NOT_ALLOCATED,
LINE_NOT_MANIFESTED, RETURN_WINDOW_EXPIRED or
QUANTITY_EXCEEDS_POLICY; the same 409 answers a request made before
any disposition policy is declared. At most ONE open RMA may exist per
(orderId, lineNo) (409 open-rma-exists). quantity must be in
[1, policy.maxUnitsPerLine]; the shipped-quantity check is planned,
not built (ADR 0003). A refusal persists nothing and publishes no
event: only a successful authorization publishes ReturnAuthorized
through the outbox. Requires an Idempotency-Key; replaying the same
key and body returns the original response.
Request
Responses
- 201
- 400
- 409
- 500
The RMA is authorized.
Response Headers
Present, with the value true, only when the answer is a replay of the stored answer of an earlier request with the same Idempotency-Key.
Path of the new RMA.
Malformed JSON body, an unknown field, a NUL byte in the body, or an invalid path, query or header parameter.
The command is refused by the domain rules, another request changed the resource first, or the Idempotency-Key was reused.
Unexpected server error.