magyari-adam commented on code in PR #4432:
URL: https://github.com/apache/fineract/pull/4432#discussion_r1991235377


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java:
##########
@@ -439,6 +477,59 @@ private String retrieveTransaction(final Long loanId, 
final String loanExternalI
         return this.toApiJsonSerializer.serialize(settings, transactionData, 
this.responseDataParameters);
     }
 
+    private Page<LoanTransactionData> retrieveTransactions(final Long loanId, 
final String loanExternalIdStr, final String excludedTypesStr,
+            Pageable pageable, final UriInfo uriInfo) {
+
+        
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
+
+        ExternalId loanExternalId = 
ExternalIdFactory.produce(loanExternalIdStr);
+        Long resolvedLoanId = getResolvedLoanId(loanId, loanExternalId);
+
+        Set<LoanTransactionType> excludedTransactionTypes = new HashSet<>();
+        if (StringUtils.isNotBlank(excludedTypesStr)) {
+            excludedTransactionTypes = new HashSet<>(
+                    
Arrays.stream(excludedTypesStr.split("\\s*,\\s*")).map(this::transactionTypeFromParam).toList());
+        }
+
+        return 
loanReadPlatformService.retrieveLoanTransactions(resolvedLoanId, 
excludedTransactionTypes, pageable);
+    }
+
+    private LoanTransactionType transactionTypeFromParam(String 
transactionTypeParam) {
+        return switch (transactionTypeParam) {
+            case DataTableApiConstant.disbursement -> 
LoanTransactionType.DISBURSEMENT;

Review Comment:
   I saw that there were already some loan related constants in it, but looking 
at it now it does look strange to put them there. Moved the new ones to their 
own place.



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

Reply via email to