adamsaghy commented on code in PR #6000:
URL: https://github.com/apache/fineract/pull/6000#discussion_r3441262317
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloannearbreach/api/WorkingCapitalNearBreachApiResource.java:
##########
@@ -108,4 +119,64 @@ public CommandProcessingResult
delete(@PathParam("breachId") @Parameter(descript
final CommandWrapper commandRequest = new
CommandWrapperBuilder().deleteWorkingCapitalNearBreach(breachId).build();
return
this.commandSourceWritePlatformService.logCommandSource(commandRequest);
}
+
+ @PUT
+ @Path("loans/{loanId}/config")
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Operation(operationId = "updateWorkingCapitalLoanNearBreachConfigById",
summary = "Update near breach configuration for an active Working Capital
Loan", description = "Overrides the near breach threshold and frequency for the
loan. Applies only to future evaluation periods; history is preserved.")
+ @RequestBody(required = true, content = @Content(schema =
@Schema(implementation =
WorkingCapitalLoanApiResourceSwagger.PutWorkingCapitalLoansLoanIdNearBreachConfigRequest.class)))
+ public CommandProcessingResult updateNearBreachConfigById(
+ @PathParam("loanId") @Parameter(description = "loanId", required =
true) final Long loanId,
+ @Parameter(hidden = true) final String apiRequestBodyAsJson) {
+ return updateNearBreachConfig(loanId, null, apiRequestBodyAsJson);
+ }
+
+ @PUT
+ @Path("loans/external-id/{loanExternalId}/config")
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Operation(operationId =
"updateWorkingCapitalLoanNearBreachConfigByExternalId", summary = "Update near
breach configuration for an active Working Capital Loan by external id",
description = "Overrides the near breach threshold and frequency for the loan.
Applies only to future evaluation periods; history is preserved.")
+ @RequestBody(required = true, content = @Content(schema =
@Schema(implementation =
WorkingCapitalLoanApiResourceSwagger.PutWorkingCapitalLoansLoanIdNearBreachConfigRequest.class)))
+ public CommandProcessingResult updateNearBreachConfigByExternalId(
+ @PathParam("loanExternalId") @Parameter(description =
"loanExternalId", required = true) final String loanExternalId,
+ @Parameter(hidden = true) final String apiRequestBodyAsJson) {
+ return updateNearBreachConfig(null, loanExternalId,
apiRequestBodyAsJson);
+ }
+
+ @GET
+ @Path("loans/{loanId}/changes")
Review Comment:
Please change endpoint from `loans/{loanId}/changes` to
`loans/{loanId}/near-breach-config`
##########
fineract-working-capital-loan/src/main/java/org/apache/fineract/portfolio/workingcapitalloannearbreach/api/WorkingCapitalNearBreachApiResource.java:
##########
@@ -108,4 +119,64 @@ public CommandProcessingResult
delete(@PathParam("breachId") @Parameter(descript
final CommandWrapper commandRequest = new
CommandWrapperBuilder().deleteWorkingCapitalNearBreach(breachId).build();
return
this.commandSourceWritePlatformService.logCommandSource(commandRequest);
}
+
+ @PUT
+ @Path("loans/{loanId}/config")
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Operation(operationId = "updateWorkingCapitalLoanNearBreachConfigById",
summary = "Update near breach configuration for an active Working Capital
Loan", description = "Overrides the near breach threshold and frequency for the
loan. Applies only to future evaluation periods; history is preserved.")
+ @RequestBody(required = true, content = @Content(schema =
@Schema(implementation =
WorkingCapitalLoanApiResourceSwagger.PutWorkingCapitalLoansLoanIdNearBreachConfigRequest.class)))
+ public CommandProcessingResult updateNearBreachConfigById(
+ @PathParam("loanId") @Parameter(description = "loanId", required =
true) final Long loanId,
+ @Parameter(hidden = true) final String apiRequestBodyAsJson) {
+ return updateNearBreachConfig(loanId, null, apiRequestBodyAsJson);
+ }
+
+ @PUT
+ @Path("loans/external-id/{loanExternalId}/config")
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Operation(operationId =
"updateWorkingCapitalLoanNearBreachConfigByExternalId", summary = "Update near
breach configuration for an active Working Capital Loan by external id",
description = "Overrides the near breach threshold and frequency for the loan.
Applies only to future evaluation periods; history is preserved.")
+ @RequestBody(required = true, content = @Content(schema =
@Schema(implementation =
WorkingCapitalLoanApiResourceSwagger.PutWorkingCapitalLoansLoanIdNearBreachConfigRequest.class)))
+ public CommandProcessingResult updateNearBreachConfigByExternalId(
+ @PathParam("loanExternalId") @Parameter(description =
"loanExternalId", required = true) final String loanExternalId,
+ @Parameter(hidden = true) final String apiRequestBodyAsJson) {
+ return updateNearBreachConfig(null, loanExternalId,
apiRequestBodyAsJson);
+ }
+
+ @GET
+ @Path("loans/{loanId}/changes")
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Operation(operationId =
"getWorkingCapitalLoanNearBreachChangeHistoryById", summary = "Retrieve near
breach configuration change history for a Working Capital Loan", description =
"Returns all near breach configuration change records for the loan, ordered by
most recent first.")
+ public List<WorkingCapitalLoanNearBreachChangeData>
getNearBreachChangeHistoryById(
+ @PathParam("loanId") @Parameter(description = "loanId", required =
true) final Long loanId) {
+
this.context.authenticatedUser().validateHasReadPermission(WorkingCapitalLoanProductConstants.WCLP_RESOURCE_NAME);
+ return
this.nearBreachChangeReadService.retrieveNearBreachChangeHistory(loanId);
+ }
+
+ @GET
+ @Path("loans/external-id/{loanExternalId}/changes")
Review Comment:
Please change endpoint from `loans/external-id/{loanExternalId}/changes` to
`loans/external-id/{loanExternalId}/near-breach-config`
--
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]