Loans
Description
The Loan entity represents an active or completed installment loan. Loans are created when a user accepts a loan application and funds are disbursed. Each loan has an associated set of installments that define the repayment schedule.
Storage
| Environment | Table Name | Region |
|---|---|---|
test |
test-loc-service |
us-west-2 |
prod |
prod-loc-service |
us-east-2 |
Fields
| Field | Type | Description |
|---|---|---|
|
String |
User ID who owns the loan |
|
String |
Unique loan identifier (UUID) |
|
String |
Reference to the originating loan application |
|
String |
Human-readable loan number (e.g., "FM-000001") |
|
Integer |
Principal loan amount in cents |
|
Integer |
Origination fee amount in cents |
|
Float |
Origination fee as a percentage |
|
String |
Fee type: |
|
Integer |
Total amount owed (principal + fee) in cents |
|
Integer |
Amount sent to user (total - fee) in cents |
|
Integer |
Current remaining balance in cents |
|
String |
Loan status: |
|
String |
Payment frequency: |
|
String |
Date funds were sent to user (RFC3339) |
|
String |
Method used: |
|
String |
Date loan was fully paid off (RFC3339) |
|
String |
Last 4 digits of disbursement account |
|
String |
Disbursement confirmation ID from payments service |
|
Boolean |
Whether autopay is enabled for this loan |
|
String |
Creation timestamp (RFC3339) |
|
String |
Last update timestamp (RFC3339) |
Keys and Indexes
GSI1 - Loans by User and Status
Used to list all loans for a user in a specific status.
| Key | Pattern |
|---|---|
GSI1PK |
|
GSI1SK |
|
Query Patterns
| Query | Index | Key Condition | Sort Key Condition |
|---|---|---|---|
Get loan by user and loan ID |
Primary |
|
|
List all loans for a user |
GSI2 |
|
|
List loans for user in status |
GSI1 |
|
|
Get loan by application ID |
GSI3 |
|
|
Status Transitions
┌──────────────────────┐
│ OPEN │
│ (Active loan with │
│ outstanding balance)│
└──────────┬───────────┘
│
┌────────────────┼────────────────┐
│ │ │
▼ ▼ ▼
┌────────────────┐ ┌──────────┐ ┌────────────────┐
│ CLOSED │ │ DEFAULTED│ │ OPEN │
│ (Fully paid) │ │ (Default)│ │ (Ongoing) │
└────────────────┘ └──────────┘ └────────────────┘
Related Entities
-
Installments - Payment schedule for this loan
-
Payments - Payment transactions for this loan
-
Loan Applications - Originating application