Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LCAM-1006|Remove laa transaction id #66

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
@Data
@Builder
public class CrimeEvidenceDTO {
private String laaTransactionId;
private Integer repId;
private String magCourtOutcome;
private EvidenceFeeDTO evidenceFee;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Void> response = maatAPIClient.head(
configuration.getMaatApi().getRepOrderEndpoints().getRepOrderCapitalUrl(),
Map.of(Constants.LAA_TRANSACTION_ID, laaTransactionId),
Map.of(),
repId
);
log.info(String.format(RESPONSE_STRING, response));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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())
Expand All @@ -59,7 +56,6 @@ public static List<ApiCapitalEvidence> getApiCapitalEvidenceList() {

public static ApiCalculateEvidenceFeeRequest getApiCalculateEvidenceFeeInvalidRequest() {
return new ApiCalculateEvidenceFeeRequest()
.withLaaTransactionId(MEANS_ASSESSMENT_TRANSACTION_ID)
.withMagCourtOutcome(Constants.SENT_FOR_TRIAL)
.withEvidenceFee(getApiEvidenceFee())
.withCapitalEvidence(getApiCapitalEvidenceList())
Expand All @@ -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()
Expand All @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
@ExtendWith(MockitoExtension.class)
class MaatCourtDataServiceTest {

private static final String LAA_TRANSACTION_ID = "laaTransactionId";

@Mock
private RestAPIClient maatCourtDataClient;

Expand All @@ -36,7 +34,7 @@ void givenAValidRepId_whenGetRepOrderCapitalByRepIdIsInvoked_thenResponseIsRetur
ResponseEntity<Void> 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());
}
}