-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
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.gobackend/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
- Monthly Payout: RA balance / (target years × 12)
- Actual Duration: Present value calculation accounting for 4% RA interest
- 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.tsto 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
Reactions are currently unavailable