You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by na...@apache.org on 2016/12/13 12:21:36 UTC

[1/2] incubator-fineract git commit: 267: Installment Fee fix on Foreclosure

Repository: incubator-fineract
Updated Branches:
  refs/heads/develop d5ac4e04a -> f1d0ce60b


267: Installment Fee fix on Foreclosure


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

Branch: refs/heads/develop
Commit: e37ffca34ce62a08868209081f9d9533ba54ed73
Parents: e9e3326
Author: jyothsnag <jy...@confluxtechnologies.com>
Authored: Tue Nov 29 14:02:26 2016 +0530
Committer: jyothsnag <jy...@confluxtechnologies.com>
Committed: Tue Nov 29 14:02:26 2016 +0530

----------------------------------------------------------------------
 .../portfolio/loanaccount/domain/Loan.java      | 34 ++++++++++++++++++--
 1 file changed, 31 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/e37ffca3/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 15e23cb..7518b3c 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
@@ -6285,10 +6285,14 @@ public class Loan extends AbstractPersistableCustom<Long> {
         final MonetaryCurrency currency = getCurrency();
         Money totalPrincipal = Money.zero(currency);
         Money [] balances = retriveIncomeForOverlappingPeriod(transactionDate);
+        boolean isInterestComponent = true;
         for (final LoanRepaymentScheduleInstallment installment : this.repaymentScheduleInstallments) {
             if (!installment.getDueDate().isBefore(transactionDate)) {
                     totalPrincipal = totalPrincipal.plus(installment.getPrincipal(currency));
                     newInstallments.remove(installment);
+				if (installment.getDueDate().isEqual(transactionDate)) {
+					isInterestComponent = false;
+				}
             }   
             
         }
@@ -6303,12 +6307,18 @@ public class Loan extends AbstractPersistableCustom<Long> {
 
         if (newInstallments.size() > 0) {
             installmentStartDate = newInstallments.get((newInstallments.size() - 1)).getDueDate();
-        }        
+        }
         
+		int installmentNumber = newInstallments.size();
+
+		if (!isInterestComponent) {
+			installmentNumber++;
+		}
+  
         
-        LoanRepaymentScheduleInstallment newInstallment = new LoanRepaymentScheduleInstallment(null, newInstallments.size() + 1,
+		LoanRepaymentScheduleInstallment newInstallment = new LoanRepaymentScheduleInstallment(null, newInstallments.size() + 1,
                 installmentStartDate, transactionDate, totalPrincipal.getAmount(),
-                balances[0].getAmount(), balances[1].getAmount(), balances[2].getAmount(), true, null);
+                balances[0].getAmount(), balances[1].getAmount(), balances[2].getAmount(), isInterestComponent, null);
         newInstallment.updateInstallmentNumber(newInstallments.size() + 1);
         newInstallments.add(newInstallment);        
         updateLoanScheduleOnForeclosure(newInstallments);
@@ -6321,8 +6331,26 @@ public class Loan extends AbstractPersistableCustom<Long> {
                 loanCharge.setActive(false);
             } else if (loanCharge.getDueLocalDate() == null) {
                 recalculateLoanCharge(loanCharge, penaltyWaitPeriod);
+                loanCharge.updateWaivedAmount(currency);
             }
         }
+        
+		for (LoanTransaction loanTransaction : getLoanTransactions()) {
+			if (loanTransaction.isChargesWaiver()) {
+				for (LoanChargePaidBy chargePaidBy : loanTransaction
+						.getLoanChargesPaid()) {
+					if ((chargePaidBy.getLoanCharge().isDueDateCharge() && chargePaidBy
+							.getLoanCharge().getDueLocalDate()
+							.isAfter(transactionDate))
+							|| (chargePaidBy.getLoanCharge().isInstalmentFee() && (chargePaidBy
+									.getInstallmentNumber() != null && chargePaidBy
+									.getInstallmentNumber() > installmentNumber))) {
+						loanTransaction.reverse();
+					}
+				}
+
+			}
+		}
     }
 
     public void updateLoanScheduleOnForeclosure(final Collection<LoanRepaymentScheduleInstallment> installments) {


[2/2] incubator-fineract git commit: Merge branch 'FINERACT-267' into develop

Posted by na...@apache.org.
Merge branch 'FINERACT-267' into develop


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

Branch: refs/heads/develop
Commit: f1d0ce60b0b671e222589b7ac60a0dba0567beba
Parents: d5ac4e0 e37ffca
Author: Nazeer Hussain Shaik <na...@confluxtechnologies.com>
Authored: Tue Dec 13 17:02:37 2016 +0530
Committer: Nazeer Hussain Shaik <na...@confluxtechnologies.com>
Committed: Tue Dec 13 17:02:37 2016 +0530

----------------------------------------------------------------------
 .../portfolio/loanaccount/domain/Loan.java      | 34 ++++++++++++++++++--
 1 file changed, 31 insertions(+), 3 deletions(-)
----------------------------------------------------------------------