This is an automated email from the ASF dual-hosted git repository.
arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new 573a0dd1f FINERACT-1724: Fix swagger of loan reschedule api
573a0dd1f is described below
commit 573a0dd1f641f24f9170d9c6970dbccbdacc77f5
Author: Adam Saghy <[email protected]>
AuthorDate: Thu Apr 13 12:10:02 2023 +0200
FINERACT-1724: Fix swagger of loan reschedule api
---
.../api/RescheduleLoansApiResource.java | 17 +++++----
.../api/RescheduleLoansApiResourceSwagger.java | 42 ++++++++++++++++++++++
2 files changed, 50 insertions(+), 9 deletions(-)
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResource.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResource.java
index 490321146..b2232bcc9 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResource.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResource.java
@@ -101,8 +101,7 @@ public class RescheduleLoansApiResource {
this.platformSecurityContext.authenticatedUser().validateHasReadPermission(RescheduleLoansApiConstants.ENTITY_NAME);
final ApiRequestJsonSerializationSettings settings =
this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- LoanRescheduleRequestData loanRescheduleReasons = null;
- loanRescheduleReasons = this.loanRescheduleRequestReadPlatformService
+ LoanRescheduleRequestData loanRescheduleReasons =
this.loanRescheduleRequestReadPlatformService
.retrieveAllRescheduleReasons(RescheduleLoansApiConstants.LOAN_RESCHEDULE_REASON);
return
this.loanRescheduleRequestToApiJsonSerializer.serialize(settings,
loanRescheduleReasons);
@@ -137,7 +136,7 @@ public class RescheduleLoansApiResource {
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Create loan reschedule request", description =
"Create a loan reschedule request.")
- @RequestBody(required = true, content = @Content(schema =
@Schema(implementation = String.class)), description = "{\"submittedOnDate\":
\"05/02/2022\",\"rescheduleFromDate\": \"05/02/2022\",\"rescheduleReasonId\":
67,\"adjustedDueDate\": \"07/01/2022\",\"loanId\": \"18\",\"dateFormat\":
\"MM/dd/yyyy\",\"locale\": \"en\"}")
+ @RequestBody(required = true, content = @Content(schema =
@Schema(implementation =
RescheduleLoansApiResourceSwagger.PostCreateRescheduleLoansRequest.class)))
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content =
@Content(schema = @Schema(implementation =
RescheduleLoansApiResourceSwagger.PostCreateRescheduleLoansResponse.class))) })
public String createLoanRescheduleRequest(final String
apiRequestBodyAsJson) {
@@ -154,12 +153,12 @@ public class RescheduleLoansApiResource {
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Update loan reschedule request", description =
"Update a loan reschedule request by either approving/rejecting it.")
- @RequestBody(required = true, content = @Content(schema =
@Schema(implementation = String.class)), description = "{\"approvedOnDate\":
\"05/02/2022\",\"dateFormat\": \"MM/dd/yyyy\",\"locale\": \"en\"}")
+ @RequestBody(required = true, content = @Content(schema =
@Schema(implementation =
RescheduleLoansApiResourceSwagger.PostUpdateRescheduleLoansRequest.class)))
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK", content =
@Content(schema = @Schema(implementation =
RescheduleLoansApiResourceSwagger.PostUpdateRescheduleLoansResponse.class))) })
public String updateLoanRescheduleRequest(@PathParam("scheduleId") final
Long scheduleId, @QueryParam("command") final String command,
final String apiRequestBodyAsJson) {
- CommandWrapper commandWrapper = null;
+ CommandWrapper commandWrapper;
if (compareIgnoreCase(command, "approve")) {
commandWrapper = new
CommandWrapperBuilder().approveLoanRescheduleRequest(RescheduleLoansApiConstants.ENTITY_NAME,
scheduleId)
@@ -172,7 +171,7 @@ public class RescheduleLoansApiResource {
}
else {
- throw new UnrecognizedQueryParamException("command", command, new
Object[] { "approve", "reject" });
+ throw new UnrecognizedQueryParamException("command", command,
"approve", "reject");
}
final CommandProcessingResult commandProcessingResult =
this.commandsSourceWritePlatformService.logCommandSource(commandWrapper);
@@ -205,9 +204,9 @@ public class RescheduleLoansApiResource {
final ApiRequestJsonSerializationSettings settings =
this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
if (StringUtils.isNotBlank(command) &&
!RescheduleLoansApiConstants.commandParams.contains(command.toLowerCase())) {
- throw new UnrecognizedQueryParamException("command", command,
- new Object[] {
RescheduleLoansApiConstants.allCommandParamName,
RescheduleLoansApiConstants.pendingCommandParamName,
-
RescheduleLoansApiConstants.approveCommandParamName,
RescheduleLoansApiConstants.rejectCommandParamName });
+ throw new UnrecognizedQueryParamException("command", command,
RescheduleLoansApiConstants.allCommandParamName,
+ RescheduleLoansApiConstants.pendingCommandParamName,
RescheduleLoansApiConstants.approveCommandParamName,
+ RescheduleLoansApiConstants.rejectCommandParamName);
}
final List<LoanRescheduleRequestData> loanRescheduleRequestsData =
this.loanRescheduleRequestReadPlatformService
.retrieveAllRescheduleRequests(command);
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResourceSwagger.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResourceSwagger.java
index 49dc52762..1f1840cde 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResourceSwagger.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResourceSwagger.java
@@ -173,6 +173,48 @@ final class RescheduleLoansApiResourceSwagger {
public Set<LoanTermVariationsData> loanTermVariationsData;
}
+ @Schema(description = "PostCreateRescheduleLoansRequest")
+ public static final class PostCreateRescheduleLoansRequest {
+
+ @Schema(example = "20 September 2011")
+ public String adjustedDueDate;
+ @Schema(example = "en")
+ public String locale;
+ @Schema(example = "dd MMMM yyyy")
+ public String dateFormat;
+ @Schema(example = "1")
+ public Integer extraTerms;
+ @Schema(example = "1")
+ public Integer graceOnInterest;
+ @Schema(example = "1")
+ public Integer graceOnPrincipal;
+ @Schema(example = "1")
+ public Long loanId;
+ @Schema(example = "1.1")
+ public BigDecimal newInterestRate;
+ @Schema(example = "20 September 2011")
+ public String rescheduleFromDate;
+ @Schema(example = "comment")
+ public String rescheduleReasonComment;
+ @Schema(example = "1")
+ public Long rescheduleReasonId;
+ @Schema(example = "20 September 2011")
+ public String submittedOnDate;
+ }
+
+ @Schema(description = "PostUpdateRescheduleLoansRequest")
+ public static final class PostUpdateRescheduleLoansRequest {
+
+ @Schema(example = "20 September 2011")
+ public String approvedOnDate;
+ @Schema(example = "20 September 2011")
+ public String rejectedOnDate;
+ @Schema(example = "en")
+ public String locale;
+ @Schema(example = "dd MMMM yyyy")
+ public String dateFormat;
+ }
+
@Schema(description = "PostCreateRescheduleLoansResponse ")
public static final class PostCreateRescheduleLoansResponse {