-
Notifications
You must be signed in to change notification settings - Fork 2.2k
FINERACT-2421: Reprocess Interest Refund txn amount if no txn was changed #5218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
|
||
| loanTransactionHelper.reverseLoanTransaction(loanId, repaymentResponse.getResourceId(), | ||
| new PostLoansLoanIdTransactionsTransactionIdRequest().dateFormat(DATETIME_PATTERN) | ||
| .transactionDate("25 January 2021").transactionAmount(0.0).locale("en")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alberto-art3ch I think transaction date is incorrect here - I assume it should be 20 January 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved, thanks!
| final Money newAmount = interestBeforeRefund.minus(progCtx.getSumOfInterestRefundAmount()).minus(interestAfterRefund); | ||
| loanTransaction.updateAmount(newAmount.getAmount()); | ||
| } | ||
| final Money interestAfterRefund = interestRefundService.totalInterestByTransactions(this, loan.getId(), targetDate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am seeing you have removed the condition check for !modifiedTransactions.isEmpty(), is there is any specific usecase for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aman-Mittal This check was preventing any recalculation in case no transactions were changed prior interest refund. While in many situations it can be considered as "optimization", but there are edge cases where it would be crucial to recalculate interest refund amount anyway, so it is safer to remove this optimization and allow the system to recalculate.
64c4403 to
5a4160f
Compare
|
Please change PR and commit to use: https://issues.apache.org/jira/browse/FINERACT-2421 |
556694f to
e616b69
Compare
8b917f0 to
1a25b9d
Compare
Done! |
|
221a2db to
f001eda
Compare
Done! Thanks |
f001eda to
b9d2adb
Compare
| final MonetaryCurrency currency = loanTransaction.getLoan().getCurrency(); | ||
| return (oldTransaction.getId() != null && oldTransaction.getTypeOf().equals(loanTransaction.getTypeOf()) // | ||
| && oldTransaction.getTransactionDate().equals(loanTransaction.getTransactionDate()) // | ||
| && (oldTransaction.getAmount(currency).compareTo(loanTransaction.getAmount(currency)) == 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simple getId() is enought. I see no reason for the rest of the checks...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason to have the other checks is to ensure that we are validating the same IR Transaction for the same date and amount, If we use only the getId() method we can get a true for other new transaction that is not a IR transaction
| transaction(2.88, "Interest Refund", "22 January 2021"), // | ||
| transaction(4.66, "Accrual", "22 January 2021") // | ||
| ); | ||
| /* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why to comment out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restored, sorry!
| | 4 | 30 | 01 May 2024 | 01 February 2024 | 319.66 | 169.66 | 1.83 | 0.0 | 0.0 | 171.49 | 171.49 | 171.49 | 0.0 | 0.0 | | ||
| | 5 | 31 | 01 June 2024 | 01 February 2024 | 148.17 | 171.49 | 0.0 | 0.0 | 0.0 | 171.49 | 171.49 | 171.49 | 0.0 | 0.0 | | ||
| | 6 | 30 | 01 July 2024 | | 0.0 | 148.17 | 2.77 | 0.0 | 0.0 | 150.94 | 80.6 | 80.6 | 0.0 | 70.34 | | ||
| | 6 | 30 | 01 July 2024 | | 0.0 | 148.17 | 2.77 | 0.0 | 0.0 | 150.94 | 80.59 | 80.59 | 0.0 | 70.35 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rounding
| transaction(1.44, "Interest Refund", "22 January 2021"), // | ||
| transaction(400.0, "Payout Refund", "26 January 2021"), // | ||
| transaction(2.58, "Interest Refund", "26 January 2021") // | ||
| transaction(2.57, "Interest Refund", "26 January 2021") // |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rounding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But why would it be changed? Rounding does not explain... i am interested in what caused this change
|
@alberto-art3ch Kindly check my raised questions. |
0398990 to
e2cd523
Compare
… txn amount if no txn was changed
e2cd523 to
e919183
Compare
|
|
||
| private boolean validateInterestRefundTransactionRelation(final LoanTransaction interestRefundTransaction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please refresh my memory why we need this?
Description
Let's allow to reprocess Interest Refund txn amount even if no transaction was changed (reverse-replayed) before
FINERACT-2421
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.