FINERACT-2169: Refactor loan account api controller;

This commit is contained in:
viktorpavlenko
2025-03-20 14:43:16 +01:00
committed by Adam Saghy
parent 993393b519
commit 3aa011b32e
7 changed files with 22 additions and 82 deletions
@@ -28,8 +28,8 @@ import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.client.models.BatchResponse;
import org.apache.fineract.client.models.GetJournalEntriesTransactionIdResponse;
import org.apache.fineract.client.models.GetLoanAccountLockResponse;
import org.apache.fineract.client.models.Header;
import org.apache.fineract.client.models.LoanAccountLockResponseDTO;
import retrofit2.Response;
public final class ErrorMessageHelper {
@@ -680,12 +680,12 @@ public final class ErrorMessageHelper {
expectedStr);
}
public static String listOfLockedLoansNotEmpty(Response<GetLoanAccountLockResponse> response) {
public static String listOfLockedLoansNotEmpty(Response<LoanAccountLockResponseDTO> response) {
String bodyStr = response.body().toString();
return String.format("List of locked loan accounts is not empty. Actual response is: %n%s", bodyStr);
}
public static String listOfLockedLoansContainsLoan(Long loanId, Response<GetLoanAccountLockResponse> response) {
public static String listOfLockedLoansContainsLoan(Long loanId, Response<LoanAccountLockResponseDTO> response) {
String bodyStr = response.body().toString();
return String.format("List of locked loan accounts contains the loan with loanId %s. List of locked loans: %n%s", loanId, bodyStr);
}
@@ -26,9 +26,9 @@ import java.io.IOException;
import java.time.LocalDate;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.client.models.GetLoanAccountLockResponse;
import org.apache.fineract.client.models.GetOldestCOBProcessedLoanResponse;
import org.apache.fineract.client.models.LoanAccountLock;
import org.apache.fineract.client.models.LoanAccountLockResponseDTO;
import org.apache.fineract.client.models.PostLoansResponse;
import org.apache.fineract.client.services.DefaultApi;
import org.apache.fineract.client.services.LoanAccountLockApi;
@@ -69,7 +69,7 @@ public class LoanCOBStepDef extends AbstractStepDef {
@Then("There are no locked loan accounts")
public void listOfLockedLoansEmpty() throws IOException {
Response<GetLoanAccountLockResponse> response = loanAccountLockApi.retrieveLockedAccounts(0, 1000).execute();
Response<LoanAccountLockResponseDTO> response = loanAccountLockApi.retrieveLockedAccounts(0, 1000).execute();
ErrorHelper.checkSuccessfulApiCall(response);
int size = response.body().getContent().size();
@@ -82,7 +82,7 @@ public class LoanCOBStepDef extends AbstractStepDef {
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
Long targetLoanId = loanResponse.body().getLoanId();
Response<GetLoanAccountLockResponse> response = loanAccountLockApi.retrieveLockedAccounts(0, 1000).execute();
Response<LoanAccountLockResponseDTO> response = loanAccountLockApi.retrieveLockedAccounts(0, 1000).execute();
ErrorHelper.checkSuccessfulApiCall(response);
List<LoanAccountLock> content = response.body().getContent();