Eyad-Sharkawy commented on PR #6405: URL: https://github.com/apache/fineract/pull/6405#issuecomment-5895110473
Thank you @adamsaghy for catching this! You are completely right on both counts: #### Premature Closure Rate Drift When `isRateChartOverridden` is `true`, overwriting `this.nominalAnnualInterestRate` with `applicableInterestRate` after applying `applyPreMaturePenalty` caused each preview/calculation call (`calculatePrematureAmount`) to permanently mutate and lower the stored contract rate. #### Fix Applied - In both `FixedDepositAccount.java` and `RecurringDepositAccount.java`, the assignment `this.nominalAnnualInterestRate = applicableInterestRate;` has been moved strictly inside the `if (this.chart != null && !this.accountTermAndPreClosure.isRateChartOverridden())` block. - The premature penalty continues to be computed locally in `applicableInterestRate` and returned as the effective rate fraction without altering the persistent `nominalAnnualInterestRate` field. - For accounts without a chart where `preClosurePenalApplicable` is `true`, the penalty is now applied cleanly against the nominal rate as a local calculation without causing rate degradation across repeated calls. #### Unit Tests - Extended `DepositAccountRateChartOverriddenTest` to execute `getEffectiveInterestRateAsFraction(..., isPreMatureClosure=true)` multiple times sequentially, verifying that `nominalAnnualInterestRate` remains unaltered and the effective rate calculation is strictly idempotent. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
