fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100...@apache.org
Subject incubator-fineract git commit: adding global config for interest charged from date same as disbursement date
Date Wed, 16 Mar 2016 11:23:36 GMT
Repository: incubator-fineract
Updated Branches:
  refs/heads/develop bf6d0eaa5 -> 04fe104dd


adding global config for interest charged from date same as disbursement date


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

Branch: refs/heads/develop
Commit: 04fe104dde51de3696dc05f545a1bbbf3ef7d83a
Parents: bf6d0ea
Author: sachinkulkarni12 <sachin.kulkarni@confluxtechnologies.com>
Authored: Tue Mar 15 18:06:24 2016 +0530
Committer: sachinkulkarni12 <sachin.kulkarni@confluxtechnologies.com>
Committed: Tue Mar 15 18:06:24 2016 +0530

----------------------------------------------------------------------
 ...tChargedFromDateSameAsDisbursalDateTest.java | 79 ++++++++++++++++++++
 .../domain/ConfigurationDomainService.java      |  2 +
 .../domain/ConfigurationDomainServiceJpa.java   |  8 ++
 .../loanaccount/data/ScheduleGeneratorDTO.java  |  9 ++-
 .../portfolio/loanaccount/domain/Loan.java      |  6 +-
 .../domain/AbstractLoanScheduleGenerator.java   | 18 +++--
 .../domain/LoanApplicationTerms.java            | 25 +++++--
 .../service/LoanScheduleAssembler.java          |  3 +-
 ...onWritePlatformServiceJpaRepositoryImpl.java |  2 +-
 .../loanaccount/service/LoanUtilService.java    |  3 +-
 ...rest_charged_date_same_as_disbursal_date.sql |  1 +
 11 files changed, 140 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/04fe104d/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest.java
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest.java
new file mode 100644
index 0000000..97fee48
--- /dev/null
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest.java
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.integrationtests;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
+import org.apache.fineract.integrationtests.common.Utils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.jayway.restassured.builder.RequestSpecBuilder;
+import com.jayway.restassured.builder.ResponseSpecBuilder;
+import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.specification.RequestSpecification;
+import com.jayway.restassured.specification.ResponseSpecification;
+
+
+public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest {
+    
+    private ResponseSpecification responseSpec;
+    private RequestSpecification requestSpec;
+    private GlobalConfigurationHelper globalConfigurationHelper;
+    
+    @Before
+    public void setup() {
+        Utils.initializeRESTAssured();
+        this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
+        this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
+        this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
+    }
+    
+    @SuppressWarnings( {"static-access", "rawtypes", "unchecked"})
+    @Test
+    public void testInterestChargedFromDateSameAsDisbursalDate(){
+        this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec,
this.responseSpec);
+        
+     // Retrieving All Global Configuration details
+        final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper
+                        .getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
+        Assert.assertNotNull(globalConfig);
+        
+        String configName = "interest-charged-from-date-same-as-disbursal-date";
+        boolean newBooleanValue = true;
+        
+        for (Integer configIndex = 0; configIndex < (globalConfig.size()); configIndex++)
{
+                if (globalConfig.get(configIndex).get("name")
+                                .equals(configName)) {
+                        String configId = (globalConfig.get(configIndex).get("id"))
+                                        .toString();
+                        Integer updateConfigId = this.globalConfigurationHelper
+                                        .updateEnabledFlagForGlobalConfiguration(this.requestSpec,
this.responseSpec,
+                                                configId.toString(), newBooleanValue);;
+                        Assert.assertNotNull(updateConfigId);
+                        break;
+                }
+        }
+        
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/04fe104d/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainService.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainService.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainService.java
index 3985fc5..a466a95 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainService.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainService.java
@@ -70,4 +70,6 @@ public interface ConfigurationDomainService {
     Date retrieveOrganisationStartDate();
     
     boolean isPaymnetypeApplicableforDisbursementCharge();
+    
+    boolean isInterestChargedFromDateSameAsDisbursementDate();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/04fe104d/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
index 45906af..c957f94 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
@@ -236,4 +236,12 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
         return property.isEnabled();
 	}
 
+    @Override
+    public boolean isInterestChargedFromDateSameAsDisbursementDate() {
+        final String propertyName = "interest-charged-from-date-same-as-disbursal-date";
+        final GlobalConfigurationProperty property = this.globalConfigurationRepository.findOneByNameWithNotFoundDetection(propertyName);
+        return property.isEnabled();
+    }
+
+  
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/04fe104d/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/ScheduleGeneratorDTO.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/ScheduleGeneratorDTO.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/ScheduleGeneratorDTO.java
index a8f7a35..7ffe6bd 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/ScheduleGeneratorDTO.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/data/ScheduleGeneratorDTO.java
@@ -39,12 +39,14 @@ public class ScheduleGeneratorDTO {
     final FloatingRateDTO floatingRateDTO;
     final Calendar calendar;
     final CalendarHistoryDataWrapper calendarHistoryDataWrapper;
+    final Boolean isInterestChargedFromDateAsDisbursementDateEnabled;
 
     public ScheduleGeneratorDTO(final LoanScheduleGeneratorFactory loanScheduleFactory, final
ApplicationCurrency applicationCurrency,
             final LocalDate calculatedRepaymentsStartingFromDate, final HolidayDetailDTO
holidayDetailDTO,
             final CalendarInstance calendarInstanceForInterestRecalculation, final CalendarInstance
compoundingCalendarInstance,
             final LocalDate recalculateFrom, final Long overdurPenaltyWaitPeriod, final FloatingRateDTO
floatingRateDTO,
-            final Calendar calendar, final CalendarHistoryDataWrapper calendarHistoryDataWrapper)
{
+            final Calendar calendar, final CalendarHistoryDataWrapper calendarHistoryDataWrapper,

+            final Boolean isInterestChargedFromDateAsDisbursementDateEnabled) {
 
         this.loanScheduleFactory = loanScheduleFactory;
         this.applicationCurrency = applicationCurrency;
@@ -57,6 +59,7 @@ public class ScheduleGeneratorDTO {
         this.floatingRateDTO = floatingRateDTO;
         this.calendar = calendar;
         this.calendarHistoryDataWrapper  = calendarHistoryDataWrapper;
+        this.isInterestChargedFromDateAsDisbursementDateEnabled = isInterestChargedFromDateAsDisbursementDateEnabled;
 
     }
 
@@ -115,5 +118,9 @@ public class ScheduleGeneratorDTO {
     public CalendarHistoryDataWrapper getCalendarHistoryDataWrapper(){
         return this.calendarHistoryDataWrapper;
     }
+    
+    public Boolean isInterestChargedFromDateAsDisbursementDateEnabled(){
+        return this.isInterestChargedFromDateAsDisbursementDateEnabled;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/04fe104d/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 42e94e4..5697c9e 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
@@ -5052,12 +5052,16 @@ public class Loan extends AbstractPersistable<Long> {
         FloatingRateDTO floatingRateDTO = scheduleGeneratorDTO.getFloatingRateDTO();
         List<LoanTermVariationsData> loanTermVariations = new ArrayList<>();
         annualNominalInterestRate = constructLoanTermVariations(floatingRateDTO, annualNominalInterestRate,
loanTermVariations);
+        LocalDate interestChargedFromDate = getInterestChargedFromDate();
+        if(interestChargedFromDate == null && scheduleGeneratorDTO.isInterestChargedFromDateAsDisbursementDateEnabled()){
+            interestChargedFromDate = getDisbursementDate();
+        }
 
         final LoanApplicationTerms loanApplicationTerms = LoanApplicationTerms.assembleFrom(scheduleGeneratorDTO.getApplicationCurrency(),
                 loanTermFrequency, loanTermPeriodFrequencyType, nthDayType, dayOfWeekType,
getDisbursementDate(),
                 getExpectedFirstRepaymentOnDate(), scheduleGeneratorDTO.getCalculatedRepaymentsStartingFromDate(),
getInArrearsTolerance(),
                 this.loanRepaymentScheduleDetail, this.loanProduct.isMultiDisburseLoan(),
this.fixedEmiAmount, disbursementData,
-                this.maxOutstandingLoanBalance, getInterestChargedFromDate(), this.loanProduct.getPrincipalThresholdForLastInstallment(),
+                this.maxOutstandingLoanBalance, interestChargedFromDate, this.loanProduct.getPrincipalThresholdForLastInstallment(),
                 this.loanProduct.getInstallmentAmountInMultiplesOf(), recalculationFrequencyType,
restCalendarInstance, compoundingMethod,
                 compoundingCalendarInstance, compoundingFrequencyType, this.loanProduct.preCloseInterestCalculationStrategy(),
                 rescheduleStrategyMethod, calendar, getApprovedPrincipal(), annualNominalInterestRate,
loanTermVariations, calendarHistoryDataWrapper);

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/04fe104d/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java
index 1556329..e60a749 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java
@@ -185,7 +185,8 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
 
             // calculated interest start date for the period
             LocalDate periodStartDateApplicableForInterest = calculateInterestStartDateForPeriod(loanApplicationTerms,
-                    scheduleParams.getPeriodStartDate(), idealDisbursementDate, firstRepaymentdate);
+                    scheduleParams.getPeriodStartDate(), idealDisbursementDate, firstRepaymentdate,

+                    loanApplicationTerms.isInterestChargedFromDateSameAsDisbursalDateEnabled(),
loanApplicationTerms.getExpectedDisbursementDate());
 
             // Loan Schedule Exceptions that need to be applied for Loan Account
             LoanTermVariationParams termVariationParams = applyLoanTermVariations(loanApplicationTerms,
scheduleParams,
@@ -249,7 +250,8 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
                 continue;
             }
             periodStartDateApplicableForInterest = calculateInterestStartDateForPeriod(loanApplicationTerms,
-                    scheduleParams.getPeriodStartDate(), idealDisbursementDate, firstRepaymentdate);
+                    scheduleParams.getPeriodStartDate(), idealDisbursementDate, firstRepaymentdate,

+                    loanApplicationTerms.isInterestChargedFromDateSameAsDisbursalDateEnabled(),
loanApplicationTerms.getExpectedDisbursementDate());
 
             // backup for pre-close transaction
             updateCompoundingDetails(scheduleParams, periodStartDateApplicableForInterest);
@@ -632,7 +634,8 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
                             // calculates period start date for interest
                             // calculation as per the configuration
                             periodStartDateApplicableForInterest = calculateInterestStartDateForPeriod(loanApplicationTerms,
-                                    scheduleParams.getPeriodStartDate(), idealDisbursementDate,
firstRepaymentdate);
+                                    scheduleParams.getPeriodStartDate(), idealDisbursementDate,
firstRepaymentdate,
+                                    loanApplicationTerms.isInterestChargedFromDateSameAsDisbursalDateEnabled(),
loanApplicationTerms.getExpectedDisbursementDate());
 
                             int daysInPeriodApplicable = Days.daysBetween(periodStartDateApplicableForInterest,
transactionDate).getDays();
                             Money interestForThisinstallment = Money.zero(currency);
@@ -1534,9 +1537,12 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
      * 
      * @param firstRepaymentdate
      *            TODO
+     * @param boolean1 
+     * @param localDate 
      */
     private LocalDate calculateInterestStartDateForPeriod(final LoanApplicationTerms loanApplicationTerms,
LocalDate periodStartDate,
-            final LocalDate idealDisbursementDate, final LocalDate firstRepaymentdate) {
+            final LocalDate idealDisbursementDate, final LocalDate firstRepaymentdate, final
Boolean isInterestChargedFromDateSameAsDisbursalDateEnabled, 
+            final LocalDate expectedDisbursementDate) {
         LocalDate periodStartDateApplicableForInterest = periodStartDate;
         if (periodStartDate.isBefore(idealDisbursementDate) || firstRepaymentdate.isAfter(periodStartDate))
{
             if (loanApplicationTerms.getInterestChargedFromLocalDate() != null) {
@@ -1544,9 +1550,11 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
                         || loanApplicationTerms.getInterestChargedFromLocalDate().isAfter(periodStartDate))
{
                     periodStartDateApplicableForInterest = loanApplicationTerms.getInterestChargedFromLocalDate();
                 }
+            } else if(loanApplicationTerms.getInterestChargedFromLocalDate() == null &&
isInterestChargedFromDateSameAsDisbursalDateEnabled) {
+                periodStartDateApplicableForInterest = expectedDisbursementDate;
             } else if (periodStartDate.isEqual(loanApplicationTerms.getExpectedDisbursementDate()))
{
                 periodStartDateApplicableForInterest = idealDisbursementDate;
-            }
+            } 
         }
         return periodStartDateApplicableForInterest;
     }

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/04fe104d/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 68e9d83..e4f1555 100755
--- 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
@@ -180,6 +180,8 @@ public final class LoanApplicationTerms {
     private final LocalDate seedDate;
 
     private final CalendarHistoryDataWrapper calendarHistoryDataWrapper;
+    
+    private final Boolean isInterestChargedFromDateSameAsDisbursalDateEnabled;
 
     public static LoanApplicationTerms assembleFrom(final ApplicationCurrency currency, final
Integer loanTermFrequency,
             final PeriodFrequencyType loanTermPeriodFrequencyType, final Integer numberOfRepayments,
final Integer repaymentEvery,
@@ -197,7 +199,7 @@ public final class LoanApplicationTerms {
             final CalendarInstance compoundingCalendarInstance, final RecalculationFrequencyType
compoundingFrequencyType,
             final BigDecimal principalThresholdForLastInstalment, final Integer installmentAmountInMultiplesOf,
             final LoanPreClosureInterestCalculationStrategy preClosureInterestCalculationStrategy,
final Calendar loanCalendar,
-            BigDecimal approvedAmount, List<LoanTermVariationsData> loanTermVariations)
{
+            BigDecimal approvedAmount, List<LoanTermVariationsData> loanTermVariations,
Boolean isInterestChargedFromDateSameAsDisbursalDateEnabled) {
 
         final LoanRescheduleStrategyMethod rescheduleStrategyMethod = null;
         final InterestRecalculationCompoundingMethod interestRecalculationCompoundingMethod
= null;
@@ -211,7 +213,8 @@ public final class LoanApplicationTerms {
                 graceOnArrearsAgeing, daysInMonthType, daysInYearType, isInterestRecalculationEnabled,
rescheduleStrategyMethod,
                 interestRecalculationCompoundingMethod, restCalendarInstance, recalculationFrequencyType,
compoundingCalendarInstance,
                 compoundingFrequencyType, principalThresholdForLastInstalment, installmentAmountInMultiplesOf,
-                preClosureInterestCalculationStrategy, loanCalendar, approvedAmount, loanTermVariations,
calendarHistoryDataWrapper);
+                preClosureInterestCalculationStrategy, loanCalendar, approvedAmount, loanTermVariations,
calendarHistoryDataWrapper,
+                isInterestChargedFromDateSameAsDisbursalDateEnabled);
     }
 
     public static LoanApplicationTerms assembleFrom(final ApplicationCurrency applicationCurrency,
final Integer loanTermFrequency,
@@ -275,6 +278,7 @@ public final class LoanApplicationTerms {
         final DaysInMonthType daysInMonthType = loanProductRelatedDetail.fetchDaysInMonthType();
         final DaysInYearType daysInYearType = loanProductRelatedDetail.fetchDaysInYearType();
         final boolean isInterestRecalculationEnabled = loanProductRelatedDetail.isInterestRecalculationEnabled();
+        final boolean isInterestChargedFromDateSameAsDisbursalDateEnabled = false;
         return new LoanApplicationTerms(applicationCurrency, loanTermFrequency, loanTermPeriodFrequencyType,
numberOfRepayments,
                 repaymentEvery, repaymentPeriodFrequencyType, nthDay.getValue(), dayOfWeek,
amortizationMethod, interestMethod,
                 interestRatePerPeriod, interestRatePeriodFrequencyType, annualNominalInterestRate,
interestCalculationPeriodMethod,
@@ -284,7 +288,8 @@ public final class LoanApplicationTerms {
                 loanProductRelatedDetail.getGraceOnDueDate(), daysInMonthType, daysInYearType,
isInterestRecalculationEnabled,
                 rescheduleStrategyMethod, compoundingMethod, restCalendarInstance, recalculationFrequencyType,
compoundingCalendarInstance,
                 compoundingFrequencyType, principalThresholdForLastInstalment, installmentAmountInMultiplesOf,
-                loanPreClosureInterestCalculationStrategy, loanCalendar, approvedAmount,
loanTermVariations, calendarHistoryDataWrapper);
+                loanPreClosureInterestCalculationStrategy, loanCalendar, approvedAmount,
loanTermVariations, calendarHistoryDataWrapper,
+                isInterestChargedFromDateSameAsDisbursalDateEnabled);
     }
 
     public static LoanApplicationTerms assembleFrom(final ApplicationCurrency applicationCurrency,
final Integer loanTermFrequency,
@@ -327,6 +332,7 @@ public final class LoanApplicationTerms {
             interestRecalculationCompoundingMethod = interestRecalculationDetails.getInterestRecalculationCompoundingMethod();
         }
         final CalendarHistoryDataWrapper calendarHistoryDataWrapper = null;
+        final boolean isInterestChargedFromDateSameAsDisbursalDateEnabled = false;
 
         return new LoanApplicationTerms(applicationCurrency, loanTermFrequency, loanTermPeriodFrequencyType,
numberOfRepayments,
                 repaymentEvery, repaymentPeriodFrequencyType, null, null, amortizationMethod,
interestMethod, interestRatePerPeriod,
@@ -337,7 +343,8 @@ public final class LoanApplicationTerms {
                 loanProductRelatedDetail.getGraceOnDueDate(), daysInMonthType, daysInYearType,
isInterestRecalculationEnabled,
                 rescheduleStrategyMethod, interestRecalculationCompoundingMethod, restCalendarInstance,
recalculationFrequencyType,
                 compoundingCalendarInstance, compoundingFrequencyType, principalThresholdForLastInstalment,
installmentAmountInMultiplesOf,
-                loanPreClosureInterestCalculationStrategy, loanCalendar, approvedAmount,
loanTermVariations, calendarHistoryDataWrapper);
+                loanPreClosureInterestCalculationStrategy, loanCalendar, approvedAmount,
loanTermVariations, calendarHistoryDataWrapper,
+                isInterestChargedFromDateSameAsDisbursalDateEnabled);
     }
 
     public static LoanApplicationTerms assembleFrom(final LoanApplicationTerms applicationTerms,
@@ -359,7 +366,8 @@ public final class LoanApplicationTerms {
                 applicationTerms.compoundingCalendarInstance, applicationTerms.compoundingFrequencyType,
                 applicationTerms.principalThresholdForLastInstalment, applicationTerms.installmentAmountInMultiplesOf,
                 applicationTerms.preClosureInterestCalculationStrategy, applicationTerms.loanCalendar,
-                applicationTerms.approvedPrincipal.getAmount(), loanTermVariations, applicationTerms.calendarHistoryDataWrapper);
+                applicationTerms.approvedPrincipal.getAmount(), loanTermVariations, applicationTerms.calendarHistoryDataWrapper,
+                applicationTerms.isInterestChargedFromDateSameAsDisbursalDateEnabled);
     }
 
     private LoanApplicationTerms(final ApplicationCurrency currency, final Integer loanTermFrequency,
@@ -381,7 +389,7 @@ public final class LoanApplicationTerms {
             final BigDecimal principalThresholdForLastInstalment, final Integer installmentAmountInMultiplesOf,
             final LoanPreClosureInterestCalculationStrategy preClosureInterestCalculationStrategy,
final Calendar loanCalendar,
             BigDecimal approvedAmount, List<LoanTermVariationsData> loanTermVariations,
-            final CalendarHistoryDataWrapper calendarHistoryDataWrapper) {
+            final CalendarHistoryDataWrapper calendarHistoryDataWrapper, Boolean isInterestChargedFromDateSameAsDisbursalDateEnabled)
{
         this.currency = currency;
         this.loanTermFrequency = loanTermFrequency;
         this.loanTermPeriodFrequencyType = loanTermPeriodFrequencyType;
@@ -440,6 +448,7 @@ public final class LoanApplicationTerms {
             this.seedDate = this.calculatedRepaymentsStartingFromDate;
         }
         this.calendarHistoryDataWrapper = calendarHistoryDataWrapper;
+        this.isInterestChargedFromDateSameAsDisbursalDateEnabled = isInterestChargedFromDateSameAsDisbursalDateEnabled;
     }
 
     public Money adjustPrincipalIfLastRepaymentPeriod(final Money principalForPeriod, final
Money totalCumulativePrincipalToDate,
@@ -1440,5 +1449,9 @@ public final class LoanApplicationTerms {
     public CalendarHistoryDataWrapper getCalendarHistoryDataWrapper() {
         return this.calendarHistoryDataWrapper;
     }
+    
+    public Boolean isInterestChargedFromDateSameAsDisbursalDateEnabled(){
+        return this.isInterestChargedFromDateSameAsDisbursalDateEnabled;
+    }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/04fe104d/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java
index 3c284ee..b5486f7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java
@@ -289,6 +289,7 @@ public class LoanScheduleAssembler {
         final Integer graceOnInterestPayment = this.fromApiJsonHelper.extractIntegerWithLocaleNamed("graceOnInterestPayment",
element);
         final Integer graceOnInterestCharged = this.fromApiJsonHelper.extractIntegerWithLocaleNamed("graceOnInterestCharged",
element);
         final LocalDate interestChargedFromDate = this.fromApiJsonHelper.extractLocalDateNamed("interestChargedFromDate",
element);
+        final Boolean isInterestChargedFromDateSameAsDisbursalDateEnabled = this.configurationDomainService.isInterestChargedFromDateSameAsDisbursementDate();
 
         final Integer graceOnArrearsAgeing = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(
                 LoanProductConstants.graceOnArrearsAgeingParameterName, element);
@@ -396,7 +397,7 @@ public class LoanScheduleAssembler {
                 maxOutstandingBalance, graceOnArrearsAgeing, daysInMonthType, daysInYearType,
isInterestRecalculationEnabled,
                 recalculationFrequencyType, restCalendarInstance, compoundingCalendarInstance,
compoundingFrequencyType,
                 principalThresholdForLastInstalment, installmentAmountInMultiplesOf, loanProduct.preCloseInterestCalculationStrategy(),
-                calendar, BigDecimal.ZERO, loanTermVariations);
+                calendar, BigDecimal.ZERO, loanTermVariations, isInterestChargedFromDateSameAsDisbursalDateEnabled);
     }
 
     private CalendarInstance createCalendarForSameAsRepayment(final Integer repaymentEvery,

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/04fe104d/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
index 869dd91..e27edf6 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
@@ -550,7 +550,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements
Loa
                     }
                 }
             }
-
+            
             final Set<LoanCollateral> possiblyModifedLoanCollateralItems = this.loanCollateralAssembler
                     .fromParsedJson(command.parsedJson());
 

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/04fe104d/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanUtilService.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanUtilService.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanUtilService.java
index ce63594..063bad8 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanUtilService.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanUtilService.java
@@ -123,10 +123,11 @@ public class LoanUtilService {
                     loan.loanInterestRecalculationDetailId(), CalendarEntityType.LOAN_RECALCULATION_COMPOUNDING_DETAIL.getValue());
             overdurPenaltyWaitPeriod = this.configurationDomainService.retrievePenaltyWaitPeriod();
         }
+        final Boolean isInterestChargedFromDateAsDisbursementDateEnabled = this.configurationDomainService.isInterestChargedFromDateSameAsDisbursementDate();
         FloatingRateDTO floatingRateDTO = constructFloatingRateDTO(loan);
         ScheduleGeneratorDTO scheduleGeneratorDTO = new ScheduleGeneratorDTO(loanScheduleFactory,
applicationCurrency,
                 calculatedRepaymentsStartingFromDate, holidayDetails, restCalendarInstance,
compoundingCalendarInstance, recalculateFrom,
-                overdurPenaltyWaitPeriod, floatingRateDTO, calendar, calendarHistoryDataWrapper);
+                overdurPenaltyWaitPeriod, floatingRateDTO, calendar, calendarHistoryDataWrapper,
isInterestChargedFromDateAsDisbursementDateEnabled);
 
         return scheduleGeneratorDTO;
     }

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/04fe104d/fineract-provider/src/main/resources/sql/migrations/core_db/V295__configuration_for_interest_charged_date_same_as_disbursal_date.sql
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/resources/sql/migrations/core_db/V295__configuration_for_interest_charged_date_same_as_disbursal_date.sql
b/fineract-provider/src/main/resources/sql/migrations/core_db/V295__configuration_for_interest_charged_date_same_as_disbursal_date.sql
new file mode 100644
index 0000000..0d1c255
--- /dev/null
+++ b/fineract-provider/src/main/resources/sql/migrations/core_db/V295__configuration_for_interest_charged_date_same_as_disbursal_date.sql
@@ -0,0 +1 @@
+INSERT INTO `c_configuration` (`name`, `value`, `date_value`, `enabled`, `is_trap_door`,
`description`) VALUES ('interest-charged-from-date-same-as-disbursal-date', 0, NULL, 0, 0,
NULL);


Mime
View raw message