From 97330a8faa78dd757f424a57e9a3192158319e72 Mon Sep 17 00:00:00 2001 From: faheem205 Date: Mon, 16 Dec 2024 22:20:55 +0500 Subject: [PATCH] SU-502 initial commit --- .../domain/LoanRepaymentScheduleInstallment.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepaymentScheduleInstallment.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepaymentScheduleInstallment.java index 678645c739e..c16a8b3f75e 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepaymentScheduleInstallment.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepaymentScheduleInstallment.java @@ -169,6 +169,9 @@ public class LoanRepaymentScheduleInstallment extends AbstractAuditableWithUTCDa @Column(name = "original_interest_charged", nullable = true) private BigDecimal originalInterestChargedAmount; + @Column(name = "migrated_installment") + private boolean isMigratedInstallment; + public LoanRepaymentScheduleInstallment() { this.installmentNumber = null; this.fromDate = null; @@ -971,7 +974,9 @@ public Money payInterestComponent(final LocalDate transactionDate, final Money t Money interestDue = Money.zero(currency); - if (isOn(transactionDate, this.getDueDate())) { + if(this.isMigratedInstallment) { + interestDue = getInterestOutstanding(currency); + } else if (isOn(transactionDate, this.getDueDate())) { interestDue = getInterestOutstanding(currency); } else if (isOnOrBetween(transactionDate) && getInterestOutstanding(currency).isGreaterThanZero()) { final RoundingMode roundingMode = RoundingMode.HALF_UP; @@ -1072,7 +1077,7 @@ public Money payPrincipalComponent(final LocalDate transactionDate, final Money //// Update installment interest charged if principal is fully paid during the accrual period and interest has //// also been recalculated and paid // Keep the original interest charged in case the transaction is rollbacked. - if (this.getLoan() != null && this.getLoan().isProgressiveLoan()) { + if (this.getLoan() != null && this.getLoan().isProgressiveLoan() && !this.isMigratedInstallment) { if (isOnOrBetween(transactionDate)) { if (this.getPrincipalOutstanding(currency).isZero() && (this.originalInterestChargedAmount == null || this.originalInterestChargedAmount.equals(BigDecimal.ZERO)) @@ -1710,4 +1715,8 @@ public boolean isFullyGraced() { public BigDecimal originalInterestChargedAmount() { return originalInterestChargedAmount; } + + public boolean isMigratedInstallment() { + return isMigratedInstallment; + } }