FINERACT-1971: Loan transaction processing strategy validation fix
This commit is contained in:
+16
@@ -396,6 +396,14 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
.extractStringNamed(LoanApiConstants.transactionProcessingStrategyCodeParameterName, element);
|
||||
baseDataValidator.reset().parameter(LoanApiConstants.transactionProcessingStrategyCodeParameterName)
|
||||
.value(transactionProcessingStrategy).notNull();
|
||||
|
||||
if (!AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
.equals(loanProduct.getTransactionProcessingStrategyCode())
|
||||
&& AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY.equals(transactionProcessingStrategy)) {
|
||||
baseDataValidator.reset().parameter(LoanApiConstants.transactionProcessingStrategyCodeParameterName).failWithCode(
|
||||
"strategy.cannot.be.advanced.payment.allocation.if.not.configured",
|
||||
"Loan transaction processing strategy cannot be Advanced Payment Allocation Strategy if it's not configured on loan product");
|
||||
}
|
||||
// Validating whether the processor is existing
|
||||
loanRepaymentScheduleTransactionProcessorFactory.determineProcessor(transactionProcessingStrategy);
|
||||
|
||||
@@ -670,6 +678,14 @@ public final class LoanApplicationCommandFromApiJsonHelper {
|
||||
loanRepaymentScheduleTransactionProcessorFactory.determineProcessor(transactionProcessingStrategy);
|
||||
}
|
||||
|
||||
if (!AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
.equals(loanProduct.getTransactionProcessingStrategyCode())
|
||||
&& AdvancedPaymentScheduleTransactionProcessor.ADVANCED_PAYMENT_ALLOCATION_STRATEGY.equals(transactionProcessingStrategy)) {
|
||||
baseDataValidator.reset().parameter(LoanApiConstants.transactionProcessingStrategyCodeParameterName).failWithCode(
|
||||
"strategy.cannot.be.advanced.payment.allocation.if.not.configured",
|
||||
"Loan transaction processing strategy cannot be Advanced Payment Allocation Strategy if it's not configured on loan product");
|
||||
}
|
||||
|
||||
BigDecimal principal = null;
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanApiConstants.principalParameterName, element)) {
|
||||
atLeastOneParameterPassedForUpdate = true;
|
||||
|
||||
Reference in New Issue
Block a user