Skip to content

Commit

Permalink
SU-502 initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
faheem205 committed Dec 16, 2024
1 parent b71e9ef commit 97330a8
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand 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))
Expand Down Expand Up @@ -1710,4 +1715,8 @@ public boolean isFullyGraced() {
public BigDecimal originalInterestChargedAmount() {
return originalInterestChargedAmount;
}

public boolean isMigratedInstallment() {
return isMigratedInstallment;
}
}

0 comments on commit 97330a8

Please sign in to comment.