fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100...@apache.org
Subject [1/2] incubator-fineract git commit: [Fineract-361] Partial periods not to be considered for PMT calculations
Date Mon, 02 Jan 2017 13:01:54 GMT
Repository: incubator-fineract
Updated Branches:
  refs/heads/develop f55a16755 -> 7b0fcc567


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


Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/5fe0e529
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/5fe0e529
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/5fe0e529

Branch: refs/heads/develop
Commit: 5fe0e529e7762c6972bd8926b5de6b9a0d0fb5ab
Parents: 9a6b5d1
Author: Adi Narayana Raju <adi.raju@confluxtechnologies.com>
Authored: Mon Jan 2 16:10:30 2017 +0530
Committer: Adi Narayana Raju <adi.raju@confluxtechnologies.com>
Committed: Mon Jan 2 16:10:30 2017 +0530

----------------------------------------------------------------------
 .../loanschedule/domain/LoanApplicationTerms.java  | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/5fe0e529/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java
index 0746522..b7aaf12 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java
@@ -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;


Mime
View raw message