Fintech · Backend
LAPO Agency Banking
Agent onboarding and agent-assisted customer account opening for a microfinance bank’s new agency banking platform, built around four-eyes approval, idempotency and architectural boundaries that tests enforce.
- Role
- Backend engineer, Onboarding squad (I own agent onboarding)
- Period
- Oct 2026 – Present
- Status
- In development · pre-launch
- Stack
- Kotlin
- Spring Boot
- JDBC
- ArchUnit
- Testcontainers
- WireMock
- OpenAPI 3.1
- Azure DevOps
The platform hasn’t launched yet, so this page covers scope and engineering decisions rather than usage metrics. Internal names and identifiers are omitted.
Context
Agency banking lets a bank serve customers through trusted local agents with POS terminals instead of branches. I work on the Onboarding squad, which builds two Kotlin / Spring Boot services:
- Agent service: agent authentication and sessions, agent onboarding and lifecycle controls, terminal assignment, and read-only core banking integration for account eligibility and live balance enquiry.
- Account-opening service: agent-assisted customer account opening from POS terminals.
Journey 1 — Onboarding an agent
The main rule: reuse what the bank already knows. A prospective agent must already hold an eligible operating account in core banking. We don’t open a new account, create a parallel float wallet or repeat KYC the bank already holds.
- Validate the account against core banking.
- Verify ownership with an OTP sent only to the phone number registered in core banking.
- Deduplicate against existing active agents and open applications.
- Capture only what’s agent-specific: service-point address, GPS coordinates, agency terms and privacy consent, and due-diligence evidence.
- Maker-checker approval. One independent four-eyes approval in the back office. Whoever initiates or reviews an application can never approve it.
- Provision. Approval issues a permanent Agent ID. Operations then links the terminal and location, confirms handover, and activates the agent, which sends a temporary password by SMS.
Journey 2 — Agent-assisted account opening
- Eligibility on every request. Only an active agent on an active, assigned terminal can start a request. This is checked against the agent service each time.
- KYC done properly. Documents go to encrypted object storage after file-signature, size and malware checks. The service validates BVN/NIN with the bank’s identity service, checks for duplicate customers and in-flight requests, requires live facial matching, and records consent that the customer controls.
- Submitted once, settled safely. Each request carries an
Idempotency-Keyand a unique reference. If a partner system times out, the request staysPENDING(202 Accepted). A background status-enquiry worker then settles it by reference instead of retrying blindly, which could open duplicate accounts.
Architecture
Hexagonal architecture, enforced by tests. ArchUnit tests check the ports-and-adapters boundaries on every build. The domain layer has no Spring, HTTP or database dependencies, and integration DTOs never leave the integration package.
Plain JDBC on purpose. We use Spring’s JdbcClient instead of JPA/Hibernate, and ArchUnit enforces that too. This gives us explicit SQL, pessimistic row locks and optimistic version checks, so state transitions stay safe under concurrent requests.
Stateless agent tokens. The agent service signs short-lived (15-minute) RS256 JWTs. Downstream services verify them locally with a public key, so there’s no auth call on every request. Live agent and terminal eligibility is still checked where it matters.
Security & data protection
- No trust in client-supplied identifiers. For a balance enquiry, the account comes only from the verified token’s agent and terminal claims, via the active terminal assignment, never from request parameters. Balances are never cached or stored.
- PII protection in layers. Sensitive fields are encrypted at rest with AES-256-GCM, with blind-index hashes for lookups. They are masked in responses and structured logs (
0123****89). Error bodies from partner systems are never shown to clients or logged. - Four-eyes rules in two places: in the domain model and as database
CHECKconstraints.
Testing
Every layer is tested against something real:
| Layer | Approach |
|---|---|
| Domain | Pure unit tests, with no framework |
| Web | @WebMvcTest slices for security rules and response formats |
| Integrations | WireMock, testing partner 500s, timeouts and empty 200s |
| Persistence | Testcontainers integration tests against a real database and real migrations |
| Contract | Automated OpenAPI 3.1 test that fails the build if any endpoint or response code is undocumented |
What I took from it
Financial systems reward being explicit: explicit SQL, explicit state transitions, explicit boundaries, and tests that keep them that way. That’s the standard I want to keep building to.