Skip to main content

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 areaWhat the business gets
1Loan productsLending products as data: schedule template, interest method, day-count convention, allocation precedence, fees, term bounds
2Schedule templatesVersioned, simulatable amortization definitions - preview any product before it opens a single account
3OriginationApplication capture, decision (approve/reject), and conversion to an open loan bound to a ledger account
4Schedule generationEqual-installment and equal-principal schedules over 30/360 and actual/365 conventions, with principal/interest/fee split per period
5DisbursementFull and tranche-based disbursement into a customer account, posted through the ledger
6Repayment & allocationRepayment capture with rule-driven precedence (penalty → fee → interest → principal) and per-period reconciliation
7Accrual & due processingDaily interest accrual booked to an accrual address, application to the account at cycle end, and due/overdue marking
8Delinquency & collectionsAgeing buckets, delinquency state, pause, and an officer collections queue
9Restructure & write-offReschedule/re-age, write-off, and charge-off - each audited and posted
10Collateral & guarantorsSecurity registration with valuation and coverage checks
11Domain eventsbank8:lending:* family (application, loan, repayment, accrual, delinquency, restructure, write-off)
12Health & opsHealth endpoint, metrics, audit journal

What the service does NOT own (business boundary):

Out of scopeOwned by
Money movement, balances, posting atomicityBank8:Ledger
Payment orchestration and schemesBank8:Payments
The book of account (GL, statements, period close)Bank8:Accounting
Prudential measurement (capital, liquidity, ECL)Bank8:Risk
Credit bureau and external scoringExternal providers (via Payments integrations)
AML detectionBank8:Compliance
Tenant-authored hook executionSentin8:Func
Schedule timingSentin8:Cron
Document bytes (agreements, statements)Sentin8:Storage

3. Business Capabilities​

CapabilityBusiness rule
Loan productsA 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 templatesA 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.
OriginationAn 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 generationA 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.
DisbursementDisbursement is a ledger posting. A partially disbursed loan reports remaining commitment; a tranche disbursement cannot exceed it.
RepaymentA repayment applies in the product's declared precedence. Overpayment produces a credit balance rather than a silent excess; the excess is refundable.
AccrualInterest 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.
DelinquencyA 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.
RestructureRescheduling replaces future unpaid periods; re-ageing resets the delinquency clock. Both are audited and preserve history - prior schedules are never deleted.
Write-offA 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.
CollateralCoverage is advisory: a loan may proceed under-covered if the product permits it, but the shortfall is recorded.
Tenant isolationEvery 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:

ConsequenceBusiness benefit
A new interest method or day-count is a template versionProduct launch is a data operation, not an engineering release
Every template can be simulated against synthetic stateThe bank sees the payment schedule before a customer does
Existing loans keep their opening versionA product change never retroactively alters a live contract
The template runs in the ledger's sandbox when it needs toBehaviour 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)​

EventFires when
bank8:lending:application:submittedAn application is captured
bank8:lending:application:approved / :rejectedA decision is recorded
bank8:lending:loan:openedAn approved application becomes a loan
bank8:lending:loan:disbursedPrincipal is disbursed (full or tranche)
bank8:lending:loan:repayment:appliedA repayment is allocated
bank8:lending:loan:accruedInterest accrual is booked for a date
bank8:lending:loan:delinquentA loan enters or changes delinquency state
bank8:lending:loan:restructuredA reschedule or re-age completes
bank8:lending:loan:written_offA loan is written off or charged off
bank8:lending:schedule:generated / :regeneratedA schedule is produced

5. Business Rules & Invariants​

  1. A loan cannot be disbursed before it is opened, and cannot be opened without an approved application.
  2. Every money movement posts through the ledger's public posting API - Lending never writes balances.
  3. Every movement is idempotent per its own key; retries are safe by construction.
  4. A generated schedule amortizes to zero within the currency scale; a non-closing schedule is rejected.
  5. Accrual is idempotent per (loan, date); the due cycle never double-posts.
  6. Delinquency events fire once per state transition, not per day.
  7. 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.
  8. A loan's product version is fixed at opening until explicitly migrated.

6. Target-User Roles & Use Cases​

RoleUse case
Credit officerReviews the queue, approves or rejects applications, disburses
Loan operationsCaptures repayments, resolves allocation questions, refunds overpayment
Collections officerWorks the arrears queue, pauses or restructures
Product managerAuthors and simulates schedule templates before launch
Risk officerConsumes delinquency and exposure events
AuditorTraces 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​

  1. An application can be submitted, approved, and converted to a loan with a bound ledger account.
  2. A preview for a known product produces a schedule matching a hand-calculated amortization to the cent.
  3. Disbursement, repayment, fee, accrual, and write-off each produce exactly one balanced ledger posting, idempotently.
  4. A cron retry of the accrual run does not double-accrue.
  5. A missed installment produces one delinquency event and appears on the collections queue.
  6. A restructure supersedes future periods without deleting history.
  7. 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.