adamsaghy commented on code in PR #4273:
URL: https://github.com/apache/fineract/pull/4273#discussion_r1930372936
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanAccrualActivityProcessingServiceImpl.java:
##########
@@ -92,42 +92,94 @@ public void processAccrualActivityForLoanClosure(@NotNull
Loan loan) {
if
(!loan.getLoanProductRelatedDetail().isEnableAccrualActivityPosting()) {
return;
}
+
LocalDate transactionDate = loan.isOverPaid() ?
loan.getOverpaidOnDate() : loan.getClosedOnDate();
- // reverse after closure activities
+
+ // Reverse accrual activities posted after the closure date
loan.getLoanTransactions(t -> t.isAccrualActivity() && !t.isReversed()
&& t.getDateOf().isAfter(transactionDate))
.forEach(this::reverseAccrualActivityTransaction);
- // calculate activity amounts
BigDecimal feeChargesPortion = BigDecimal.ZERO;
BigDecimal penaltyChargesPortion = BigDecimal.ZERO;
BigDecimal interestPortion = BigDecimal.ZERO;
- // collect installment amounts
+
+ // Calculate total portions from all installments
for (LoanRepaymentScheduleInstallment installment :
loan.getRepaymentScheduleInstallments()) {
- feeChargesPortion = MathUtil.add(feeChargesPortion,
installment.getFeeChargesCharged());
- penaltyChargesPortion = MathUtil.add(penaltyChargesPortion,
installment.getPenaltyCharges());
- interestPortion = MathUtil.add(interestPortion,
installment.getInterestCharged());
+ if (!installment.isDownPayment()) { // Exclude downpayment
installments
Review Comment:
We can ignore any installments which are after the maturity date
(installment that is marked "additional" for example).
--
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]