System Design Atlas

B2B wholesale orders with credit limits

07 / 10Worked example

Critical flow

How does repeated delivery evidence convert a credit reservation to a receivable exactly once?

Trace the failure point through the architecture: 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. Durable acceptance, actual effect and response are considered separately. DEL-101 identifies the inventory-management delivery record used to reconcile actual delivery.

Starting point Persist the local commitment and transmit the external order separately.

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.

Failure point in the sequence

Commit before reply and later delivery reconciliation

A-101 stays open with its reservations until the same delivery reference is reconciled.

Order API
Relational datastore
Fulfilment worker
Inventory management
Response intake
Reconciliation worker
  1. 01 Order API · Local processingCustomer portal has submitted A-101 with 10 boxes
  2. 02 Order API → Relational datastoreCommit stock + credit + outbox
  3. 03 Relational datastore → Order APIbestätigt
  4. 04 Fulfilment worker → Relational datastoreRead the open fulfilment request
  5. 05 Fulfilment worker → Inventory managementDeliver the same fulfilment request
  6. 06 Inventory management · Local processingGoods shipped
  7. 07 Order API · Local processingResponse missing; investigate
  8. 08 Reconciliation worker → Inventory managementRequest delivery status of A-101
  9. 09 Inventory management → Response intakeRecord DEL-101 with its order reference
  10. 10 Response intake → Relational datastoreAuthenticate the evidence and commit the inbox
  11. 11 Reconciliation worker → Relational datastoreRead the linked delivery evidence
  12. 12 Reconciliation worker → Relational datastoreReservation → receivable

Result: Delivery evidence takes effect once; until then, stock and credit remain reserved.

A lost result requires investigation; the delivery reference establishes one receivable.

The same delivery evidence arrives twice. Convert the reservation to a receivable once. Credit exposure remains 20,000 cents rather than doubling to 40,000.

Effect, response and recovery

Specific error
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.
Before and after commit
Commit durably completes the local change. Before commit, the old state remains valid; afterwards, an identical retry returns the stored outcome. Reconcile the external effect using its existing reference.
Retry behaviour
Retry A-101 with the same offer and 10 boxes: return the existing confirmation. Reusing the key with 11 boxes produces a conflict. Duplicate delivery evidence converts the credit reservation to a receivable only once.

Apply delivery once

Apply delivery once

Convert the reservation into a receivable exactly once.

The same proof of delivery comes twice.

Credit exposure remains 20,000 cents instead of double 40,000.

Alternative considered
Creating a receivable per message consumes the credit limit twice.
Trade-off
Evidence identity must be maintained.
Reassess
Partial delivery requires partial delivery records.

Terms in this step

Apply delivery once
Credit exposure remains 20,000 cents instead of double 40,000.

Try it yourself

The same delivery evidence arrives twice. Calculate the receivable and remaining credit reservation.

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 first record replaces the 20,000-cent credit reservation with a 20,000-cent receivable.
Second part of the solution
The retry changes nothing: credit reservation zero, receivable 20,000 cents. Exposure does not become 40,000 cents.

Apply to your project

Which corresponding assumption would you test first in your project? Consider this trigger: Partial delivery requires partial delivery records.

Step 8 distinguishes item and customer bottlenecks.