dr-fuch commented on PR #6034: URL: https://github.com/apache/fineract/pull/6034#issuecomment-4911124046
Hi again @aditinikam I was working on [FINERACT-2048](https://issues.apache.org/jira/browse/FINERACT-2048) here is my [PR](https://github.com/apache/fineract/pull/5895/). You only have to update your new `StandingInstructionWriteServiceImpl`, but I suggest you create a class only for StandingInstructionValidations following SOC principles. If someone with zero or a little bit knowledge on Fineract wants to update StandingInstructionWriteServiceImpl will have to does a big effort to find what will have to be updated. Regarding Integer types, if you check you are doing multiple times ``` private static Integer parseInteger(final String value) { return StringUtils.isBlank(value) ? null : Integer.valueOf(value.trim()); } ``` that's why I suggest the use of `@Max` and `@Min`, you are not using locale as in ``` private static LocalDate parseDate(final String value, final String dateFormat, final String locale) { if (StringUtils.isBlank(value)) { return null; } if (StringUtils.isBlank(dateFormat)) { return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE); } return LocalDate.parse(value, formatter(dateFormat, locale)); } ``` Using jakarta validations you'll have to capture exceptions for `@NotNull`, `@Max` and `@Min` instead throws all and on the StandingInstructionDataValidator inject on DataValidatorBuilder to mix them with business logic validations added to `private final List<ApiParameterError> dataValidationErrors`. A plus: If you check my PR you can see some rules does not apply to all scenarios, rules applied with nested ifs statements, we can add an strategy data validation abstract class and implement strategy for each scenario depending on fields combinations (listed on last table) -- 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]
