Skip to content

Commit

Permalink
FINERACT-2148: fix styles
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksii-novikov-onix committed Dec 9, 2024
1 parent 30f53f7 commit fba9420
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3286,24 +3286,22 @@ public CommandProcessingResult chargeOff(JsonCommand command) {

final ProgressiveLoanInterestScheduleModel scheduleModel = result.getRight();

repaymentScheduleInstallments.stream()
.filter(installment -> !installment.getFromDate().isAfter(transactionDate) && installment.getDueDate().isAfter(transactionDate))
.forEach(installment -> {
final BigDecimal newInterest = emiCalculator
.getPeriodInterestTillDate(scheduleModel, installment.getDueDate(), transactionDate).getAmount();
final BigDecimal interestRemoved = installment.getInterestCharged().subtract(newInterest);
installment.updatePrincipal(defaultToZeroIfNull(installment.getPrincipal()).add(interestRemoved));
installment.updateInterestCharged(newInterest);
repaymentScheduleInstallments.stream().filter(installment -> !installment.getFromDate().isAfter(transactionDate)
&& installment.getDueDate().isAfter(transactionDate)).forEach(installment -> {
final BigDecimal newInterest = emiCalculator
.getPeriodInterestTillDate(scheduleModel, installment.getDueDate(), transactionDate).getAmount();
final BigDecimal interestRemoved = installment.getInterestCharged().subtract(newInterest);
installment.updatePrincipal(defaultToZeroIfNull(installment.getPrincipal()).add(interestRemoved));
installment.updateInterestCharged(newInterest);
});
} else {
calculatePartialPeriodInterest(loan, transactionDate);
}

repaymentScheduleInstallments.stream()
.filter(installment -> installment.getFromDate().isAfter(transactionDate))
repaymentScheduleInstallments.stream().filter(installment -> installment.getFromDate().isAfter(transactionDate))
.forEach(installment -> {
installment.updatePrincipal(defaultToZeroIfNull(installment.getPrincipal()).add(installment.getInterestCharged()));
installment.updateInterestCharged(BigDecimal.ZERO);
installment.updatePrincipal(defaultToZeroIfNull(installment.getPrincipal()).add(installment.getInterestCharged()));
installment.updateInterestCharged(BigDecimal.ZERO);
});

loan.updateLoanSummaryDerivedFields();
Expand Down

0 comments on commit fba9420

Please sign in to comment.