System Design Atlas

Account posting and bank transfers

02 / 10Worked example

Business rules and operational targets

How does posting prevent overdrafts in the case of simultaneous transfers?

The system boundary leads to a business rule: each posting set adds up to zero per currency. Available funds remain at least zero without granted credit. For U-41, there is at most one original and at most one rejection-related reversal posting set. An operating goal, on the other hand, describes a measurable property and is initially a test assumption.

Starting point Bind authorisation evidence to the account, payee, amount and EUR.

Assumptions for the example case

Our own fictitious example draft: transfer in EUR with positive whole cent amounts; a debited customer account and an internal settlement account; external settlement with status query; reversal posting after proven rejection. Figures and quality goals are illustrative test assumptions. Outside are foreign exchange, interest, fees, regulatory approval check and a complete bank ledger.

Rules governing the result

Four gates · each condition protects the same booking

1
Authorisation bound to the transferAccount, recipient, amount
2
Sufficient fundsBalance after booking ≥ 0
3
Posting set balancedDebit + credit = 0 EUR
4
Unique effectAt most one reversal posting
Response-time test assumption locally measure; observe external clearing time separately
Response lost after external success Order remains open → Payment service requests A-41 → only secure rejection allows the counter-booking.

All four gates must pass before commit. An unknown external outcome opens an investigation, not a reversal posting.

Two transfers initially see 10,000 cents. Check available balance within the same transaction as the debit. An invariant test must deliver a winner at two attempts of 7,000 cents each.

Business requirements (functional)

Further reading
Invariant
Each posting set adds up to zero per currency. Available funds remain at least zero without granted credit. For U-41, there is at most one original and at most one rejection-related reversal posting set.
Boundary test
7,000 cents are to be rejected with available balance 6,999, booked at 7,000 and 7,001; the remainder 0 and 1 cent respectively.
Unresolved outcome
After external success, the response is lost. U-41 remains open; A-41 is queried. A time-out does not allow a reversal posting. Only a definitive rejection triggers exactly a reversal posting.

Quality goals (non-functional)

Further reading
Local acceptance
Fictitious target: 95% of local administrative commands within 800 ms in the peak-load profile 20 transfers/s for 900 s = 18,000 transfers. External execution and media transfer shall be measured 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.

Protect available funds

Protect available funds

Check available funds in the same transaction as the debit.

Two transfers initially see 10,000 cents.

An invariant test must deliver a winner at two attempts of 7,000 cents each.

Alternative considered
A check before the transaction could let both transfers succeed.
Trade-off
Access to the same account is waiting for a short time.
Reassess
Measured account lock times exceed the response target.

Terms in this step

Protect available funds
An invariant test must deliver a winner at two attempts of 7,000 cents each.

Try it yourself

Run two transfers of 7,000 cents each against 10,000 cents in both orders. State the number of winners and the remaining balance.

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 atomic posting commit wins; the second sees only 3,000 cents and is rejected.
Second part of the solution
In reverse order, the other transfer wins. There are always 3,000 cents and exactly one original balanced posting set.

Apply to your project

Which corresponding assumption in your project would you check first? Use as an occasion: Measured account lock times exceed the response target.

Step 3: Measure account hotspots.