galovics commented on code in PR #4629:
URL: https://github.com/apache/fineract/pull/4629#discussion_r2064123073
##########
fineract-provider/src/main/java/org/apache/fineract/cob/loan/LoanInterestRecalculationCOBBusinessStep.java:
##########
@@ -43,16 +46,48 @@ public Loan execute(Loan loan) {
return loan;
}
- log.debug("Start processing loan interest recalculation [{}]",
loan.getId());
-
ThreadLocalContextUtil.setActionContext(ActionContext.DEFAULT);
+ // Overdue installment check
+ LocalDate businessDate = DateUtils.getBusinessLocalDate();
+ if (!hasOverdueInstallment(loan, businessDate)) {
+ log.debug("Skip loan interest recalculation [{}] - No overdue
installments.", loan.getId());
+ return loan;
+ }
- loan = loanWritePlatformService.recalculateInterest(loan);
+ log.debug("Start processing loan interest recalculation [{}]",
loan.getId());
+ try {
+ loan = loanWritePlatformService.recalculateInterest(loan);
Review Comment:
Shouldn't the whole thing be in a try block to ensure the action context is
set back to COB? (Like in the case if hasOverdueInstallment fails?)
--
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]