FINERACT-2082: Progressive loan schedule type should only support Advanced payment allocation strategy
This commit is contained in:
committed by
Adam Saghy
parent
1679ea9237
commit
55a67b1344
+26
-24
@@ -794,19 +794,8 @@ public final class LoanProductDataValidator {
|
||||
}
|
||||
}
|
||||
|
||||
String loanScheduleType = LoanScheduleType.CUMULATIVE.name();
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.LOAN_SCHEDULE_TYPE, element)) {
|
||||
loanScheduleType = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.LOAN_SCHEDULE_TYPE, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_TYPE).value(loanScheduleType)
|
||||
.isOneOfEnumValues(LoanScheduleType.class);
|
||||
}
|
||||
|
||||
if (!LoanScheduleType.PROGRESSIVE.equals(LoanScheduleType.valueOf(loanScheduleType))
|
||||
&& AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
.equals(transactionProcessingStrategyCode)) {
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE).failWithCode(
|
||||
"supported.only.for.progressive.loan.schedule.type",
|
||||
"Progressive repayment schedule processing is only available with `Advanced payment allocation` strategy");
|
||||
validateLoanScheduleType(transactionProcessingStrategyCode, baseDataValidator, element);
|
||||
}
|
||||
|
||||
String loanScheduleProcessingType = LoanScheduleProcessingType.HORIZONTAL.name();
|
||||
@@ -1786,19 +1775,8 @@ public final class LoanProductDataValidator {
|
||||
}
|
||||
}
|
||||
|
||||
String loanScheduleType = loanProduct.getLoanProductRelatedDetail().getLoanScheduleType().name();
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.LOAN_SCHEDULE_TYPE, element)) {
|
||||
loanScheduleType = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.LOAN_SCHEDULE_TYPE, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_TYPE).value(loanScheduleType)
|
||||
.isOneOfEnumValues(LoanScheduleType.class);
|
||||
|
||||
if (!LoanScheduleType.PROGRESSIVE.equals(LoanScheduleType.valueOf(loanScheduleType))
|
||||
&& AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
.equals(transactionProcessingStrategyCode)) {
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE).failWithCode(
|
||||
"supported.only.for.progressive.loan.schedule.type",
|
||||
"Progressive repayment schedule processing is only available with `Advanced payment allocation` strategy");
|
||||
}
|
||||
validateLoanScheduleType(transactionProcessingStrategyCode, baseDataValidator, element);
|
||||
}
|
||||
|
||||
String loanScheduleProcessingType = loanProduct.getLoanProductRelatedDetail().getLoanScheduleProcessingType().name();
|
||||
@@ -2463,4 +2441,28 @@ public final class LoanProductDataValidator {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void validateLoanScheduleType(final String transactionProcessingStrategyCode, final DataValidatorBuilder baseDataValidator,
|
||||
final JsonElement element) {
|
||||
final String loanScheduleType = this.fromApiJsonHelper.extractStringNamed(LoanProductConstants.LOAN_SCHEDULE_TYPE, element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_TYPE).value(loanScheduleType)
|
||||
.isOneOfEnumValues(LoanScheduleType.class);
|
||||
|
||||
if (!LoanScheduleType.PROGRESSIVE.equals(LoanScheduleType.valueOf(loanScheduleType))
|
||||
&& AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
.equals(transactionProcessingStrategyCode)) {
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_PROCESSING_TYPE).failWithCode(
|
||||
"supported.only.for.progressive.loan.schedule.type",
|
||||
"Progressive repayment schedule processing is only available with `Advanced payment allocation` strategy");
|
||||
}
|
||||
|
||||
if (LoanScheduleType.PROGRESSIVE.equals(LoanScheduleType.valueOf(loanScheduleType))
|
||||
&& !AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
.equals(transactionProcessingStrategyCode)) {
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.LOAN_SCHEDULE_TYPE).failWithCode(
|
||||
"supported.only.with.advanced.payment.allocation.strategy",
|
||||
loanScheduleType + " loan schedule type is not available with " + transactionProcessingStrategyCode + " strategy");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user