Installments
Description
The Installment entity represents a scheduled payment within a loan’s repayment plan. Each loan has multiple installments based on its repayment cadence (e.g., biweekly). Installments track their due dates, amounts, and payment applications.
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 installment |
|
String |
Loan this installment belongs to |
|
String |
Unique installment identifier (UUID) |
|
Integer |
Total installment amount in cents |
|
Integer |
Remaining balance in cents |
|
String |
Installment status (see Status Values below) |
|
String |
Due date in YYYY-MM-DD format |
|
String |
Process that last updated this installment |
|
Array |
List of payments applied to this installment |
|
String |
Reason for last update (for audit logging) |
|
String |
Creation timestamp (RFC3339) |
|
String |
Last update timestamp (RFC3339) |
Keys and Indexes
Query Patterns
| Query | Index | Key Condition | Sort Key Condition |
|---|---|---|---|
Get installment by ID |
Primary |
|
|
List installments for loan |
Primary |
|
|
List scheduled installments due today |
GSI1 |
|
|
List overdue scheduled installments |
GSI1 |
|
|
List installments for user’s loan by date |
GSI2 |
|
|
Status Transitions
┌──────────────────────┐
│ SCHEDULED │
│ (Payment pending) │
└──────────┬───────────┘
│
┌─────────────────────┼─────────────────────┐
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ COMPLETED │ │ OVERDUE │ │ DEFAULTED │
│ (Fully paid) │ │ (Past due) │ │ (Default) │
└─────────────────┘ └────────┬────────┘ └─────────────────┘
│
┌──────────▼───────────┐
│ COMPLETED │
│ (Paid after due) │
└──────────────────────┘
Payment Applications
When a payment is applied to an installment, an entry is added to loc_applications:
{
"loc_applications": [
{
"payment_id": "pay-123",
"installment_id": "inst-456",
"amount": 2500,
"payment_date": "2024-01-15T12:00:00Z"
},
{
"payment_id": "pay-789",
"installment_id": "inst-456",
"amount": 2500,
"payment_date": "2024-01-16T12:00:00Z"
}
]
}
An installment is marked COMPLETED when loc_outstanding_balance reaches zero.
Outstanding Balance Calculation
The outstanding balance is calculated as:
outstanding_balance = total_amount - sum(applications.amount)
This calculation is performed when saving the installment and verified against the stored loc_outstanding_balance field.
Related Entities
-
Loans - Parent loan for this installment
-
Payments - Payments applied to this installment
-
Installment Logs - Audit trail for this installment