somasorosdpc commented on code in PR #4242:
URL: https://github.com/apache/fineract/pull/4242#discussion_r1906588038
##########
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java:
##########
@@ -218,24 +218,22 @@ public ChangedTransactionDetail
reprocessLoanTransactions(final LocalDate disbur
protected void calculateAccrualActivity(LoanTransaction loanTransaction,
MonetaryCurrency currency,
List<LoanRepaymentScheduleInstallment> installments) {
- loanTransaction.resetDerivedComponents();
- // determine how much is outstanding total and breakdown for
principal, interest and charges
- final Money principalPortion = Money.zero(currency);
- Money interestPortion = Money.zero(currency);
- Money feeChargesPortion = Money.zero(currency);
- Money penaltychargesPortion = Money.zero(currency);
+
final int firstNormalInstallmentNumber =
LoanRepaymentScheduleProcessingWrapper.fetchFirstNormalInstallmentNumber(installments);
final LoanRepaymentScheduleInstallment currentInstallment =
installments.stream()
.filter(installment ->
LoanRepaymentScheduleProcessingWrapper.isInPeriod(loanTransaction.getTransactionDate(),
installment,
installment.getInstallmentNumber().equals(firstNormalInstallmentNumber)))
.findFirst().orElseThrow();
-
- interestPortion =
interestPortion.plus(currentInstallment.getInterestCharged(currency));
- feeChargesPortion =
feeChargesPortion.plus(currentInstallment.getFeeChargesCharged(currency));
- penaltychargesPortion =
penaltychargesPortion.plus(currentInstallment.getPenaltyChargesCharged(currency));
-
- loanTransaction.updateComponentsAndTotal(principalPortion,
interestPortion, feeChargesPortion, penaltychargesPortion);
+ if
(loanTransaction.getDateOf().isEqual(currentInstallment.getDueDate()) ||
installments.stream()
Review Comment:
Accrual Activity transactions are created on instalment due dates. The only
exception is if a loan is paid off. In that case all the normal installments
should be paid off. If they are not fully paid off, but there is an Accrual
Activity Transaction available is that the loan will be reopened. In that case
this transaction should be reversed instead of recalculated/reverse-replayed.
--
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]