Business processes / 7 / 12
Document lifecycle
An electronic invoice between two companies goes from draft to accepted, rejected or cancelled, and every legally important step must also be confirmed by an external registry. How to keep that state machine correct when two people click at once and the registry answers late, twice or never.
- 14 min
- Intermediate
- 12 steps
- Lost updates
- 0 /day
- Differs from registry
- 0
- Stuck in pending
- 0
- Duplicate effects
- 0 /day
- request
- reply
- redelivery
- duplicate
- lost
Numbers are a model scenario, not measurements
The real request
Buyer app → Document APIRequest
GET /documents/inv_5120 HTTP/1.1
Response
HTTP/1.1 200 OK
{
"id": "inv_5120",
"type": "invoice",
"state": 1"delivered",
"version": 24,
"actions": 3["accept", "reject"]
}
state— The current state. Only the server changes it.version— How many times the document has changed. Draft 1, signed 2, sent 3, delivered 4.actions— What this user may do in this state. The UI shows only these buttons.
Build it yourselfCheat sheetCompare lessons
Course: 74 lessons
01 Foundations
02 Scaling
03 Data & storage
04 Communication
05 Reliability
06 Architecture
07 Security
08 Shipping
09 Whole systems
10 Business processes
11 Case studies