From 09f8821420c7d756507031801548346d8b1afd3e Mon Sep 17 00:00:00 2001 From: Venkat Velpuri Date: Fri, 27 Oct 2023 12:13:31 +0100 Subject: [PATCH] LCAM-1006|Remove laa transaction id --- .../laa/crime/evidence/builder/CrimeEvidenceDTOBuilder.java | 1 - .../justice/laa/crime/evidence/dto/CrimeEvidenceDTO.java | 1 - .../justice/laa/crime/evidence/service/EvidenceService.java | 2 +- .../laa/crime/evidence/service/MaatCourtDataService.java | 5 ++--- .../resources/schemas/apiCalculateEvidenceFeeRequest.json | 4 ---- .../crime/evidence/builder/CrimeEvidenceDTOBuilderTest.java | 1 - .../crime/evidence/data/builder/TestModelDataBuilder.java | 6 ------ .../laa/crime/evidence/service/EvidenceServiceTest.java | 3 +-- .../crime/evidence/service/MaatCourtDataServiceTest.java | 4 +--- 9 files changed, 5 insertions(+), 22 deletions(-) diff --git a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/builder/CrimeEvidenceDTOBuilder.java b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/builder/CrimeEvidenceDTOBuilder.java index bef9598..8b7e755 100644 --- a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/builder/CrimeEvidenceDTOBuilder.java +++ b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/builder/CrimeEvidenceDTOBuilder.java @@ -12,7 +12,6 @@ public class CrimeEvidenceDTOBuilder { public static CrimeEvidenceDTO build(final ApiCalculateEvidenceFeeRequest request) { return CrimeEvidenceDTO.builder() - .laaTransactionId(request.getLaaTransactionId()) .repId(request.getRepId()) .magCourtOutcome(request.getMagCourtOutcome()) .evidenceFee(EvidenceFeeDTOBuilder.build(request)) diff --git a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/dto/CrimeEvidenceDTO.java b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/dto/CrimeEvidenceDTO.java index 15239cd..772c24e 100644 --- a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/dto/CrimeEvidenceDTO.java +++ b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/dto/CrimeEvidenceDTO.java @@ -9,7 +9,6 @@ @Data @Builder public class CrimeEvidenceDTO { - private String laaTransactionId; private Integer repId; private String magCourtOutcome; private EvidenceFeeDTO evidenceFee; 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 fe3bb24..23b7216 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 @@ -33,7 +33,7 @@ public ApiCalculateEvidenceFeeResponse calculateEvidenceFee(CrimeEvidenceDTO cri if (capEvidenceCount != null) { capEvidenceOutstandingCount = crimeEvidenceDTO.getCapitalEvidence().stream().filter(f -> f.getDateReceived() == null).count(); - capEvidenceCount = maatCourtDataService.getRepOrderCapitalByRepId(crimeEvidenceDTO.getRepId(), crimeEvidenceDTO.getLaaTransactionId()); + capEvidenceCount = maatCourtDataService.getRepOrderCapitalByRepId(crimeEvidenceDTO.getRepId()); } if (null != crimeEvidenceDTO.getIncomeEvidenceReceivedDate()) { diff --git a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/MaatCourtDataService.java b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/MaatCourtDataService.java index 4cc7fa1..2de5ac9 100644 --- a/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/MaatCourtDataService.java +++ b/crime-evidence/src/main/java/uk/gov/justice/laa/crime/evidence/service/MaatCourtDataService.java @@ -6,7 +6,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import uk.gov.justice.laa.crime.commons.client.RestAPIClient; -import uk.gov.justice.laa.crime.evidence.common.Constants; import uk.gov.justice.laa.crime.evidence.config.ServicesConfiguration; import java.util.Map; @@ -21,11 +20,11 @@ public class MaatCourtDataService { private final ServicesConfiguration configuration; private static final String RESPONSE_STRING = "Response from Court Data API: %s"; - public Long getRepOrderCapitalByRepId(Integer repId, String laaTransactionId) { + public Long getRepOrderCapitalByRepId(Integer repId) { ResponseEntity response = maatAPIClient.head( configuration.getMaatApi().getRepOrderEndpoints().getRepOrderCapitalUrl(), - Map.of(Constants.LAA_TRANSACTION_ID, laaTransactionId), + Map.of(), repId ); log.info(String.format(RESPONSE_STRING, response)); diff --git a/crime-evidence/src/main/resources/schemas/apiCalculateEvidenceFeeRequest.json b/crime-evidence/src/main/resources/schemas/apiCalculateEvidenceFeeRequest.json index 9944f3e..7321a5f 100644 --- a/crime-evidence/src/main/resources/schemas/apiCalculateEvidenceFeeRequest.json +++ b/crime-evidence/src/main/resources/schemas/apiCalculateEvidenceFeeRequest.json @@ -5,10 +5,6 @@ "title": "Calculate Evidence Fee Request", "description": "Data Contract for Calculate Evidence Fee Request", "properties": { - "laaTransactionId": { - "type": "string", - "description": "The txn / correlation UUID" - }, "repId": { "type": "integer", "description": "MAAT / Rep Id" diff --git a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/builder/CrimeEvidenceDTOBuilderTest.java b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/builder/CrimeEvidenceDTOBuilderTest.java index 638e4e0..8b99226 100644 --- a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/builder/CrimeEvidenceDTOBuilderTest.java +++ b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/builder/CrimeEvidenceDTOBuilderTest.java @@ -24,7 +24,6 @@ void givenApiCalculateEvidenceFeeRequest_whenBuildIsInvoked_thenCorrectCrimeEvid TestModelDataBuilder.getApiCalculateEvidenceFeeRequest(Boolean.TRUE)); softly.assertThat(crimeEvidenceDTO.getRepId()).isEqualTo(TestModelDataBuilder.TEST_REP_ID); - softly.assertThat(crimeEvidenceDTO.getLaaTransactionId()).isEqualTo(TestModelDataBuilder.MEANS_ASSESSMENT_TRANSACTION_ID); softly.assertThat(crimeEvidenceDTO.getMagCourtOutcome()).isEqualTo(TestModelDataBuilder.MSG_COURT_OUTCOME); softly.assertThat(crimeEvidenceDTO.getEvidenceFee().getFeeLevel()).isEqualTo(EvidenceFeeLevel.LEVEL1.getFeeLevel()); softly.assertThat(crimeEvidenceDTO.getEvidenceFee().getDescription()).isEqualTo(EvidenceFeeLevel.LEVEL1.getDescription()); 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 738b1df..cca4fee 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 @@ -18,8 +18,6 @@ public class TestModelDataBuilder { public static final Integer TEST_REP_ID = 91919; - public static final String MEANS_ASSESSMENT_TRANSACTION_ID = "7c49ebfe-fe3a-4f2f-8dad-f7b8f03b8327"; - public static final LocalDateTime CAPITAL_EVIDENCE_RECEIVED_DATE = LocalDateTime.of(2023, 3, 9, 15, 1, 25); public static final LocalDateTime INCOME_EVIDENCE_RECEIVED_DATE = @@ -32,7 +30,6 @@ public class TestModelDataBuilder { public static ApiCalculateEvidenceFeeRequest getApiCalculateEvidenceFeeRequest(boolean isValid) { return new ApiCalculateEvidenceFeeRequest() .withRepId(isValid ? TEST_REP_ID : null) - .withLaaTransactionId(MEANS_ASSESSMENT_TRANSACTION_ID) .withMagCourtOutcome(MSG_COURT_OUTCOME) .withEvidenceFee(getApiEvidenceFee()) .withCapitalEvidence(getApiCapitalEvidenceList()) @@ -59,7 +56,6 @@ public static List getApiCapitalEvidenceList() { public static ApiCalculateEvidenceFeeRequest getApiCalculateEvidenceFeeInvalidRequest() { return new ApiCalculateEvidenceFeeRequest() - .withLaaTransactionId(MEANS_ASSESSMENT_TRANSACTION_ID) .withMagCourtOutcome(Constants.SENT_FOR_TRIAL) .withEvidenceFee(getApiEvidenceFee()) .withCapitalEvidence(getApiCapitalEvidenceList()) @@ -71,7 +67,6 @@ public static ApiCalculateEvidenceFeeRequest getApiCalculateEvidenceFeeInvalidRe public static CrimeEvidenceDTO getCrimeEvidenceDTO() { return CrimeEvidenceDTO.builder() .repId(TEST_REP_ID) - .laaTransactionId(MEANS_ASSESSMENT_TRANSACTION_ID) .magCourtOutcome(Constants.SENT_FOR_TRIAL) .evidenceFee(EvidenceFeeDTO.builder().build()) .capitalEvidence(List.of(CapitalEvidenceDTO.builder() @@ -89,7 +84,6 @@ public static CrimeEvidenceDTO getCrimeEvidenceDTO() { public static ApiCalculateEvidenceFeeRequest getApiCalculateEvidenceFeeRequest() { return new ApiCalculateEvidenceFeeRequest() .withRepId(TEST_REP_ID) - .withLaaTransactionId(MEANS_ASSESSMENT_TRANSACTION_ID) .withMagCourtOutcome(MSG_COURT_OUTCOME) .withEvidenceFee(new ApiEvidenceFee()) .withCapitalEvidence(getApiCapitalEvidenceList()) 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 bf16422..31ed836 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 @@ -16,7 +16,6 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) @@ -35,7 +34,7 @@ class EvidenceServiceTest { @Test void givenValidCrimeEvidence_whenCalculateEvidenceFeeIsInvoked_validResponseIsReturned() { CrimeEvidenceDTO requestDTO = TestModelDataBuilder.getCrimeEvidenceDTO(); - when(maatCourtDataService.getRepOrderCapitalByRepId(anyInt(), anyString())) + when(maatCourtDataService.getRepOrderCapitalByRepId(anyInt())) .thenReturn(2L); ApiCalculateEvidenceFeeResponse response = evidenceService.calculateEvidenceFee(requestDTO); diff --git a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/MaatCourtDataServiceTest.java b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/MaatCourtDataServiceTest.java index 51dbed1..cd34d5b 100644 --- a/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/MaatCourtDataServiceTest.java +++ b/crime-evidence/src/test/java/uk/gov/justice/laa/crime/evidence/service/MaatCourtDataServiceTest.java @@ -20,8 +20,6 @@ @ExtendWith(MockitoExtension.class) class MaatCourtDataServiceTest { - private static final String LAA_TRANSACTION_ID = "laaTransactionId"; - @Mock private RestAPIClient maatCourtDataClient; @@ -36,7 +34,7 @@ void givenAValidRepId_whenGetRepOrderCapitalByRepIdIsInvoked_thenResponseIsRetur ResponseEntity expected = new ResponseEntity<>(HttpStatus.OK); when(maatCourtDataClient.head(any(), anyMap(), any())) .thenReturn(expected); - maatCourtDataService.getRepOrderCapitalByRepId(TestModelDataBuilder.TEST_REP_ID, LAA_TRANSACTION_ID); + maatCourtDataService.getRepOrderCapitalByRepId(TestModelDataBuilder.TEST_REP_ID); verify(maatCourtDataClient, atLeastOnce()).head(any(), anyMap(), any()); } } \ No newline at end of file