FINERACT-2169: Refactor loan COB catch up api controller;

This commit is contained in:
viktorpavlenko
2025-03-25 12:11:29 +01:00
committed by Adam Saghy
parent 20195464c9
commit b646ba6ca7
4 changed files with 41 additions and 60 deletions
@@ -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.GetOldestCOBProcessedLoanResponse;
import org.apache.fineract.client.models.LoanAccountLock;
import org.apache.fineract.client.models.LoanAccountLockResponseDTO;
import org.apache.fineract.client.models.OldestCOBProcessedLoanDTO;
import org.apache.fineract.client.models.PostLoansResponse;
import org.apache.fineract.client.services.DefaultApi;
import org.apache.fineract.client.services.LoanAccountLockApi;
@@ -54,7 +54,7 @@ public class LoanCOBStepDef extends AbstractStepDef {
@Then("The cobProcessedDate of the oldest loan processed by COB is more than 1 day earlier than cobBusinessDate")
public void checkOldestCOBProcessed() throws IOException {
Response<GetOldestCOBProcessedLoanResponse> response = loanCobCatchUpApi.getOldestCOBProcessedLoan().execute();
Response<OldestCOBProcessedLoanDTO> response = loanCobCatchUpApi.getOldestCOBProcessedLoan().execute();
ErrorHelper.checkSuccessfulApiCall(response);
LocalDate cobDate = response.body().getCobBusinessDate();
@@ -79,7 +79,7 @@ import org.apache.fineract.client.models.GetLoansLoanIdTransactions;
import org.apache.fineract.client.models.GetLoansLoanIdTransactionsResponse;
import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse;
import org.apache.fineract.client.models.InterestPauseRequestDto;
import org.apache.fineract.client.models.IsCatchUpRunningResponse;
import org.apache.fineract.client.models.IsCatchUpRunningDTO;
import org.apache.fineract.client.models.PaymentAllocationOrder;
import org.apache.fineract.client.models.PostClientsResponse;
import org.apache.fineract.client.models.PostLoansLoanIdRequest;
@@ -2293,19 +2293,19 @@ public class LoanStepDef extends AbstractStepDef {
.pollInterval(Duration.ofSeconds(5)) //
.pollDelay(Duration.ofSeconds(5)) //
.until(() -> {
Response<IsCatchUpRunningResponse> isCatchUpRunningResponse = loanCobCatchUpApi.isCatchUpRunning().execute();
Response<IsCatchUpRunningDTO> isCatchUpRunningResponse = loanCobCatchUpApi.isCatchUpRunning().execute();
ErrorHelper.checkSuccessfulApiCall(isCatchUpRunningResponse);
IsCatchUpRunningResponse isCatchUpRunning = isCatchUpRunningResponse.body();
return isCatchUpRunning.getIsCatchUpRunning();
IsCatchUpRunningDTO isCatchUpRunning = isCatchUpRunningResponse.body();
return isCatchUpRunning.getCatchUpRunning();
});
await().atMost(Duration.ofMinutes(4)) //
.pollInterval(Duration.ofSeconds(5)) //
.pollDelay(Duration.ofSeconds(5)) //
.until(() -> {
Response<IsCatchUpRunningResponse> isCatchUpRunningResponse = loanCobCatchUpApi.isCatchUpRunning().execute();
Response<IsCatchUpRunningDTO> isCatchUpRunningResponse = loanCobCatchUpApi.isCatchUpRunning().execute();
ErrorHelper.checkSuccessfulApiCall(isCatchUpRunningResponse);
IsCatchUpRunningResponse isCatchUpRunning = isCatchUpRunningResponse.body();
return !isCatchUpRunning.getIsCatchUpRunning();
IsCatchUpRunningDTO isCatchUpRunning = isCatchUpRunningResponse.body();
return !isCatchUpRunning.getCatchUpRunning();
});
}