adamsaghy commented on code in PR #5218:
URL: https://github.com/apache/fineract/pull/5218#discussion_r2618497591
##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java:
##########
@@ -563,12 +563,10 @@ private void handleInterestRefund(final LoanTransaction
loanTransaction, final T
.filter(LoanTransaction::isNotReversed).map(AbstractPersistableCustom::getId).toList();
final List<LoanTransaction> modifiedTransactions = new
ArrayList<>(progCtx.getAlreadyProcessedTransactions().stream()
.filter(LoanTransaction::isNotReversed).filter(tr ->
tr.getId() == null).toList());
- if (!modifiedTransactions.isEmpty()) {
- final Money interestAfterRefund =
interestRefundService.totalInterestByTransactions(this, loan.getId(),
targetDate,
- modifiedTransactions, unmodifiedTransactionIds);
- final Money newAmount =
interestBeforeRefund.minus(progCtx.getSumOfInterestRefundAmount()).minus(interestAfterRefund);
- loanTransaction.updateAmount(newAmount.getAmount());
- }
+ final Money interestAfterRefund =
interestRefundService.totalInterestByTransactions(this, loan.getId(),
targetDate,
Review Comment:
@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.
--
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]