LOC Service Documentation
Overview
The LOC Service is a multi-product lending platform built as AWS Lambda functions with a DynamoDB backend. It hosts two distinct products that share common infrastructure (payments, notifications, feature flags, DynamoDB helpers) while keeping product-specific business logic fully isolated.
| Product | Description |
|---|---|
Installment Loan ( |
Fixed-term installment loans with biweekly payment schedules, automated collections, ACH/pinless disbursement and repayment, and PDF loan agreement generation. |
Credit Line ( |
Revolving line of credit with a draw period, monthly billing cycle (interest accrual, statement generation, minimum payment calculation), and RTP→Pinless→ACH disbursement. |
Installment Loan Features
-
Loan Applications — Underwriting, approval/rejection, and loan term generation
-
Loan Disbursements — Sending funds via ACH or pinless debit
-
Installment Scheduling — Biweekly payment schedules with flexible due dates
-
Automated Collections — Scheduled jobs for autopay, notifications, and retries
-
Payment Processing — ACH and pinless debit with webhook handling
-
Loan Agreement Generation — PDF agreements via LaTeX templates
-
Audit Logging — Complete payment and installment change history via DynamoDB streams
Credit Line Features
-
Application & KYC — MLA check, credit limit offer, agreement PDF, TTL expiry handling
-
Draw Period — RTP→Pinless→ACH disbursement, fixed or membership-gated draw period
-
Monthly Billing — Interest accrual, statement generation, minimum payment calculation
-
Collections — Autopay and manual payment notifications with 14-day grace window
-
Repayment Period — Transition triggered by membership downgrade or fixed draw period expiry
Lambda Functions
Installment Loan
| Lambda | Description | Trigger |
|---|---|---|
|
REST API — loan applications, disbursements, payments, queries |
API Gateway |
|
Processes ACH/pinless payment webhooks (returns, completions, chargebacks) |
Kinesis Stream |
|
Queries installments due and enqueues payment events |
CloudWatch Events |
|
Executes payment collection from SQS queue |
SQS Queue |
|
Loan balance reconciliation |
SQS Queue |
|
Generates PDF loan agreements using LaTeX templates |
SQS / Direct Invoke |
|
Creates audit log entries from DynamoDB stream events |
DynamoDB Streams |
Credit Line
| Lambda | Description | Trigger |
|---|---|---|
|
REST API — draw requests, account queries, payment management |
API Gateway |
|
Monthly billing: accrues interest, generates statement, calculates NextMinPaymentDue |
CloudWatch Events |
|
loc_due / loc_overdue / loc_upcoming collection and notification jobs |
CloudWatch Events |
|
Processes ACH/RTP payment webhooks (returns, chargebacks) |
Kinesis Stream |
|
Transitions FIXED draw period lines to repayment when DrawPeriodEnd is reached |
CloudWatch Events |
Development
For development setup and commands, see the README.md.
make generate.host # Regenerate code from OpenAPI spec + mocks
make test.host # Run tests with coverage
make lint.host # Run all linters
make format.host # Format code
make build.host # Build all Lambda binaries