adamsaghy commented on code in PR #4242:
URL: https://github.com/apache/fineract/pull/4242#discussion_r1905910138
##########
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:
Why do we need this condition? why to ignore if it was not on the
installment due date?
--
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]