adamsaghy commented on code in PR #4775:
URL: https://github.com/apache/fineract/pull/4775#discussion_r2174732437
##########
fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/ProgressiveLoanTransactionValidatorImpl.java:
##########
@@ -269,6 +273,69 @@ public void validateContractTerminationUndo(final
JsonCommand command, final Lon
});
}
+ private static final List<String>
BUY_DOWN_FEE_TRANSACTION_SUPPORTED_PARAMETERS = List
+ .of(new String[] { "transactionDate", "dateFormat", "locale",
"transactionAmount", "paymentTypeId", "note", "externalId" });
+
+ @Override
+ public void validateBuyDownFee(JsonCommand command, Long loanId) {
+ final String json = command.json();
+ final Type typeOfMap = new TypeToken<Map<String, Object>>()
{}.getType();
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
BUY_DOWN_FEE_TRANSACTION_SUPPORTED_PARAMETERS);
+
+ final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
+ final DataValidatorBuilder baseDataValidator = new
DataValidatorBuilder(dataValidationErrors)
+ .resource("loan.transaction.buyDownFee");
+
+ final JsonElement element = this.fromApiJsonHelper.parse(json);
+ final Loan loan =
this.loanRepositoryWrapper.findOneWithNotFoundDetection(loanId, true);
+
+ // Validate buy down fee is enabled on loan product
+ if (!loan.getLoanProductRelatedDetail().isEnableBuyDownFee()) {
Review Comment:
We should validate against the loan, not the loan product:
`loan.getLoanProductRelatedDetail()...`
Please do the same for all the below!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]