[BUG-347] Stop interest posting once the loan has moved to overpaid state

This commit is contained in:
Vishwa
2016-05-05 18:28:57 +05:30
parent 401cad4d35
commit e7fbec05be
@@ -5053,6 +5053,10 @@ public class Loan extends AbstractPersistable<Long> {
accrualTransaction); accrualTransaction);
lastCompoundingDate = compoundingDetail.getEffectiveDate(); lastCompoundingDate = compoundingDetail.getEffectiveDate();
} }
LoanRepaymentScheduleInstallment lastInstallment = this.repaymentScheduleInstallments.get(this.repaymentScheduleInstallments
.size() - 1);
reverseTransactionsPostEffectiveDate(incomeTransactions, lastInstallment.getDueDate());
reverseTransactionsPostEffectiveDate(accrualTransactions, lastInstallment.getDueDate());
} }
} }
@@ -5163,6 +5167,14 @@ public class Loan extends AbstractPersistable<Long> {
return null; return null;
} }
private void reverseTransactionsPostEffectiveDate(List<LoanTransaction> transactions, LocalDate effectiveDate) {
for (LoanTransaction loanTransaction : transactions) {
if (loanTransaction.getTransactionDate().isAfter(effectiveDate)) {
loanTransaction.reverse();
}
}
}
private List<LoanInterestRecalcualtionAdditionalDetails> extractInterestRecalculationAdditionalDetails() { private List<LoanInterestRecalcualtionAdditionalDetails> extractInterestRecalculationAdditionalDetails() {
List<LoanInterestRecalcualtionAdditionalDetails> retDetails = new ArrayList<>(); List<LoanInterestRecalcualtionAdditionalDetails> retDetails = new ArrayList<>();
if (null != this.repaymentScheduleInstallments && this.repaymentScheduleInstallments.size() > 0) { if (null != this.repaymentScheduleInstallments && this.repaymentScheduleInstallments.size() > 0) {