Hi all, I am Senesh. I recently contributed a few fixes (FINERACT-2950, FINERACT-2954, FINERACT-2945). While reading the loan schedule code, I noticed something I would like to check with you before I open a ticket.
What I found (from code reading only): In LoanApplicationTerms.calculatePeriodsInOneYear(), for DAILY interest with DaysInYearType = ACTUAL on cumulative (declining balance) loans, the code uses DefaultPaymentPeriodsInOneYearCalculator.calculate(DAYS). That method returns a fixed 365. It never checks if the year is a leap year. The progressive engine (ProgressiveEMICalculator) does handle leap years: it uses 366 in a leap year and splits periods that cross a year boundary. So the same product setting (ACTUAL) gives different results depending on which schedule engine processes the loan. Related tickets I found: - FINERACT-2197 added leap-year-aware day counts, but its acceptance criteria say "Only supported for Progressive loans". - FINERACT-2492 (AprCalculator fix) treats ACTUAL resolving to 365 on cumulative loans as correct, and says it would automatically benefit from any future leap-year support. - FINERACT-1982 (open) asks for /365 vs /366 on daily charge accrual. That is charges, not loan interest. Example (my hand calculation from the formula, I have not run it yet): Declining balance, daily interest, ACTUAL/ACTUAL, 12% annual rate, 10,000 principal, disbursed 2024-01-01, first due date 2024-02-01 (31 days): - Current code: 10,000 x 12% x 31/365 = 101.92 - Leap-year aware: 10,000 x 12% x 31/366 = 101.64 My questions: 1. Is 365 for cumulative loans with ACTUAL intended legacy behavior, or should ACTUAL be leap-year aware there too? 2. If it should be fixed, would you prefer it as a bug ticket or as an improvement that extends FINERACT-2197 to cumulative loans? 3. I expect some existing integration tests with daily interest and 2024 dates may assert the 365-based numbers, and would need new expected values. Is that acceptable? I would be glad to open a JIRA ticket and work on a fix with a unit test, if you think it is worth doing. I wanted to ask first because FINERACT-2197 explicitly limited this to progressive loans. Thank you, Senesh GitHub: https://github.com/ImalkaPerera
