Bank8:Branch - Business Requirements & Functionality
Audience: branch operations managers, head tellers, finance operations, and anyone evaluating what Bank8:Branch does for the business. For architecture read
README.md; for wire-level detail readDESIGN.md.
1. Business Purpose
- Cash is a position, not a memo. Every note in a drawer, the vault, and in transit is an accountable position with a server-side record - not a running total a teller keeps on a terminal.
- The branch has a shape. Offices form a hierarchy with staff attached to them, so authority, reporting, and cash limits follow the organisation the bank actually runs - not a flat list of users.
- Shift balancing is evidence, not arithmetic on the client. A teller's expected cash is computed from the movements the bank recorded; a variance is a discrepancy someone must explain, and the summary is generated server-side so it cannot be edited.
- Counter work reconciles to the book. Cash deposits, withdrawals, and vault movements post to the ledger against the seeded cash, clearing, and suspense accounts, so the branch's physical cash and the bank's book must agree.
2. Business Scope (What the Service Provides)
| # | Capability area | What the business gets |
|---|---|---|
| 1 | Office hierarchy | A governed tree of branches, sub-branches, and back-office units with subtree querying |
| 2 | Staff | Staff records bound to offices, as the basis for teller rights and reporting scope |
| 3 | Tellers | Named cash-handling positions within an office, with limits |
| 4 | Cashier sessions | Open and close a shift with an expected-versus-counted reconciliation |
| 5 | Cash allocation | Float from vault to teller, teller to teller, and teller to vault - each a ledger posting |
| 6 | Denomination counts | Cash counted by note/coin, so a shift close totals to a physical count, not an estimate |
| 7 | Shift summary | A server-generated, immutable record of a teller's shift: movements, expected cash, counted cash, variance |
| 8 | Vault position | The branch's own cash position, by denomination |
| 9 | Cash in transit | Funds handed between branches or to a cash logistics provider |
| 10 | Domain events | bank8:branch:* family (cashier, cash, vault) |
| 11 | Health & ops | Health endpoint, metrics, audit journal |
What the service does NOT own (business boundary):
| Out of scope | Owned by |
|---|---|
| Money movement, balances, posting atomicity | Bank8:Ledger |
| The book of account (GL, statements, close) | Bank8:Accounting |
| Customer records and accounts | Bank8:Ledger |
| Teller UI and customer interaction | apps/eteller |
| Staff identity and sign-in | Sentin8:Auth (Branch holds the business record, not credentials) |
| Delegation and approval journeys | Sentin8:BFF / Sentin8:Auth |
| Payment schemes | Bank8:Payments |
3. Business Capabilities
| Capability | Business rule |
|---|---|
| Office hierarchy | An office has a parent except the head office; its hierarchy path supports subtree queries. An office with open cashier sessions or assigned staff cannot be deactivated - it can only be closed after the work is settled. |
| Staff | A staff record belongs to exactly one office at a time; a transfer is an audited change. Staff are not credentials - identity stays with the platform. |
| Tellers | A teller belongs to an office and carries cash limits (per-transaction and per-shift). Limits are enforced when cash leaves the drawer, not on a report afterwards. |
| Cashier session | A teller must open a session before handling cash and close it before leaving. A session close records counted cash per denomination; the variance (counted minus expected) is stored, never adjusted away. |
| Cash allocation | Every allocation is a ledger posting between the drawer, vault, and clearing accounts. An allocation cannot exceed the source's available cash. |
| Shift summary | Generated server-side from recorded movements. Once a session closes the summary is immutable; a correction is a new, audited adjustment - not an edit. |
| Vault position | The vault's position is derived from allocation and settlement movements; it is never typed in. |
| Cash in transit | Funds leave a source drawer or vault as an in-transit position and land at the destination only when received - an unreceived transfer is visible, not lost. |
| Tenant isolation | Every row is environment-scoped and row-level-security enforced. |
3.1 Why cash control is server-side
A teller terminal that keeps a local session log can be refreshed, closed, or reloaded into an inconsistent state - and a variance then has no evidence. Bank8:Branch computes expected cash from the movements the bank actually recorded, requires a physical count, and stores the variance.
| Consequence | Business benefit |
|---|---|
| Shift summary is reproducible at any time | An audit reproduces the shift, rather than trusting a cached screen |
| Variance is a first-class number | Discrepancies are quantified and owned, not rounded into a total |
| Drawer cash is a ledger position | Branch cash and the book of account must agree |
| Limits are enforced at the drawer | A teller cannot exceed authority even if the UI is bypassed |
4. Business Events (Outbound)
| Event | Fires when |
|---|---|
bank8:branch:office:created / :updated | Office structure changes |
bank8:branch:staff:created / :updated | Staff assigned or transferred |
bank8:branch:teller:created / :updated | A teller is created or its limits change |
bank8:branch:cashier:opened / :closed | A shift opens or closes |
bank8:branch:cash:allocated | Float moves between vault, drawer, or teller |
bank8:branch:cash:settled | Cash is settled back to the vault |
bank8:branch:cash:variance | A shift closes with a non-zero variance |
bank8:branch:vault:transferred | A vault transfer or cash-in-transit movement |
5. Business Rules & Invariants
- Cash cannot move without an open cashier session at the source, and cannot move to a teller without one at the destination.
- Every cash movement is a ledger posting - Branch never holds a cash balance of its own.
- An allocation cannot exceed the source's available cash or the teller's limit.
- A closed session's summary is immutable; corrections are audited adjustments.
- Variance is recorded, never suppressed - a zero variance is a positive assertion, not a default.
- Cash in transit lands only on receipt.
- An office or staff record with open work cannot be deactivated.
- Branch never writes another service's tables.
6. Target-User Roles & Use Cases
| Role | Use case |
|---|---|
| Head teller | Opens the branch day, allocates floats, settles drawers, reviews variances |
| Teller | Opens a shift, handles counter cash, counts out at close |
| Branch manager | Defines office structure, assigns staff, sets teller limits |
| Finance operations | Reconciles branch cash to the book via the ledger |
| Auditor | Reproduces any shift summary and traces every movement to a posting |
7. KPIs / Success Criteria
- Every closed shift has a counted figure and a recorded variance.
- Zero cash movements without a posting.
- Branch cash reconciles to the ledger cash accounts at close of day.
- Cash-in-transit age visible; no unreceived transfer older than policy.
- Variance trend per teller and per branch available to management.
8. Dependencies & Reliance on Other Services
- Bank8:Ledger - the posting API for every cash movement; the seeded cash, clearing, and suspense internal accounts.
- Sentin8:Bus - events out.
- Sentin8:Auth - staff identity and sign-in (Branch holds the business record only).
- Sentin8:BFF - delegated counter operations.
- apps/eteller - the terminal that drives sessions and counts.
- Bank8:Accounting - consumes cash postings.
9. Acceptance Criteria
- A teller cannot record a cash movement without an open session.
- Opening a shift, depositing, and closing produces a server-generated summary whose expected cash equals the sum of recorded movements.
- A counted figure different from expected records a variance and emits
cash:variance. - An allocation beyond available cash or beyond the teller limit is refused.
- A closed summary cannot be edited; an adjustment creates a new audited record.
- Cash in transit appears at the destination only after receipt.
10. Open Business Questions
- Whether the vault is a teller position or a distinct object (current design: distinct, so vault and drawer reconcile separately).
- Multi-currency drawers: one drawer per denomination, or a counted breakdown across denominations in a single drawer?
- Whether cash-in-transit is internal (branch to branch) only, or also to external logistics providers.
Architecture & Design: bank8:branch and its underlying concepts were designed by Hamid Jahanzad.