Skip to content

CPF: Create RSS (Retirement Sum Scheme) Backend Calculator #180

@jcleow

Description

@jcleow

Priority: P2 (Medium)
Effort: Medium (4-6h)
Dependencies: #154, #155

Description

Implement backend calculator for RSS (Retirement Sum Scheme) payout estimates. RSS is for CPF members who do not meet the minimum RA balance ($60K MRS) required for CPF LIFE at age 65.

Background

Currently, RSS calculations exist only in the frontend (useRAConversion.ts). This should be moved to the backend for consistency with other CPF calculators.

New Files

  • backend/internal/cpf/retirement/rss.go
  • backend/internal/cpf/retirement/rss_test.go

New Endpoint

POST /api/v2/cpf/calculators/rss-estimate

Request

{
  "ra_balance_at_65": 45000,
  "target_payout_years": 25,
  "interest_rate": 0.04
}

Response

{
  "monthly_payout": 150.00,
  "years_of_payout": 22.5,
  "depletion_age": 87.5,
  "total_payout": 40500.00
}

Calculation Logic

  1. Monthly Payout: RA balance / (target years × 12)
  2. Actual Duration: Present value calculation accounting for 4% RA interest
  3. Depletion Age: 65 + actual duration

Formula (with interest)

PV = PMT × [(1 - (1 + r)^-n) / r]
Solve for n: n = -ln(1 - PV×r/PMT) / ln(1 + r)

Frontend Integration

  • Update useRAConversion.ts to call backend API instead of local calculation
  • Remove duplicate calculation logic from frontend

Acceptance Criteria

  • Calculate monthly payout for given RA balance
  • Account for RA interest (4%) during drawdown
  • Calculate actual years of payout
  • Calculate depletion age
  • Unit tests for various balance scenarios
  • Frontend updated to use backend API

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium prioritycpfCPF/retirement related

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions