fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100...@apache.org
Subject [1/5] incubator-fineract git commit: FINERACT-94: Flexible morotorium(only principal portion)
Date Tue, 26 Apr 2016 05:43:25 GMT
Repository: incubator-fineract
Updated Branches:
  refs/heads/develop 3970b2ede -> e083d7904


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/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 ee19e66..56248ec 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
@@ -302,6 +302,7 @@ public class LoanScheduleAssembler {
 
         // grace details
         final Integer graceOnPrincipalPayment = this.fromApiJsonHelper.extractIntegerWithLocaleNamed("graceOnPrincipalPayment",
element);
+        final Integer recurringMoratoriumOnPrincipalPeriods = this.fromApiJsonHelper.extractIntegerWithLocaleNamed("recurringMoratoriumOnPrincipalPeriods",
element);
         final Integer graceOnInterestPayment = this.fromApiJsonHelper.extractIntegerWithLocaleNamed("graceOnInterestPayment",
element);
         final Integer graceOnInterestCharged = this.fromApiJsonHelper.extractIntegerWithLocaleNamed("graceOnInterestCharged",
element);
         final LocalDate interestChargedFromDate = this.fromApiJsonHelper.extractLocalDateNamed("interestChargedFromDate",
element);
@@ -408,7 +409,7 @@ public class LoanScheduleAssembler {
                 repaymentEvery, repaymentPeriodFrequencyType, nthDay, weekDayType, amortizationMethod,
interestMethod,
                 interestRatePerPeriod, interestRatePeriodFrequencyType, annualNominalInterestRate,
interestCalculationPeriodMethod,
                 allowPartialPeriodInterestCalcualtion, principalMoney, expectedDisbursementDate,
repaymentsStartingFromDate,
-                calculatedRepaymentsStartingFromDate, graceOnPrincipalPayment, graceOnInterestPayment,
graceOnInterestCharged,
+                calculatedRepaymentsStartingFromDate, graceOnPrincipalPayment, recurringMoratoriumOnPrincipalPeriods,
graceOnInterestPayment, graceOnInterestCharged,
                 interestChargedFromDate, inArrearsToleranceMoney, loanProduct.isMultiDisburseLoan(),
emiAmount, disbursementDatas,
                 maxOutstandingBalance, graceOnArrearsAgeing, daysInMonthType, daysInYearType,
isInterestRecalculationEnabled,
                 recalculationFrequencyType, restCalendarInstance, compoundingCalendarInstance,
compoundingFrequencyType,

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java
index 1a3da8e..626f84b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/RescheduleLoansApiConstants.java
@@ -35,6 +35,7 @@ public class RescheduleLoansApiConstants {
     // create action request parameters
     public static final String loanIdParamName = "loanId";
     public static final String graceOnPrincipalParamName = "graceOnPrincipal";
+    public static final String recurringMoratoriumOnPrincipalPeriodsParamName = "recurringMoratoriumOnPrincipalPeriods";
     public static final String graceOnInterestParamName = "graceOnInterest";
     public static final String extraTermsParamName = "extraTerms";
     public static final String rescheduleFromDateParamName = "rescheduleFromDate";
@@ -48,7 +49,7 @@ public class RescheduleLoansApiConstants {
     public static final String resheduleWithInterestRecalculationNotSupportedErrorCode =
"loan.reschedule.interestrecalculation.error.code";
     
     public static final Set<String> CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
dateFormatParamName,
-            graceOnPrincipalParamName, graceOnInterestParamName, extraTermsParamName, rescheduleFromDateParamName,
+            graceOnPrincipalParamName, recurringMoratoriumOnPrincipalPeriodsParamName, graceOnInterestParamName,
extraTermsParamName, rescheduleFromDateParamName,
             newInterestRateParamName, rescheduleReasonIdParamName, rescheduleReasonCommentParamName,
submittedOnDateParamName,
             loanIdParamName, adjustedDueDateParamName, recalculateInterestParamName));
 

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/CalculateLoanScheduleQueryFromApiJsonHelper.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/CalculateLoanScheduleQueryFromApiJsonHelper.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/CalculateLoanScheduleQueryFromApiJsonHelper.java
index f0f9a75..48a5c51 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/CalculateLoanScheduleQueryFromApiJsonHelper.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/CalculateLoanScheduleQueryFromApiJsonHelper.java
@@ -51,7 +51,7 @@ public final class CalculateLoanScheduleQueryFromApiJsonHelper {
             "inArrearsTolerance", "interestRatePerPeriod", "repaymentEvery", "numberOfRepayments",
"loanTermFrequency",
             "loanTermFrequencyType", "repaymentFrequencyType", "amortizationType", "interestType",
"interestCalculationPeriodType",
             LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName, "interestRateFrequencyType",
"expectedDisbursementDate",
-            "repaymentsStartingFromDate", "graceOnPrincipalPayment", "graceOnInterestPayment",
"graceOnInterestCharged",
+            "repaymentsStartingFromDate", "graceOnPrincipalPayment", "recurringMoratoriumOnPrincipalPeriods",
"graceOnInterestPayment", "graceOnInterestCharged",
             "interestChargedFromDate", "submittedOnDate", "submittedOnNote", "locale", "dateFormat",
"charges", "collateral",
             "syncDisbursementWithMeeting", "linkAccountId", LoanApiConstants.disbursementDataParameterName,
             LoanApiConstants.emiAmountParameterName, LoanApiConstants.maxOutstandingBalanceParameterName,

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java
index c55c16a..6b2c4c4 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java
@@ -67,6 +67,7 @@ public final class LoanApplicationCommandFromApiJsonHelper {
             "interestCalculationPeriodType", LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName,
             "interestRateFrequencyType", "expectedDisbursementDate", "repaymentsStartingFromDate",
             "graceOnPrincipalPayment",
+            "recurringMoratoriumOnPrincipalPeriods",
             "graceOnInterestPayment",
             "graceOnInterestCharged",
             "interestChargedFromDate",

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
index 3f0e3a1..772ea77 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
@@ -548,7 +548,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService
{
                     + " l.closedon_date as closedOnDate, cbu.username as closedByUsername,
cbu.firstname as closedByFirstname, cbu.lastname as closedByLastname, l.writtenoffon_date
as writtenOffOnDate, "
                     + " l.expected_firstrepaymenton_date as expectedFirstRepaymentOnDate,
l.interest_calculated_from_date as interestChargedFromDate, l.expected_maturedon_date as expectedMaturityDate,
"
                     + " l.principal_amount_proposed as proposedPrincipal, l.principal_amount
as principal, l.approved_principal as approvedPrincipal, l.arrearstolerance_amount as inArrearsTolerance,
l.number_of_repayments as numberOfRepayments, l.repay_every as repaymentEvery,"
-                    + " l.grace_on_principal_periods as graceOnPrincipalPayment, l.grace_on_interest_periods
as graceOnInterestPayment, l.grace_interest_free_periods as graceOnInterestCharged,l.grace_on_arrears_ageing
as graceOnArrearsAgeing,"
+                    + " l.grace_on_principal_periods as graceOnPrincipalPayment, l.recurring_moratorium_principal_periods
as recurringMoratoriumOnPrincipalPeriods, l.grace_on_interest_periods as graceOnInterestPayment,
l.grace_interest_free_periods as graceOnInterestCharged,l.grace_on_arrears_ageing as graceOnArrearsAgeing,"
                     + " l.nominal_interest_rate_per_period as interestRatePerPeriod, l.annual_nominal_interest_rate
as annualInterestRate, "
                     + " l.repayment_period_frequency_enum as repaymentFrequencyType, l.repayment_frequency_nth_day_enum
as repaymentFrequencyNthDayType, l.repayment_frequency_day_of_week_enum as repaymentFrequencyDayOfWeekType,
l.interest_period_frequency_enum as interestRateFrequencyType, "
                     + " l.term_frequency as termFrequency, l.term_period_frequency_enum as
termPeriodFrequencyType, "
@@ -740,6 +740,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService
{
             final boolean isFloatingInterestRate = rs.getBoolean("isFloatingInterestRate");
 
             final Integer graceOnPrincipalPayment = JdbcSupport.getIntegerDefaultToNullIfZero(rs,
"graceOnPrincipalPayment");
+            final Integer recurringMoratoriumOnPrincipalPeriods = JdbcSupport.getIntegerDefaultToNullIfZero(rs,
"recurringMoratoriumOnPrincipalPeriods");
             final Integer graceOnInterestPayment = JdbcSupport.getIntegerDefaultToNullIfZero(rs,
"graceOnInterestPayment");
             final Integer graceOnInterestCharged = JdbcSupport.getIntegerDefaultToNullIfZero(rs,
"graceOnInterestCharged");
             final Integer graceOnArrearsAgeing = JdbcSupport.getIntegerDefaultToNullIfZero(rs,
"graceOnArrearsAgeing");
@@ -899,7 +900,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService
{
                     repaymentFrequencyDayOfWeekType, transactionStrategyId, transactionStrategyName,
amortizationType,
                     interestRatePerPeriod, interestRateFrequencyType, annualInterestRate,
interestType, isFloatingInterestRate,
                     interestRateDifferential, interestCalculationPeriodType, allowPartialPeriodInterestCalcualtion,
-                    expectedFirstRepaymentOnDate, graceOnPrincipalPayment, graceOnInterestPayment,
graceOnInterestCharged,
+                    expectedFirstRepaymentOnDate, graceOnPrincipalPayment, recurringMoratoriumOnPrincipalPeriods,
graceOnInterestPayment, graceOnInterestCharged,
                     interestChargedFromDate, timeline, loanSummary, feeChargesDueAtDisbursementCharged,
syncDisbursementWithMeeting,
                     loanCounter, loanProductCounter, multiDisburseLoan, canDefineInstallmentAmount,
fixedEmiAmount, outstandingLoanBalance,
                     inArrears, graceOnArrearsAgeing, isNPA, daysInMonthType, daysInYearType,
isInterestRecalculationEnabled,

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResource.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResource.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResource.java
index 5a1db4d..a7d1816 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResource.java
@@ -81,7 +81,7 @@ public class LoanProductsApiResource {
 
     private final Set<String> LOAN_PRODUCT_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id",
"name", "shortName", "description",
             "fundId", "fundName", "includeInBorrowerCycle", "currency", "principal", "minPrincipal",
"maxPrincipal", "numberOfRepayments",
-            "minNumberOfRepayments", "maxNumberOfRepayments", "repaymentEvery", "repaymentFrequencyType",
"graceOnPrincipalPayment",
+            "minNumberOfRepayments", "maxNumberOfRepayments", "repaymentEvery", "repaymentFrequencyType",
"graceOnPrincipalPayment", "recurringMoratoriumOnPrincipalPeriods",
             "graceOnInterestPayment", "graceOnInterestCharged", "interestRatePerPeriod",
"minInterestRatePerPeriod",
             "maxInterestRatePerPeriod", "interestRateFrequencyType", "annualInterestRate",
"amortizationType", "interestType",
             "interestCalculationPeriodType", LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName,
"inArrearsTolerance",

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java
index f7ff948..48f730a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/data/LoanProductData.java
@@ -105,6 +105,7 @@ public class LoanProductData {
     private final Long transactionProcessingStrategyId;
     private final String transactionProcessingStrategyName;
     private final Integer graceOnPrincipalPayment;
+    private final Integer recurringMoratoriumOnPrincipalPeriods;
     private final Integer graceOnInterestPayment;
     private final Integer graceOnInterestCharged;
     private final Integer graceOnArrearsAgeing;
@@ -218,6 +219,7 @@ public class LoanProductData {
         final Long transactionProcessingStrategyId = null;
         final String transactionProcessingStrategyName = null;
         final Integer graceOnPrincipalPayment = null;
+        final Integer recurringMoratoriumOnPrincipalPeriods = null;
         final Integer graceOnInterestPayment = null;
         final Integer graceOnInterestCharged = null;
         final Integer graceOnArrearsAgeing = null;
@@ -254,7 +256,7 @@ public class LoanProductData {
                 numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery,
interestRatePerPeriod,
                 minInterestRatePerPeriod, maxInterestRatePerPeriod, annualInterestRate, repaymentFrequencyType,
interestRateFrequencyType,
                 amortizationType, interestType, interestCalculationPeriodType, allowPartialPeriodInterestCalcualtion,
fundId, fundName,
-                transactionProcessingStrategyId, transactionProcessingStrategyName, graceOnPrincipalPayment,
graceOnInterestPayment,
+                transactionProcessingStrategyId, transactionProcessingStrategyName, graceOnPrincipalPayment,
recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment,
                 graceOnInterestCharged, charges, accountingType, includeInBorrowerCycle,
useBorrowerCycle, startDate, closeDate, status,
                 externalId, principalVariations, interestRateVariations, numberOfRepaymentVariations,
multiDisburseLoan, maxTrancheCount,
                 outstandingLoanBalance, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType,
daysInYearType,
@@ -304,6 +306,7 @@ public class LoanProductData {
         final Long transactionProcessingStrategyId = null;
         final String transactionProcessingStrategyName = null;
         final Integer graceOnPrincipalPayment = null;
+        final Integer recurringMoratoriumOnPrincipalPeriods = null;
         final Integer graceOnInterestPayment = null;
         final Integer graceOnInterestCharged = null;
         final Integer graceOnArrearsAgeing = null;
@@ -342,7 +345,7 @@ public class LoanProductData {
                 numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery,
interestRatePerPeriod,
                 minInterestRatePerPeriod, maxInterestRatePerPeriod, annualInterestRate, repaymentFrequencyType,
interestRateFrequencyType,
                 amortizationType, interestType, interestCalculationPeriodType, allowPartialPeriodInterestCalcualtion,
fundId, fundName,
-                transactionProcessingStrategyId, transactionProcessingStrategyName, graceOnPrincipalPayment,
graceOnInterestPayment,
+                transactionProcessingStrategyId, transactionProcessingStrategyName, graceOnPrincipalPayment,
recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment,
                 graceOnInterestCharged, charges, accountingType, includeInBorrowerCycle,
useBorrowerCycle, startDate, closeDate, status,
                 externalId, principalVariations, interestRateVariations, numberOfRepaymentVariations,
multiDisburseLoan, maxTrancheCount,
                 outstandingLoanBalance, graceOnArrearsAgeing, overdueDaysForNPA, daysInMonthType,
daysInYearType,
@@ -398,6 +401,7 @@ public class LoanProductData {
         final String transactionProcessingStrategyName = null;
 
         final Integer graceOnPrincipalPayment = null;
+        final Integer recurringMoratoriumOnPrincipalPeriods = null;
         final Integer graceOnInterestPayment = null;
         final Integer graceOnInterestCharged = null;
         final Integer graceOnArrearsAgeing = null;
@@ -437,7 +441,7 @@ public class LoanProductData {
                 numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery,
interestRatePerPeriod,
                 minInterestRatePerPeriod, maxInterestRatePerPeriod, annualInterestRate, repaymentFrequencyType,
interestRateFrequencyType,
                 amortizationType, interestType, interestCalculationPeriodType, allowPartialPeriodInterestCalcualtion,
fundId, fundName,
-                transactionProcessingStrategyId, transactionProcessingStrategyName, graceOnPrincipalPayment,
graceOnInterestPayment,
+                transactionProcessingStrategyId, transactionProcessingStrategyName, graceOnPrincipalPayment,
recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment,
                 graceOnInterestCharged, charges, accountingType, includeInBorrowerCycle,
useBorrowerCycle, startDate, closeDate, status,
                 externalId, principalVariationsForBorrowerCycle, interestRateVariationsForBorrowerCycle,
                 numberOfRepaymentVariationsForBorrowerCycle, multiDisburseLoan, maxTrancheCount,
outstandingLoanBalance,
@@ -469,7 +473,7 @@ public class LoanProductData {
             final EnumOptionData interestRateFrequencyType, final EnumOptionData amortizationType,
final EnumOptionData interestType,
             final EnumOptionData interestCalculationPeriodType, final Boolean allowPartialPeriodInterestCalcualtion,
final Long fundId,
             final String fundName, final Long transactionProcessingStrategyId, final String
transactionProcessingStrategyName,
-            final Integer graceOnPrincipalPayment, final Integer graceOnInterestPayment,
final Integer graceOnInterestCharged,
+            final Integer graceOnPrincipalPayment, final Integer recurringMoratoriumOnPrincipalPeriods,
final Integer graceOnInterestPayment, final Integer graceOnInterestCharged,
             final Collection<ChargeData> charges, final EnumOptionData accountingType,
final boolean includeInBorrowerCycle,
             boolean useBorrowerCycle, final LocalDate startDate, final LocalDate closeDate,
final String status, final String externalId,
             Collection<LoanProductBorrowerCycleVariationData> principalVariations,
@@ -499,6 +503,7 @@ public class LoanProductData {
         this.minNumberOfRepayments = minNumberOfRepayments;
         this.maxNumberOfRepayments = maxNumberOfRepayments;
         this.graceOnPrincipalPayment = graceOnPrincipalPayment;
+        this.recurringMoratoriumOnPrincipalPeriods = recurringMoratoriumOnPrincipalPeriods;
         this.graceOnInterestPayment = graceOnInterestPayment;
         this.graceOnInterestCharged = graceOnInterestCharged;
         this.repaymentEvery = repaymentEvery;
@@ -668,6 +673,7 @@ public class LoanProductData {
         }
 
         this.graceOnPrincipalPayment = productData.graceOnPrincipalPayment;
+        this.recurringMoratoriumOnPrincipalPeriods = productData.recurringMoratoriumOnPrincipalPeriods;
         this.graceOnInterestPayment = productData.graceOnInterestPayment;
         this.graceOnInterestCharged = productData.graceOnInterestCharged;
         this.includeInBorrowerCycle = productData.includeInBorrowerCycle;
@@ -810,6 +816,10 @@ public class LoanProductData {
     public Integer getGraceOnPrincipalPayment() {
         return this.graceOnPrincipalPayment;
     }
+    
+    public Integer getRecurringMoratoriumOnPrincipalPeriods() {
+    	return this.recurringMoratoriumOnPrincipalPeriods;
+    }
 
     public Integer getGraceOnInterestPayment() {
         return this.graceOnInterestPayment;

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java
index 9116117..53d60a7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProduct.java
@@ -251,6 +251,7 @@ public class LoanProduct extends AbstractPersistable<Long> {
 
         // grace details
         final Integer graceOnPrincipalPayment = command.integerValueOfParameterNamed("graceOnPrincipalPayment");
+        final Integer recurringMoratoriumOnPrincipalPeriods = command.integerValueOfParameterNamed("recurringMoratoriumOnPrincipalPeriods");
         final Integer graceOnInterestPayment = command.integerValueOfParameterNamed("graceOnInterestPayment");
         final Integer graceOnInterestCharged = command.integerValueOfParameterNamed("graceOnInterestCharged");
         final Integer minimumDaysBetweenDisbursalAndFirstRepayment = command
@@ -327,7 +328,7 @@ public class LoanProduct extends AbstractPersistable<Long> {
         return new LoanProduct(fund, loanTransactionProcessingStrategy, name, shortName,
description, currency, principal, minPrincipal,
                 maxPrincipal, interestRatePerPeriod, minInterestRatePerPeriod, maxInterestRatePerPeriod,
interestFrequencyType,
                 annualInterestRate, interestMethod, interestCalculationPeriodMethod, allowPartialPeriodInterestCalcualtion,
repaymentEvery,
-                repaymentFrequencyType, numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments,
graceOnPrincipalPayment,
+                repaymentFrequencyType, numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments,
graceOnPrincipalPayment, recurringMoratoriumOnPrincipalPeriods,
                 graceOnInterestPayment, graceOnInterestCharged, amortizationMethod, inArrearsTolerance,
productCharges, accountingRuleType,
                 includeInBorrowerCycle, startDate, closeDate, externalId, useBorrowerCycle,
loanProductBorrowerCycleVariations,
                 multiDisburseLoan, maxTrancheCount, outstandingLoanBalance, graceOnArrearsAgeing,
overdueDaysForNPA, daysInMonthType,
@@ -552,7 +553,7 @@ public class LoanProduct extends AbstractPersistable<Long> {
             final InterestCalculationPeriodMethod interestCalculationPeriodMethod, final
boolean considerPartialPeriodInterest,
             final Integer repayEvery, final PeriodFrequencyType repaymentFrequencyType, final
Integer defaultNumberOfInstallments,
             final Integer defaultMinNumberOfInstallments, final Integer defaultMaxNumberOfInstallments,
-            final Integer graceOnPrincipalPayment, final Integer graceOnInterestPayment,
final Integer graceOnInterestCharged,
+            final Integer graceOnPrincipalPayment, final Integer recurringMoratoriumOnPrincipalPeriods,
final Integer graceOnInterestPayment, final Integer graceOnInterestCharged,
             final AmortizationMethod amortizationMethod, final BigDecimal inArrearsTolerance,
final List<Charge> charges,
             final AccountingRuleType accountingRuleType, final boolean includeInBorrowerCycle,
final LocalDate startDate,
             final LocalDate closeDate, final String externalId, final boolean useBorrowerCycle,
@@ -598,7 +599,7 @@ public class LoanProduct extends AbstractPersistable<Long> {
 
         this.loanProductRelatedDetail = new LoanProductRelatedDetail(currency, defaultPrincipal,
defaultNominalInterestRatePerPeriod,
                 interestPeriodFrequencyType, defaultAnnualNominalInterestRate, interestMethod,
interestCalculationPeriodMethod,
-                considerPartialPeriodInterest, repayEvery, repaymentFrequencyType, defaultNumberOfInstallments,
graceOnPrincipalPayment,
+                considerPartialPeriodInterest, repayEvery, repaymentFrequencyType, defaultNumberOfInstallments,
graceOnPrincipalPayment, recurringMoratoriumOnPrincipalPeriods,
                 graceOnInterestPayment, graceOnInterestCharged, amortizationMethod, inArrearsTolerance,
graceOnArrearsAgeing,
                 daysInMonthType.getValue(), daysInYearType.getValue(), isInterestRecalculationEnabled);
 

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductMinimumRepaymentScheduleRelatedDetail.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductMinimumRepaymentScheduleRelatedDetail.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductMinimumRepaymentScheduleRelatedDetail.java
index 15cf538..218d839 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductMinimumRepaymentScheduleRelatedDetail.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductMinimumRepaymentScheduleRelatedDetail.java
@@ -40,6 +40,8 @@ public interface LoanProductMinimumRepaymentScheduleRelatedDetail {
 	
 	Integer graceOnPrincipalPayment();
 	
+	Integer recurringMoratoriumOnPrincipalPeriods();
+	
 	Money getInArrearsTolerance();
 	
 	BigDecimal getNominalInterestRatePerPeriod();

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRelatedDetail.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRelatedDetail.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRelatedDetail.java
index 8f7a8d2..1d7aaf6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRelatedDetail.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRelatedDetail.java
@@ -98,6 +98,9 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
     @Column(name = "grace_on_principal_periods", nullable = true)
     private Integer graceOnPrincipalPayment;
 
+    @Column(name = "recurring_moratorium_principal_periods", nullable = true)
+    private Integer recurringMoratoriumOnPrincipalPeriods;
+
     @Column(name = "grace_on_interest_periods", nullable = true)
     private Integer graceOnInterestPayment;
 
@@ -130,13 +133,13 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
             final BigDecimal nominalAnnualInterestRate, final InterestMethod interestMethod,
             final InterestCalculationPeriodMethod interestCalculationPeriodMethod, final
boolean allowPartialPeriodInterestCalcualtion,
             final Integer repaymentEvery, final PeriodFrequencyType repaymentPeriodFrequencyType,
final Integer numberOfRepayments,
-            final Integer graceOnPrincipalPayment, final Integer graceOnInterestPayment,
final Integer graceOnInterestCharged,
+            final Integer graceOnPrincipalPayment, final Integer recurringMoratoriumOnPrincipalPeriods,
final Integer graceOnInterestPayment, final Integer graceOnInterestCharged,
             final AmortizationMethod amortizationMethod, final BigDecimal inArrearsTolerance,
final Integer graceOnArrearsAgeing,
             final Integer daysInMonthType, final Integer daysInYearType, final boolean isInterestRecalculationEnabled)
{
 
         return new LoanProductRelatedDetail(currency, principal, nominalInterestRatePerPeriod,
interestRatePeriodFrequencyType,
                 nominalAnnualInterestRate, interestMethod, interestCalculationPeriodMethod,
allowPartialPeriodInterestCalcualtion,
-                repaymentEvery, repaymentPeriodFrequencyType, numberOfRepayments, graceOnPrincipalPayment,
graceOnInterestPayment,
+                repaymentEvery, repaymentPeriodFrequencyType, numberOfRepayments, graceOnPrincipalPayment,
recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment,
                 graceOnInterestCharged, amortizationMethod, inArrearsTolerance, graceOnArrearsAgeing,
daysInMonthType, daysInYearType,
                 isInterestRecalculationEnabled);
     }
@@ -150,7 +153,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
             final BigDecimal defaultAnnualNominalInterestRate, final InterestMethod interestMethod,
             final InterestCalculationPeriodMethod interestCalculationPeriodMethod, final
boolean allowPartialPeriodInterestCalcualtion,
             final Integer repayEvery, final PeriodFrequencyType repaymentFrequencyType, final
Integer defaultNumberOfRepayments,
-            final Integer graceOnPrincipalPayment, final Integer graceOnInterestPayment,
final Integer graceOnInterestCharged,
+            final Integer graceOnPrincipalPayment, final Integer recurringMoratoriumOnPrincipalPeriods,
final Integer graceOnInterestPayment, final Integer graceOnInterestCharged,
             final AmortizationMethod amortizationMethod, final BigDecimal inArrearsTolerance,
final Integer graceOnArrearsAgeing,
             final Integer daysInMonthType, final Integer daysInYearType, final boolean isInterestRecalculationEnabled)
{
         this.currency = currency;
@@ -165,6 +168,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
         this.repaymentPeriodFrequencyType = repaymentFrequencyType;
         this.numberOfRepayments = defaultNumberOfRepayments;
         this.graceOnPrincipalPayment = defaultToNullIfZero(graceOnPrincipalPayment);
+        this.recurringMoratoriumOnPrincipalPeriods = recurringMoratoriumOnPrincipalPeriods;
         this.graceOnInterestPayment = defaultToNullIfZero(graceOnInterestPayment);
         this.graceOnInterestCharged = defaultToNullIfZero(graceOnInterestCharged);
         this.amortizationMethod = amortizationMethod;
@@ -217,6 +221,11 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
     }
 
     @Override
+    public Integer recurringMoratoriumOnPrincipalPeriods() {
+        return this.recurringMoratoriumOnPrincipalPeriods;
+    }
+    
+    @Override
     public Money getInArrearsTolerance() {
         return Money.of(this.currency, this.inArrearsTolerance);
     }
@@ -431,6 +440,14 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
             actualChanges.put("locale", localeAsInput);
             this.graceOnPrincipalPayment = newValue;
         }
+        
+        final String recurringMoratoriumOnPrincipalPeriodsParamName = "recurringMoratoriumOnPrincipalPeriods";
+        if (command.isChangeInIntegerParameterNamed(recurringMoratoriumOnPrincipalPeriodsParamName,
this.recurringMoratoriumOnPrincipalPeriods)) {
+            final Integer newValue = command.integerValueOfParameterNamed(recurringMoratoriumOnPrincipalPeriodsParamName);
+            actualChanges.put(recurringMoratoriumOnPrincipalPeriodsParamName, newValue);
+            actualChanges.put("locale", localeAsInput);
+            this.recurringMoratoriumOnPrincipalPeriods = newValue;
+        }
 
         final String graceOnInterestPaymentParamName = "graceOnInterestPayment";
         if (command.isChangeInIntegerParameterNamed(graceOnInterestPaymentParamName, this.graceOnInterestPayment))
{
@@ -500,6 +517,23 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
             baseDataValidator.reset().parameter("graceOnInterestCharged").value(this.graceOnInterestCharged)
                     .failWithCode(".mustBeLessThan.numberOfRepayments");
         }
+        
+        int graceOnPrincipal = 0;
+        if (this.getGraceOnPrincipalPayment() != null) {
+        	graceOnPrincipal = this.getGraceOnPrincipalPayment().intValue();
+        }
+        int recurMoratoriumOnPrincipal = 0;
+        if (this.recurringMoratoriumOnPrincipalPeriods() != null) {
+        	recurMoratoriumOnPrincipal = this.recurringMoratoriumOnPrincipalPeriods().intValue();
+        }
+        
+        if (  ( recurMoratoriumOnPrincipal > 0 ) 
+        	&& ( (this.numberOfRepayments - graceOnPrincipal) % ( recurMoratoriumOnPrincipal
+ 1) != 1) ) {
+            baseDataValidator.reset().parameter("graceOnPrincipalPayments.and.recurringMoratoriumOnPrincipalPeriods")
+	            	.value(graceOnPrincipal)
+	            	.value(recurMoratoriumOnPrincipal)
+	                .failWithCode("causes.principal.moratorium.for.last.installment");
+        }
 
         if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors);
}
     }

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
index 39b4d62..3437b94 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/serialization/LoanProductDataValidator.java
@@ -67,7 +67,7 @@ public final class LoanProductDataValidator {
             "numberOfRepayments", "minNumberOfRepayments", "maxNumberOfRepayments", "repaymentFrequencyType",
"interestRatePerPeriod",
             "minInterestRatePerPeriod", "maxInterestRatePerPeriod", "interestRateFrequencyType",
"amortizationType", "interestType",
             "interestCalculationPeriodType", LoanProductConstants.allowPartialPeriodInterestCalcualtionParamName,
"inArrearsTolerance",
-            "transactionProcessingStrategyId", "graceOnPrincipalPayment", "graceOnInterestPayment",
"graceOnInterestCharged", "charges",
+            "transactionProcessingStrategyId", "graceOnPrincipalPayment", "recurringMoratoriumOnPrincipalPeriods",
"graceOnInterestPayment", "graceOnInterestCharged", "charges",
             "accountingRule", "includeInBorrowerCycle", "startDate", "closeDate", "externalId",
"isLinkedToFloatingInterestRates",
             "floatingRatesId", "interestRateDifferential", "minDifferentialLendingRate",
"defaultDifferentialLendingRate",
             "maxDifferentialLendingRate", "isFloatingInterestRateCalculationAllowed",

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java
index c71286a..47f5493 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java
@@ -184,7 +184,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
                     + "lp.nominal_interest_rate_per_period as interestRatePerPeriod, lp.min_nominal_interest_rate_per_period
as minInterestRatePerPeriod, lp.max_nominal_interest_rate_per_period as maxInterestRatePerPeriod,
lp.interest_period_frequency_enum as interestRatePerPeriodFreq, "
                     + "lp.annual_nominal_interest_rate as annualInterestRate, lp.interest_method_enum
as interestMethod, lp.interest_calculated_in_period_enum as interestCalculationInPeriodMethod,lp.allow_partial_period_interest_calcualtion
as allowPartialPeriodInterestCalcualtion, "
                     + "lp.repay_every as repaidEvery, lp.repayment_period_frequency_enum
as repaymentPeriodFrequency, lp.number_of_repayments as numberOfRepayments, lp.min_number_of_repayments
as minNumberOfRepayments, lp.max_number_of_repayments as maxNumberOfRepayments, "
-                    + "lp.grace_on_principal_periods as graceOnPrincipalPayment, lp.grace_on_interest_periods
as graceOnInterestPayment, lp.grace_interest_free_periods as graceOnInterestCharged,lp.grace_on_arrears_ageing
as graceOnArrearsAgeing,lp.overdue_days_for_npa as overdueDaysForNPA, "
+                    + "lp.grace_on_principal_periods as graceOnPrincipalPayment, lp.recurring_moratorium_principal_periods
as recurringMoratoriumOnPrincipalPeriods, lp.grace_on_interest_periods as graceOnInterestPayment,
lp.grace_interest_free_periods as graceOnInterestCharged,lp.grace_on_arrears_ageing as graceOnArrearsAgeing,lp.overdue_days_for_npa
as overdueDaysForNPA, "
                     + "lp.min_days_between_disbursal_and_first_repayment As minimumDaysBetweenDisbursalAndFirstRepayment,
"
                     + "lp.amortization_method_enum as amortizationMethod, lp.arrearstolerance_amount
as tolerance, "
                     + "lp.accounting_type as accountingType, lp.include_in_borrower_cycle
as includeInBorrowerCycle,lp.use_borrower_cycle as useBorrowerCycle, lp.start_date as startDate,
lp.close_date as closeDate,  "
@@ -263,6 +263,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
             final Integer repaymentEvery = JdbcSupport.getInteger(rs, "repaidEvery");
 
             final Integer graceOnPrincipalPayment = JdbcSupport.getIntegerDefaultToNullIfZero(rs,
"graceOnPrincipalPayment");
+            final Integer recurringMoratoriumOnPrincipalPeriods = JdbcSupport.getIntegerDefaultToNullIfZero(rs,
"recurringMoratoriumOnPrincipalPeriods");
             final Integer graceOnInterestPayment = JdbcSupport.getIntegerDefaultToNullIfZero(rs,
"graceOnInterestPayment");
             final Integer graceOnInterestCharged = JdbcSupport.getIntegerDefaultToNullIfZero(rs,
"graceOnInterestCharged");
             final Integer graceOnArrearsAgeing = JdbcSupport.getIntegerDefaultToNullIfZero(rs,
"graceOnArrearsAgeing");
@@ -412,7 +413,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
                     minInterestRatePerPeriod, maxInterestRatePerPeriod, annualInterestRate,
repaymentFrequencyType,
                     interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType,
                     allowPartialPeriodInterestCalcualtion, fundId, fundName, transactionStrategyId,
transactionStrategyName,
-                    graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged,
this.charges, accountingRuleType,
+                    graceOnPrincipalPayment, recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment,
graceOnInterestCharged, this.charges, accountingRuleType,
                     includeInBorrowerCycle, useBorrowerCycle, startDate, closeDate, status,
externalId,
                     principalVariationsForBorrowerCycle, interestRateVariationsForBorrowerCycle,
                     numberOfRepaymentVariationsForBorrowerCycle, multiDisburseLoan, maxTrancheCount,
outstandingLoanBalance,

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/fineract-provider/src/main/resources/sql/migrations/core_db/V298__recurring_moratorium_principal_periods.sql
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/resources/sql/migrations/core_db/V298__recurring_moratorium_principal_periods.sql
b/fineract-provider/src/main/resources/sql/migrations/core_db/V298__recurring_moratorium_principal_periods.sql
new file mode 100644
index 0000000..ad4ddf3
--- /dev/null
+++ b/fineract-provider/src/main/resources/sql/migrations/core_db/V298__recurring_moratorium_principal_periods.sql
@@ -0,0 +1,5 @@
+ALTER TABLE m_product_loan
+	ADD COLUMN `recurring_moratorium_principal_periods` SMALLINT(5) NULL DEFAULT NULL AFTER
`grace_on_principal_periods`;
+	
+ALTER TABLE m_loan
+	ADD COLUMN `recurring_moratorium_principal_periods` SMALLINT(5) NULL DEFAULT NULL AFTER
`grace_on_principal_periods`;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/437de26c/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/LoanProductRelatedDetailTestHelper.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/LoanProductRelatedDetailTestHelper.java
b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/LoanProductRelatedDetailTestHelper.java
index 3e635aa..c429578 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/LoanProductRelatedDetailTestHelper.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/LoanProductRelatedDetailTestHelper.java
@@ -144,6 +144,7 @@ public class LoanProductRelatedDetailTestHelper {
             final AmortizationMethod amortizationMethod, final BigDecimal inArrearsTolerance)
{
 
         final Integer graceOnPrincipalPayment = Integer.valueOf(0);
+        final Integer recurringMoratoriumOnPrincipalPeriods = Integer.valueOf(0);
         final Integer graceOnInterestPayment = Integer.valueOf(0);
         final Integer graceOnInterestCharged = Integer.valueOf(0);
         final Integer graceOnArrearsAgeing = Integer.valueOf(0);
@@ -155,7 +156,7 @@ public class LoanProductRelatedDetailTestHelper {
 
         return new LoanProductRelatedDetail(currency, defaultPrincipal, defaultNominalInterestRatePerPeriod,
interestPeriodFrequencyType,
                 defaultAnnualNominalInterestRate, interestMethod, interestCalculationPeriodMethod,
considerPartialPeriodInterest, repayEvery,
-                repaymentFrequencyType, defaultNumberOfRepayments, graceOnPrincipalPayment,
graceOnInterestPayment, graceOnInterestCharged,
+                repaymentFrequencyType, defaultNumberOfRepayments, graceOnPrincipalPayment,
recurringMoratoriumOnPrincipalPeriods, graceOnInterestPayment, graceOnInterestCharged,
                 amortizationMethod, inArrearsTolerance, graceOnArrearsAgeing, daysInMonthType,
daysInYearType, isInterestRecalculationEnabled);
     }
 }
\ No newline at end of file



Mime
View raw message