Mk9894 commented on code in PR #3158:
URL: https://github.com/apache/fineract/pull/3158#discussion_r1195985811
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java:
##########
@@ -114,6 +121,53 @@ public String retrieveTemplate(@PathParam("savingsId")
final Long savingsId,
SavingsApiSetConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS);
}
+ @GET
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Operation(summary = "List Savings Account Transactions", description =
"The list capability of savings account transactions can support pagination,
sorting and filtering.\n\n"
+ + "Example Requests:\n" + "\n" +
"savingsaccounts/{savingsId}/transactions\n" + "\n"
+ + "savingsaccounts/{savingsId}/transactions?offset=10&limit=50\n"
+ "\n"
+ +
"savingsaccounts/{savingsId}/transactions?orderBy=displayName&sortOrder=DESC\n"
+ "\n"
+ +
"savingsaccounts/{savingsId}/transactions?dateFormat=yyyy-MM-dd&locale=en&fromDate=2013-01-01&toDate=2013-12-01\n"
+ "\n"
+ +
"savingsaccounts/{savingsId}/transactions?fromAmount=500&toAmount=1000\n" + "\n"
+ +
"savingsaccounts/{savingsId}/transactions?transactionType=deposit")
+ @ApiResponses({
+ @ApiResponse(responseCode = "200", description = "OK", content =
@Content(schema = @Schema(implementation =
SavingsAccountTransactionsApiResourceSwagger.GetSavingsAccountTransactionsResponse.class)))
})
+ public String retrieveAll(@Context final UriInfo uriInfo,
+ @PathParam("savingsId") @Parameter(description = "savingsId")
final Long savingsId,
+ @QueryParam("externalId") @Parameter(description = "externalId")
final String externalId,
+ @QueryParam("offset") @Parameter(description = "offset") final
Integer offset,
+ @QueryParam("limit") @Parameter(description = "limit") final
Integer limit,
+ @QueryParam("orderBy") @Parameter(description = "orderBy") final
String orderBy,
+ @QueryParam("sortOrder") @Parameter(description = "sortOrder")
final String sortOrder,
+ @QueryParam("dateFormat") @Parameter(description = "dateFormat")
final String dateFormat,
+ @QueryParam("fromDate") @Parameter(description = "fromDate") final
DateParam fromDateParam,
+ @QueryParam("toDate") @Parameter(description = "toDate") final
DateParam toDateParam,
+ @QueryParam("fromAmount") @Parameter(description = "fromAmount")
@DecimalMin(value = "0", message = "must be greater than or equal to 0") final
BigDecimal fromAmount,
+ @QueryParam("toAmount") @Parameter(description = "toAmount")
@DecimalMin(value = "0", message = "must be greater than or equal to 0") final
BigDecimal toAmount,
+ @QueryParam("locale") @Parameter(description = "locale") final
String locale,
+ @QueryParam("transactionType") @Parameter(description =
"transcationType") final String transactionType) {
+
+
this.context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME);
+ final SearchParameters searchParameters =
SearchParameters.forPagination(offset, limit, orderBy, sortOrder);
+
+ LocalDate fromDate = null;
Review Comment:
@galovics
Thank you for sharing the information regarding the HandlerArgumentResolver.
I found that HandlerArgumentResolver is specific to Spring MVC framework and I
understand that the HandlerArgumentResolver interface is not directly related
to the Jersey framework, which is a separate framework for building RESTful web
services.
Also it seems that **Fineract** is indeed using the Jersey framework for
handling REST requests, rather than the MVC framework.
In a Spring Boot application, we have the flexibility to choose either the
Spring MVC or Jersey framework for handling REST requests. When using Spring
MVC, the HandlerArgumentResolver interface allows us to customize the
resolution of method arguments in controller methods. However, in the case of
Jersey, an equivalent mechanism called the ParamConverterProvider interface is
used to handle method arguments.
In Jersey, if we want to achieve similar functionality to the
HandlerArgumentResolver, we can implement the ParamConverterProvider interface.
This interface enables us to define custom conversion logic for method
parameters in Jersey-based REST endpoints. The ParamConverterProvider is
responsible for converting the values from incoming requests into the desired
method parameter types.
Regarding your specific concern, if we choose to implement the
ParamConverter interface in our custom implementation, we might not have access
to the "locale" and "dateFormat" Query parameters from the Request. This could
limit our ability to convert the given date string to a LocalDate object based
on the specified locale and dateFormat.
Considering this, it seems more appropriate to use the legacy approach as
currently implemented in the PR. This approach allows us to retrieve the
"**locale**" and "**dateFormat**" Query parameters and utilize them for
converting the date string to a LocalDate object, satisfying the requirements.
Thanks.
Please let me know if you have any further questions or concerns
--
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]