adamsaghy commented on code in PR #5063:
URL: https://github.com/apache/fineract/pull/5063#discussion_r2464990112


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java:
##########
@@ -775,4 +783,50 @@ private Long getResolvedLoanIdWithExistsCheck(final Long 
loanId, final ExternalI
             throw new IllegalArgumentException("loanId and loanExternalId 
cannot be both null");
         }
     }
+
+    @POST
+    @Path("{loanId}/transactions/reage-preview")
+    @Consumes({ MediaType.APPLICATION_JSON })
+    @Produces({ MediaType.APPLICATION_JSON })
+    @Operation(summary = "Preview Re-Age Schedule", description = "Generates a 
preview of the re-aged loan schedule based on the provided parameters without 
creating any transactions or modifying the loan.")
+    @RequestBody(required = true, content = @Content(schema = 
@Schema(implementation = 
LoanTransactionsApiResourceSwagger.PostLoansLoanIdTransactionsRequest.class)))
+    @ApiResponses({
+            @ApiResponse(responseCode = "200", description = "OK", content = 
@Content(schema = @Schema(implementation = LoanScheduleData.class))) })
+    public String previewReAgeSchedule(@PathParam("loanId") 
@Parameter(description = "loanId", required = true) final Long loanId,
+            @Parameter(hidden = true) final String apiRequestBodyAsJson, 
@Context final UriInfo uriInfo) {
+        final LoanScheduleData result = previewReAgeScheduleInternal(loanId, 
null, apiRequestBodyAsJson);
+        final ApiRequestJsonSerializationSettings settings = 
this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
+        return this.loanScheduleToApiJsonSerializer.serialize(settings, 
result, new HashSet<>());

Review Comment:
   No need to serialize. Simply return the `LoanScheduleData result`. Also you 
can remove the `ApiResponses` annotation as well in that case.



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