Loan Applications

Description

The Loan Application entity represents a user’s application for a loan. Applications go through underwriting and are either approved or rejected. Approved applications have a TTL and will expire if not converted to a loan within 24 hours.

Storage

Environment Table Name Region

test

test-loc-service

us-west-2

prod

prod-loc-service

us-east-2

Fields

Field Type Description

loc_user_id

String

User ID who owns the application

loc_loan_application_id

String

Unique application identifier (UUID)

loc_loan_id

String

Loan ID if application was converted (empty if not yet converted)

loc_loan_number

String

Pre-assigned loan number for this application

loc_loan_agreement_key

String

S3 key for the generated loan agreement PDF

loc_status

String

Application status: APPROVED, REJECTED, ABANDONED

loc_adverse_actions

Array

List of reasons if application was rejected

ttl

Integer

Unix timestamp for DynamoDB TTL (only for approved applications)

loc_loan_amount

Integer

Approved loan amount in cents

loc_fee_type

String

Fee type: fixed or percentage

loc_origination_fee

Integer

Origination fee amount in cents

loc_fee_percent

Float

Origination fee as a percentage

loc_total_amount

Integer

Total amount to repay in cents

loc_amount_disbursed

Integer

Amount to be sent to user in cents

loc_repayment_cadence

String

Payment frequency: biweekly

loc_installment_schedule

Array

Proposed installment schedule with amounts and due dates

loc_created_date

String

Creation timestamp (RFC3339)

loc_last_updated

String

Last update timestamp (RFC3339)

Status Values

Status Description

APPROVED

Application approved, awaiting user acceptance

REJECTED

Application rejected during underwriting

ABANDONED

Application expired without conversion to loan

Installment Schedule Format

{
  "loc_installment_schedule": [
    { "amount": 5000, "due_date": "2024-02-01" },
    { "amount": 5000, "due_date": "2024-02-15" },
    { "amount": 5000, "due_date": "2024-03-01" }
  ]
}

Keys and Indexes

Primary Key

Key Pattern

PK

USER#<user_id>

SK

LOANAPP#<loan_application_id>

Query Patterns

Query Index Key Condition Sort Key Condition

Get application by user and ID

Primary

PK = USER#<user_id>

SK = LOANAPP#<application_id>

List all applications for user

Primary

PK = USER#<user_id>

SK begins_with LOANAPP#

TTL and Expiration

Approved loan applications have a 24-hour TTL. When the TTL expires:

  1. DynamoDB automatically deletes the record

  2. The deletion triggers a DynamoDB Stream event

  3. The expiration handler processes the event

  4. If no loan was created, the application is re-saved with ABANDONED status

This ensures that approved applications that are never accepted are properly tracked and don’t remain in an indefinite approved state.

  • Loans - Loan created from this application