angelboxes commented on a change in pull request #614: Stop creating
unnecessary overdue charge when amount is 0.
URL: https://github.com/apache/fineract/pull/614#discussion_r306662695
##########
File path:
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
##########
@@ -2490,6 +2493,9 @@ public LoanOverdueDTO
applyChargeToOverdueLoanInstallment(final Long loanId, fin
final LoanCharge loanCharge =
LoanCharge.createNewFromJson(loan, chargeDefinition, command, entry.getValue());
+ if (BigDecimal.ZERO.compareTo(loanCharge.amount()) == 0) {
+ return null;
Review comment:
Ok that may be right I'm just saying it as I don't take anything for granted
and also it will avoid returning a null value as the overdueDTO.
Also, something similiar it could happen in the applyOverdueChargesForLoan
function with the if statement:
if(overdueDTO == null){
return;
}
Because you are iterating a list of multiple overdue installments for the
same loan. If the penalty charge is calculated based on the installment
interest amount, that amount can be different for each one of those
installments, for the first one the calculated amount for all the installment
charges can be 0, but for the next ones it could be a value greater than zero.
Making a return call would not calculate charges for the next overdue
installments.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services