LOC Service Documentation

Overview

The LOC (Line of Credit) Service is an installment loan service built as AWS Lambda functions with a DynamoDB backend. It handles the complete loan lifecycle including applications, disbursements, installment scheduling, payment collections, and loan agreement generation.

High-Level Features

  • Loan Applications - Underwriting, approval/rejection, and loan term generation

  • Loan Disbursements - Sending funds to users via ACH or pinless debit

  • Installment Scheduling - Biweekly payment schedules with flexible due dates

  • Automated Collections - Scheduled jobs for autopay, notifications, and payment retries

  • Payment Processing - ACH and pinless debit payment methods with webhook handling

  • Loan Agreement Generation - PDF loan agreements generated via LaTeX templates

  • Audit Logging - Complete payment and installment change history via DynamoDB streams

Services

The LOC Service consists of several Lambda functions:

Service Description Trigger

API

Main REST API handling loan applications, disbursements, payments, and queries

API Gateway

ACH Handler

Processes payment webhooks from the payments service (ACH returns, completions)

Kinesis Stream

Collections Job

Scheduled job that queries installments and enqueues payments for processing

CloudWatch Events

Collections Worker

Processes payment events from SQS queue, executes actual payment collection

SQS Queue

Expiration Handler

Handles TTL expiration events for abandoned loan applications

DynamoDB Streams

Agreements Generator

Generates PDF loan agreements using LaTeX templates

SQS Queue / Direct Invoke

Log Handler

Creates audit log entries from DynamoDB stream events

DynamoDB Streams

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