adamsaghy commented on code in PR #4605:
URL: https://github.com/apache/fineract/pull/4605#discussion_r2055732776
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResource.java:
##########
@@ -72,31 +72,23 @@ public class CollectionSheetApiResource {
+ "This Api retrieves repayment details of all individual loans
under a office as on a specified meeting date.\n\n"
+ "Save Collection Sheet:\n\n"
+ "This Api allows the loan officer to perform bulk repayments of
individual loans and deposit of mandatory savings on a given meeting date.")
- @RequestBody(required = true, content = @Content(schema =
@Schema(implementation =
CollectionSheetApiResourceSwagger.PostCollectionSheetRequest.class)))
+ @RequestBody(required = true, content = @Content(schema =
@Schema(implementation = CollectionSheetRequest.class)))
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content =
@Content(schema = @Schema(implementation =
CollectionSheetApiResourceSwagger.PostCollectionSheetResponse.class))) })
- public String generateCollectionSheet(@QueryParam("command")
@Parameter(description = "command") final String commandParam,
- @Parameter(hidden = true) final String apiRequestBodyAsJson,
@Context final UriInfo uriInfo) {
- final CommandWrapperBuilder builder = new
CommandWrapperBuilder().withJson(apiRequestBodyAsJson);
- CommandProcessingResult result = null;
+ public Response generateCollectionSheet(@QueryParam("command")
@Parameter(description = "command") final String commandParam,
+ @Parameter(hidden = true) CollectionSheetRequest
collectionSheetRequest) {
+ final String payload =
toApiJsonSerializer.serialize(collectionSheetRequest);
+ final CommandWrapperBuilder builder = new
CommandWrapperBuilder().withJson(payload);
- if (is(commandParam, "generateCollectionSheet")) {
+ if (CommandParameterUtil.is(commandParam,
GENERATE_COLLECTION_SHEET_COMMAND_VALUE)) {
this.context.authenticatedUser().validateHasReadPermission(CollectionSheetConstants.COLLECTIONSHEET_RESOURCE_NAME);
- final JsonElement parsedQuery =
this.fromJsonHelper.parse(apiRequestBodyAsJson);
- final JsonQuery query = JsonQuery.from(apiRequestBodyAsJson,
parsedQuery, this.fromJsonHelper);
- final IndividualCollectionSheetData collectionSheet =
this.collectionSheetReadPlatformService
- .generateIndividualCollectionSheet(query);
- final ApiRequestJsonSerializationSettings settings =
this.apiRequestPrameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings,
collectionSheet);
- } else if (is(commandParam, "saveCollectionSheet")) {
+ final JsonElement parsedQuery = this.fromJsonHelper.parse(payload);
+ final JsonQuery query = JsonQuery.from(payload, parsedQuery,
this.fromJsonHelper);
+ return
Response.ok(this.collectionSheetReadPlatformService.generateIndividualCollectionSheet(query)).build();
+ } else if (CommandParameterUtil.is(commandParam,
SAVE_COLLECTION_SHEET_COMMAND_VALUE)) {
final CommandWrapper commandRequest =
builder.saveIndividualCollectionSheet().build();
- result =
this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
- return this.toApiJsonSerializer.serialize(result);
+ return
Response.ok(this.commandsSourceWritePlatformService.logCommandSource(commandRequest)).build();
Review Comment:
hmm....
--
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]