136 : accrual exception while doing repayment
This commit is contained in:
+11
-1
@@ -30,6 +30,7 @@ import java.util.HashSet;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.ListIterator;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -2005,7 +2006,16 @@ public class Loan extends AbstractPersistable<Long> {
|
|||||||
|
|
||||||
private LocalDate determineExpectedMaturityDate() {
|
private LocalDate determineExpectedMaturityDate() {
|
||||||
final int numberOfInstallments = this.repaymentScheduleInstallments.size();
|
final int numberOfInstallments = this.repaymentScheduleInstallments.size();
|
||||||
return this.repaymentScheduleInstallments.get(numberOfInstallments - 1).getDueDate();
|
LocalDate maturityDate = this.repaymentScheduleInstallments.get(numberOfInstallments - 1).getDueDate();
|
||||||
|
ListIterator<LoanRepaymentScheduleInstallment> iterator = this.repaymentScheduleInstallments.listIterator(numberOfInstallments);
|
||||||
|
while(iterator.hasPrevious()){
|
||||||
|
LoanRepaymentScheduleInstallment loanRepaymentScheduleInstallment = iterator.previous();
|
||||||
|
if(!loanRepaymentScheduleInstallment.isRecalculatedInterestComponent()){
|
||||||
|
maturityDate = loanRepaymentScheduleInstallment.getDueDate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return maturityDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> loanApplicationRejection(final AppUser currentUser, final JsonCommand command,
|
public Map<String, Object> loanApplicationRejection(final AppUser currentUser, final JsonCommand command,
|
||||||
|
|||||||
+3
@@ -461,6 +461,9 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService {
|
|||||||
Set<LoanCharge> loanCharges = loan.charges();
|
Set<LoanCharge> loanCharges = loan.charges();
|
||||||
|
|
||||||
for (LoanRepaymentScheduleInstallment installment : installments) {
|
for (LoanRepaymentScheduleInstallment installment : installments) {
|
||||||
|
if (installment.getDueDate().isAfter(loan.getMaturityDate())) {
|
||||||
|
accruedTill = DateUtils.getLocalDateOfTenant();
|
||||||
|
}
|
||||||
if(!isOrganisationDateEnabled || new LocalDate(organisationStartDate).isBefore(installment.getDueDate())){
|
if(!isOrganisationDateEnabled || new LocalDate(organisationStartDate).isBefore(installment.getDueDate())){
|
||||||
generateLoanScheduleAccrualData(accruedTill, loanScheduleAccrualDatas, loanId, officeId, accrualStartDate, repaymentFrequency,
|
generateLoanScheduleAccrualData(accruedTill, loanScheduleAccrualDatas, loanId, officeId, accrualStartDate, repaymentFrequency,
|
||||||
repayEvery, interestCalculatedFrom, loanProductId, currency, currencyData, loanCharges, installment);
|
repayEvery, interestCalculatedFrom, loanProductId, currency, currencyData, loanCharges, installment);
|
||||||
|
|||||||
+3
@@ -312,6 +312,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
checkForProductMixRestrictions(loan);
|
checkForProductMixRestrictions(loan);
|
||||||
|
|
||||||
LocalDate recalculateFrom = null;
|
LocalDate recalculateFrom = null;
|
||||||
|
if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
|
||||||
|
recalculateFrom = actualDisbursementDate;
|
||||||
|
}
|
||||||
ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan, recalculateFrom);
|
ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan, recalculateFrom);
|
||||||
|
|
||||||
// validate actual disbursement date against meeting date
|
// validate actual disbursement date against meeting date
|
||||||
|
|||||||
Reference in New Issue
Block a user