thesmallstar commented on a change in pull request #1251:
URL: https://github.com/apache/fineract/pull/1251#discussion_r496282815



##########
File path: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java
##########
@@ -288,6 +290,19 @@ public LoanScheduleData retrieveRepaymentSchedule(final 
Long loanId,
 
     @Override
     public Page<LoanAccountData> retrieveAll(final SearchParameters 
searchParameters) {
+        if (searchParameters != null && searchParameters.getStatusValues() != 
null && searchParameters.getStatusValues().size() != 0) {
+            final List<String> statusValues = 
searchParameters.getStatusValues();
+            for (int i = 0; i < statusValues.size(); i++) {
+                if (LoanStatus.fromString(statusValues.get(i)) == 
LoanStatus.INVALID) {
+                    final List<ApiParameterError> dataValidationErrors = new 
ArrayList<>();
+                    final String defaultUserMessage = "The Status value '" + 
statusValues.get(i) + "' is not supported.";
+                    final ApiParameterError error = 
ApiParameterError.parameterError("validation.msg.loan.status.value.is.not.supported",
+                            defaultUserMessage, "status", statusValues.get(i));
+                    dataValidationErrors.add(error);
+                    throw new 
PlatformApiDataValidationException(dataValidationErrors);
+                }
+            }
+        }

Review comment:
       @vorburger  here, we are checking for all strings that were given to us 
and make sure none of them returns an Invalid status if it does we return a 
PlatformApiDataValidationException, does this answer your question? (I might 
have missed something?)
   
   
   




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to