Authoritative data and states
How do stock and credit reservations both remain unchanged on rejection or a crash?
The interfaces require authoritative state. Order confirmation reserves stock and credit together. Available stock and remaining credit stay non-negative. Delivery replaces the credit reservation with a receivable and consumes reserved stock once. The table separates current states from the evidence that established them.
Starting point Bind the order to P-101 and the quantity.
Assumptions for the example case
A fictional example design with one customer, one currency and one warehouse; a binding price offer; complete local stock and credit reservations; and one complete delivery. Figures and quality goals are illustrative test assumptions. Multiple currencies, tax calculation, partial delivery and credit insurance are outside the scope.
Data relationships and permitted transitions
Order, offer, two reservations and fulfilment
Stock and credit reservations belong to A-101; geliefert replaces the credit reservation with a receivable.
Entities and relationships
| Entity | Authoritative data | Responsibility |
|---|---|---|
| Order A-101 | 10 boxes, P-101, 20,000 cents and state | Reserves stock and credit together. |
| Offer P-101 | Items, unit price, end of validity | Immutable price reference. |
| Stock W-101 | 15 boxes and active reservations | Authoritative for local commitments. |
| Credit line K-101 | Limit, outstanding receivables and active reservations | Available credit before the order: 30,000 cents. |
| Fulfilment request | Order, external reference and evidence | Prevents double handover. |
Order A-101
- Authoritative data
- 10 boxes, P-101, 20,000 cents and state
- Responsibility
- Reserves stock and credit together.
Offer P-101
- Authoritative data
- Items, unit price, end of validity
- Responsibility
- Immutable price reference.
Stock W-101
- Authoritative data
- 15 boxes and active reservations
- Responsibility
- Authoritative for local commitments.
Credit line K-101
- Authoritative data
- Limit, outstanding receivables and active reservations
- Responsibility
- Available credit before the order: 30,000 cents.
Fulfilment request
- Authoritative data
- Order, external reference and evidence
- Responsibility
- Prevents double handover.
Permitted state transitions
| Starting point | Target | Condition |
|---|---|---|
| eingegangen | bestätigt | Price valid; 10 boxes and 20,000 cents reserved together. |
| eingegangen | abgelehnt | At least one commitment requirement is missing. |
| bestätigt | erfüllung_offen | External fulfilment request created durably. |
| bestätigt | storniert | Before fulfilment starts, both reservations are released. |
| erfüllung_offen | geliefert | Matching delivery evidence; the credit reservation is atomically converted to a receivable. |
| erfüllung_offen | klärung | The external outcome remains unknown. |
| geliefert or storniert or abgelehnt | terminal | Returns and settlement are separate follow-up processes. |
eingegangen
- Target
- bestätigt
- Condition
- Price valid; 10 boxes and 20,000 cents reserved together.
eingegangen
- Target
- abgelehnt
- Condition
- At least one commitment requirement is missing.
bestätigt
- Target
- erfüllung_offen
- Condition
- External fulfilment request created durably.
bestätigt
- Target
- storniert
- Condition
- Before fulfilment starts, both reservations are released.
erfüllung_offen
- Target
- geliefert
- Condition
- Matching delivery evidence; the credit reservation is atomically converted to a receivable.
erfüllung_offen
- Target
- klärung
- Condition
- The external outcome remains unknown.
geliefert or storniert or abgelehnt
- Target
- terminal
- Condition
- Returns and settlement are separate follow-up processes.
Change reservations together
Perform both checks and reservations in one transaction.
Stock is sufficient but credit is not.
Rejection does not leave a half-commitment.
- Alternative considered
- Two independent reservations require compensation.
- Trade-off
- The shared write datastore constrains separation.
- Reassess
- Independent warehouses require a distributed commitment contract.
Terms in this step
- Change reservations together
- Rejection does not leave a half-commitment.
Try it yourself
Stock is sufficient but credit is not. State the permitted changes and the outcome of a crash before commit.
A hint for your attempt
Use the specific entities and conditions from this step. The two solution parts distinguish the decision from its evidenced outcome.
Compare with a possible solution
- First part of the solution
- The transaction rejects the entire order; stock and credit reservations remain unchanged.
- Second part of the solution
- A crash before commit likewise leaves no partial reservation. Both resources are checked and changed together.
Apply to your project
Which corresponding assumption would you test first in your project? Consider this trigger: Independent warehouses require a distributed commitment contract.