FINERACT-2117: Early and late payment - In advance payment strategy: Adjust last, unpaid period

This commit is contained in:
Jose Alberto Hernandez
2024-08-19 13:20:47 +02:00
committed by Adam Saghy
parent 3e923bf483
commit 04533f03c6
9 changed files with 120 additions and 9 deletions
@@ -61,6 +61,7 @@ import org.apache.fineract.portfolio.loanproduct.domain.LoanPreClosureInterestCa
import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductPaymentAllocationRule;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductValueConditionType;
import org.apache.fineract.portfolio.loanproduct.domain.LoanRescheduleStrategyMethod;
import org.apache.fineract.portfolio.loanproduct.domain.LoanSupportedInterestRefundTypes;
import org.apache.fineract.portfolio.loanproduct.domain.RecalculationFrequencyType;
import org.apache.fineract.portfolio.loanproduct.exception.EqualAmortizationUnsupportedFeatureException;
@@ -1042,7 +1043,27 @@ public final class LoanProductDataValidator {
final Integer rescheduleStrategyMethod = this.fromApiJsonHelper
.extractIntegerNamed(LoanProductConstants.rescheduleStrategyMethodParameterName, element, Locale.getDefault());
baseDataValidator.reset().parameter(LoanProductConstants.rescheduleStrategyMethodParameterName).value(rescheduleStrategyMethod)
.notNull().inMinMaxRange(1, 3);
.notNull().inMinMaxRange(1, 4);
final LoanRescheduleStrategyMethod loanRescheduleStrategyMethod = LoanRescheduleStrategyMethod
.fromInt(rescheduleStrategyMethod);
String loanScheduleType = LoanScheduleType.CUMULATIVE.toString();
if (fromApiJsonHelper.parameterExists(LoanProductConstants.LOAN_SCHEDULE_TYPE, element)) {
loanScheduleType = fromApiJsonHelper.extractStringNamed(LoanProductConstants.LOAN_SCHEDULE_TYPE, element);
}
if (LoanScheduleType.CUMULATIVE.equals(LoanScheduleType.valueOf(loanScheduleType))
&& LoanRescheduleStrategyMethod.ADJUST_LAST_UNPAID_PERIOD.equals(loanRescheduleStrategyMethod)) {
baseDataValidator.reset().parameter(LoanProductConstants.rescheduleStrategyMethodParameterName).failWithCode(
"reschedule.strategy.method.not.supported.for.loan.schedule.type.cumulative",
"Adjust last, unpaid period is only supported for Progressive loan schedule type");
}
if (LoanScheduleType.PROGRESSIVE.equals(LoanScheduleType.valueOf(loanScheduleType))
&& !LoanRescheduleStrategyMethod.ADJUST_LAST_UNPAID_PERIOD.equals(loanRescheduleStrategyMethod)) {
baseDataValidator.reset().parameter(LoanProductConstants.rescheduleStrategyMethodParameterName).failWithCode(
"reschedule.strategy.method.not.supported.for.loan.schedule.type.progressive",
loanScheduleType.toString() + " reschedule strategy type is not supported for Progressive loan schedule type");
}
}
RecalculationFrequencyType frequencyType = null;
@@ -99,7 +99,7 @@ import org.springframework.stereotype.Component;
+ "Specifies which amount portion should be added to principal for interest recalculation. \n"
+ "Example Values:0=NONE(Only on principal), 1=INTEREST(Principal+Interest), 2=FEE(Principal+Fee), 3=FEE And INTEREST (Principal+Fee+Interest)\n"
+ "rescheduleStrategyMethod\n" + "Specifies what action should perform on loan repayment schedule for advance payments. \n"
+ "Example Values:1=Reschedule next repayments, 2=Reduce number of installments, 3=Reduce EMI amount\n"
+ "Example Values:1=Reschedule next repayments, 2=Reduce number of installments, 3=Reduce EMI amount, 4=Adjust last, unpaid period\n"
+ "recalculationCompoundingFrequencyType\n"
+ "Specifies effective date from which the compounding of interest or fee amounts will be considered in recalculation on late payment.\n"
+ "Example Values:1=Same as repayment period, 2=Daily, 3=Weekly, 4=Monthly\n" + "recalculationCompoundingFrequencyInterval\n"
@@ -15845,7 +15845,7 @@ An enumeration that indicates the type of transaction processing strategy to be
</tr>
<tr>
<td class=fielddesc>Specifies what action should perform on loan repayment schedule for advance payments. <br>
<span>Example Values:</span>1=Reschedule next repayments, 2=Reduce number of installments, 3=Reduce EMI amount</td>
<span>Example Values:</span>1=Reschedule next repayments, 2=Reduce number of installments, 3=Reduce EMI amount, 4=Adjust last, unpaid period</td>
</tr>
<tr class=alt>
<td>recalculationCompoundingFrequencyType</td>
@@ -51748,7 +51748,7 @@ An enumeration that indicates the type of transaction processing strategy to be
</tr>
<tr>
<td class=fielddesc>Specifies what action should perform on loan repayment schedule for advance payments. <br>
<span>Example Values:</span>1=Reschedule next repayments, 2=Reduce number of installments, 3=Reduce EMI amount</td>
<span>Example Values:</span>1=Reschedule next repayments, 2=Reduce number of installments, 3=Reduce EMI amount, 4=Adjust last, unpaid period</td>
</tr>
<tr class=alt>
<td>recalculationCompoundingFrequencyType</td>