Returns Workflow
Returns are a state machine, not a flag. Each transition is a distinct call, so the record is
auditable end to end.
1. Validate eligibility
Check the return window, item condition, and item eligibility before creating the
authorisation. Creating an RMA the policy would reject leaves a record you then have to unwind.
2. Create the return authorisation
3. Approve or reject
4. Add tracking, then receive
markReceived is the point the return becomes real — inventory and financial consequences follow
from it, not from approve. Approving an RMA that never arrives costs you nothing.
5. Inspect and complete
Inspection decides restock, refurbish, or reject. Then:
complete finalises the record and settles order, inventory, and financial state together.
Cancelling
Finding returns
listPending() is the operational view — everything authorised but not yet resolved. That’s the
queue a returns agent should work from.
Why the transitions are separate
A single status field you overwrite loses the history. Because each step is its own call, the
record answers when it was approved, when the parcel landed, and who completed it — which is
what a chargeback or an audit actually asks.
update_return is deliberately not exposed as a single tool: its input is complex and
unbounded. The status-transition methods above cover the practical paths.