FINERACT-2556: Prevent no-op updates for approved amount modification#5696
FINERACT-2556: Prevent no-op updates for approved amount modification#5696devi-pathak2263 wants to merge 1 commit intoapache:developfrom
Conversation
|
@devi-pathak2263 This PR seems not much to do with FINERACT-2541.... |
|
@devi-pathak2263 Please follow PR and commit title naming conventions: |
Thanks for the feedback! This is a small follow-up improvement related to FINERACT-2541. While reviewing the existing implementation, I noticed that updating the approved amount with the same value still triggers history creation and events. This PR adds validation to prevent such no-op updates and includes test coverage for it. Please let me know if you’d prefer this to be linked to a separate issue instead. |
FINERACT-2541 is for external investor related changes... This PR is for loan approval... it's defo not relevant to FINERACT-2541 :) |
Thanks for the clarification, and apologies for the confusion! I understand now that this is not related to FINERACT-2541. I came across this while reviewing the implementation and thought it might fit as a follow-up, but I see the distinction now. I’ll create a separate JIRA issue for this improvement and update the PR accordingly. Thanks again for the guidance! |
|
|
||
| BigDecimal newApprovedAmount = command.bigDecimalValueOfParameterNamed(LoanApiConstants.amountParameterName); | ||
|
|
||
| if (newApprovedAmount.compareTo(loan.getApprovedPrincipal()) == 0) { |
There was a problem hiding this comment.
Seems like duplicated code: Make and helper function, and maintain constants for long strings
There was a problem hiding this comment.
Thanks for the suggestion! I’ve refactored the duplicated validation into a helper method and extracted the error message into a constant.
…ation test (FINERACT-2541)
6371d6b to
2ce1a10
Compare
|
Looks like some CI jobs failed due to dependency resolution issues and timeouts. Could someone please re-run the checks when possible? Thanks! |
Description
This PR implements FINERACT-2556.
Currently, updating the approved amount with the same value still triggers unnecessary history entries and business events.
Such no-op updates:
This change adds validation to ensure that the approved amount is different from the current value, preventing no-op updates.
Also includes integration test coverage for this scenario.
This can be considered a small improvement to ensure only meaningful updates are processed.
JIRA: https://issues.apache.org/jira/browse/FINERACT-2556