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: 136 : accrual exception while doing repayment
Date Tue, 26 Apr 2016 06:23:45 GMT
Repository: incubator-fineract
Updated Branches:
  refs/heads/develop c0c6f1d83 -> 19329c4a1


136 : accrual exception while doing repayment


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

Branch: refs/heads/develop
Commit: 67be38e71ab26836f341b62cd80277b2abbedfad
Parents: 3970b2e
Author: sachinkulkarni12 <sachin.kulkarni@confluxtechnologies.com>
Authored: Thu Apr 21 16:47:00 2016 +0530
Committer: sachinkulkarni12 <sachin.kulkarni@confluxtechnologies.com>
Committed: Fri Apr 22 10:45:58 2016 +0530

----------------------------------------------------------------------
 .../fineract/portfolio/loanaccount/domain/Loan.java     | 12 +++++++++++-
 .../loanaccount/domain/LoanAccountDomainServiceJpa.java |  3 +++
 .../LoanWritePlatformServiceJpaRepositoryImpl.java      |  3 +++
 3 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/67be38e7/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 1bf5ec1..fd9ca04 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
@@ -30,6 +30,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.ListIterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
@@ -2005,7 +2006,16 @@ public class Loan extends AbstractPersistable<Long> {
 
     private LocalDate determineExpectedMaturityDate() {
         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,

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/67be38e7/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java
index 437e7e6..ba0788f 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java
@@ -461,6 +461,9 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService
{
         Set<LoanCharge> loanCharges = loan.charges();
 
         for (LoanRepaymentScheduleInstallment installment : installments) {
+            if (installment.getDueDate().isAfter(loan.getMaturityDate())) {
+                accruedTill = DateUtils.getLocalDateOfTenant();
+            }
             if(!isOrganisationDateEnabled || new LocalDate(organisationStartDate).isBefore(installment.getDueDate())){
                 generateLoanScheduleAccrualData(accruedTill, loanScheduleAccrualDatas, loanId,
officeId, accrualStartDate, repaymentFrequency, 
                         repayEvery, interestCalculatedFrom, loanProductId, currency, currencyData,
loanCharges, installment);

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/67be38e7/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
index 639836a..6130338 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
@@ -312,6 +312,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
         checkForProductMixRestrictions(loan);
         
         LocalDate recalculateFrom = null;
+        if (loan.repaymentScheduleDetail().isInterestRecalculationEnabled()) {
+            recalculateFrom = actualDisbursementDate;
+        }
         ScheduleGeneratorDTO scheduleGeneratorDTO = this.loanUtilService.buildScheduleGeneratorDTO(loan,
recalculateFrom);
 
         // validate actual disbursement date against meeting date


Mime
View raw message