budaidev commented on code in PR #5760:
URL: https://github.com/apache/fineract/pull/5760#discussion_r3073103876
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloan/serialization/WorkingCapitalLoanDataValidator.java:
##########
@@ -429,6 +434,86 @@ public void validateUpdateDiscount(final String json,
final WorkingCapitalLoan l
throwExceptionIfValidationWarningsExist(dataValidationErrors);
}
+ public void validateRepayment(final String json, final WorkingCapitalLoan
loan) {
+ if (StringUtils.isBlank(json)) {
+ throw new InvalidJsonException();
+ }
+ final Type typeOfMap = new TypeToken<Map<String, Object>>()
{}.getType();
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
REPAYMENT_SUPPORTED_PARAMETERS);
+
+ final JsonElement element = this.fromApiJsonHelper.parse(json);
+ if (element != null && element.isJsonObject()) {
+ final JsonObject root = element.getAsJsonObject();
+ if (root.has(WorkingCapitalLoanConstants.paymentDetailsParamName)
+ &&
root.get(WorkingCapitalLoanConstants.paymentDetailsParamName).isJsonObject()) {
+ final String paymentDetailsJson =
root.getAsJsonObject(WorkingCapitalLoanConstants.paymentDetailsParamName).toString();
+
this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap,
paymentDetailsJson, PAYMENT_DETAILS_SUPPORTED_PARAMETERS);
+ }
+ }
+
+ final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
+ final DataValidatorBuilder baseDataValidator = new
DataValidatorBuilder(dataValidationErrors)
+ .resource(WorkingCapitalLoanConstants.RESOURCE_NAME);
+
+ final LocalDate transactionDate =
this.fromApiJsonHelper.parameterHasValue(WorkingCapitalLoanConstants.transactionDateParamName,
Review Comment:
Do we actually want to use the actualDisbursementDate for fallback, instead
of the transcationDate parameter? Is it really the same?
--
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]