diff --git a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/builder/UpdateEvidenceDTOBuilder.java b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/builder/UpdateEvidenceDTOBuilder.java index 0832ed7..d45a431 100644 --- a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/builder/UpdateEvidenceDTOBuilder.java +++ b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/builder/UpdateEvidenceDTOBuilder.java @@ -9,13 +9,13 @@ public static UpdateEvidenceDTO build(final ApiUpdateIncomeEvidenceRequest reque return UpdateEvidenceDTO.builder() .financialAssessmentId(request.getFinancialAssessmentId()) .magCourtOutcome(request.getMagCourtOutcome()) - .applicantDetails(request.getApplicantEvidenceItems().getApplicantDetails()) + .applicantDetails(request.getApplicantEvidenceItems() != null ? request.getApplicantEvidenceItems().getApplicantDetails() : null) .applicantPensionAmount(request.getApplicantPensionAmount()) .applicationReceivedDate(request.getMetadata().getApplicationReceivedDate()) - .partnerDetails(request.getPartnerEvidenceItems().getApplicantDetails()) + .partnerDetails(request.getPartnerEvidenceItems() != null ? request.getPartnerEvidenceItems().getApplicantDetails() : null) .partnerPensionAmount(request.getPartnerPensionAmount()) - .applicantIncomeEvidenceItems(request.getApplicantEvidenceItems().getIncomeEvidenceItems()) - .partnerIncomeEvidenceItems(request.getPartnerEvidenceItems().getIncomeEvidenceItems()) + .applicantIncomeEvidenceItems(request.getApplicantEvidenceItems() != null ? request.getApplicantEvidenceItems().getIncomeEvidenceItems() : null) + .partnerIncomeEvidenceItems(request.getPartnerEvidenceItems() != null ? request.getPartnerEvidenceItems().getIncomeEvidenceItems() : null) .evidenceDueDate(request.getEvidenceDueDate()) .evidenceReceivedDate(request.getEvidenceReceivedDate()) .build(); diff --git a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/controller/IncomeEvidenceController.java b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/controller/IncomeEvidenceController.java index 4c200e1..855cbb4 100644 --- a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/controller/IncomeEvidenceController.java +++ b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/controller/IncomeEvidenceController.java @@ -35,8 +35,6 @@ public ResponseEntity createEvidence(ApiCreateI public ResponseEntity updateEvidence(ApiUpdateIncomeEvidenceRequest request) { UpdateEvidenceDTO updateEvidenceDTO = UpdateEvidenceDTOBuilder.build(request); - evidenceService.updateEvidence(updateEvidenceDTO); - - return ResponseEntity.ok().build(); + return ResponseEntity.ok(evidenceService.updateEvidence(updateEvidenceDTO)); } } diff --git a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/dto/EvidenceReceivedResultDTO.java b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/dto/EvidenceReceivedResultDTO.java index 45c1468..9aa8ce0 100644 --- a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/dto/EvidenceReceivedResultDTO.java +++ b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/dto/EvidenceReceivedResultDTO.java @@ -9,5 +9,6 @@ @Builder public class EvidenceReceivedResultDTO { private boolean evidenceReceived; + private int incomeEvidenceRequiredId; private int minimumEvidenceItemsRequired; } diff --git a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/EvidenceService.java b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/EvidenceService.java index 67a1a77..f60d600 100644 --- a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/EvidenceService.java +++ b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/EvidenceService.java @@ -94,18 +94,18 @@ public ApiUpdateIncomeEvidenceResponse updateEvidence(UpdateEvidenceDTO updateEv throw new IllegalArgumentException("No income evidence items provided"); } + incomeEvidenceValidationService.checkEvidenceReceivedDate( + DateUtil.parseLocalDate(updateEvidenceDTO.getEvidenceReceivedDate()), + updateEvidenceDTO.getApplicationReceivedDate()); + ApiGetMeansAssessmentResponse oldMeansAssessmentResponse = meansAssessmentApiService.find(updateEvidenceDTO.getFinancialAssessmentId()); ApiIncomeEvidenceSummary incomeEvidenceSummary = oldMeansAssessmentResponse.getIncomeEvidenceSummary(); incomeEvidenceValidationService.checkEvidenceDueDates( - DateUtil.toDate(updateEvidenceDTO.getEvidenceDueDate()), - DateUtil.toDate(incomeEvidenceSummary.getFirstReminderDate()), - DateUtil.toDate(incomeEvidenceSummary.getSecondReminderDate()), - DateUtil.toDate(incomeEvidenceSummary.getEvidenceDueDate())); - - incomeEvidenceValidationService.checkEvidenceReceivedDate( - DateUtil.toDate(updateEvidenceDTO.getEvidenceReceivedDate()), - DateUtil.asDate(updateEvidenceDTO.getApplicationReceivedDate())); + DateUtil.parseLocalDate(updateEvidenceDTO.getEvidenceDueDate()), + DateUtil.parseLocalDate(incomeEvidenceSummary.getFirstReminderDate()), + DateUtil.parseLocalDate(incomeEvidenceSummary.getSecondReminderDate()), + DateUtil.parseLocalDate(incomeEvidenceSummary.getEvidenceDueDate())); boolean evidenceReceived = checkEvidenceReceived( applicantEvidenceItems, @@ -119,7 +119,7 @@ public ApiUpdateIncomeEvidenceResponse updateEvidence(UpdateEvidenceDTO updateEv updateEvidenceReceivedDate(incomeEvidenceSummary, evidenceReceived, updateEvidenceDTO.getEvidenceReceivedDate()); updateEvidenceDueDate(incomeEvidenceSummary, updateEvidenceDTO.getEvidenceDueDate()); - ApiUpdateMeansAssessmentRequest updateMeansAssessmentRequest = createUpdateMeansAssessmentRequest( + ApiMeansAssessmentResponse updateAssessmentResponse = updateMeansAssessment( incomeEvidenceSummary, updateEvidenceDTO.getFinancialAssessmentId(), updateEvidenceDTO.getApplicantDetails().getId(), @@ -128,10 +128,8 @@ public ApiUpdateIncomeEvidenceResponse updateEvidence(UpdateEvidenceDTO updateEv partnerEvidenceItems ); - ApiMeansAssessmentResponse updateEvidenceResponse = meansAssessmentApiService.update(updateMeansAssessmentRequest); - - applicantEvidenceItems = getUpdatedEvidenceItems(updateEvidenceResponse, updateEvidenceDTO.getApplicantDetails().getId()); - partnerEvidenceItems = getUpdatedEvidenceItems(updateEvidenceResponse, updateEvidenceDTO.getPartnerDetails().getId()); + applicantEvidenceItems = getUpdatedEvidenceItems(updateAssessmentResponse, updateEvidenceDTO.getApplicantDetails().getId()); + partnerEvidenceItems = getUpdatedEvidenceItems(updateAssessmentResponse, updateEvidenceDTO.getPartnerDetails().getId()); return new ApiUpdateIncomeEvidenceResponse() .withApplicantEvidenceItems(new ApiIncomeEvidenceItems(updateEvidenceDTO.getApplicantDetails(), applicantEvidenceItems)) @@ -146,16 +144,6 @@ protected boolean isCalcRequired(CrimeEvidenceDTO crimeEvidenceDTO) { (crimeEvidenceDTO.getEvidenceFee() == null || crimeEvidenceDTO.getEvidenceFee().getFeeLevel() == null); } - private List getUpdatedEvidenceItems( - ApiMeansAssessmentResponse meansAssessmentResponse, - int personId) { - return meansAssessmentResponse.getIncomeEvidence() - .stream() - .filter(evidence -> evidence.getApplicantId() == personId) - .map(this::mapApiIncomeEvidence) - .toList(); - } - private boolean checkEvidenceReceived( List applicantEvidenceItems, List partnerEvidenceItems, @@ -192,7 +180,7 @@ private boolean checkEvidenceReceived( } boolean partnerRequiredEvidenceOutstanding = incomeEvidenceService.isRequiredEvidenceOutstanding( - partnerEvidenceReceivedResult.getMinimumEvidenceItemsRequired(), partnerEvidenceItems); + partnerEvidenceReceivedResult.getIncomeEvidenceRequiredId(), partnerEvidenceItems); if (partnerRequiredEvidenceOutstanding) { return false; @@ -200,12 +188,22 @@ private boolean checkEvidenceReceived( } boolean applicantRequiredEvidenceOutstanding = incomeEvidenceService.isRequiredEvidenceOutstanding( - applicantEvidenceReceivedResult.getMinimumEvidenceItemsRequired(), applicantEvidenceItems); + applicantEvidenceReceivedResult.getIncomeEvidenceRequiredId(), applicantEvidenceItems); return !applicantRequiredEvidenceOutstanding; } - private ApiUpdateMeansAssessmentRequest createUpdateMeansAssessmentRequest( + private List getUpdatedEvidenceItems( + ApiMeansAssessmentResponse meansAssessmentResponse, + int personId) { + return meansAssessmentResponse.getIncomeEvidence() + .stream() + .filter(evidence -> evidence.getApplicantId() == personId) + .map(this::mapApiIncomeEvidence) + .toList(); + } + + private ApiMeansAssessmentResponse updateMeansAssessment( ApiIncomeEvidenceSummary currentIncomeEvidenceSummary, int financialAssessmentId, int applicantId, @@ -219,10 +217,12 @@ private ApiUpdateMeansAssessmentRequest createUpdateMeansAssessmentRequest( applicantEvidenceItems.forEach(applicantEvidenceItem -> incomeEvidenceItems.add(mapApiIncomeEvidence(applicantEvidenceItem, applicantId))); partnerEvidenceItems.forEach(partnerEvidenceItem -> incomeEvidenceItems.add(mapApiIncomeEvidence(partnerEvidenceItem, partnerId))); - return new ApiUpdateMeansAssessmentRequest() + ApiUpdateMeansAssessmentRequest request = new ApiUpdateMeansAssessmentRequest() .withFinancialAssessmentId(financialAssessmentId) .withIncomeEvidence(incomeEvidenceItems) .withIncomeEvidenceSummary(currentIncomeEvidenceSummary); + + return meansAssessmentApiService.update(request); } private uk.gov.justice.laa.crime.common.model.meansassessment.ApiIncomeEvidence mapApiIncomeEvidence(ApiIncomeEvidence apiIncomeEvidence, int applicantId) { @@ -250,11 +250,6 @@ private void updateEvidenceDueDate(ApiIncomeEvidenceSummary incomeEvidenceSummar } else if (LocalDateTime.now().isAfter(evidenceDueDate) && evidenceDueDate != previousEvidenceDueDate) { incomeEvidenceSummary.setEvidenceDueDate(previousEvidenceDueDate); } - - // TODO: What should the due date be set as if the provided evidenceDueDate is in the past - // and the previousEvidenceDueDate is null? SP just raises an exception. - - } private void updateEvidenceReceivedDate(ApiIncomeEvidenceSummary incomeEvidenceSummary, boolean evidenceReceived, LocalDateTime evidenceReceivedDate) { diff --git a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceService.java b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceService.java index 67ed5fe..680768f 100644 --- a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceService.java +++ b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceService.java @@ -43,10 +43,9 @@ public boolean isRequiredEvidenceOutstanding(int incomeEvidenceRequiredId, List< return true; } - // TODO: Is the check in here correct (on id to id)? for (IncomeEvidenceRequiredItemProjection requiredEvidenceItem : requiredEvidenceItems) { Optional evidenceItem = providedEvidenceItems.stream() - .filter(providedEvidenceItem -> providedEvidenceItem.getId().equals(requiredEvidenceItem.getId())) + .filter(providedEvidenceItem -> providedEvidenceItem.getEvidenceType().getName().equals(requiredEvidenceItem.getIncomeEvidenceRequiredDescription())) .findFirst(); if (evidenceItem.isEmpty() || evidenceItem.get().getDateReceived() == null) { @@ -72,13 +71,11 @@ public EvidenceReceivedResultDTO checkMinimumEvidenceItemsReceived( pensionAmount.doubleValue()); if (incomeEvidenceRequiredEntity == null) { - return new EvidenceReceivedResultDTO(true, 0); + return new EvidenceReceivedResultDTO(true, 0, 0); } - // NOTE: Assumption here from the SP that if we get a null value back from the query to the - // income evidence required table, then this isn't an error. boolean minimumEvidenceItemsReceived = providedEvidenceItems.size() >= incomeEvidenceRequiredEntity.getEvidenceItemsRequired(); - return new EvidenceReceivedResultDTO(minimumEvidenceItemsReceived, incomeEvidenceRequiredEntity.getEvidenceItemsRequired()); + return new EvidenceReceivedResultDTO(minimumEvidenceItemsReceived, incomeEvidenceRequiredEntity.getId(), incomeEvidenceRequiredEntity.getEvidenceItemsRequired()); } } diff --git a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceValidationService.java b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceValidationService.java index 7077637..c51ec20 100644 --- a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceValidationService.java +++ b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceValidationService.java @@ -1,5 +1,6 @@ package uk.gov.justice.laa.crime.evidence.service; +import java.time.LocalDate; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -18,42 +19,43 @@ public class IncomeEvidenceValidationService { public void validate(EvidenceDTO evidenceDTO){ checkExtraEvidenceDescription(evidenceDTO.getIncomeExtraEvidence(), evidenceDTO.getIncomeExtraEvidenceText()); - checkEvidenceReceivedDate(DateUtil.toDate(evidenceDTO.getIncomeEvidenceReceivedDate()), - DateUtil.toDate(evidenceDTO.getApplicationReceivedDate())); - checkEvidenceDueDates(DateUtil.toDate(evidenceDTO.getEvidenceDueDate()), - DateUtil.toDate(evidenceDTO.getFirstReminderDate()), - DateUtil.toDate(evidenceDTO.getSecondReminderDate()), - DateUtil.toDate(evidenceDTO.getExistingEvidenceDueDate())); + + checkEvidenceReceivedDate( + DateUtil.parseLocalDate(evidenceDTO.getIncomeEvidenceReceivedDate()), + DateUtil.parseLocalDate(evidenceDTO.getApplicationReceivedDate())); + + checkEvidenceDueDates(DateUtil.parseLocalDate(evidenceDTO.getEvidenceDueDate()), + DateUtil.parseLocalDate(evidenceDTO.getFirstReminderDate()), + DateUtil.parseLocalDate(evidenceDTO.getSecondReminderDate()), + DateUtil.parseLocalDate(evidenceDTO.getExistingEvidenceDueDate())); } - public void checkEvidenceReceivedDate(Date incomeEvidenceReceivedDate, Date applicationReceivedDate) { - Date currentDate = DateUtil.getCurrentDate(); - if (incomeEvidenceReceivedDate != null && incomeEvidenceReceivedDate.after(currentDate)) { + public void checkEvidenceReceivedDate(LocalDate incomeEvidenceReceivedDate, LocalDate applicationReceivedDate) { + LocalDate currentDate = LocalDate.now(); + if (incomeEvidenceReceivedDate != null && incomeEvidenceReceivedDate.isAfter(currentDate)) { throw new IllegalArgumentException("Income evidence received date cannot be in the future"); } - if (incomeEvidenceReceivedDate != null && incomeEvidenceReceivedDate.before(applicationReceivedDate)) { + if (incomeEvidenceReceivedDate != null && incomeEvidenceReceivedDate.isBefore(applicationReceivedDate)) { throw new IllegalArgumentException("Income evidence received date cannot be before application date received"); } } - public void checkExtraEvidenceDescription(String incomeExtraEvidence, String incomeExtraEvidenceText) { if (OtherEvidenceTypes.getFrom(incomeExtraEvidence) != null && StringUtils.isBlank(incomeExtraEvidenceText)) { throw new IllegalArgumentException("When other evidence is requested, you must provide descriptive text."); } } - - public void checkEvidenceDueDates(Date evidenceDueDate, Date firstReminderDate, Date secondReminderDate, - Date existingEvidenceDueDate) { - Date currentDate = DateUtil.getCurrentDate(); + public void checkEvidenceDueDates(LocalDate evidenceDueDate, LocalDate firstReminderDate, LocalDate secondReminderDate, + LocalDate existingEvidenceDueDate) { + LocalDate currentDate = LocalDate.now(); if ((evidenceDueDate == null && existingEvidenceDueDate != null) && ( firstReminderDate != null || secondReminderDate != null)) { throw new IllegalArgumentException("Evidence due date cannot be null"); } - if (evidenceDueDate != null && evidenceDueDate.before(currentDate) + if (evidenceDueDate != null && evidenceDueDate.isBefore(currentDate) && (!evidenceDueDate.equals(existingEvidenceDueDate))) { throw new IllegalArgumentException("Cannot set due date in the past."); } diff --git a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/MeansAssessmentApiService.java b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/MeansAssessmentApiService.java index 5074d39..02423cb 100644 --- a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/MeansAssessmentApiService.java +++ b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/MeansAssessmentApiService.java @@ -32,7 +32,6 @@ public ApiGetMeansAssessmentResponse find(Integer assessmentId) { return response; } - // TODO: Is this response type what CMA will be returning when updating a means assessment? public ApiMeansAssessmentResponse update(ApiUpdateMeansAssessmentRequest request) { ApiMeansAssessmentResponse response = cmaApiClient.put( request, diff --git a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/staticdata/entity/IncomeEvidenceRequiredEntity.java b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/staticdata/entity/IncomeEvidenceRequiredEntity.java index cc2569b..1945a12 100644 --- a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/staticdata/entity/IncomeEvidenceRequiredEntity.java +++ b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/staticdata/entity/IncomeEvidenceRequiredEntity.java @@ -24,6 +24,9 @@ @Table(name = "income_evidence_required", schema = "crime_evidence") public class IncomeEvidenceRequiredEntity { @Id + @Column(name = "ID", nullable = false) + private int id; + @Column(name = "MCOO_OUTCOME", nullable = false) private String mcooOutcome; @@ -37,10 +40,10 @@ public class IncomeEvidenceRequiredEntity { private int annualPensionAmount; @Column(name = "APPLICANT_PARTNER") - private int applicantPartner; + private String applicantPartner; @Column(name = "PARTNER_EMST_CODE") - private int partnerEmstCode; + private String partnerEmstCode; @Column(name = "USER_CREATED", nullable = false) private String createdBy; diff --git a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/staticdata/entity/IncomeEvidenceRequiredItemEntity.java b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/staticdata/entity/IncomeEvidenceRequiredItemEntity.java index 032c32c..07b8583 100644 --- a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/staticdata/entity/IncomeEvidenceRequiredItemEntity.java +++ b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/staticdata/entity/IncomeEvidenceRequiredItemEntity.java @@ -30,6 +30,9 @@ public class IncomeEvidenceRequiredItemEntity { @Column(name = "IEVR_ID", nullable = false) private int incomeEvidenceRequiredId; + @Column(name = "INEV_EVIDENCE", nullable = false) + private String incomeEvidenceRequiredDescription; + @Column(name = "MANDATORY", nullable = false) private String mandatory; diff --git a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/staticdata/projection/IncomeEvidenceRequiredItemProjection.java b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/staticdata/projection/IncomeEvidenceRequiredItemProjection.java index bed02c2..132c7ae 100644 --- a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/staticdata/projection/IncomeEvidenceRequiredItemProjection.java +++ b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/staticdata/projection/IncomeEvidenceRequiredItemProjection.java @@ -1,9 +1,7 @@ package uk.gov.justice.laa.crime.evidence.staticdata.projection; -// TODO: Should this also contain the evidence received date? This doesn't exist on said table, -// so not sure exactly where this should come from if so. public interface IncomeEvidenceRequiredItemProjection { int getId(); - int getIncomeEvidenceRequiredId(); String getMandatory(); + String getIncomeEvidenceRequiredDescription(); } diff --git a/crime-evidence/src/main/resources/application.yaml b/crime-evidence/src/main/resources/application.yaml index 3e67533..266fa83 100644 --- a/crime-evidence/src/main/resources/application.yaml +++ b/crime-evidence/src/main/resources/application.yaml @@ -56,9 +56,15 @@ spring: oauth2: client: provider: + cma: + token-uri: ${CMA_API_OAUTH_URL} maat-api: token-uri: ${MAAT_API_OAUTH_URL} registration: + cma: + client-id: ${CMA_API_OAUTH_CLIENT_ID} + client-secret: ${CMA_API_OAUTH_CLIENT_SECRET} + authorization-grant-type: client_credentials maat-api: client-id: ${MAAT_API_OAUTH_CLIENT_ID} client-secret: ${MAAT_API_OAUTH_CLIENT_SECRET} @@ -73,6 +79,11 @@ retry-config: jitter-value: 0.75 services: + cma-api: + base-url: ${CMA_API_BASE_URL} + endpoints: + find-url: ${services.cma-api.base-url}/api/internal/v1/assessment/means/{financialAssessmentId} + update-url: ${services.cma-api.base-url}/api/internal/v1/assessment/means maat-api: base-url: ${MAAT_API_BASE_URL} assessments-domain: ${services.maat-api.base-url}/api/internal/v1/assessment diff --git a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/config/MockServicesConfiguration.java b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/config/MockServicesConfiguration.java index 73c954c..a98098c 100644 --- a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/config/MockServicesConfiguration.java +++ b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/config/MockServicesConfiguration.java @@ -8,17 +8,27 @@ public static ServicesConfiguration getConfiguration(int port) { ServicesConfiguration servicesConfiguration = new ServicesConfiguration(); ServicesConfiguration.MaatApi maatApiConfiguration = new ServicesConfiguration.MaatApi(); + ServicesConfiguration.CmaApi cmaApiConfiguration = new ServicesConfiguration.CmaApi(); ServicesConfiguration.MaatApi.RepOrderEndpoints repOrderEndpoints = new ServicesConfiguration.MaatApi.RepOrderEndpoints( "/rep-orders/capital/reporder/{repId}" ); + ServicesConfiguration.CmaApi.Endpoints cmaEndpoints = + new ServicesConfiguration.CmaApi.Endpoints( + "/assessment/means/{financialAssessmentId}", + "/assessment/means"); + maatApiConfiguration.setBaseUrl(host); maatApiConfiguration.setRepOrderEndpoints(repOrderEndpoints); + cmaApiConfiguration.setBaseUrl(host); + cmaApiConfiguration.setEndpoints(cmaEndpoints); + servicesConfiguration.setOAuthEnabled(false); servicesConfiguration.setMaatApi(maatApiConfiguration); + servicesConfiguration.setCmaApi(cmaApiConfiguration); return servicesConfiguration; } diff --git a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/controller/IncomeEvidenceControllerTest.java b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/controller/IncomeEvidenceControllerTest.java index 217ad20..6edd620 100644 --- a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/controller/IncomeEvidenceControllerTest.java +++ b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/controller/IncomeEvidenceControllerTest.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Test; +import org.mockito.Mock; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; @@ -12,6 +13,7 @@ import uk.gov.justice.laa.crime.common.model.evidence.ApiUpdateIncomeEvidenceRequest; import uk.gov.justice.laa.crime.commons.tracing.TraceIdHandler; import uk.gov.justice.laa.crime.evidence.data.builder.TestModelDataBuilder; +import uk.gov.justice.laa.crime.evidence.service.EvidenceService; import uk.gov.justice.laa.crime.util.RequestBuilderUtils; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -22,6 +24,9 @@ class IncomeEvidenceControllerTest { private static final String ENDPOINT_URL = "/api/internal/v1/evidence"; + @MockBean + private EvidenceService evidenceService; + @Autowired private MockMvc mvc; @@ -75,6 +80,7 @@ void givenEmptyRequestBody_whenUpdateEvidenceIsInvoked_thenBadRequestResponseIsR @Test void givenInvalidRequest_whenUpdateEvidenceIsInvoked_thenBadRequestResponseIsReturned() throws Exception { ApiUpdateIncomeEvidenceRequest request = TestModelDataBuilder.getApiUpdateIncomeEvidenceRequest(); + request.setApplicantEvidenceItems(TestModelDataBuilder.getApiIncomeEvidenceItems()); request.setMagCourtOutcome(null); String content = objectMapper.writeValueAsString(request); mvc.perform(RequestBuilderUtils.buildRequestGivenContent(HttpMethod.PUT, content, ENDPOINT_URL)) @@ -82,10 +88,20 @@ void givenInvalidRequest_whenUpdateEvidenceIsInvoked_thenBadRequestResponseIsRet } @Test - void givenValidRequest_whenUpdateEvidenceIsInvoked_thenOkResponseIsReturned() throws Exception { + void givenValidRequestWithApplicantDetails_whenUpdateEvidenceIsInvoked_thenOkResponseIsReturned() throws Exception { ApiUpdateIncomeEvidenceRequest request = TestModelDataBuilder.getApiUpdateIncomeEvidenceRequest(); + request.setApplicantEvidenceItems(TestModelDataBuilder.getApiIncomeEvidenceItems()); String content = objectMapper.writeValueAsString(request); mvc.perform(RequestBuilderUtils.buildRequestGivenContent(HttpMethod.PUT, content, ENDPOINT_URL)) .andExpect(status().isOk()); } + + @Test + void givenValidRequestWithPartnerDetails_whenUpdateEvidenceIsInvoked_thenOkResponseIsReturned() throws Exception { + ApiUpdateIncomeEvidenceRequest request = TestModelDataBuilder.getApiUpdateIncomeEvidenceRequest(); + request.setPartnerEvidenceItems(TestModelDataBuilder.getApiIncomeEvidenceItems()); + String content = objectMapper.writeValueAsString(request); + mvc.perform(RequestBuilderUtils.buildRequestGivenContent(HttpMethod.PUT, content, ENDPOINT_URL)) + .andExpect(status().isOk()); + } } diff --git a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/data/builder/TestModelDataBuilder.java b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/data/builder/TestModelDataBuilder.java index 766b835..3426d80 100644 --- a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/data/builder/TestModelDataBuilder.java +++ b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/data/builder/TestModelDataBuilder.java @@ -92,6 +92,7 @@ public static ApiApplicantDetails getApiPartnerDetails() { public static ApiIncomeEvidenceMetadata getApiIncomeEvidenceMetadata() { return new ApiIncomeEvidenceMetadata() + .withApplicationReceivedDate(LocalDate.now()) .withNotes("mock notes") .withEvidencePending(false) .withUserSession(getUserSession()); @@ -125,7 +126,6 @@ public static ApiUpdateIncomeEvidenceRequest getApiUpdateIncomeEvidenceRequest() return new ApiUpdateIncomeEvidenceRequest() .withEvidenceDueDate(DUE_DATE) .withMagCourtOutcome(MagCourtOutcome.SENT_FOR_TRIAL) - .withApplicantEvidenceItems(getApiIncomeEvidenceItems()) .withFinancialAssessmentId(FINANCIAL_ASSESSMENT_ID) .withMetadata(getApiIncomeEvidenceMetadata()); } diff --git a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/EvidenceServiceTest.java b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/EvidenceServiceTest.java index f2f14d7..88c8a0c 100644 --- a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/EvidenceServiceTest.java +++ b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/EvidenceServiceTest.java @@ -29,6 +29,7 @@ import uk.gov.justice.laa.crime.evidence.staticdata.enums.ApplicantType; import static org.assertj.core.api.AssertionsForClassTypes.assertThat; +import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.when; @@ -140,21 +141,8 @@ void givenCommittedForTrialAndEvidenceFeeLevelIsNotNull_WhenIsCalcRequired_False void givenNoEvidenceItems_whenUpdateEvidenceIsInvoked_thenIncomeEvidenceIsNotUpdated() { UpdateEvidenceDTO updateEvidenceDTO = TestModelDataBuilder.getUpdateEvidenceRequest(); - ApiUpdateIncomeEvidenceResponse updateEvidenceResponse = evidenceService.updateEvidence(updateEvidenceDTO); - - // TODO: If no evidence is provided, presumably we want to not even bother doing the update? - Assertions.assertNull(updateEvidenceResponse.getApplicantEvidenceItems()); - } - - @Test - void givenMinimumEvidenceItemsLimitIsNotMet_whenUpdateEvidenceIsInvoked_thenIncomeEvidenceIsUpdated() { -// when(meansAssessmentApiService.find(123)).thenReturn( -// new ApiGetMeansAssessmentResponse(123, 1, ) -// ) - - when(incomeEvidenceService.checkMinimumEvidenceItemsReceived(Collections.emptyList(), ApplicantType.APPLICANT, MagCourtOutcome.APPEAL_TO_CC, EmploymentStatus.EMPLOY, null, BigDecimal.ZERO)) - .thenReturn(EvidenceReceivedResultDTO.builder().minimumEvidenceItemsRequired(0).build()); - - UpdateEvidenceDTO updateEvidenceDTO = TestModelDataBuilder.getUpdateEvidenceRequest(); + assertThatThrownBy(() -> evidenceService.updateEvidence(updateEvidenceDTO)) + .isInstanceOf(IllegalArgumentException.class) + .hasMessage("No income evidence items provided"); } } \ No newline at end of file diff --git a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceServiceTest.java b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceServiceTest.java index 055f799..ba84286 100644 --- a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceServiceTest.java +++ b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceServiceTest.java @@ -35,8 +35,8 @@ public class IncomeEvidenceServiceTest { void givenNoRequiredEvidenceItemsExist_whenIsRequiredEvidenceOutstandingIsInvokedWithNoProvidedEvidenceItems_thenReturnFalse() { when(incomeEvidenceRequiredItemRepository.findByIncomeEvidenceRequiredId(1)).thenReturn( List.of( - createIncomeEvidenceRequiredItemProjection(34, 1, false), - createIncomeEvidenceRequiredItemProjection(35, 2, false) + createIncomeEvidenceRequiredItemProjection(34, "mock1", false), + createIncomeEvidenceRequiredItemProjection(35, "mock2", false) ) ); @@ -51,8 +51,8 @@ void givenNoRequiredEvidenceItemsExist_whenIsRequiredEvidenceOutstandingIsInvoke void givenNoRequiredEvidenceItemsExist_whenIsRequiredEvidenceOutstandingIsInvokedWithProvidedEvidenceItems_thenReturnFalse() { when(incomeEvidenceRequiredItemRepository.findByIncomeEvidenceRequiredId(1)).thenReturn( List.of( - createIncomeEvidenceRequiredItemProjection(34, 1, false), - createIncomeEvidenceRequiredItemProjection(35, 2, false) + createIncomeEvidenceRequiredItemProjection(34, "mock1", false), + createIncomeEvidenceRequiredItemProjection(35, "mock2", false) ) ); @@ -72,9 +72,9 @@ void givenNoRequiredEvidenceItemsExist_whenIsRequiredEvidenceOutstandingIsInvoke void givenAtLeastOneRequiredEvidenceItemNotReceived_whenIsRequiredEvidenceOutstandingIsInvoked_thenReturnTrue() { when(incomeEvidenceRequiredItemRepository.findByIncomeEvidenceRequiredId(2)).thenReturn( List.of( - createIncomeEvidenceRequiredItemProjection(34, 1, false), - createIncomeEvidenceRequiredItemProjection(35, 2, false), - createIncomeEvidenceRequiredItemProjection(36, 2, true) + createIncomeEvidenceRequiredItemProjection(34, "mock1", false), + createIncomeEvidenceRequiredItemProjection(35, "mock2", false), + createIncomeEvidenceRequiredItemProjection(36, "mock3", true) ) ); @@ -186,7 +186,7 @@ void givenEvidenceItemsProvidedAndMinimumIsNotMet_whenCheckMinimumEvidenceItemsR } private static IncomeEvidenceRequiredItemProjection createIncomeEvidenceRequiredItemProjection( - int id, int incomeEvidenceRequiredId, boolean mandatory) + int id, String description, boolean mandatory) { return new IncomeEvidenceRequiredItemProjection() { @Override @@ -195,13 +195,13 @@ public int getId() { } @Override - public int getIncomeEvidenceRequiredId() { - return incomeEvidenceRequiredId; + public String getMandatory() { + return mandatory ? "Y" : "N"; } @Override - public String getMandatory() { - return mandatory ? "Y" : "N"; + public String getIncomeEvidenceRequiredDescription() { + return description; } }; } diff --git a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceValidationServiceTest.java b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceValidationServiceTest.java index f70a750..80e5203 100644 --- a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceValidationServiceTest.java +++ b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/IncomeEvidenceValidationServiceTest.java @@ -31,31 +31,29 @@ class IncomeEvidenceValidationServiceTest { @Test void givenValidDates_whenCheckEvidenceReceivedDateIsInvoked_noExceptionIsThrown() { - incomeEvidenceValidationService.checkEvidenceReceivedDate(new Date(), new Date()); + incomeEvidenceValidationService.checkEvidenceReceivedDate(LocalDate.now(), LocalDate.now()); } @Test void givenValidDates_whenCheckEvidenceReceivedDateIsInvokedWithIncomeEvidenceReceivedDateNull_noExceptionIsThrown() { - incomeEvidenceValidationService.checkEvidenceReceivedDate(null, new Date()); + incomeEvidenceValidationService.checkEvidenceReceivedDate(null, LocalDate.now()); } @Test void givenValidDates_whenCheckEvidenceReceivedDateIsInvokedWithIncomeEvidenceReceivedDateAfterCurrentDate_thenExceptionIsThrown() { LocalDate futureDate = LocalDate.now().plusMonths(2); - Date convertedFutureDate = DateUtil.asDate(futureDate); - Date currentDate = new Date(); + LocalDate currentDate = LocalDate.now(); assertThrows(IllegalArgumentException.class, () -> - incomeEvidenceValidationService.checkEvidenceReceivedDate(convertedFutureDate, currentDate) + incomeEvidenceValidationService.checkEvidenceReceivedDate(futureDate, currentDate) ); } @Test void givenValidDates_whenCheckEvidenceReceivedDateIsInvokedWithIncomeEvidenceReceivedDateBeforeCurrentDate_ExceptionIsThrown() { LocalDate pastDate = LocalDate.now().minusMonths(2); - Date pastDateConverted = DateUtil.asDate(pastDate); - Date currentDate = new Date(); + LocalDate currentDate = LocalDate.now(); assertThrows(IllegalArgumentException.class, () -> - incomeEvidenceValidationService.checkEvidenceReceivedDate(pastDateConverted, currentDate) + incomeEvidenceValidationService.checkEvidenceReceivedDate(pastDate, currentDate) ); } @@ -102,12 +100,12 @@ void givenIncomeExtraEvidenceReceivedDate_whenCheckExtraEvidenceDescriptionIsInv @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvoked_thenNoExceptionIsThrown() { - incomeEvidenceValidationService.checkEvidenceDueDates(new Date(), new Date(), new Date(), new Date()); + incomeEvidenceValidationService.checkEvidenceDueDates(LocalDate.now(), LocalDate.now(), LocalDate.now(), LocalDate.now()); } @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithEvidenceDueDateNull_thenExceptionIsThrown() { - Date currentDate = new Date(); + LocalDate currentDate = LocalDate.now(); assertThrows(IllegalArgumentException.class, () -> incomeEvidenceValidationService.checkEvidenceDueDates(null, currentDate, currentDate, currentDate) ); @@ -116,105 +114,96 @@ void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithEvidenceDueDateNull_t @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithEvidenceDueDateAfterCurrentDate_thenNoExceptionIsThrown() { LocalDate futureDate = LocalDate.now().plusMonths(2); - Date futureDateConverted = DateUtil.asDate(futureDate); - Date currentDate = new Date(); - incomeEvidenceValidationService.checkEvidenceDueDates(futureDateConverted, currentDate, currentDate, currentDate); + LocalDate currentDate = LocalDate.now(); + incomeEvidenceValidationService.checkEvidenceDueDates(futureDate, currentDate, currentDate, currentDate); } @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithEvidenceDueDateBeforeCurrentDate_thenExceptionIsThrown() { LocalDate pastDate = LocalDate.now().minusMonths(2); - Date pastDateConverted = DateUtil.asDate(pastDate); - Date currentDate1 = new Date(); - Date currentDate2 = new Date(); - Date currentDate3 = new Date(); + LocalDate currentDate1 = LocalDate.now(); + LocalDate currentDate2 = LocalDate.now(); + LocalDate currentDate3 = LocalDate.now(); assertThrows(IllegalArgumentException.class, () -> - incomeEvidenceValidationService.checkEvidenceDueDates(pastDateConverted, currentDate1, currentDate2, currentDate3) + incomeEvidenceValidationService.checkEvidenceDueDates(pastDate, currentDate1, currentDate2, currentDate3) ); } @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithFirstReminderDateNull_thenNoExceptionIsThrown() { - incomeEvidenceValidationService.checkEvidenceDueDates(new Date(), null, new Date(), new Date()); + incomeEvidenceValidationService.checkEvidenceDueDates(LocalDate.now(), null, LocalDate.now(), LocalDate.now()); } @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithFirstReminderDateAfterCurrentDate_thenNoExceptionIsThrown() { LocalDate futureDate = LocalDate.now().plusMonths(2); - Date currentDate1 = new Date(); - Date futureDateConverted = DateUtil.asDate(futureDate); - Date currentDate2 = new Date(); - Date currentDate3 = new Date(); - incomeEvidenceValidationService.checkEvidenceDueDates(currentDate1, futureDateConverted, currentDate2, currentDate3); + LocalDate currentDate1 = LocalDate.now(); + LocalDate currentDate2 = LocalDate.now(); + LocalDate currentDate3 = LocalDate.now(); + incomeEvidenceValidationService.checkEvidenceDueDates(currentDate1, futureDate, currentDate2, currentDate3); } @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithFirstReminderDateBeforeCurrentDate_thenNoExceptionIsThrown() { LocalDate pastDate = LocalDate.now().minusMonths(2); - Date currentDate1 = new Date(); - Date pastDateConverted = DateUtil.asDate(pastDate); - Date currentDate2 = new Date(); - Date currentDate3 = new Date(); - incomeEvidenceValidationService.checkEvidenceDueDates(currentDate1, pastDateConverted, currentDate2, currentDate3); + LocalDate currentDate1 = LocalDate.now(); + LocalDate currentDate2 = LocalDate.now(); + LocalDate currentDate3 = LocalDate.now(); + incomeEvidenceValidationService.checkEvidenceDueDates(currentDate1, pastDate, currentDate2, currentDate3); } @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithSecondReminderDateNull_thenExceptionIsThrown() { - incomeEvidenceValidationService.checkEvidenceDueDates(new Date(), new Date(), null, new Date()); + incomeEvidenceValidationService.checkEvidenceDueDates(LocalDate.now(), LocalDate.now(), null, LocalDate.now()); } @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithExistingEvidenceDueDateAsNullAndEvidenceDueDateBeforeDate_thenExceptionIsThrown() { LocalDate pastDate = LocalDate.now().minusMonths(2); - Date pastDateConverted = DateUtil.asDate(pastDate); - Date currentDate1 = new Date(); - Date currentDate2 = new Date(); + LocalDate currentDate1 = LocalDate.now(); + LocalDate currentDate2 = LocalDate.now(); assertThrows(IllegalArgumentException.class, () -> - incomeEvidenceValidationService.checkEvidenceDueDates(pastDateConverted, currentDate1, currentDate2, null) + incomeEvidenceValidationService.checkEvidenceDueDates(pastDate, currentDate1, currentDate2, null) ); } @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithExistingEvidenceDueDateAsNullAndEvidenceDueDateAfterDate_thenNoExceptionIsThrown() { LocalDate futureDate = LocalDate.now().plusMonths(2); - Date futureDateConverted = DateUtil.asDate(futureDate); - Date currentDate1 = new Date(); - Date currentDate2 = new Date(); - incomeEvidenceValidationService.checkEvidenceDueDates(futureDateConverted, currentDate1, currentDate2, null); + LocalDate currentDate1 = LocalDate.now(); + LocalDate currentDate2 = LocalDate.now(); + incomeEvidenceValidationService.checkEvidenceDueDates(futureDate, currentDate1, currentDate2, null); } @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithExistingEvidenceDueDateAsNullAndEvidenceDueDateAsNull_thenNoExceptionIsThrown() { - Date currentDate1 = new Date(); - Date currentDate2 = new Date(); + LocalDate currentDate1 = LocalDate.now(); + LocalDate currentDate2 = LocalDate.now(); incomeEvidenceValidationService.checkEvidenceDueDates(null, currentDate1, currentDate2, null); } @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithSecondReminderDateAfterCurrentDate_thenNoExceptionIsThrown() { LocalDate futureDate = LocalDate.now().plusMonths(2); - Date currentDate1 = new Date(); - Date currentDate2 = new Date(); - Date futureDateConverted = DateUtil.asDate(futureDate); - incomeEvidenceValidationService.checkEvidenceDueDates(currentDate1, currentDate2, futureDateConverted, currentDate2); + LocalDate currentDate1 = LocalDate.now(); + LocalDate currentDate2 = LocalDate.now(); + incomeEvidenceValidationService.checkEvidenceDueDates(currentDate1, currentDate2, futureDate, currentDate2); } @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithSecondReminderDateBeforeCurrentDate_thenNoExceptionIsThrown() { LocalDate pastDate = LocalDate.now().minusMonths(2); - Date currentDate1 = new Date(); - Date currentDate2 = new Date(); - Date pastDateConverted = DateUtil.asDate(pastDate); - incomeEvidenceValidationService.checkEvidenceDueDates(currentDate1, currentDate2, pastDateConverted, currentDate2); + LocalDate currentDate1 = LocalDate.now(); + LocalDate currentDate2 = LocalDate.now(); + incomeEvidenceValidationService.checkEvidenceDueDates(currentDate1, currentDate2, pastDate, currentDate2); } @Test void givenValidDates_whenCheckEvidenceDueDatesIsInvokedWithExistingEvidenceDueDateBeforeCurrentDate_thenNoExceptionIsThrown() { LocalDate pastDate = LocalDate.now().minusMonths(2); - Date currentDate1 = new Date(); - Date currentDate2 = new Date(); - Date pastDateConverted = DateUtil.asDate(pastDate); - incomeEvidenceValidationService.checkEvidenceDueDates(currentDate1, currentDate2, currentDate2, pastDateConverted); + LocalDate currentDate1 = LocalDate.now(); + LocalDate currentDate2 = LocalDate.now(); + incomeEvidenceValidationService.checkEvidenceDueDates(currentDate1, currentDate2, currentDate2, pastDate); } @Test diff --git a/crime-evidence/src/test/resources/application.yaml b/crime-evidence/src/test/resources/application.yaml index 879a578..2067143 100644 --- a/crime-evidence/src/test/resources/application.yaml +++ b/crime-evidence/src/test/resources/application.yaml @@ -24,9 +24,15 @@ spring: oauth2: client: provider: + cma: + token-uri: http://localhost:${wiremock.server.port}/oauth2/token maat-api: token-uri: http://localhost:9999/oauth2/token registration: + cma: + client-id: dummy-client + client-secret: dummy-client + authorization-grant-type: client_credentials maat-api: client-id: dummy-client client-secret: dummy-secret @@ -45,6 +51,11 @@ springdoc: operationsSorter: method services: + cma-api: + base-url: http://localhost:${wiremock.server.port} + endpoints: + find-url: ${services.cma-api.base-url}/api/internal/v1/assessment/means/{financialAssessmentId} + update-url: ${services.cma-api.base-url}/api/internal/v1/assessment/means maat-api: oAuthEnabled: true baseUrl: http://localhost:9999