Repository navigation
FINERACT-848: Add ability to define custom interest rate in fixed and recurring deposit accounts - #6405
FINERACT-848: Add ability to define custom interest rate in fixed and recurring deposit accounts#6405Eyad-Sharkawy wants to merge 1 commit into
Conversation
|
Hi @Aman-Mittal / reviewers, all 86 test and quality checks passed, but the regression-safety check was cancelled on the baseline step (Instance #1: The operation was canceled). Could someone with write permissions please re-run that failed job? Thank you |
20515cb to
1eeacd5
Compare
1eeacd5 to
6387330
Compare
|
I saw the announcement regarding FINERACT-2621, so I went ahead and rebased this PR to ensure full compatibility with the new Spring Boot 4.1 upgrade. |
6387330 to
d1a63b6
Compare
|
Hi @adamsaghy / @Aman-Mittal, I know the core team has been laser-focused on shipping the Working Capital epic recently! I just resolved a few minor Swagger conflicts to keep this branch perfectly up-to-date with develop. Since this is a larger domain feature (FINERACT-848), let me know if there is anything I can do to make the review process easier once the team has bandwidth to look at the general queue again. |
Sorry for being slow on PR review. I am facing an increased workload at the moment, but will try to review your PR ASAP. |
|
@Eyad-Sharkawy Can you please review the below concerns or mine? Gap? To handle the override, the PR moved the premature-closure penalty outside the chart != null block. It still ends with this.nominalAnnualInterestRate = applicableInterestRate; (FixedDepositAccount.java:193, RecurringDepositAccount.java:245).
This happens in a real API flow:
The RD endpoint works the same way. I traced this through the code but didn't run it. It's easy to demonstrate: calling the method from testFixedDepositEffectiveInterestRateWithOverriddenRateAndPrematureClosurePenalty a second time returns 0.055 instead of 0.065. Suggested fix? Don't write the penalised rate back to nominalAnnualInterestRate when the override is on. Alternatively, calculate the penalised rate in a local variable and leave the stored custom rate alone. -> Is this correct? Change not mentioned in the description The same move means FD accounts with no chart at all now get the premature-closure penalty. That happens when the product had no applicable chart (DepositAccountAssembler.java:308-313); before this PR, those accounts had no penalty. These accounts also get the drift bug above. This may be intended, but the description only talks about overridden accounts, so the author should either confirm it or keep the old behaviour. |
d1a63b6 to
71489d3
Compare
|
Thank you @adamsaghy for catching this! You are completely right on both counts: Premature Closure Rate DriftWhen Fix Applied
Unit Tests
|
85c2381 to
b9aeb1c
Compare
|
Hi @adamsaghy, just a quick update: all 90 CI checks are now passing, and all previous review feedback has been addressed. Ready for your final review whenever you have a chance. Thank you! |
galovics
left a comment
There was a problem hiding this comment.
Hi @Eyad-Sharkawy, thanks for the PR. The direction is fine and the unit tests are good, but the FD refactor changes behaviour for accounts that do not use the feature.
FixedDepositAccount.getEffectiveInterestRateAsFraction: the pre-closure penalty block and thethis.nominalAnnualInterestRate = applicableInterestRateassignment used to live insideif (this.chart != null). Now the penalty runs whenchart == nulltoo, so a non-overridden FD with no chart and a premature closure gets rate minus penalty, and the lowered rate is written back onto the entity, so calling it again lowers it a second time. Your idempotency test covers only the overridden case. Why not keep the original structure and just add&& !isRateChartOverridden()to the existing condition? If the new structure is intended, pls add a test for no-chart + not-overridden + premature closure.DepositAccountDataValidator(~580 and ~620): the two blocks are identical, extract a helper. On update,isRateChartOverridden=truerequiresnominalAnnualInterestRatein the same payload, so toggling the flag on an account that already has a rate is rejected - fall back to the stored value?zeroOrPositiveAmount()lets 0 through andvalidateDomainRulesrejects it later from another layer.- Toggling the flag back to
falseleaves the custom rate innominalAnnualInterestRateuntil the next recalculation. Intended? Please cover it with a test. Boolean isRateChartOverridden = false+parameterExistsin the assembler is one call withbooleanPrimitiveValueOfParameterNamed, andcreateNew/ the constructor should take a primitive. The flag is threaded through 8+instance/withTemplatefactories just to default to false - do the data classes need it at all?- Revert the reformat of
DEPOSIT_ACCOUNT_REQUEST_DATA_PARAMETERS(hides the one-line change) and check the response-data sets and template include the new param. - No integration test hits the API: create an FD/RD with
isRateChartOverridden=true, check interest and the GET, toggle on update. The DB column, mapper SQL and JSON parsing are not exercised. The 406-line test repeats its setup.
b9aeb1c to
915b1ab
Compare
|
Hi @galovics, thank you for the detailed and constructive review! I have addressed all points:
|
915b1ab to
fd026a9
Compare
Description
Resolves FINERACT-848.
Adds the ability to override product-level interest rate charts with a custom nominal annual interest rate for Fixed Deposit (FD) and Recurring Deposit (RD) accounts:
isRateChartOverriddenboolean flag to deposit account terms and data models.FixedDepositAccountandRecurringDepositAccountso that whenisRateChartOverriddenis enabled, custom nominal annual interest rate takes precedence and bypasses product chart slab lookups.DepositAccountRateChartOverriddenTest.Checklist