[Fineract-361] Partial periods not to be considered for PMT calculations

This commit is contained in:
Adi Narayana Raju
2017-01-02 16:10:30 +05:30
parent 9a6b5d1c12
commit 5fe0e529e7
@@ -633,7 +633,7 @@ public final class LoanApplicationTerms {
// with periodic interest for default month and year for
// equal installment
final BigDecimal periodicInterestRateForRepaymentPeriod = periodicInterestRate(calculator, mc, DaysInMonthType.DAYS_30,
DaysInYearType.DAYS_365, periodStartDate, periodEndDate);
DaysInYearType.DAYS_365, periodStartDate, periodEndDate, true);
Money totalPmtForThisInstallment = calculateTotalDueForEqualInstallmentRepaymentPeriod(periodicInterestRateForRepaymentPeriod,
outstandingBalance, periodsElapsed);
return totalPmtForThisInstallment;
@@ -966,7 +966,13 @@ public final class LoanApplicationTerms {
}
private BigDecimal periodicInterestRate(final PaymentPeriodsInOneYearCalculator calculator, final MathContext mc,
final DaysInMonthType daysInMonthType, final DaysInYearType daysInYearType, LocalDate periodStartDate, LocalDate periodEndDate) {
final DaysInMonthType daysInMonthType, final DaysInYearType daysInYearType, LocalDate periodStartDate,
LocalDate periodEndDate) {
return periodicInterestRate(calculator, mc, daysInMonthType, daysInYearType, periodStartDate, periodEndDate, false);
}
private BigDecimal periodicInterestRate(final PaymentPeriodsInOneYearCalculator calculator, final MathContext mc, final DaysInMonthType daysInMonthType,
final DaysInYearType daysInYearType, LocalDate periodStartDate, LocalDate periodEndDate, boolean isForPMT) {
final long loanTermPeriodsInOneYear = calculatePeriodsInOneYear(calculator);
@@ -974,7 +980,12 @@ public final class LoanApplicationTerms {
final BigDecimal loanTermPeriodsInYearBigDecimal = BigDecimal.valueOf(loanTermPeriodsInOneYear);
BigDecimal periodicInterestRate = BigDecimal.ZERO;
BigDecimal loanTermFrequencyBigDecimal = calculateLoanTermFrequency(periodStartDate, periodEndDate);
BigDecimal loanTermFrequencyBigDecimal = BigDecimal.ONE;
if(isForPMT){
loanTermFrequencyBigDecimal = BigDecimal.valueOf(this.repaymentEvery);
} else {
loanTermFrequencyBigDecimal = calculateLoanTermFrequency(periodStartDate, periodEndDate);
}
switch (this.interestCalculationPeriodMethod) {
case INVALID:
break;