adamsaghy commented on code in PR #5102:
URL: https://github.com/apache/fineract/pull/5102#discussion_r2490490296
##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java:
##########
@@ -3357,4 +3473,121 @@ private void
handleReAgeWithInterestRecalculationEnabled(final LoanTransaction l
Money.of(currency, interestFromZeroedInstallments.get()),
Money.zero(currency), Money.zero(currency));
reprocessInstallments(installments);
}
+
+ private boolean
keepUsingEmiCalculatorBasedOnReAge(ProgressiveTransactionCtx
progressiveTransactionCtx) {
+ boolean hasActiveReAge =
progressiveTransactionCtx.getReAgeInterestHandlingType() != null;
+ return !hasActiveReAge ||
progressiveTransactionCtx.getReAgeInterestHandlingType().equals(LoanReAgeInterestHandlingType.DEFAULT);
+ }
+
+ OutstandingBalances
liftOutstandingBalances(List<LoanRepaymentScheduleInstallment> installments,
LoanTransaction loanTransaction,
+ MonetaryCurrency currency, boolean skipDownPayments, boolean
onlyPlayableInterest, boolean isEqualInstallmentForInterest,
+ boolean isEqualInstallmentForFeesAndPenalties, TransactionCtx ctx)
{
+
+ AtomicReference<Money> outstandingPrincipalBalance = new
AtomicReference<>(Money.zero(currency));
+ AtomicReference<Money> outstandingInterestBalance = new
AtomicReference<>(Money.zero(currency));
+ AtomicReference<Money> outstandingFeesBalance = new
AtomicReference<>(Money.zero(currency));
+ AtomicReference<Money> outstandingPenaltiesBalance = new
AtomicReference<>(Money.zero(currency));
+ AtomicReference<Money> accruedInterestToMove = new
AtomicReference<>(Money.zero(currency));
+ AtomicReference<Money> accruedFeeToMove = new
AtomicReference<>(Money.zero(currency));
+ AtomicReference<Money> accruedPenaltyToMove = new
AtomicReference<>(Money.zero(currency));
+ final List<LoanCharge> liftedLoanCharges = new ArrayList<>();
+
+ installments.stream().filter(i -> !skipDownPayments ||
!i.isDownPayment()).forEach(i -> {
+ Money principalOutstanding = i.getPrincipalOutstanding(currency);
+ if (principalOutstanding.isGreaterThanZero()) {
+
outstandingPrincipalBalance.set(outstandingPrincipalBalance.get().add(principalOutstanding));
+ i.addToPrincipal(loanTransaction.getTransactionDate(),
principalOutstanding.negated());
+ }
+ Money interestOutstanding = i.getInterestOutstanding(currency);
+ if (isEqualInstallmentForInterest &&
interestOutstanding.isGreaterThanZero()) {
+
outstandingInterestBalance.set(outstandingInterestBalance.get().add(interestOutstanding));
+ i.addToInterest(loanTransaction.getTransactionDate(),
interestOutstanding.negated());
+ BigDecimal paid = MathUtil.nullToZero(i.getInterestPaid());
+ BigDecimal accrued =
MathUtil.nullToZero(i.getInterestAccrued());
+ if (paid.compareTo(accrued) < 0) {
+ accruedInterestToMove.set(Money.of(currency,
accrued.subtract(paid)));
+ i.setInterestAccrued(paid);
+ }
+ }
+
+ if (isEqualInstallmentForFeesAndPenalties) {
+ getLoanChargesOfInstallment(ctx.getCharges(), i, 1)//
+ .stream()//
+ .filter(c ->
MathUtil.isGreaterThanZero(c.getAmountOutstanding()))//
+ .forEach(loanInstallmentCharge -> {
+ // if
(MathUtil.nullToZero(loanInstallmentCharge.getAmountPaid()).equals(ZERO)) {
+ // ctx.getCharges().remove(loanInstallmentCharge);
+ //
loanTransaction.getLoan().getCharges().remove(loanInstallmentCharge);
+ // }
Review Comment:
if we dont need it, remove it.
--
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]