Eyad-Sharkawy commented on PR #6405:
URL: https://github.com/apache/fineract/pull/6405#issuecomment-6430860551

   Hi @adamsaghy, thank you for the sharp review and for catching these edge 
cases! All points have been addressed (and I have updated the PR description 
above to document these domain decisions):
   
   **1. Reinvestment 0% Interest Rate:**
   * In both `FixedDepositAccount.reInvest` and 
`RecurringDepositAccount.reInvest`, the new account now inherits the custom 
interest rate when `isRateChartOverridden` is true (`interestRate = 
this.accountTermAndPreClosure.isRateChartOverridden() ? 
this.nominalAnnualInterestRate : BigDecimal.ZERO`), rather than defaulting to 0.
   * Added unit tests in `DepositAccountRateChartOverriddenTest` verifying that 
reinvested accounts retain their custom rate and calculate interest properly.
   
   **2. Premature Closure Penalty for Overridden Accounts:**
   * In both `FixedDepositAccount` and `RecurringDepositAccount`, the premature 
closure penalty is now applied to custom rates when `isPreMatureClosure && 
isPreClosurePenalApplicable()`.
   * The calculation is performed in a local variable and is not written back 
to `this.nominalAnnualInterestRate`, ensuring full idempotency and zero rate 
drift during previews (`calculatePrematureAmount`) or premature closure.
   * Updated unit test 
`testFixedDepositEffectiveInterestRateWithOverriddenRateAndPrematureClosurePenalty`
 to assert the penalized rate (e.g., 7.5% - 1.0% = 6.5%) and verify that 
multiple invocations do not mutate the stored contract rate.
   * Added equivalent unit test 
`testRecurringDepositEffectiveInterestRateWithOverriddenRateAndPrematureClosurePenalty`.
   
   **3. Integration Test Gaps:**
   * Added `testFixedDepositAccountWithRateChartOverriddenEndToEnd()` in 
`FixedDepositTest`, which keeps the override enabled through approval, 
activation, and interest calculation, verifying that interest is calculated at 
the custom 10% rate.
   * Added equivalent end-to-end integration test 
`testRecurringDepositAccountWithRateChartOverriddenEndToEnd()` in 
`RecurringDepositTest`.


-- 
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]

Reply via email to