Bank8:Lending - Business Requirements & Functionality
Audience: product owners, credit officers, collections managers, and
anyone evaluating what Bank8:Lending does for the business. For
architecture read README.md; for wire-level detail read DESIGN.md.
1. Business Purpose
- Lending is a product line, not a ledger side-effect. Application,
decision, disbursement, repayment, delinquency, restructuring, and
write-off are first-class business objects with their own lifecycle -
on the same double-entry ledger the rest of the bank uses.
- Amortization is bank-authored data. A repayment schedule is
generated from a versioned, simulatable template: the bank shapes its
own products (interest method, day-count, allocation order) without
waiting for an engineering release, and previews the result before
launch.
- Every loan movement is a posting. Disbursement, repayment, fees,
accrual, and write-off all re-enter the ledger's posting pipeline, so
loan money obeys exactly the same invariants as a customer transfer:
balanced, idempotent, audited, tenant-isolated.
- Delinquency is measured, not noticed. Arrears are computed from
the schedule on every due cycle and surfaced as events to Risk and
Compliance before a customer calls.
2. Business Scope (What the Service Provides)
| # | Capability area | What the business gets |
|---|
| 1 | Loan products | Lending products as data: schedule template, interest method, day-count convention, allocation precedence, fees, term bounds |
| 2 | Schedule templates | Versioned, simulatable amortization definitions - preview any product before it opens a single account |
| 3 | Origination | Application capture, decision (approve/reject), and conversion to an open loan bound to a ledger account |
| 4 | Schedule generation | Equal-installment and equal-principal schedules over 30/360 and actual/365 conventions, with principal/interest/fee split per period |
| 5 | Disbursement | Full and tranche-based disbursement into a customer account, posted through the ledger |
| 6 | Repayment & allocation | Repayment capture with rule-driven precedence (penalty → fee → interest → principal) and per-period reconciliation |
| 7 | Accrual & due processing | Daily interest accrual booked to an accrual address, application to the account at cycle end, and due/overdue marking |
| 8 | Delinquency & collections | Ageing buckets, delinquency state, pause, and an officer collections queue |
| 9 | Restructure & write-off | Reschedule/re-age, write-off, and charge-off - each audited and posted |
| 10 | Collateral & guarantors | Security registration with valuation and coverage checks |
| 11 | Domain events | bank8:lending:* family (application, loan, repayment, accrual, delinquency, restructure, write-off) |
| 12 | 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 |
| Payment orchestration and schemes | Bank8:Payments |
| The book of account (GL, statements, period close) | Bank8:Accounting |
| Prudential measurement (capital, liquidity, ECL) | Bank8:Risk |
| Credit bureau and external scoring | External providers (via Payments integrations) |
| AML detection | Bank8:Compliance |
| Tenant-authored hook execution | Sentin8:Func |
| Schedule timing | Sentin8:Cron |
| Document bytes (agreements, statements) | Sentin8:Storage |
3. Business Capabilities
| Capability | Business rule |
|---|
| Loan products | A lending product declares a schedule template, interest method, day-count convention, allocation order, and parameter bounds. Changing a product creates a new version; existing loans keep the version they were opened with until migrated. |
| Schedule templates | A template is versioned and simulatable. A preview writes nothing and is journaled, so a product decision has an evidence trail before it reaches a customer. |
| Origination | An application moves draft → submitted → approved or rejected. Approval requires an audited actor. A loan can only be opened from an approved application, and opening it creates and binds a ledger account in the same flow. |
| Schedule generation | A schedule must amortize exactly: the sum of principal installments equals the disbursed principal, and the final period closes the balance to zero within the currency's scale. A schedule that does not close is rejected, never corrected by a rounding plug. |
| Disbursement | Disbursement is a ledger posting. A partially disbursed loan reports remaining commitment; a tranche disbursement cannot exceed it. |
| Repayment | A repayment applies in the product's declared precedence. Overpayment produces a credit balance rather than a silent excess; the excess is refundable. |
| Accrual | Interest accrues daily to an accrual address and is applied to the account at the cycle boundary. Accrual is idempotent per (loan, date) - a cron retry never double-accrues. |
| Delinquency | A loan is delinquent when a scheduled installment is unpaid past its due date plus grace. Delinquency state transitions emit events once per transition, never once per day. |
| Restructure | Rescheduling replaces future unpaid periods; re-ageing resets the delinquency clock. Both are audited and preserve history - prior schedules are never deleted. |
| Write-off | A write-off posts the outstanding principal and interest to the bank's write-off accounts and moves the loan to a terminal state. It is not a delete. |
| Collateral | Coverage is advisory: a loan may proceed under-covered if the product permits it, but the shortfall is recorded. |
| Tenant isolation | Every row is environment-scoped and row-level-security enforced. |
3.1 Why lending is data, not code
Most cores compile a small set of amortization methods into the schema
and require a change request for the fourteenth product variant.
Bank8:Lending treats the schedule definition as versioned data that can
be simulated before activation:
| Consequence | Business benefit |
|---|
| A new interest method or day-count is a template version | Product launch is a data operation, not an engineering release |
| Every template can be simulated against synthetic state | The bank sees the payment schedule before a customer does |
| Existing loans keep their opening version | A product change never retroactively alters a live contract |
| The template runs in the ledger's sandbox when it needs to | Behaviour that must execute stays isolated from the posting transaction |
3.2 Ready-made lending products (a starting point, not a ceiling)
Seeding provides conventional shapes - unsecured personal loan, secured
term loan, line of credit, mortgage, and BNPL - with default templates
and allocation orders. Every parameter, template, and mapping is
editable; an institution with an entirely different lending model
(murabaha, cooperative lending, agricultural seasonal credit) composes
its own without a code change.
4. Business Events (Outbound)
| Event | Fires when |
|---|
bank8:lending:application:submitted | An application is captured |
bank8:lending:application:approved / :rejected | A decision is recorded |
bank8:lending:loan:opened | An approved application becomes a loan |
bank8:lending:loan:disbursed | Principal is disbursed (full or tranche) |
bank8:lending:loan:repayment:applied | A repayment is allocated |
bank8:lending:loan:accrued | Interest accrual is booked for a date |
bank8:lending:loan:delinquent | A loan enters or changes delinquency state |
bank8:lending:loan:restructured | A reschedule or re-age completes |
bank8:lending:loan:written_off | A loan is written off or charged off |
bank8:lending:schedule:generated / :regenerated | A schedule is produced |
5. Business Rules & Invariants
- A loan cannot be disbursed before it is opened, and cannot be opened
without an approved application.
- Every money movement posts through the ledger's public posting API -
Lending never writes balances.
- Every movement is idempotent per its own key; retries are safe by
construction.
- A generated schedule amortizes to zero within the currency scale; a
non-closing schedule is rejected.
- Accrual is idempotent per (loan, date); the due cycle never
double-posts.
- Delinquency events fire once per state transition, not per day.
- History is never deleted: restructure adds a new schedule version and
supersedes the old one; write-off is a terminal state with postings,
not a row removal.
- A loan's product version is fixed at opening until explicitly
migrated.
6. Target-User Roles & Use Cases
| Role | Use case |
|---|
| Credit officer | Reviews the queue, approves or rejects applications, disburses |
| Loan operations | Captures repayments, resolves allocation questions, refunds overpayment |
| Collections officer | Works the arrears queue, pauses or restructures |
| Product manager | Authors and simulates schedule templates before launch |
| Risk officer | Consumes delinquency and exposure events |
| Auditor | Traces any loan from application to every posting it produced |
7. KPIs / Success Criteria
- Schedule generation closes every loan to zero, with zero rounding
plugs.
- Disbursement-to-posting latency ≤ seconds.
- Zero double-posted accruals or repayments across cron retries.
- Arrears visible on the collections queue on the due cycle, not days
later.
- Every loan movement traceable to a ledger posting id.
8. Dependencies & Reliance on Other Services
- Bank8:Ledger - accounts for loans and customers; the posting API
for every movement; the seeded internal accounts for interest and fee
income, accrual, and write-off.
- Sentin8:Bus - events in and out.
- Sentin8:Cron - accrual, due, and delinquency cycle timing.
- Sentin8:Flow - multi-step workflows (origination, disbursement,
restructure).
- Sentin8:Func - optional tenant-authored behaviour around the
schedule.
- Bank8:Accounting - consumes loan postings for the book.
- Bank8:Risk, Bank8:Compliance - consume delinquency events.
- Sentin8:Storage - agreement and statement documents.
9. Acceptance Criteria
- An application can be submitted, approved, and converted to a loan
with a bound ledger account.
- A preview for a known product produces a schedule matching a
hand-calculated amortization to the cent.
- Disbursement, repayment, fee, accrual, and write-off each produce
exactly one balanced ledger posting, idempotently.
- A cron retry of the accrual run does not double-accrue.
- A missed installment produces one delinquency event and appears on
the collections queue.
- A restructure supersedes future periods without deleting history.
- A write-off posts to the write-off accounts and terminally closes the
loan.
10. Open Business Questions
- Whether tranche disbursement is offered on all products or only on
commercial shapes.
- Grace-period semantics for revolving products (does grace apply per
draw or per statement cycle?).
- Whether external credit-bureau decisions are recorded here or remain
in Payments integrations.
Architecture & Design: bank8:lending and its underlying concepts were designed by Hamid Jahanzad.