FINERACT-2380: move retrofit client based test to feign

This commit is contained in:
Adam Saghy
2025-11-26 10:47:29 +01:00
parent 5d2a9c5390
commit f28382b70f
22 changed files with 98 additions and 158 deletions
@@ -70,7 +70,7 @@ public class InternalLoanAccountLockApiResource implements InitializingBean {
@Produces({ MediaType.APPLICATION_JSON })
@SuppressFBWarnings("SLF4J_SIGN_ONLY_FORMAT")
public Response placeLockOnLoanAccount(@Context final UriInfo uriInfo, @PathParam("loanId") Long loanId,
@PathParam("lockOwner") String lockOwner, @RequestBody(required = false) String error) {
@PathParam("lockOwner") String lockOwner, @RequestBody(required = false) LockRequest request) {
log.warn("------------------------------------------------------------");
log.warn(" ");
log.warn("Placing lock on loan: {}", loanId);
@@ -80,11 +80,10 @@ public class InternalLoanAccountLockApiResource implements InitializingBean {
LoanAccountLock loanAccountLock = new LoanAccountLock(loanId, LockOwner.valueOf(lockOwner),
ThreadLocalContextUtil.getBusinessDateByType(BusinessDateType.COB_DATE));
if (StringUtils.isNotBlank(error)) {
loanAccountLock.setError(error, error);
if (StringUtils.isNotBlank(request.getError())) {
loanAccountLock.setError(request.getError(), request.getError());
}
loanAccountLockRepository.save(loanAccountLock);
return Response.status(Response.Status.ACCEPTED).build();
}
}
@@ -0,0 +1,27 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.cob.api;
import lombok.Data;
@Data
public class LockRequest {
private String error;
}
@@ -18,6 +18,7 @@
*/
package org.apache.fineract.portfolio.loanaccount.api;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
@@ -68,15 +69,13 @@ public class LoanDisbursementDetailApiResource {
@Path("{disbursementId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
public String updateDisbursementDate(@PathParam("loanId") final Long loanId, @PathParam("disbursementId") final Long disbursementId,
final String apiRequestBodyAsJson) {
public CommandProcessingResult updateDisbursementDate(@PathParam("loanId") final Long loanId,
@PathParam("disbursementId") final Long disbursementId, final String apiRequestBodyAsJson) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateDisbusementDate(loanId, disbursementId)
.withJson(apiRequestBodyAsJson).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
return this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
}
@PUT
@@ -84,14 +83,13 @@ public class LoanDisbursementDetailApiResource {
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = LoanDisbursementDetailApiResourceSwagger.PostAddAndDeleteDisbursementDetailRequest.class)))
public String addAndDeleteDisbursementDetail(@PathParam("loanId") final Long loanId, final String apiRequestBodyAsJson) {
public CommandProcessingResult addAndDeleteDisbursementDetail(@PathParam("loanId") final Long loanId,
@Parameter(hidden = true) final String apiRequestBodyAsJson) {
CommandWrapper commandRequest = new CommandWrapperBuilder().addAndDeleteDisbursementDetails(loanId).withJson(apiRequestBodyAsJson)
.build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
return this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
}
@GET