Business rules and operational targets
How does credit reservation protect the remaining limit during concurrent orders?
The system boundary leads to a business rule: 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. An operational target describes a measurable property and begins as a test assumption.
Starting point Treat price, stock and credit as one commitment.
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.
Rules governing the result
Three commitment checks and an unknown external outcome
Offer, stock and credit limit are checked before confirmation; a timeout releases no reservation.
Business requirements (functional)
Further reading
- Invariant
- 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.
- Boundary test
- Available credit of 19,999 cents rejects A-101; 20,000 and 20,001 cents permit the reservation, leaving 0 and 1 cent respectively. The offer is valid until 13:00 UTC, exclusively; at exactly 13:00 it has expired.
- Unresolved outcome
- Inventory management delivers, but its response is missing. The order remains erfüllung_offen or klärung; order support reconciles the same reference. A timeout releases neither stock nor credit reservations automatically.
Quality goals (non-functional)
Further reading
- Local acceptance
- Illustrative target: 95% of local management commands complete within 800 ms under a peak profile of 30 orders/s for 600 s = 18,000 orders. Measure external execution and media transfer separately.
- Traceability
- Every rejected or open operation shows its reason, latest evidenced state and responsible role. Check this in a sample after the failure from step 7.
Preserve the credit limit
Check credit reservations atomically against the remaining limit.
Two orders see the same available credit.
Reserve 20,000 cents from the available 30,000 at most once.
- Alternative considered
- A daily credit export is too stale for this decision.
- Trade-off
- Contention for one customer can cause waits.
- Reassess
- Real credit-limit changes come from an external authoritative system.
Terms in this step
- Preserve the credit limit
- Reserve 20,000 cents from the available 30,000 at most once.
Try it yourself
Two orders each request 20,000 cents against 30,000 cents of available credit. State the winner count and remaining credit.
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
- Only the first atomic commit reserves 20,000 cents.
- Second part of the solution
- The second is rejected; 10,000 cents remain free. Reverse order only changes the winner.
Apply to your project
Which corresponding assumption would you test first in your project? Consider this trigger: Real credit-limit changes come from an external authoritative system.