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: MIFOSX-2516: fix for Floating rates with multi tranche loan
Date Wed, 24 Feb 2016 06:37:15 GMT
Repository: incubator-fineract
Updated Branches:
  refs/heads/0.1.0-incubating 1be4d026c -> 8d160d3e7


MIFOSX-2516: fix for  Floating rates with multi tranche loan


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

Branch: refs/heads/0.1.0-incubating
Commit: 331e8e4dec73ed68b3b002cfebd0647b99d652ad
Parents: 1be4d02
Author: pramod <pramod@confluxtechnologies.com>
Authored: Tue Feb 23 14:29:02 2016 +0530
Committer: pramod <pramod@confluxtechnologies.com>
Committed: Tue Feb 23 14:29:02 2016 +0530

----------------------------------------------------------------------
 .../floatingrates/data/FloatingRateDTO.java     | 82 ++++++++++----------
 .../data/LoanTermVariationsData.java            |  2 +-
 .../portfolio/loanaccount/domain/Loan.java      |  1 +
 3 files changed, 45 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/331e8e4d/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/data/FloatingRateDTO.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/data/FloatingRateDTO.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/data/FloatingRateDTO.java
index 008e29f..0dfee5c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/data/FloatingRateDTO.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/data/FloatingRateDTO.java
@@ -25,51 +25,55 @@ import org.joda.time.LocalDate;
 
 public class FloatingRateDTO {
 
-	private final boolean isFloatingInterestRate;
-	private final LocalDate startDate;
-	private BigDecimal interestRateDiff;
-	private final Collection<FloatingRatePeriodData> baseLendingRatePeriods;
+    private final boolean isFloatingInterestRate;
+    private final LocalDate startDate;
+    private BigDecimal interestRateDiff;
+    private BigDecimal actualInterestRateDiff;
+    private final Collection<FloatingRatePeriodData> baseLendingRatePeriods;
 
-	public FloatingRateDTO(final boolean isFloatingInterestRate,
-			final LocalDate startDate, final BigDecimal interestRateDiff,
-			final Collection<FloatingRatePeriodData> baseLendingRatePeriods) {
-		this.isFloatingInterestRate = isFloatingInterestRate;
-		this.startDate = startDate;
-		this.interestRateDiff = interestRateDiff;
-		this.baseLendingRatePeriods = baseLendingRatePeriods;
-	}
+    public FloatingRateDTO(final boolean isFloatingInterestRate, final LocalDate startDate,
final BigDecimal interestRateDiff,
+            final Collection<FloatingRatePeriodData> baseLendingRatePeriods) {
+        this.isFloatingInterestRate = isFloatingInterestRate;
+        this.startDate = startDate;
+        this.interestRateDiff = interestRateDiff;
+        this.actualInterestRateDiff = interestRateDiff;
+        this.baseLendingRatePeriods = baseLendingRatePeriods;
+    }
 
-	public BigDecimal fetchBaseRate(LocalDate date) {
-		BigDecimal rate = null;
-		for (FloatingRatePeriodData periodData : this.baseLendingRatePeriods) {
-			final LocalDate periodFromDate = new LocalDate(periodData.getFromDate());
-			if (periodFromDate.isBefore(date)
-					|| periodFromDate.isEqual(date)) {
-				rate = periodData.getInterestRate();
-				break;
-			}
-		}
-		return rate;
-	}
+    public BigDecimal fetchBaseRate(LocalDate date) {
+        BigDecimal rate = null;
+        for (FloatingRatePeriodData periodData : this.baseLendingRatePeriods) {
+            final LocalDate periodFromDate = new LocalDate(periodData.getFromDate());
+            if (periodFromDate.isBefore(date) || periodFromDate.isEqual(date)) {
+                rate = periodData.getInterestRate();
+                break;
+            }
+        }
+        return rate;
+    }
 
-	public void addInterestRateDiff(final BigDecimal diff) {
-		this.interestRateDiff = this.interestRateDiff.add(diff);
-	}
+    public void addInterestRateDiff(final BigDecimal diff) {
+        this.interestRateDiff = this.interestRateDiff.add(diff);
+    }
 
-	public boolean isFloatingInterestRate() {
-		return this.isFloatingInterestRate;
-	}
+    public boolean isFloatingInterestRate() {
+        return this.isFloatingInterestRate;
+    }
 
-	public LocalDate getStartDate() {
-		return this.startDate;
-	}
+    public LocalDate getStartDate() {
+        return this.startDate;
+    }
 
-	public BigDecimal getInterestRateDiff() {
-		return this.interestRateDiff;
-	}
+    public BigDecimal getInterestRateDiff() {
+        return this.interestRateDiff;
+    }
 
-	public Collection<FloatingRatePeriodData> getBaseLendingRatePeriods() {
-		return this.baseLendingRatePeriods;
-	}
+    public Collection<FloatingRatePeriodData> getBaseLendingRatePeriods() {
+        return this.baseLendingRatePeriods;
+    }
+
+    public void resetInterestRateDiff() {
+        this.interestRateDiff = this.actualInterestRateDiff;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/331e8e4d/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTermVariationsData.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTermVariationsData.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTermVariationsData.java
index 2113666..f5d2cc0 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTermVariationsData.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTermVariationsData.java
@@ -84,7 +84,7 @@ public class LoanTermVariationsData implements Comparable<LoanTermVariationsData
     }
 
     private boolean occursBefore(final LocalDate date, final LocalDate target) {
-        return target != null && target.isBefore(date);
+        return target != null && !target.isAfter(date);
     }
 
     public LocalDate getDateValue() {

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/331e8e4d/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
index ac4aa45..56fd87c 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
@@ -2597,6 +2597,7 @@ public class Loan extends AbstractPersistable<Long> {
         final boolean isSpecificToInstallment = false;
         BigDecimal interestRate = annualNominalInterestRate;
         if (loanProduct.isLinkedToFloatingInterestRate()) {
+            floatingRateDTO.resetInterestRateDiff();
             Collection<FloatingRatePeriodData> applicableRates = loanProduct.fetchInterestRates(floatingRateDTO);
             LocalDate interestRateStartDate = DateUtils.getLocalDateOfTenant();
             for (FloatingRatePeriodData periodData : applicableRates) {


Mime
View raw message