You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by GitBox <gi...@apache.org> on 2020/09/28 23:04:57 UTC

[GitHub] [fineract] thesmallstar commented on a change in pull request #1251: FINERACT-1095 Added status parameter in Loans API

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:
users@infra.apache.org