diff --git a/src/main/java/uk/gov/hmcts/opal/controllers/DefendantAccountController.java b/src/main/java/uk/gov/hmcts/opal/controllers/DefendantAccountController.java index 768bcac8d..f19cd62ab 100644 --- a/src/main/java/uk/gov/hmcts/opal/controllers/DefendantAccountController.java +++ b/src/main/java/uk/gov/hmcts/opal/controllers/DefendantAccountController.java @@ -18,7 +18,6 @@ import uk.gov.hmcts.opal.dto.AccountEnquiryDto; import uk.gov.hmcts.opal.dto.AccountSearchDto; import uk.gov.hmcts.opal.dto.AccountSearchResultsDto; -import uk.gov.hmcts.opal.dto.AccountSummaryDto; import uk.gov.hmcts.opal.entity.DefendantAccountEntity; import uk.gov.hmcts.opal.service.DefendantAccountService; @@ -79,12 +78,12 @@ public ResponseEntity> getDefendantAccountsByBusine return ResponseEntity.ok(response); } - @GetMapping(value = "/details", consumes = MediaType.APPLICATION_JSON_VALUE) + @GetMapping(value = "/details") @Operation(summary = "Get defendant account details by providing the defendant account summary") public ResponseEntity getAccountDetailsByAccountSummary( - @RequestBody AccountSummaryDto accountSummary) { + @RequestParam(name = "defendantAccountId") Long defendantAccountId) { - AccountDetailsDto response = defendantAccountService.getAccountDetailsByAccountSummary(accountSummary); + AccountDetailsDto response = defendantAccountService.getAccountDetailsByDefendantAccountId(defendantAccountId); if (response == null) { return ResponseEntity.noContent().build(); diff --git a/src/main/java/uk/gov/hmcts/opal/dto/AccountDetailsDto.java b/src/main/java/uk/gov/hmcts/opal/dto/AccountDetailsDto.java index f4fc971c8..89d5431e7 100644 --- a/src/main/java/uk/gov/hmcts/opal/dto/AccountDetailsDto.java +++ b/src/main/java/uk/gov/hmcts/opal/dto/AccountDetailsDto.java @@ -51,12 +51,6 @@ public class AccountDetailsDto implements ToJsonString { //defendant_accounts.prosecutor_case_reference private String pcr; - //debtor_detail.document_language - private String documentLanguage; - - //debtor_detail.hearing_language - private String hearingLanguage; - //payment_terms.installment_amount / payment_terms.installment_period private String paymentDetails; @@ -69,9 +63,6 @@ public class AccountDetailsDto implements ToJsonString { //payment_terms.jail_days private int daysInDefault; - //defendant_accounts.suspended_committal_date - private LocalDate sentencedDate; - //defendant_accounts.last_enforcement private String lastEnforcement; diff --git a/src/main/java/uk/gov/hmcts/opal/repository/DefendantAccountPartiesRepository.java b/src/main/java/uk/gov/hmcts/opal/repository/DefendantAccountPartiesRepository.java index 5d64b5883..32fc3084b 100644 --- a/src/main/java/uk/gov/hmcts/opal/repository/DefendantAccountPartiesRepository.java +++ b/src/main/java/uk/gov/hmcts/opal/repository/DefendantAccountPartiesRepository.java @@ -6,9 +6,6 @@ import org.springframework.stereotype.Repository; import uk.gov.hmcts.opal.entity.DefendantAccountPartiesEntity; -import java.math.BigDecimal; -import java.time.LocalDate; - @Repository public interface DefendantAccountPartiesRepository extends JpaRepository { @@ -17,20 +14,6 @@ public interface DefendantAccountPartiesRepository extends JpaRepository responseEntity = defendantAccountController - .getAccountDetailsByAccountSummary(AccountSummaryDto.builder().build()); + .getAccountDetailsByAccountSummary(1L); // Assert assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); assertEquals(mockResponse, responseEntity.getBody()); - verify(defendantAccountService, times(1)).getAccountDetailsByAccountSummary(any( - AccountSummaryDto.class)); + verify(defendantAccountService, times(1)).getAccountDetailsByDefendantAccountId(any( + Long.class)); } @Test diff --git a/src/test/java/uk/gov/hmcts/opal/service/DefendantAccountServiceTest.java b/src/test/java/uk/gov/hmcts/opal/service/DefendantAccountServiceTest.java index b99890b61..03da6b560 100644 --- a/src/test/java/uk/gov/hmcts/opal/service/DefendantAccountServiceTest.java +++ b/src/test/java/uk/gov/hmcts/opal/service/DefendantAccountServiceTest.java @@ -32,7 +32,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.math.BigDecimal; import java.time.LocalDate; import java.util.List; @@ -166,8 +165,8 @@ void testGetAccountDetailsByAccountSummaryTemporary() { PartyEntity mockPartyEntity = PartyEntity.builder().build(); mockAccountPartyEntity.setParty(mockPartyEntity); - when(defendantAccountPartiesRepository.findByDefendantAccountDetailsCustomQuery( - any(), any(), any(), any(), any(), any(), any(), any())) + when(defendantAccountPartiesRepository.findByDefendantAccountId( + any())) .thenReturn(mockAccountPartyEntity); DebtorDetailEntity mockDebtorDetail = new DebtorDetailEntity(); @@ -186,23 +185,12 @@ void testGetAccountDetailsByAccountSummaryTemporary() { List mockNotes = List.of(NoteEntity.builder().build()); when(noteRepository.findByAssociatedRecordIdAndNoteType(any(), any())).thenReturn(mockNotes); - defendantAccountService.getAccountDetailsByAccountSummary(constructTestAccountSummaryDto(LocalDate.now())); + defendantAccountService.getAccountDetailsByDefendantAccountId(1L); } @Test void testGetAccountDetailsByAccountSummaryTemporary2() { - var testAccountSummary = AccountSummaryDto.builder().court("test").build(); - defendantAccountService.getAccountDetailsByAccountSummary(testAccountSummary); + defendantAccountService.getAccountDetailsByDefendantAccountId(0L); } - private AccountSummaryDto constructTestAccountSummaryDto(final LocalDate today) { - return AccountSummaryDto.builder() - .accountNo("accountNameNo") - .name("Smith, Mr JJ") - .dateOfBirth(today) - .addressLine1("Scotland") - .balance(BigDecimal.valueOf(1000)) - .court("London") - .build(); - } }