From a50499f2d976447251b1cd0650a6e566784a0f07 Mon Sep 17 00:00:00 2001 From: Russell Dodd Date: Wed, 11 Sep 2024 14:33:19 +0100 Subject: [PATCH] PO-770: convert JSON names to snake case --- .../uk/gov/hmcts/opal/config/Constants.java | 12 +- .../hmcts/opal/steps/BearerTokenStepDef.java | 2 +- .../opal/steps/DefendantSearchApiStepDef.java | 36 +- .../gov/hmcts/opal/steps/RefDataStepDef.java | 70 +- .../draftaccount/DraftAccountDeleteSteps.java | 2 +- .../defendantAccountAddNoteLegacy.feature | 12 +- ...8-192_addNote_postedBy_postedByAAD.feature | 48 +- ...PO-235-Notes_RolesAndBusinessUnits.feature | 42 +- .../opalMode/PO-250_authorisation.feature | 38 +- .../defendantAccountAddNoteOpal.feature | 22 +- .../defendantAccountDetailsOpal.feature | 10 +- .../defendantAccountSearchOpal.feature | 74 +- .../PO-420_globalAndLocalOffences.feature | 12 +- .../PO-421_majorCreditorsReturnBUData.feature | 16 +- .../PO-424_filterCourtsOnBU.feature | 12 +- .../PO-614_newFieldsInOffenceAPI.feature | 18 +- ...henticationInternalUserControllerTest.java | 14 +- ...BusinessUnitControllerIntegrationTest.java | 40 +- .../CourtControllerIntegrationTest.java | 18 +- ...ndantAccountControllerIntegrationTest.java | 34 +- .../EnforcerControllerIntegrationTest.java | 18 +- ...ajorCreditorControllerIntegrationTest.java | 16 +- .../OffenceControllerIntegrationTest.java | 10 +- .../TestingSupportControllerTest.java | 42 +- .../client/AzureTokenClient.java | 2 +- .../authentication/model/SecurityToken.java | 3 + .../opal/authorisation/model/Permission.java | 4 +- .../hmcts/opal/authorisation/model/Role.java | 4 +- .../opal/authorisation/model/UserState.java | 4 +- .../controllers/BusinessUnitController.java | 4 +- .../opal/controllers/CourtController.java | 4 +- .../controllers/DraftAccountController.java | 2 +- .../opal/controllers/EnforcerController.java | 5 +- .../LocalJusticeAreaController.java | 5 +- .../controllers/MajorCreditorController.java | 16 +- .../opal/controllers/OffenceController.java | 4 +- .../advice/GlobalExceptionHandler.java | 2 +- .../gov/hmcts/opal/dto/AccountDetailsDto.java | 19 + .../gov/hmcts/opal/dto/AccountSummaryDto.java | 5 + .../uk/gov/hmcts/opal/dto/AddNoteDto.java | 4 + .../java/uk/gov/hmcts/opal/dto/DateDto.java | 3 + .../java/uk/gov/hmcts/opal/dto/NoteDto.java | 10 + .../hmcts/opal/dto/OpalS2SRequestWrapper.java | 3 +- .../opal/dto/OpalS2SResponseWrapper.java | 3 + .../opal/dto/search/AccountSearchDto.java | 7 + .../dto/search/AccountSearchResultsDto.java | 4 + .../hmcts/opal/entity/AddressCyEntity.java | 2 + .../uk/gov/hmcts/opal/entity/CourtEntity.java | 2 + .../gov/hmcts/opal/entity/EnforcerEntity.java | 2 + .../opal/entity/LocalJusticeAreaEntity.java | 2 + .../opal/entity/MajorCreditorEntity.java | 2 + .../gov/hmcts/opal/entity/PrisonEntity.java | 2 + .../projection/BusinessUnitReferenceData.java | 17 +- .../entity/projection/CourtReferenceData.java | 10 +- .../projection/DefendantAccountSummary.java | 9 + .../projection/EnforcerReferenceData.java | 8 +- .../entity/projection/LjaReferenceData.java | 7 + .../MajorCreditorReferenceData.java | 11 +- .../projection/OffenceReferenceData.java | 15 +- .../service/opal/DraftAccountService.java | 2 +- .../service/opal/MajorCreditorService.java | 8 +- src/main/resources/tempDetailsData.json | 28 +- src/main/resources/tempSearchData.json | 806 +++++++++--------- .../service/opal/DraftAccountServiceTest.java | 5 +- 64 files changed, 904 insertions(+), 769 deletions(-) diff --git a/src/functionalTest/java/uk/gov/hmcts/opal/config/Constants.java b/src/functionalTest/java/uk/gov/hmcts/opal/config/Constants.java index 96fb232a..32109d31 100644 --- a/src/functionalTest/java/uk/gov/hmcts/opal/config/Constants.java +++ b/src/functionalTest/java/uk/gov/hmcts/opal/config/Constants.java @@ -2,13 +2,13 @@ public class Constants { - public static final String BUSINESS_UNIT_REF_DATA_URI = "/business-units/ref-data/"; - public static final String COURTS_REF_DATA_URI = "/courts/ref-data/"; - public static final String LJA_REF_DATA_URI = "/local-justice-areas/ref-data/"; - public static final String OFFENCES_REF_DATA_URI = "/offences/ref-data/"; + public static final String BUSINESS_UNIT_REF_DATA_URI = "/business-units"; + public static final String COURTS_REF_DATA_URI = "/courts"; + public static final String LJA_REF_DATA_URI = "/local-justice-areas"; + public static final String OFFENCES_REF_DATA_URI = "/offences"; - public static final String ENFORCERS_REF_DATA_URI = "/enforcers/ref-data/Aldridge"; - public static final String MAJOR_CREDITORS_URI = "/major-creditors/"; + public static final String ENFORCERS_REF_DATA_URI = "/enforcers?q=Aldridge"; + public static final String MAJOR_CREDITORS_URI = "/major-creditors"; public static final String DRAFT_ACCOUNT_URI = "/draft-accounts"; public static final String RESULTS_URI = "/results"; } diff --git a/src/functionalTest/java/uk/gov/hmcts/opal/steps/BearerTokenStepDef.java b/src/functionalTest/java/uk/gov/hmcts/opal/steps/BearerTokenStepDef.java index ce322b88..357d7ad6 100644 --- a/src/functionalTest/java/uk/gov/hmcts/opal/steps/BearerTokenStepDef.java +++ b/src/functionalTest/java/uk/gov/hmcts/opal/steps/BearerTokenStepDef.java @@ -38,7 +38,7 @@ private static String fetchToken(String user) { .get(getTestUrl() + "/testing-support/token/user"); then().assertThat().statusCode(200); - return then().extract().body().jsonPath().getString("accessToken"); + return then().extract().body().jsonPath().getString("access_token"); } public static String getToken() { diff --git a/src/functionalTest/java/uk/gov/hmcts/opal/steps/DefendantSearchApiStepDef.java b/src/functionalTest/java/uk/gov/hmcts/opal/steps/DefendantSearchApiStepDef.java index 0aaae2f6..d4c79d26 100644 --- a/src/functionalTest/java/uk/gov/hmcts/opal/steps/DefendantSearchApiStepDef.java +++ b/src/functionalTest/java/uk/gov/hmcts/opal/steps/DefendantSearchApiStepDef.java @@ -26,14 +26,16 @@ public void postToDefendantSearchAPI(DataTable searchCriteria) throws JSONExcept requestBody.put("initials", dataToPost.get("initials") != null ? dataToPost.get("initials") : ""); JSONObject dateOfBirth = new JSONObject(); - dateOfBirth.put("dayOfMonth", dataToPost.get("dayOfMonth") != null ? dataToPost.get("dayOfMonth") : ""); - dateOfBirth.put("monthOfYear", dataToPost.get("monthOfYear") != null ? dataToPost.get("monthOfYear") : ""); + dateOfBirth.put("day_of_month", + dataToPost.get("day_of_month") != null ? dataToPost.get("day_of_month") : ""); + dateOfBirth.put("month_of_year", + dataToPost.get("month_of_year") != null ? dataToPost.get("month_of_year") : ""); dateOfBirth.put("year", dataToPost.get("year") != null ? dataToPost.get("year") : ""); - requestBody.put("dateOfBirth", dateOfBirth); + requestBody.put("date_of_birth", dateOfBirth); requestBody.put( - "addressLine", - dataToPost.get("addressLine") != null ? dataToPost.get("addressLine") : "" + "address_line", + dataToPost.get("address_line") != null ? dataToPost.get("address_line") : "" ); SerenityRest @@ -53,17 +55,17 @@ public void thereIsOneResultReturnedMatching(DataTable expectedData) { then().assertThat() .statusCode(200) - .body("totalCount", Matchers.equalTo(1)) - .body("searchResults.name[0]", Matchers.equalTo(expectedResult.get("name"))) - .body("searchResults.dateOfBirth[0]", Matchers.equalTo(expectedResult.get("dateOfBirth"))) - .body("searchResults.addressLine1[0]", Matchers.equalTo(expectedResult.get("addressLine1"))); + .body("total_count", Matchers.equalTo(1)) + .body("search_results.name[0]", Matchers.equalTo(expectedResult.get("name"))) + .body("search_results.date_of_birth[0]", Matchers.equalTo(expectedResult.get("dateOfBirth"))) + .body("search_results.address_line_1[0]", Matchers.equalTo(expectedResult.get("addressLine1"))); } @Then("there are no results returned") public void thereAreNoResultsReturned() { then().assertThat() .statusCode(200) - .body("totalCount", Matchers.equalTo(0)); + .body("total_count", Matchers.equalTo(0)); } @Then("the returned results match") @@ -72,7 +74,7 @@ public void theReturnedResultsMatch(DataTable expectedData) { then().assertThat() .statusCode(200); - int totalCount = then().extract().jsonPath().getInt("totalCount"); + int totalCount = then().extract().jsonPath().getInt("total_count"); System.out.println("total count is : " + totalCount); int index = 0; @@ -80,19 +82,19 @@ public void theReturnedResultsMatch(DataTable expectedData) { while (index < totalCount) { if (expectedResult.get("name") != null) { then().assertThat() - .body("searchResults.name[" + index + "]", Matchers.containsString(expectedResult.get("name"))); + .body("search_results.name[" + index + "]", Matchers.containsString(expectedResult.get("name"))); } - if (expectedResult.get("dateOfBirth") != null) { + if (expectedResult.get("date_of_birth") != null) { then().assertThat() .body( - "searchResults.dateOfBirth[" + index + "]", - Matchers.containsString(expectedResult.get("dateOfBirth")) + "search_results.date_of_birth[" + index + "]", + Matchers.containsString(expectedResult.get("date_of_birth")) ); } - if (expectedResult.get("addressLine1") != null) { + if (expectedResult.get("address_line_1") != null) { then().assertThat() .body( - "searchResults.addressLine1[" + index + "]", + "search_results.address_line_1[" + index + "]", Matchers.containsString(expectedResult.get("addressLine1")) ); } diff --git a/src/functionalTest/java/uk/gov/hmcts/opal/steps/RefDataStepDef.java b/src/functionalTest/java/uk/gov/hmcts/opal/steps/RefDataStepDef.java index b031c2b9..0d13f5a6 100644 --- a/src/functionalTest/java/uk/gov/hmcts/opal/steps/RefDataStepDef.java +++ b/src/functionalTest/java/uk/gov/hmcts/opal/steps/RefDataStepDef.java @@ -41,7 +41,7 @@ public class RefDataStepDef extends BaseStepDef { @When("I make a request to the business unit ref data api filtering by business unit type {string}") public void getRequestToBusinessUnitRefData(String filter) { - methods.getRequest(BUSINESS_UNIT_REF_DATA_URI + filter); + methods.getRequest(BUSINESS_UNIT_REF_DATA_URI + "?q=" + filter); } @@ -52,17 +52,17 @@ public void getRequestToOffencesRefDataBusinessUnit(int businessUnitId) { @When("I make a request to the offence ref data api filtering by cjs code {string}") public void getRequestToOffencesRefDataCjsCode(String cjsCode) { - methods.getRequest(OFFENCES_REF_DATA_URI + cjsCode); + methods.getRequest(OFFENCES_REF_DATA_URI + "?q=" + cjsCode); } @When("I make a request to the offence ref data api filtering with the offence title {string}") public void getRequestToOffencesRefDataWording(String filter) { - methods.getRequest(OFFENCES_REF_DATA_URI + filter); + methods.getRequest(OFFENCES_REF_DATA_URI + "?q=" + filter); } @When("I make a request to the major creditors ref data api filter by major creditor id {int}") public void getRequestToMajorCreditorsBy(int majorCreditorId) { - methods.getRequest(MAJOR_CREDITORS_URI + majorCreditorId); + methods.getRequest(MAJOR_CREDITORS_URI + "/" + majorCreditorId); } @When("I make a request to the LJA ref data api with") @@ -77,17 +77,17 @@ public void getRequestToCourtsRefData() { @When("I make a request to the court ref data api with a filter of {string}") public void getRequestToCourtsRefDataWithFilter(String filter) { - methods.getRequest(COURTS_REF_DATA_URI + filter); + methods.getRequest(COURTS_REF_DATA_URI + "?q=" + filter); } @When("I make a request to the court ref data api with a filter of {string} and a business unit of {int}") public void getRequestToCourtsRefDataWithFilterAndBU(String filter, int businessUnitId) { - methods.getRequest(COURTS_REF_DATA_URI + filter + "?businessUnit=" + businessUnitId); + methods.getRequest(COURTS_REF_DATA_URI + "?q=" + filter + "?business_unit=" + businessUnitId); } @When("I make a request to the court ref data api with a business unit of {int}") public void getRequestToCourtsRefDataWithBU(int businessUnitId) { - methods.getRequest(COURTS_REF_DATA_URI + "?businessUnit=" + businessUnitId); + methods.getRequest(COURTS_REF_DATA_URI + "?business_unit=" + businessUnitId); } @Then("the LJA ref data matching to result") @@ -110,13 +110,13 @@ public void theResponseContainsTheCorrectCourt(String courtName) throws SQLExcep court = db.getCourtsByCourtName(courtName); then().assertThat().statusCode(200); for (int i = 0; i < totalCount; i++) { - String courtId = then().extract().jsonPath().getString("refData.courtId[" + i + "]"); + String courtId = then().extract().jsonPath().getString("refData.court_id[" + i + "]"); assertEquals(courtId, court.getJSONObject(i).getString("court_id")); - String businessUnitId = then().extract().jsonPath().getString("refData.businessUnitId[" + i + "]"); + String businessUnitId = then().extract().jsonPath().getString("refData.business_unit_id[" + i + "]"); assertEquals(businessUnitId, court.getJSONObject(i).getString("business_unit_id")); - String courtCode = then().extract().jsonPath().getString("refData.courtCode[" + i + "]"); + String courtCode = then().extract().jsonPath().getString("refData.court_code[" + i + "]"); assertEquals(courtCode, court.getJSONObject(i).getString("court_code")); String name = then().extract().jsonPath().getString("refData.name[" + i + "]"); @@ -139,12 +139,14 @@ public void responseContainsMajorCreditorData(DataTable data) { Map expected = data.asMap(String.class, String.class); then().assertThat().statusCode(200); - assertEquals(expected.get("majorCreditorId"), then().extract().jsonPath().getString("majorCreditorId")); - assertEquals(expected.get("majorCreditorCode"), then().extract().jsonPath().getString("majorCreditorCode")); + assertEquals(expected.get("majorCreditorId"), + then().extract().jsonPath().getString("major_creditor_id")); + assertEquals(expected.get("majorCreditorCode"), + then().extract().jsonPath().getString("major_creditor_code")); assertEquals(expected.get("name"), then().extract().jsonPath().getString("name")); assertEquals( - expected.get("businessUnitId"), - then().extract().jsonPath().getString("businessUnit.businessUnitId") + expected.get("business_unit_d"), + then().extract().jsonPath().getString("business_unit.business_unit_id") ); } @@ -153,12 +155,14 @@ public void responseDoesNotContainMajorCreditorData(DataTable data) { Map expected = data.asMap(String.class, String.class); then().assertThat().statusCode(200); - assertNotEquals(expected.get("majorCreditorId"), then().extract().jsonPath().getString("majorCreditorId")); - assertNotEquals(expected.get("majorCreditorCode"), then().extract().jsonPath().getString("majorCreditorCode")); + assertNotEquals(expected.get("major_creditor_id"), + then().extract().jsonPath().getString("major_creditor_id")); + assertNotEquals(expected.get("major_creditor_code"), + then().extract().jsonPath().getString("major_creditor_code")); assertNotEquals(expected.get("name"), then().extract().jsonPath().getString("name")); assertNotEquals( - expected.get("businessUnitId"), - then().extract().jsonPath().getString("businessUnit.businessUnitId") + expected.get("business_unit_id"), + then().extract().jsonPath().getString("businessUnit.business_unit_id") ); } @@ -169,9 +173,9 @@ public void responseContainsCourtData(DataTable data) { then().assertThat().statusCode(200); for (int i = 0; i < totalCount; i++) { String actualName = then().extract().jsonPath().getString("refData.name[" + i + "]"); - String actualBuId = then().extract().jsonPath().getString("refData.businessUnitId[" + i + "]"); + String actualBuId = then().extract().jsonPath().getString("refData.business_unit_id[" + i + "]"); String expectedName = expectedData.get("name"); - String expectedBuId = expectedData.get("businessUnitId"); + String expectedBuId = expectedData.get("business_unit_id"); log.info("\nApi response: \n" + " Count: " + (i + 1) + "/" + totalCount + "\n " + actualName + "\n " + actualBuId); if (expectedName == null) { @@ -194,9 +198,9 @@ public void responseDoesNotContainCourtData(DataTable data) { then().assertThat().statusCode(200); for (int i = 0; i < totalCount; i++) { String actualName = then().extract().jsonPath().getString("refData.name[" + i + "]"); - String actualBuId = then().extract().jsonPath().getString("refData.businessUnitId[" + i + "]"); + String actualBuId = then().extract().jsonPath().getString("refData.business_unit_id[" + i + "]"); String expectedName = expectedData.get("name"); - String expectedBuId = expectedData.get("businessUnitId"); + String expectedBuId = expectedData.get("business_unit_id"); log.info("\nApi response: \n" + " Count: " + (i + 1) + "/" + totalCount + "\n " + actualName + "\n " + actualBuId); if (expectedName == null) { @@ -218,10 +222,10 @@ public void responseContainsOffenceData(DataTable data) { int totalCount = then().extract().jsonPath().getInt("count"); then().assertThat().statusCode(200); for (int i = 0; i < totalCount; i++) { - String actualOffenceTitle = then().extract().jsonPath().getString("refData.getOffenceTitle[" + i + "]"); - String actualBuId = then().extract().jsonPath().getString("refData.businessUnitId[" + i + "]"); + String actualOffenceTitle = then().extract().jsonPath().getString("refData._offence_title[" + i + "]"); + String actualBuId = then().extract().jsonPath().getString("refData.business_unit_id[" + i + "]"); String expectedOffenceTitle = expectedData.get("offenceTitle"); - String expectedBuId = expectedData.get("businessUnitId"); + String expectedBuId = expectedData.get("business_unit_id"); log.info("Expected name: " + expectedOffenceTitle + " Expected buId: " + expectedBuId); log.info("\nApi response: \n" + " Count: " + (i + 1) + "/" + totalCount + "\n " + actualOffenceTitle + "\n " + actualBuId); @@ -252,9 +256,9 @@ public void responseDoesNotContainOffenceData(DataTable data) { int totalCount = then().extract().jsonPath().getInt("count"); then().assertThat().statusCode(200); for (int i = 0; i < totalCount; i++) { - String actualOffenceTitle = then().extract().jsonPath().getString("refData.getOffenceTitle[" + i + "]"); - String actualBuId = then().extract().jsonPath().getString("refData.businessUnitId[" + i + "]"); - String expectedBuId = expectedData.get("businessUnitId"); + String actualOffenceTitle = then().extract().jsonPath().getString("refData.offence_title[" + i + "]"); + String actualBuId = then().extract().jsonPath().getString("refData.business_unit_id[" + i + "]"); + String expectedBuId = expectedData.get("business_unit_id"); log.info("\nApi response: \n" + " Count: " + (i + 1) + "/" + totalCount + "\n " + actualOffenceTitle + "\n " + actualBuId); assertNotEquals(expectedBuId, actualBuId); @@ -267,13 +271,13 @@ public void theResponseContainsTheCorrectMajorCreditor(int majorCreditorId) thro JSONArray majorCreditor; majorCreditor = db.getMajorCredByID(String.valueOf(majorCreditorId)); then().assertThat().statusCode(200); - String majorCreditorFromAPI = then().extract().jsonPath().getString("majorCreditorId"); + String majorCreditorFromAPI = then().extract().jsonPath().getString("major_creditor_id"); assertEquals(majorCreditorFromAPI, majorCreditor.getJSONObject(0).getString("major_creditor_id")); - String businessUnitId = then().extract().jsonPath().getString("businessUnit.businessUnitId"); + String businessUnitId = then().extract().jsonPath().getString("businessUnit.business_unit_id"); assertEquals(businessUnitId, majorCreditor.getJSONObject(0).getString("business_unit_id")); - String majorCreditorCode = then().extract().jsonPath().getString("majorCreditorCode"); + String majorCreditorCode = then().extract().jsonPath().getString("major_creditor_code"); assertEquals(majorCreditorCode, majorCreditor.getJSONObject(0).getString("major_creditor_code")); String name = then().extract().jsonPath().getString("name"); @@ -288,10 +292,10 @@ public void theResponseDoesNotContainTheCorrectMajorCreditor(int majorCreditorId JSONArray majorCreditor; majorCreditor = db.getMajorCredByID(String.valueOf(majorCreditorId)); then().assertThat().statusCode(200); - String majorCreditorFromAPI = then().extract().jsonPath().getString("majorCreditorId"); + String majorCreditorFromAPI = then().extract().jsonPath().getString("major_creditor_id"); assertNotEquals(majorCreditorFromAPI, majorCreditor.getJSONObject(0).getString("major_creditor_id")); - String majorCreditorCode = then().extract().jsonPath().getString("majorCreditorCode"); + String majorCreditorCode = then().extract().jsonPath().getString("major_creditor_code"); assertNotEquals(majorCreditorCode, majorCreditor.getJSONObject(0).getString("major_creditor_code")); String name = then().extract().jsonPath().getString("name"); diff --git a/src/functionalTest/java/uk/gov/hmcts/opal/steps/draftaccount/DraftAccountDeleteSteps.java b/src/functionalTest/java/uk/gov/hmcts/opal/steps/draftaccount/DraftAccountDeleteSteps.java index ff5e7127..04ec1012 100644 --- a/src/functionalTest/java/uk/gov/hmcts/opal/steps/draftaccount/DraftAccountDeleteSteps.java +++ b/src/functionalTest/java/uk/gov/hmcts/opal/steps/draftaccount/DraftAccountDeleteSteps.java @@ -24,7 +24,7 @@ public static void deleteDraftAccount(String draftAccountId) { .accept("*/*") .contentType("application/json") .when() - .delete(getTestUrl() + DRAFT_ACCOUNT_URI + "/" + draftAccountId + "?ignoreMissing=true"); + .delete(getTestUrl() + DRAFT_ACCOUNT_URI + "/" + draftAccountId + "?ignore_missing=true"); } @Then("I delete the created draft accounts") diff --git a/src/functionalTest/resources/features/legacyMode/defendantAccountAddNoteLegacy.feature b/src/functionalTest/resources/features/legacyMode/defendantAccountAddNoteLegacy.feature index c255adc5..2ec66adb 100644 --- a/src/functionalTest/resources/features/legacyMode/defendantAccountAddNoteLegacy.feature +++ b/src/functionalTest/resources/features/legacyMode/defendantAccountAddNoteLegacy.feature @@ -3,10 +3,10 @@ Feature: Test the add note endpoint for Legacy Scenario: assert add note canned response is valid for Legacy route When I make a request to the defendant account add notes api with - | associatedRecordId | 500000000 | - | businessUnitId | 17 | - | noteText | test account note1 | + | associated_record_id | 500000000 | + | business_unit_id | 17 | + | note_text | test account note1 | Then the add notes response contains - | noteId | 12345678 | - | associatedRecordId | 500000000 | - | noteText | test account note1 | + | note_id | 12345678 | + | associated_record_id | 500000000 | + | note_text | test account note1 | diff --git a/src/functionalTest/resources/features/opalMode/PO-184-187-188-192_addNote_postedBy_postedByAAD.feature b/src/functionalTest/resources/features/opalMode/PO-184-187-188-192_addNote_postedBy_postedByAAD.feature index 2b7a2b64..2bcad3c4 100644 --- a/src/functionalTest/resources/features/opalMode/PO-184-187-188-192_addNote_postedBy_postedByAAD.feature +++ b/src/functionalTest/resources/features/opalMode/PO-184-187-188-192_addNote_postedBy_postedByAAD.feature @@ -4,40 +4,40 @@ Feature: tests for changes to postedBy and postedByAAD Scenario: postedBy and postedByAAD are correct for the different users Given I am testing as the "opal-test@hmcts.net" user When I make a request to the defendant account add notes api with - | associatedRecordId | 500000010 | - | businessUnitId | 73 | - | noteText | test postedBy and PostedByAAD Opal user1 | + | associated_record_id | 500000010 | + | business_unit_id | 73 | + | note_text | test postedBy and PostedByAAD Opal user1 | And the add notes response contains - | associatedRecordId | 500000010 | - | noteText | test postedBy and PostedByAAD Opal user1 | - | postedBy | L073JG | - | postedByUserId | 500000000 | + | associated_record_id | 500000010 | + | note_text | test postedBy and PostedByAAD Opal user1 | + | posted_by | L073JG | + | posted_by_user_id | 500000000 | Given I am testing as the "opal-test-2@hmcts.net" user When I make a request to the defendant account add notes api with - | associatedRecordId | 500000010 | - | businessUnitId | 71 | - | noteText | test postedBy and PostedByAAD Opal user2 | + | associated_record_id | 500000010 | + | business_unit_id | 71 | + | note_text | test postedBy and PostedByAAD Opal user2 | Then the add notes request is forbidden Given I am testing as the "opal-test-3@hmcts.net" user When I make a request to the defendant account add notes api with - | associatedRecordId | 500000010 | - | businessUnitId | 26 | - | noteText | test postedBy and PostedByAAD Opal user3 | + | associated_record_id | 500000010 | + | business_unit_id | 26 | + | note_text | test postedBy and PostedByAAD Opal user3 | And the add notes response contains - | associatedRecordId | 500000010 | - | noteText | test postedBy and PostedByAAD Opal user3 | - | postedBy | L026SH | - | postedByUserId | 500000002 | + | associated_record_id | 500000010 | + | note_text | test postedBy and PostedByAAD Opal user3 | + | posted_by | L026SH | + | posted_by_user_id | 500000002 | Given I am testing as the "opal-test-4@hmcts.net" user When I make a request to the defendant account add notes api with - | associatedRecordId | 500000010 | - | businessUnitId | 47 | - | noteText | test postedBy and PostedByAAD Opal user4 | + | associated_record_id | 500000010 | + | business_unit_id | 47 | + | note_text | test postedBy and PostedByAAD Opal user4 | And the add notes response contains - | associatedRecordId | 500000010 | - | noteText | test postedBy and PostedByAAD Opal user4 | - | postedBy | L047SA | - | postedByUserId | 500000003 | + | associated_record_id | 500000010 | + | note_text | test postedBy and PostedByAAD Opal user4 | + | posted_by | L047SA | + | posted_by_user_id | 500000003 | diff --git a/src/functionalTest/resources/features/opalMode/PO-235-Notes_RolesAndBusinessUnits.feature b/src/functionalTest/resources/features/opalMode/PO-235-Notes_RolesAndBusinessUnits.feature index 1ad13520..71d7d625 100644 --- a/src/functionalTest/resources/features/opalMode/PO-235-Notes_RolesAndBusinessUnits.feature +++ b/src/functionalTest/resources/features/opalMode/PO-235-Notes_RolesAndBusinessUnits.feature @@ -4,40 +4,40 @@ Feature: tests for notes roles/permissions for accounts dependant on business un Scenario: A user can add a note to a business unit it is part of Given I am testing as the "opal-test@hmcts.net" user When I make a request to the defendant account add notes api with - | associatedRecordId | 500000010 | - | businessUnitId | 73 | - | noteText | test roles and perms Opal user1 | + | associated_record_id | 500000010 | + | business_unit_id | 73 | + | note_text | test roles and perms Opal user1 | And the add notes response contains - | associatedRecordId | 500000010 | - | noteText | test roles and perms Opal user1 | - | postedBy | L073JG | - | postedByUserId | 500000000 | - | businessUnitId | 73 | + | associated_record_id | 500000010 | + | note_text | test roles and perms Opal user1 | + | posted_by | L073JG | + | posted_by_user_id | 500000000 | + | business_unit_id | 73 | When I make a request to the defendant account add notes api with - | associatedRecordId | 500000010 | - | businessUnitId | 77 | - | noteText | test roles and perms Opal user1 | + | associated_record_id | 500000010 | + | business_unit_id | 77 | + | note_text | test roles and perms Opal user1 | And the add notes response contains - | associatedRecordId | 500000010 | - | noteText | test roles and perms Opal user1 | - | postedBy | L067JG | - | postedByUserId | 500000000 | - | businessUnitId | 77 | + | associated_record_id | 500000010 | + | note_text | test roles and perms Opal user1 | + | posted_by | L067JG | + | posted_by_user_id | 500000000 | + | business_unit_id | 77 | Scenario: A user cannot add a note to a business unit it is not part of Given I am testing as the "opal-test@hmcts.net" user When I make a request to the defendant account add notes api with - | associatedRecordId | 500000010 | - | businessUnitId | 24 | - | noteText | test roles and perms Opal user1 | + | associated_record_id | 500000010 | + | business_unit_id | 24 | + | note_text | test roles and perms Opal user1 | Then the add notes request is forbidden Scenario: The business unit must be defined in the request Given I am testing as the "opal-test@hmcts.net" user When I make a request to the defendant account add notes api with - | associatedRecordId | 500000010 | - | noteText | test roles and perms Opal user1 | + | associated_record_id | 500000010 | + | note_text | test roles and perms Opal user1 | #When error logging is looked at would be good to check the error message Then the add notes request is forbidden diff --git a/src/functionalTest/resources/features/opalMode/PO-250_authorisation.feature b/src/functionalTest/resources/features/opalMode/PO-250_authorisation.feature index 5543fc71..1aa66aa5 100644 --- a/src/functionalTest/resources/features/opalMode/PO-250_authorisation.feature +++ b/src/functionalTest/resources/features/opalMode/PO-250_authorisation.feature @@ -33,10 +33,10 @@ Feature: Authorisation on endpoints | defendantID | 500000009 | Then the response from the defendant account details api is - | defendantAccountId | 500000009 | - | accountNumber | 80000000000I | - | fullName | Mr Smart D John | - | address | 10 Brooks Lake, Cobham | + | defendant_account_id | 500000009 | + | account_number | 80000000000I | + | full_name | Mr Smart D John | + | address | 10 Brooks Lake, Cobham | Given I am testing as the "opal-test-2@hmcts.net" user When I make a request to the defendant account details api with @@ -49,11 +49,11 @@ Feature: Authorisation on endpoints When I make a request to get the defendant account notes for | defendantID | 500000009 | Then the response contains the following in position "0" - | associatedRecordId | 500000009 | - | noteText | Comment for Notes 500000009 | + | associated_record_id | 500000009 | + | note_text | Comment for Notes 500000009 | Then the response contains the following in position "1" - | associatedRecordId | 500000009 | - | noteText | Comment for Notes 500000010 | + | associated_record_id | 500000009 | + | note_text | Comment for Notes 500000010 | Given I am testing as the "opal-test-2@hmcts.net" user When I make a request to get the defendant account notes for @@ -63,19 +63,19 @@ Feature: Authorisation on endpoints Scenario: Add Notes endpoint Given I am testing as the "opal-test@hmcts.net" user When I make a request to the defendant account add notes api with - | associatedRecordId | 500000010 | - | businessUnitId | 73 | - | noteText | test roles and perms Opal user1 | + | associated_record_id | 500000010 | + | business_unit_id | 73 | + | note_text | test roles and perms Opal user1 | And the add notes response contains - | associatedRecordId | 500000010 | - | noteText | test roles and perms Opal user1 | - | postedBy | L073JG | - | postedByUserId | 500000000 | - | businessUnitId | 73 | + | associated_record_id | 500000010 | + | note_text | test roles and perms Opal user1 | + | posted_by | L073JG | + | posted_by_user_id | 500000000 | + | business_unit_id | 73 | Given I am testing as the "opal-test-2@hmcts.net" user When I make a request to the defendant account add notes api with - | associatedRecordId | 500000010 | - | businessUnitId | 71 | - | noteText | test roles and perms Opal user1 | + | associated_record_id | 500000010 | + | business_unit_id | 71 | + | note_text | test roles and perms Opal user1 | Then the add notes request is forbidden diff --git a/src/functionalTest/resources/features/opalMode/defendantAccountAddNoteOpal.feature b/src/functionalTest/resources/features/opalMode/defendantAccountAddNoteOpal.feature index 8e333f82..179b190a 100644 --- a/src/functionalTest/resources/features/opalMode/defendantAccountAddNoteOpal.feature +++ b/src/functionalTest/resources/features/opalMode/defendantAccountAddNoteOpal.feature @@ -3,23 +3,23 @@ Feature: Test the add note endpoint for Opal PO-139 Scenario: assert add note response is valid for opal route Given I am testing as the "opal-test@hmcts.net" user When I make a request to the defendant account add notes api with - | associatedRecordId | 500000000 | - | businessUnitId | 73 | - | noteText | test account note Opal | + | associated_record_id | 500000000 | + | business_unit_id | 73 | + | note_text | test account note Opal | Then the add notes response contains - | associatedRecordId | 500000000 | - | noteText | test account note Opal | + | associated_record_id | 500000000 | + | note_text | test account note Opal | Scenario: latest added note response is returned in ac details request Given I am testing as the "opal-test@hmcts.net" user When I make a request to the defendant account add notes api with - | associatedRecordId | 500000001 | - | businessUnitId | 73 | - | noteText | test account note2 Opal | + | associated_record_id | 500000001 | + | business_unit_id | 73 | + | note_text | test account note2 Opal | And the add notes response contains - | associatedRecordId | 500000001 | - | noteText | test account note2 Opal | + | associated_record_id | 500000001 | + | note_text | test account note2 Opal | When I make a request to the defendant account details api with | defendantID | 500000001 | Then the following account note is returned in the ac details request - | accountNotes | test account note2 Opal | + | account_notes | test account note2 Opal | diff --git a/src/functionalTest/resources/features/opalMode/defendantAccountDetailsOpal.feature b/src/functionalTest/resources/features/opalMode/defendantAccountDetailsOpal.feature index bc079afb..e370b072 100644 --- a/src/functionalTest/resources/features/opalMode/defendantAccountDetailsOpal.feature +++ b/src/functionalTest/resources/features/opalMode/defendantAccountDetailsOpal.feature @@ -7,10 +7,10 @@ Feature: Test the defendant account details API Opal | defendantID | 500000009 | Then the response from the defendant account details api is - | defendantAccountId | 500000009 | - | accountNumber | 80000000000I | - | fullName | Mr Smart D John | - | address | 10 Brooks Lake, Cobham | + | defendant_account_id | 500000009 | + | account_number | 80000000000I | + | full_name | Mr Smart D John | + | address | 10 Brooks Lake, Cobham | Scenario Outline: No data returned when a non-existent account ID is used @@ -25,5 +25,3 @@ Feature: Test the defendant account details API Opal | 999999999 | | 123 | | 50000000L | - - diff --git a/src/functionalTest/resources/features/opalMode/defendantAccountSearchOpal.feature b/src/functionalTest/resources/features/opalMode/defendantAccountSearchOpal.feature index c80347c4..3a66d1eb 100644 --- a/src/functionalTest/resources/features/opalMode/defendantAccountSearchOpal.feature +++ b/src/functionalTest/resources/features/opalMode/defendantAccountSearchOpal.feature @@ -4,58 +4,58 @@ Feature: Test the defendant account search API Opal Scenario: exact search with correct parameters - exact result match Given I am testing as the "opal-test@hmcts.net" user When I make a call to the defendant search API using the parameters - | forename | Smart | - | surname | John | - | initials | D | - | dayOfMonth | 23 | - | monthOfYear | 11 | - | year | 1999 | - | addressLine | 10 Brooks Lake | + | forename | Smart | + | surname | John | + | initials | D | + | day_of_month | 23 | + | month_of_year | 11 | + | year | 1999 | + | address_line | 10 Brooks Lake | Then there is one result returned matching - | name | Mr Smart D John | - | dateOfBirth | 1999-11-23 | - | addressLine1 | 10 Brooks Lake | + | name | Mr Smart D John | + | dateOfBirth | 1999-11-23 | + | addressLine1 | 10 Brooks Lake | Scenario: exact search with incorrect parameters - no result match Given I am testing as the "opal-test@hmcts.net" user When I make a call to the defendant search API using the parameters - | forename | Smart | - | surname | John | - | initials | D | - | dayOfMonth | 22 | - | monthOfYear | 11 | - | year | 1999 | - | addressLine | 10 Brooks Lake | + | forename | Smart | + | surname | John | + | initials | D | + | day_of_month | 22 | + | month_of_year | 11 | + | year | 1999 | + | address_line | 10 Brooks Lake | Then there are no results returned Scenario: partial search on surname - results contain partial surname Given I am testing as the "opal-test@hmcts.net" user When I make a call to the defendant search API using the parameters - | forename | Smart | - | surname | Joh | - | initials | D | - | dayOfMonth | 23 | - | monthOfYear | 11 | - | year | 1999 | - | addressLine | 10 Brooks Lake | + | forename | Smart | + | surname | Joh | + | initials | D | + | day_of_month | 23 | + | month_of_year | 11 | + | year | 1999 | + | address_line | 10 Brooks Lake | Then the returned results match - | name | Mr Smart D John | - | dateOfBirth | 1999-11-23 | - | addressLine1 | 10 Brooks Lake | + | name | Mr Smart D John | + | dateOfBirth | 1999-11-23 | + | addressLine1 | 10 Brooks Lake | Scenario: broad search - all relevant results returned Given I am testing as the "opal-test@hmcts.net" user When I make a call to the defendant search API using the parameters - | forename | il | - | surname | | - | initials | | - | dayOfMonth | | - | monthOfYear | | - | year | | - | addressLine | | + | forename | il | + | surname | | + | initials | | + | day_of_month | | + | month_of_year | | + | year | | + | address_line | | Then the returned results match - | name | il | - | dateOfBirth | | - | addressLine1 | | + | name | il | + | dateOfBirth | | + | addressLine1 | | diff --git a/src/functionalTest/resources/features/opalMode/manualAccountCreation/PO-420_globalAndLocalOffences.feature b/src/functionalTest/resources/features/opalMode/manualAccountCreation/PO-420_globalAndLocalOffences.feature index d9d5da8a..097a263e 100644 --- a/src/functionalTest/resources/features/opalMode/manualAccountCreation/PO-420_globalAndLocalOffences.feature +++ b/src/functionalTest/resources/features/opalMode/manualAccountCreation/PO-420_globalAndLocalOffences.feature @@ -5,29 +5,29 @@ Feature: PO-420 Global and Local Offences Given I am testing as the "opal-test@hmcts.net" user When I make a request to the offence ref data api filtering with the offence title "Attempt theft" Then the response contains the below offence data - | offenceTitle | Attempt theft | - | businessUnitId | null | + | offence_title | Attempt theft | + | business_unit_id | null | @Opal @PO-420 Scenario: The Offences API returns all the Local offences Given I am testing as the "opal-test@hmcts.net" user When I make a request to the offence ref data api filtering by business unit 0 Then the response contains the below offence data - | businessUnitId | not null | + | business_unit_id | not null | @Opal @PO-420 Scenario: The Offences API returns filtered Local offences Given I am testing as the "opal-test@hmcts.net" user When I make a request to the offence ref data api filtering by business unit 1 Then the response contains the below offence data - | businessUnitId | 1 | + | business_unit_id | 1 | When I make a request to the offence ref data api filtering by business unit 12 Then the response contains the below offence data - | businessUnitId | 12 | + | business_unit_id | 12 | @Opal @PO-420 Scenario: The Offences API returns filtered Local offences - negative test Given I am testing as the "opal-test@hmcts.net" user When I make a request to the offence ref data api filtering by business unit 12 Then the response does not contain the below offence data - | businessUnitId | 1 | + | business_unit_id | 1 | diff --git a/src/functionalTest/resources/features/opalMode/manualAccountCreation/PO-421_majorCreditorsReturnBUData.feature b/src/functionalTest/resources/features/opalMode/manualAccountCreation/PO-421_majorCreditorsReturnBUData.feature index 4746ffba..58dca063 100644 --- a/src/functionalTest/resources/features/opalMode/manualAccountCreation/PO-421_majorCreditorsReturnBUData.feature +++ b/src/functionalTest/resources/features/opalMode/manualAccountCreation/PO-421_majorCreditorsReturnBUData.feature @@ -5,10 +5,10 @@ Feature: Major Creditors Api returns Business unit level Data Given I am testing as the "opal-test@hmcts.net" user When I make a request to the major creditors ref data api filter by major creditor id 15 Then the response contains the below major creditor data - | majorCreditorId | 15 | - | name | CHESTERFIELD BOROUGH COUNCIL | - | majorCreditorCode | CHBC | - | businessUnitId | 10 | + | major_creditor_id | 15 | + | name | CHESTERFIELD BOROUGH COUNCIL | + | major_creditor_code | CHBC | + | business_unit_id | 10 | @Opal @PO-421 @@ -16,7 +16,7 @@ Feature: Major Creditors Api returns Business unit level Data Given I am testing as the "opal-test@hmcts.net" user When I make a request to the major creditors ref data api filter by major creditor id 109 Then the response does not contain the below major creditor data - | majorCreditorId | 15 | - | name | CHESTERFIELD BOROUGH COUNCIL | - | majorCreditorCode | CHBC | - | businessUnitId | 10 | + | major_creditor_id | 15 | + | name | CHESTERFIELD BOROUGH COUNCIL | + | major_creditor_code | CHBC | + | business_unit_id | 10 | diff --git a/src/functionalTest/resources/features/opalMode/manualAccountCreation/PO-424_filterCourtsOnBU.feature b/src/functionalTest/resources/features/opalMode/manualAccountCreation/PO-424_filterCourtsOnBU.feature index 9c1c69df..7a09d2d1 100644 --- a/src/functionalTest/resources/features/opalMode/manualAccountCreation/PO-424_filterCourtsOnBU.feature +++ b/src/functionalTest/resources/features/opalMode/manualAccountCreation/PO-424_filterCourtsOnBU.feature @@ -5,27 +5,27 @@ Feature: Courts API can be filtered by business unit id Given I am testing as the "opal-test@hmcts.net" user When I make a request to the court ref data api with a filter of "magistrates" and a business unit of 43 Then the response contains the below courts data - | name | magistrates | - | businessUnitId | 43 | + | name | magistrates | + | business_unit_id | 43 | @Opal @PO-424 Scenario: I can filter the court ref data api by name and business unit id - negative test Given I am testing as the "opal-test@hmcts.net" user When I make a request to the court ref data api with a filter of "result" and a business unit of 48 Then the response does not contain the below courts data - | name | magistrates | - | businessUnitId | 43 | + | name | magistrates | + | business_unit_id | 43 | @Opal @PO-424 Scenario: I can filter the court ref data api by just business unit id Given I am testing as the "opal-test@hmcts.net" user When I make a request to the court ref data api with a business unit of 43 Then the response contains the below courts data - | businessUnitId | 43 | + | business_unit_id | 43 | @Opal @PO-424 Scenario: I can filter the court ref data api by just business unit id - negative test Given I am testing as the "opal-test@hmcts.net" user When I make a request to the court ref data api with a business unit of 84 Then the response does not contain the below courts data - | businessUnitId | 43 | + | business_unit_id | 43 | diff --git a/src/functionalTest/resources/features/opalMode/manualAccountCreation/offences/PO-614_newFieldsInOffenceAPI.feature b/src/functionalTest/resources/features/opalMode/manualAccountCreation/offences/PO-614_newFieldsInOffenceAPI.feature index 465177d0..85889079 100644 --- a/src/functionalTest/resources/features/opalMode/manualAccountCreation/offences/PO-614_newFieldsInOffenceAPI.feature +++ b/src/functionalTest/resources/features/opalMode/manualAccountCreation/offences/PO-614_newFieldsInOffenceAPI.feature @@ -5,12 +5,12 @@ Feature: PO-614 Introduce the new OFFENCE table columns into the OFFENCES entity Given I am testing as the "opal-test@hmcts.net" user When I make a request to the offence ref data api filtering by cjs code "AA06001" Then the response contains the below offence data fields and values - | offenceId | 310844 | - | getCjsCode | AA06001 | - | businessUnitId | null | - | getOffenceTitle | Fail to wear protective clothing/footwear and meets other criteria when entering quarantine centre/facility | - | getOffenceTitleCy | null | - | dateUsedFrom | 2007-06-30T00:00:00 | - | dateUsedTo | 2007-06-30T00:00:00 | - | offenceOas | null | - | offenceOasCy | null | + | offence_id | 310844 | + | get_cjs_code | AA06001 | + | business_unit_id | null | + | offence_title | Fail to wear protective clothing/footwear and meets other criteria when entering quarantine centre/facility | + | offence_title_cy | null | + | date_used_from | 2007-06-30T00:00:00 | + | date_used_to | 2007-06-30T00:00:00 | + | offence_oas | null | + | offence_oas_cy | null | diff --git a/src/integrationTest/java/uk/gov/hmcts/opal/authentication/controller/AuthenticationInternalUserControllerTest.java b/src/integrationTest/java/uk/gov/hmcts/opal/authentication/controller/AuthenticationInternalUserControllerTest.java index c1e1ac07..cbb2f961 100644 --- a/src/integrationTest/java/uk/gov/hmcts/opal/authentication/controller/AuthenticationInternalUserControllerTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/opal/authentication/controller/AuthenticationInternalUserControllerTest.java @@ -89,13 +89,13 @@ void testHandleOauthCode() throws Exception { .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$.accessToken").value("accessToken")) - .andExpect(jsonPath("$.userState.userName").value("name")) - .andExpect(jsonPath("$.userState.userId").value("123")) - .andExpect(jsonPath("$.userState.roles[0].businessUnitId").value("123")) - .andExpect(jsonPath("$.userState.roles[0].businessUserId").value("BU123")) - .andExpect(jsonPath("$.userState.roles[0].permissions[0].permissionId").value("1")) - .andExpect(jsonPath("$.userState.roles[0].permissions[0].permissionName") + .andExpect(jsonPath("$.access_token").value("accessToken")) + .andExpect(jsonPath("$.user_state.user_name").value("name")) + .andExpect(jsonPath("$.user_state.user_id").value("123")) + .andExpect(jsonPath("$.user_state.roles[0].business_unit_id").value("123")) + .andExpect(jsonPath("$.user_state.roles[0].business_user_id").value("BU123")) + .andExpect(jsonPath("$.user_state.roles[0].permissions[0].permission_id").value("1")) + .andExpect(jsonPath("$.user_state.roles[0].permissions[0].permission_name") .value("Notes")); } diff --git a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/BusinessUnitControllerIntegrationTest.java b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/BusinessUnitControllerIntegrationTest.java index 90d6f320..d4e334e7 100644 --- a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/BusinessUnitControllerIntegrationTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/BusinessUnitControllerIntegrationTest.java @@ -35,7 +35,7 @@ @ActiveProfiles({"integration"}) class BusinessUnitControllerIntegrationTest { - private static final String URL_BASE = "/business-units/"; + private static final String URL_BASE = "/business-units"; @Autowired MockMvc mockMvc; @@ -53,7 +53,7 @@ void testGetBusinessUnitById() throws Exception { when(businessUnitService.getBusinessUnit((short)1)).thenReturn(businessUnitEntity); - mockMvc.perform(get(URL_BASE + "1")) + mockMvc.perform(get(URL_BASE + "/1")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.businessUnitId").value(1)) @@ -70,7 +70,7 @@ void testGetBusinessUnitById() throws Exception { void testGetBusinessUnitById_WhenBusinessUnitDoesNotExist() throws Exception { when(businessUnitService.getBusinessUnit((short)2)).thenReturn(null); - mockMvc.perform(get(URL_BASE + "2")) + mockMvc.perform(get(URL_BASE + "/2")) .andExpect(status().isNotFound()); } @@ -81,7 +81,7 @@ void testPostBusinessUnitsSearch() throws Exception { when(businessUnitService.searchBusinessUnits(any(BusinessUnitSearchDto.class))) .thenReturn(singletonList(businessUnitEntity)); - mockMvc.perform(post(URL_BASE + "search") + mockMvc.perform(post(URL_BASE + "/search") .contentType(MediaType.APPLICATION_JSON) .content("{\"criteria\":\"value\"}")) .andExpect(status().isOk()) @@ -97,7 +97,7 @@ void testPostBusinessUnitsSearch() throws Exception { @Test void testPostBusinessUnitsSearch_WhenBusinessUnitDoesNotExist() throws Exception { - mockMvc.perform(post(URL_BASE + "search") + mockMvc.perform(post(URL_BASE + "/search") .contentType(MediaType.APPLICATION_JSON) .content("{\"criteria\":\"2\"}")) .andExpect(status().isOk()); @@ -109,17 +109,17 @@ void testGetBusinessUnitRefData() throws Exception { when(businessUnitService.getReferenceData(any())).thenReturn(singletonList(refData)); - mockMvc.perform(get(URL_BASE + "ref-data") + mockMvc.perform(get(URL_BASE) .header("authorization", "Bearer some_value")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.count").value(1)) - .andExpect(jsonPath("$.refData[0].businessUnitId").value(1)) - .andExpect(jsonPath("$.refData[0].businessUnitName").value("Business Unit 001")) - .andExpect(jsonPath("$.refData[0].businessUnitCode").value("AAAA")) - .andExpect(jsonPath("$.refData[0].businessUnitType").value("LARGE UNIT")) - .andExpect(jsonPath("$.refData[0].accountNumberPrefix").value("XX")) - .andExpect(jsonPath("$.refData[0].opalDomain").value("Fines")); + .andExpect(jsonPath("$.refData[0].business_unit_id").value(1)) + .andExpect(jsonPath("$.refData[0].business_unit_name").value("Business Unit 001")) + .andExpect(jsonPath("$.refData[0].business_unit_code").value("AAAA")) + .andExpect(jsonPath("$.refData[0].business_unit_type").value("LARGE UNIT")) + .andExpect(jsonPath("$.refData[0].account_number_prefix").value("XX")) + .andExpect(jsonPath("$.refData[0].opal_domain").value("Fines")); } @Test @@ -131,17 +131,17 @@ void testGetBusinessUnitRefData_Permission_success() throws Exception { when(userStateService.getUserStateUsingAuthToken(anyString())).thenReturn(userState); when(userState.allRolesWithPermission(any())).thenReturn(new TestUserRoles(true)); - mockMvc.perform(get(URL_BASE + "ref-data/?permission=MANUAL_ACCOUNT_CREATION") + mockMvc.perform(get(URL_BASE + "?permission=MANUAL_ACCOUNT_CREATION") .header("authorization", "Bearer some_value")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.count").value(1)) - .andExpect(jsonPath("$.refData[0].businessUnitId").value(1)) - .andExpect(jsonPath("$.refData[0].businessUnitName").value("Business Unit 001")) - .andExpect(jsonPath("$.refData[0].businessUnitCode").value("AAAA")) - .andExpect(jsonPath("$.refData[0].businessUnitType").value("LARGE UNIT")) - .andExpect(jsonPath("$.refData[0].accountNumberPrefix").value("XX")) - .andExpect(jsonPath("$.refData[0].opalDomain").value("Fines")); + .andExpect(jsonPath("$.refData[0].business_unit_id").value(1)) + .andExpect(jsonPath("$.refData[0].business_unit_name").value("Business Unit 001")) + .andExpect(jsonPath("$.refData[0].business_unit_code").value("AAAA")) + .andExpect(jsonPath("$.refData[0].business_unit_type").value("LARGE UNIT")) + .andExpect(jsonPath("$.refData[0].account_number_prefix").value("XX")) + .andExpect(jsonPath("$.refData[0].opal_domain").value("Fines")); } @Test @@ -153,7 +153,7 @@ void testGetBusinessUnitRefData_Permission_empty() throws Exception { when(userStateService.getUserStateUsingAuthToken(anyString())).thenReturn(userState); when(userState.allRolesWithPermission(any())).thenReturn(new TestUserRoles(false)); - mockMvc.perform(get(URL_BASE + "ref-data/?permission=MANUAL_ACCOUNT_CREATION") + mockMvc.perform(get(URL_BASE + "?permission=MANUAL_ACCOUNT_CREATION") .header("authorization", "Bearer some_value")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) diff --git a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/CourtControllerIntegrationTest.java b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/CourtControllerIntegrationTest.java index eb79aea8..ef305633 100644 --- a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/CourtControllerIntegrationTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/CourtControllerIntegrationTest.java @@ -30,7 +30,7 @@ @ActiveProfiles({"integration"}) class CourtControllerIntegrationTest { - private static final String URL_BASE = "/courts/"; + private static final String URL_BASE = "/courts"; @Autowired MockMvc mockMvc; @@ -54,7 +54,7 @@ void testGetCourtById() throws Exception { when(courtService.getCourt(1L)).thenReturn(courtEntity); - mockMvc.perform(get(URL_BASE + "1") + mockMvc.perform(get(URL_BASE + "/1") .header("authorization", "Bearer some_value")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) @@ -70,7 +70,7 @@ void testGetCourtById() throws Exception { void testGetCourtById_WhenCourtDoesNotExist() throws Exception { when(courtService.getCourt(2L)).thenReturn(null); - mockMvc.perform(get(URL_BASE + "2").header("authorization", "Bearer some_value")) + mockMvc.perform(get(URL_BASE + "/2").header("authorization", "Bearer some_value")) .andExpect(status().isNotFound()); } @@ -86,7 +86,7 @@ void testPostCourtsSearch() throws Exception { when(courtService.searchCourts(any(CourtSearchDto.class))).thenReturn(singletonList(courtEntity)); - mockMvc.perform(post(URL_BASE + "search") + mockMvc.perform(post(URL_BASE + "/search") .header("authorization", "Bearer some_value") .contentType(MediaType.APPLICATION_JSON) .content("{\"criteria\":\"value\"}")) @@ -101,7 +101,7 @@ void testPostCourtsSearch() throws Exception { @Test void testPostCourtsSearch_WhenCourtDoesNotExist() throws Exception { - mockMvc.perform(post(URL_BASE + "search") + mockMvc.perform(post(URL_BASE + "/search") .header("authorization", "Bearer some_value") .contentType(MediaType.APPLICATION_JSON) .content("{\"criteria\":\"2\"}")) @@ -115,14 +115,14 @@ void testGetCourtRefData() throws Exception { when(courtService.getReferenceData(any(), any())).thenReturn(singletonList(refData)); - mockMvc.perform(get(URL_BASE + "ref-data") + mockMvc.perform(get(URL_BASE) .header("authorization", "Bearer some_value")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.count").value(1)) - .andExpect(jsonPath("$.refData[0].courtId").value(1)) - .andExpect(jsonPath("$.refData[0].courtCode").value(11)) + .andExpect(jsonPath("$.refData[0].court_id").value(1)) + .andExpect(jsonPath("$.refData[0].court_code").value(11)) .andExpect(jsonPath("$.refData[0].name").value("Main Court")) - .andExpect(jsonPath("$.refData[0].nationalCourtCode").value("MN1234")); + .andExpect(jsonPath("$.refData[0].national_court_code").value("MN1234")); } } diff --git a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/DefendantAccountControllerIntegrationTest.java b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/DefendantAccountControllerIntegrationTest.java index ecd55710..8f71f7f0 100644 --- a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/DefendantAccountControllerIntegrationTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/DefendantAccountControllerIntegrationTest.java @@ -68,9 +68,9 @@ void testGetDefendantAccountById() throws Exception { .header("authorization", "Bearer some_value")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$.defendantAccountId").value(1)) - .andExpect(jsonPath("$.accountNumber").value("abc123")) - .andExpect(jsonPath("$.businessUnitId").value(6)); + .andExpect(jsonPath("$.defendant_account_id").value(1)) + .andExpect(jsonPath("$.account_number").value("abc123")) + .andExpect(jsonPath("$.business_unit_id").value(6)); } @@ -100,12 +100,12 @@ void testPostDefendantAccountsSearch() throws Exception { .content("{\"criteria\":\"value\"}")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$.pageSize").value(100)) - .andExpect(jsonPath("$.searchResults[0].defendantAccountId").value(1)) - .andExpect(jsonPath("$.searchResults[0].accountNo").value("abc123")) - .andExpect(jsonPath("$.searchResults[0].name").value("Keith Criminal")) - .andExpect(jsonPath("$.searchResults[0].court").value("Crown Court")) - .andExpect(jsonPath("$.searchResults[0].addressLine1").value("1 Central London")); + .andExpect(jsonPath("$.page_size").value(100)) + .andExpect(jsonPath("$.search_results[0].defendant_account_id").value(1)) + .andExpect(jsonPath("$.search_results[0].account_no").value("abc123")) + .andExpect(jsonPath("$.search_results[0].name").value("Keith Criminal")) + .andExpect(jsonPath("$.search_results[0].court").value("Crown Court")) + .andExpect(jsonPath("$.search_results[0].address_line_1").value("1 Central London")); } @Test @@ -185,8 +185,8 @@ public void testAddNote() throws Exception { .content(new ObjectMapper().writeValueAsString(addNoteDto))) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$.noteType").value("quick")) - .andExpect(jsonPath("$.businessUnitId").value(123)); + .andExpect(jsonPath("$.note_type").value("quick")) + .andExpect(jsonPath("$.business_unit_id").value(123)); } @Test @@ -201,12 +201,12 @@ public void testGetNotesForDefendantAccount_notePresent() throws Exception { .header("authorization", "Bearer some_value")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$[0].noteType").value("quick")) - .andExpect(jsonPath("$[0].noteText").value("A reminder note")) - .andExpect(jsonPath("$[0].postedBy").value("Vincent")) - .andExpect(jsonPath("$[0].associatedRecordId").value("abc123")) - .andExpect(jsonPath("$[0].postedDate").value("2024-03-25 15:30:00")) - .andExpect(jsonPath("$[0].businessUnitId").value(123)); + .andExpect(jsonPath("$[0].note_type").value("quick")) + .andExpect(jsonPath("$[0].note_text").value("A reminder note")) + .andExpect(jsonPath("$[0].posted_by").value("Vincent")) + .andExpect(jsonPath("$[0].associated_record_id").value("abc123")) + .andExpect(jsonPath("$[0].posted_date").value("2024-03-25 15:30:00")) + .andExpect(jsonPath("$[0].business_unit_id").value(123)); } @Test diff --git a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/EnforcerControllerIntegrationTest.java b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/EnforcerControllerIntegrationTest.java index 37f7a6f4..f76c1be6 100644 --- a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/EnforcerControllerIntegrationTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/EnforcerControllerIntegrationTest.java @@ -29,7 +29,7 @@ @ActiveProfiles({"integration"}) class EnforcerControllerIntegrationTest { - private static final String URL_BASE = "/enforcers/"; + private static final String URL_BASE = "/enforcers"; @Autowired MockMvc mockMvc; @@ -44,7 +44,7 @@ void testGetEnforcerById() throws Exception { when(enforcerService.getEnforcer(1L)).thenReturn(enforcerEntity); - mockMvc.perform(get(URL_BASE + "1")) + mockMvc.perform(get(URL_BASE + "/1")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.enforcerId").value(1)) @@ -68,7 +68,7 @@ void testGetEnforcerById() throws Exception { void testGetEnforcerById_WhenEnforcerDoesNotExist() throws Exception { when(enforcerService.getEnforcer(2L)).thenReturn(null); - mockMvc.perform(get(URL_BASE + "2")) + mockMvc.perform(get(URL_BASE + "/2")) .andExpect(status().isNotFound()); } @@ -78,7 +78,7 @@ void testPostEnforcersSearch() throws Exception { when(enforcerService.searchEnforcers(any(EnforcerSearchDto.class))).thenReturn(singletonList(enforcerEntity)); - mockMvc.perform(post(URL_BASE + "search") + mockMvc.perform(post(URL_BASE + "/search") .contentType(MediaType.APPLICATION_JSON) .content("{\"criteria\":\"value\"}")) .andExpect(status().isOk()) @@ -101,7 +101,7 @@ void testPostEnforcersSearch() throws Exception { @Test void testPostEnforcersSearch_WhenEnforcerDoesNotExist() throws Exception { - mockMvc.perform(post(URL_BASE + "search") + mockMvc.perform(post(URL_BASE + "/search") .contentType(MediaType.APPLICATION_JSON) .content("{\"criteria\":\"2\"}")) .andExpect(status().isOk()); @@ -114,15 +114,15 @@ void testGetEnforcerRefData() throws Exception { when(enforcerService.getReferenceData(any())).thenReturn(singletonList(refData)); - mockMvc.perform(get(URL_BASE + "ref-data") + mockMvc.perform(get(URL_BASE) .header("authorization", "Bearer some_value")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.count").value(1)) - .andExpect(jsonPath("$.refData[0].enforcerId").value(1)) - .andExpect(jsonPath("$.refData[0].enforcerCode").value(2)) + .andExpect(jsonPath("$.refData[0].enforcer_id").value(1)) + .andExpect(jsonPath("$.refData[0].enforcer_code").value(2)) .andExpect(jsonPath("$.refData[0].name").value("Enforcers UK Ltd")) - .andExpect(jsonPath("$.refData[0].nameCy").value("Enforcers Wales Ltd")); + .andExpect(jsonPath("$.refData[0].name_cy").value("Enforcers Wales Ltd")); } diff --git a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/MajorCreditorControllerIntegrationTest.java b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/MajorCreditorControllerIntegrationTest.java index b8dec457..bac840c7 100644 --- a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/MajorCreditorControllerIntegrationTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/MajorCreditorControllerIntegrationTest.java @@ -29,7 +29,7 @@ @ActiveProfiles({"integration"}) class MajorCreditorControllerIntegrationTest { - private static final String URL_BASE = "/major-creditors/"; + private static final String URL_BASE = "/major-creditors"; @Autowired MockMvc mockMvc; @@ -44,7 +44,7 @@ void testGetMajorCreditorById() throws Exception { when(majorCreditorService.getMajorCreditor(1L)).thenReturn(majorCreditorEntity); - mockMvc.perform(get(URL_BASE + "1")) + mockMvc.perform(get(URL_BASE + "/1")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.majorCreditorId").value(1)) @@ -61,7 +61,7 @@ void testGetMajorCreditorById() throws Exception { void testGetMajorCreditorById_WhenMajorCreditorDoesNotExist() throws Exception { when(majorCreditorService.getMajorCreditor(2L)).thenReturn(null); - mockMvc.perform(get(URL_BASE + "2")) + mockMvc.perform(get(URL_BASE + "/2")) .andExpect(status().isNotFound()); } @@ -72,7 +72,7 @@ void testPostMajorCreditorsSearch() throws Exception { when(majorCreditorService.searchMajorCreditors(any(MajorCreditorSearchDto.class))) .thenReturn(singletonList(majorCreditorEntity)); - mockMvc.perform(post(URL_BASE + "search") + mockMvc.perform(post(URL_BASE + "/search") .contentType(MediaType.APPLICATION_JSON) .content("{\"criteria\":\"value\"}")) .andExpect(status().isOk()) @@ -88,7 +88,7 @@ void testPostMajorCreditorsSearch() throws Exception { @Test void testPostMajorCreditorsSearch_WhenMajorCreditorDoesNotExist() throws Exception { - mockMvc.perform(post(URL_BASE + "search") + mockMvc.perform(post(URL_BASE + "/search") .contentType(MediaType.APPLICATION_JSON) .content("{\"criteria\":\"2\"}")) .andExpect(status().isOk()); @@ -101,13 +101,13 @@ void testGetMajorCreditorRefData() throws Exception { when(majorCreditorService.getReferenceData(any(), any())).thenReturn(singletonList(refData)); - mockMvc.perform(get(URL_BASE + "ref-data") + mockMvc.perform(get(URL_BASE) .header("authorization", "Bearer some_value")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.count").value(1)) - .andExpect(jsonPath("$.refData[0].majorCreditorId").value(1)) - .andExpect(jsonPath("$.refData[0].majorCreditorCode").value("MC_001")) + .andExpect(jsonPath("$.refData[0].major_creditor_id").value(1)) + .andExpect(jsonPath("$.refData[0].major_creditor_code").value("MC_001")) .andExpect(jsonPath("$.refData[0].name").value("Major Credit Card Ltd")) .andExpect(jsonPath("$.refData[0].postcode").value("MN12 4TT")); } diff --git a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/OffenceControllerIntegrationTest.java b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/OffenceControllerIntegrationTest.java index 3af4f2a9..dcd19c9f 100644 --- a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/OffenceControllerIntegrationTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/OffenceControllerIntegrationTest.java @@ -28,7 +28,7 @@ @ActiveProfiles({"integration"}) class OffenceControllerIntegrationTest { - private static final String URL_BASE = "/offences/"; + private static final String URL_BASE = "/offences"; @Autowired MockMvc mockMvc; @@ -43,7 +43,7 @@ void testGetOffenceById() throws Exception { when(offenceService.getOffence((short)1)).thenReturn(offenceEntity); - mockMvc.perform(get(URL_BASE + "1")) + mockMvc.perform(get(URL_BASE + "/1")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.offenceId").value(1)) @@ -57,7 +57,7 @@ void testGetOffenceById() throws Exception { void testGetOffenceById_WhenOffenceDoesNotExist() throws Exception { when(offenceService.getOffence((short)2)).thenReturn(null); - mockMvc.perform(get(URL_BASE + "2")) + mockMvc.perform(get(URL_BASE + "/2")) .andExpect(status().isNotFound()); } @@ -67,7 +67,7 @@ void testPostOffencesSearch() throws Exception { when(offenceService.searchOffences(any(OffenceSearchDto.class))).thenReturn(singletonList(offenceEntity)); - mockMvc.perform(post(URL_BASE + "search") + mockMvc.perform(post(URL_BASE + "/search") .contentType(MediaType.APPLICATION_JSON) .content("{\"criteria\":\"value\"}")) .andExpect(status().isOk()) @@ -80,7 +80,7 @@ void testPostOffencesSearch() throws Exception { @Test void testPostOffencesSearch_WhenOffenceDoesNotExist() throws Exception { - mockMvc.perform(post(URL_BASE + "search") + mockMvc.perform(post(URL_BASE + "/search") .contentType(MediaType.APPLICATION_JSON) .content("{\"criteria\":\"2\"}")) .andExpect(status().isOk()); diff --git a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/TestingSupportControllerTest.java b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/TestingSupportControllerTest.java index dda183b8..b7f1b5fc 100644 --- a/src/integrationTest/java/uk/gov/hmcts/opal/controllers/TestingSupportControllerTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/opal/controllers/TestingSupportControllerTest.java @@ -129,13 +129,13 @@ void testGetToken() throws Exception { mockMvc.perform(get("/testing-support/token/test-user")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$.accessToken").value("testToken")) - .andExpect(jsonPath("$.userState.userName").value("name")) - .andExpect(jsonPath("$.userState.userId").value("123")) - .andExpect(jsonPath("$.userState.roles[0].businessUnitId").value("123")) - .andExpect(jsonPath("$.userState.roles[0].businessUserId").value("BU123")) - .andExpect(jsonPath("$.userState.roles[0].permissions[0].permissionId").value("1")) - .andExpect(jsonPath("$.userState.roles[0].permissions[0].permissionName") + .andExpect(jsonPath("$.access_token").value("testToken")) + .andExpect(jsonPath("$.user_state.user_name").value("name")) + .andExpect(jsonPath("$.user_state.user_id").value("123")) + .andExpect(jsonPath("$.user_state.roles[0].business_unit_id").value("123")) + .andExpect(jsonPath("$.user_state.roles[0].business_user_id").value("BU123")) + .andExpect(jsonPath("$.user_state.roles[0].permissions[0].permission_id").value("1")) + .andExpect(jsonPath("$.user_state.roles[0].permissions[0].permission_name") .value("Notes")); } @@ -157,13 +157,13 @@ void testGetTokenForUser() throws Exception { .header("X-User-Email", "test@example.com")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$.accessToken").value("testToken")) - .andExpect(jsonPath("$.userState.userName").value("name")) - .andExpect(jsonPath("$.userState.userId").value("123")) - .andExpect(jsonPath("$.userState.roles[0].businessUnitId").value("123")) - .andExpect(jsonPath("$.userState.roles[0].businessUserId").value("BU123")) - .andExpect(jsonPath("$.userState.roles[0].permissions[0].permissionId").value("1")) - .andExpect(jsonPath("$.userState.roles[0].permissions[0].permissionName") + .andExpect(jsonPath("$.access_token").value("testToken")) + .andExpect(jsonPath("$.user_state.user_name").value("name")) + .andExpect(jsonPath("$.user_state.user_id").value("123")) + .andExpect(jsonPath("$.user_state.roles[0].business_unit_id").value("123")) + .andExpect(jsonPath("$.user_state.roles[0].business_user_id").value("BU123")) + .andExpect(jsonPath("$.user_state.roles[0].permissions[0].permission_id").value("1")) + .andExpect(jsonPath("$.user_state.roles[0].permissions[0].permission_name") .value("Notes")); } @@ -196,13 +196,13 @@ void testGetTokenForUserFailure() throws Exception { .header("X-User-Email", "test@example.com")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$.accessToken").value("testToken")) - .andExpect(jsonPath("$.userState.userName").value("name")) - .andExpect(jsonPath("$.userState.userId").value("123")) - .andExpect(jsonPath("$.userState.roles[0].businessUnitId").value("123")) - .andExpect(jsonPath("$.userState.roles[0].businessUserId").value("BU123")) - .andExpect(jsonPath("$.userState.roles[0].permissions[0].permissionId").value("1")) - .andExpect(jsonPath("$.userState.roles[0].permissions[0].permissionName") + .andExpect(jsonPath("$.access_token").value("testToken")) + .andExpect(jsonPath("$.user_state.user_name").value("name")) + .andExpect(jsonPath("$.user_state.user_id").value("123")) + .andExpect(jsonPath("$.user_state.roles[0].business_unit_id").value("123")) + .andExpect(jsonPath("$.user_state.roles[0].business_user_id").value("BU123")) + .andExpect(jsonPath("$.user_state.roles[0].permissions[0].permission_id").value("1")) + .andExpect(jsonPath("$.user_state.roles[0].permissions[0].permission_name") .value("Notes")); } } diff --git a/src/main/java/uk/gov/hmcts/opal/authentication/client/AzureTokenClient.java b/src/main/java/uk/gov/hmcts/opal/authentication/client/AzureTokenClient.java index cc2513c5..501d831f 100644 --- a/src/main/java/uk/gov/hmcts/opal/authentication/client/AzureTokenClient.java +++ b/src/main/java/uk/gov/hmcts/opal/authentication/client/AzureTokenClient.java @@ -31,7 +31,7 @@ public AccessTokenResponse getAccessToken(AccessTokenRequest request) { body.add("username", request.getUsername()); body.add("password", request.getPassword()); - log.info(":getAccessToken:"); + log.info(":getAccessToken: for user name: {}", request.getUsername()); ResponseEntity response = restClient .post() diff --git a/src/main/java/uk/gov/hmcts/opal/authentication/model/SecurityToken.java b/src/main/java/uk/gov/hmcts/opal/authentication/model/SecurityToken.java index d254922a..966918b8 100644 --- a/src/main/java/uk/gov/hmcts/opal/authentication/model/SecurityToken.java +++ b/src/main/java/uk/gov/hmcts/opal/authentication/model/SecurityToken.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.opal.authentication.model; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Builder; import lombok.Value; import uk.gov.hmcts.opal.authorisation.model.UserState; @@ -8,6 +9,8 @@ @Value public class SecurityToken { + @JsonProperty("access_token") String accessToken; + @JsonProperty("user_state") UserState userState; } diff --git a/src/main/java/uk/gov/hmcts/opal/authorisation/model/Permission.java b/src/main/java/uk/gov/hmcts/opal/authorisation/model/Permission.java index 08a1b7ad..1ebbf911 100644 --- a/src/main/java/uk/gov/hmcts/opal/authorisation/model/Permission.java +++ b/src/main/java/uk/gov/hmcts/opal/authorisation/model/Permission.java @@ -17,8 +17,8 @@ public class Permission { String permissionName; @JsonCreator - public Permission(@JsonProperty("permissionId") Long permissionId, - @JsonProperty("permissionName") String permissionName) { + public Permission(@JsonProperty("permission_id") Long permissionId, + @JsonProperty("permission_name") String permissionName) { this.permissionId = permissionId; this.permissionName = permissionName; } diff --git a/src/main/java/uk/gov/hmcts/opal/authorisation/model/Role.java b/src/main/java/uk/gov/hmcts/opal/authorisation/model/Role.java index 963f0a6e..ae8f8227 100644 --- a/src/main/java/uk/gov/hmcts/opal/authorisation/model/Role.java +++ b/src/main/java/uk/gov/hmcts/opal/authorisation/model/Role.java @@ -25,8 +25,8 @@ public class Role { Set permissions; @JsonCreator - public Role(@JsonProperty("businessUserId") String businessUserId, - @JsonProperty("businessUnitId") Short businessUnitId, + public Role(@JsonProperty("business_user_id") String businessUserId, + @JsonProperty("business_unit_id") Short businessUnitId, @JsonProperty("permissions") Set permissions) { this.businessUserId = businessUserId; diff --git a/src/main/java/uk/gov/hmcts/opal/authorisation/model/UserState.java b/src/main/java/uk/gov/hmcts/opal/authorisation/model/UserState.java index 5d2914ff..85254ad2 100644 --- a/src/main/java/uk/gov/hmcts/opal/authorisation/model/UserState.java +++ b/src/main/java/uk/gov/hmcts/opal/authorisation/model/UserState.java @@ -28,8 +28,8 @@ public class UserState { @JsonCreator public UserState( - @JsonProperty("userId") Long userId, - @JsonProperty("userName") String userName, + @JsonProperty("user_id") Long userId, + @JsonProperty("user_name") String userName, @JsonProperty("roles") Set roles ) { this.userId = userId; diff --git a/src/main/java/uk/gov/hmcts/opal/controllers/BusinessUnitController.java b/src/main/java/uk/gov/hmcts/opal/controllers/BusinessUnitController.java index bf62263c..1d816038 100644 --- a/src/main/java/uk/gov/hmcts/opal/controllers/BusinessUnitController.java +++ b/src/main/java/uk/gov/hmcts/opal/controllers/BusinessUnitController.java @@ -72,10 +72,10 @@ public ResponseEntity> postBusinessUnitsSearch( return buildResponse(response); } - @GetMapping(value = {"/ref-data", "/ref-data/", "/ref-data/{filter}"}) + @GetMapping @Operation(summary = "Returns Business Units as reference data with an optional filter applied") public ResponseEntity getBusinessUnitRefData( - @PathVariable Optional filter, @RequestParam Optional permission, + @RequestParam("q") Optional filter, @RequestParam Optional permission, @RequestHeader(value = "Authorization", required = false) String authHeaderValue) { log.info(":GET:getBusinessUnitRefData: permission: {}, query: \n{}", permission, filter); diff --git a/src/main/java/uk/gov/hmcts/opal/controllers/CourtController.java b/src/main/java/uk/gov/hmcts/opal/controllers/CourtController.java index 3d653412..1c235eea 100644 --- a/src/main/java/uk/gov/hmcts/opal/controllers/CourtController.java +++ b/src/main/java/uk/gov/hmcts/opal/controllers/CourtController.java @@ -74,10 +74,10 @@ public ResponseEntity> postCourtsSearch(@RequestBody CourtSear return buildResponse(response); } - @GetMapping(value = {"/ref-data", "/ref-data/", "/ref-data/{filter}"}) + @GetMapping @Operation(summary = "Returns courts as reference data with an optional filter applied") public ResponseEntity getCourtRefData( - @PathVariable Optional filter, @RequestParam Optional businessUnit) { + @RequestParam("q") Optional filter, @RequestParam("business_unit") Optional businessUnit) { log.info(":GET:getCourtRefData: business unit: {}, filter string: {}", businessUnit, filter); List refData = opalCourtService.getReferenceData(filter, businessUnit); diff --git a/src/main/java/uk/gov/hmcts/opal/controllers/DraftAccountController.java b/src/main/java/uk/gov/hmcts/opal/controllers/DraftAccountController.java index 69672c86..80f1d5e5 100644 --- a/src/main/java/uk/gov/hmcts/opal/controllers/DraftAccountController.java +++ b/src/main/java/uk/gov/hmcts/opal/controllers/DraftAccountController.java @@ -107,7 +107,7 @@ public ResponseEntity postDraftAccount(@RequestBody Add public ResponseEntity deleteDraftAccountById( @PathVariable Long draftAccountId, @RequestHeader(value = "Authorization", required = false) String authHeaderValue, - @RequestParam Optional ignoreMissing) { + @RequestParam("ignore_missing") Optional ignoreMissing) { log.info(":DELETE:deleteDraftAccountById: draftAccountId: {}", draftAccountId); diff --git a/src/main/java/uk/gov/hmcts/opal/controllers/EnforcerController.java b/src/main/java/uk/gov/hmcts/opal/controllers/EnforcerController.java index 2401137f..14504854 100644 --- a/src/main/java/uk/gov/hmcts/opal/controllers/EnforcerController.java +++ b/src/main/java/uk/gov/hmcts/opal/controllers/EnforcerController.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import uk.gov.hmcts.opal.dto.reference.EnforcerReferenceDataResults; import uk.gov.hmcts.opal.dto.search.EnforcerSearchDto; @@ -62,10 +63,10 @@ public ResponseEntity> postEnforcersSearch(@RequestBody Enf return buildResponse(response); } - @GetMapping(value = {"/ref-data", "/ref-data/", "/ref-data/{filter}"}) + @GetMapping @Operation(summary = "Returns Enforcers as reference data with an optional filter applied") public ResponseEntity getEnforcersRefData( - @PathVariable Optional filter) { + @RequestParam("q") Optional filter) { log.info(":GET:getEnforcersRefData: query: \n{}", filter); List refData = opalEnforcerService.getReferenceData(filter); diff --git a/src/main/java/uk/gov/hmcts/opal/controllers/LocalJusticeAreaController.java b/src/main/java/uk/gov/hmcts/opal/controllers/LocalJusticeAreaController.java index f945dc49..a7de3d14 100644 --- a/src/main/java/uk/gov/hmcts/opal/controllers/LocalJusticeAreaController.java +++ b/src/main/java/uk/gov/hmcts/opal/controllers/LocalJusticeAreaController.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import uk.gov.hmcts.opal.dto.reference.LjaReferenceDataResults; import uk.gov.hmcts.opal.dto.search.LocalJusticeAreaSearchDto; @@ -64,10 +65,10 @@ public ResponseEntity> postLocalJusticeAreasSearch( return buildResponse(response); } - @GetMapping(value = {"/ref-data", "/ref-data/", "/ref-data/{filter}"}) + @GetMapping @Operation(summary = "Returns Local Justice Area as reference data with an optional filter applied") public ResponseEntity getLocalJusticeAreaRefData( - @PathVariable Optional filter) { + @RequestParam("q") Optional filter) { log.info(":GET:getLocalJusticeAreaRefData: query: \n{}", filter); List refData = opalLocalJusticeAreaService.getReferenceData(filter); diff --git a/src/main/java/uk/gov/hmcts/opal/controllers/MajorCreditorController.java b/src/main/java/uk/gov/hmcts/opal/controllers/MajorCreditorController.java index f8874ac1..42de7f37 100644 --- a/src/main/java/uk/gov/hmcts/opal/controllers/MajorCreditorController.java +++ b/src/main/java/uk/gov/hmcts/opal/controllers/MajorCreditorController.java @@ -3,7 +3,6 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -17,7 +16,6 @@ import uk.gov.hmcts.opal.dto.search.MajorCreditorSearchDto; import uk.gov.hmcts.opal.entity.MajorCreditorEntity; import uk.gov.hmcts.opal.entity.projection.MajorCreditorReferenceData; -import uk.gov.hmcts.opal.service.MajorCreditorServiceInterface; import uk.gov.hmcts.opal.service.opal.MajorCreditorService; import java.util.List; @@ -32,13 +30,9 @@ @Tag(name = "Major Creditor Controller") public class MajorCreditorController { - private final MajorCreditorServiceInterface majorCreditorService; - private final MajorCreditorService opalMajorCreditorService; - public MajorCreditorController(@Qualifier("majorCreditorServiceProxy") MajorCreditorServiceInterface - majorCreditorService, MajorCreditorService opalMajorCreditorService) { - this.majorCreditorService = majorCreditorService; + public MajorCreditorController(MajorCreditorService opalMajorCreditorService) { this.opalMajorCreditorService = opalMajorCreditorService; } @@ -48,7 +42,7 @@ public ResponseEntity getMajorCreditorById(@PathVariable Lo log.info(":GET:getMajorCreditorById: majorCreditorId: {}", majorCreditorId); - MajorCreditorEntity response = majorCreditorService.getMajorCreditor(majorCreditorId); + MajorCreditorEntity response = opalMajorCreditorService.getMajorCreditor(majorCreditorId); return buildResponse(response); } @@ -59,15 +53,15 @@ public ResponseEntity> postMajorCreditorsSearch( @RequestBody MajorCreditorSearchDto criteria) { log.info(":POST:postMajorCreditorsSearch: query: \n{}", criteria); - List response = majorCreditorService.searchMajorCreditors(criteria); + List response = opalMajorCreditorService.searchMajorCreditors(criteria); return buildResponse(response); } - @GetMapping(value = {"/ref-data", "/ref-data/", "/ref-data/{filter}"}) + @GetMapping @Operation(summary = "Returns MajorCreditors as reference data with an optional filter applied") public ResponseEntity getMajorCreditorRefData( - @PathVariable Optional filter, @RequestParam Optional businessUnit) { + @RequestParam("q") Optional filter, @RequestParam Optional businessUnit) { log.info(":GET:getMajorCreditorRefData: business unit: {}, filter string: {}", businessUnit, filter); List refData = opalMajorCreditorService.getReferenceData(filter, businessUnit); diff --git a/src/main/java/uk/gov/hmcts/opal/controllers/OffenceController.java b/src/main/java/uk/gov/hmcts/opal/controllers/OffenceController.java index 98aa0324..064cea27 100644 --- a/src/main/java/uk/gov/hmcts/opal/controllers/OffenceController.java +++ b/src/main/java/uk/gov/hmcts/opal/controllers/OffenceController.java @@ -62,12 +62,12 @@ public ResponseEntity> postOffencesSearch(@RequestBody Offen return buildResponse(response); } - @GetMapping(value = {"/ref-data", "/ref-data/", "/ref-data/{filter}"}) + @GetMapping @Operation(summary = "Returns 'global' Offences as reference data with an optional filter applied. " + "If the business unit is provided, then that is used to return only 'local' offences " + "for that business unit, or ALL local offences if the business unit provided is zero.") public ResponseEntity getOffenceRefData( - @PathVariable Optional filter, @RequestParam Optional businessUnit) { + @RequestParam("q") Optional filter, @RequestParam Optional businessUnit) { log.info(":GET:getOffenceRefData: business unit: {}, filter string: {}", businessUnit, filter); diff --git a/src/main/java/uk/gov/hmcts/opal/controllers/advice/GlobalExceptionHandler.java b/src/main/java/uk/gov/hmcts/opal/controllers/advice/GlobalExceptionHandler.java index 4db517f7..be4143ed 100644 --- a/src/main/java/uk/gov/hmcts/opal/controllers/advice/GlobalExceptionHandler.java +++ b/src/main/java/uk/gov/hmcts/opal/controllers/advice/GlobalExceptionHandler.java @@ -38,7 +38,7 @@ import static uk.gov.hmcts.opal.authentication.service.AccessTokenService.AUTH_HEADER; import static uk.gov.hmcts.opal.util.HttpUtil.extractPreferredUsername; -@Slf4j +@Slf4j(topic = "GlobalExceptionHandler") @ControllerAdvice @RequiredArgsConstructor public class GlobalExceptionHandler { 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 924aeb22..732f9ee3 100644 --- a/src/main/java/uk/gov/hmcts/opal/dto/AccountDetailsDto.java +++ b/src/main/java/uk/gov/hmcts/opal/dto/AccountDetailsDto.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.opal.dto; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -16,63 +17,79 @@ public class AccountDetailsDto implements ToJsonString { //defendant_accounts.defendant_account_id + @JsonProperty("defendant_account_id") private Long defendantAccountId; //defendant_accounts.account_number + @JsonProperty("account_number") private String accountNumber; // parties.surname, parties,initials, parties.forenames, parties.title + @JsonProperty("full_name") private String fullName; // business_units.business_unit_name + @JsonProperty("account_ct") private String accountCT; // business_units.business_unit_id + @JsonProperty("business_unit_id") private Short businessUnitId; //parties.address_line_(*) private String address; //parties.postcode + @JsonProperty("post_code") private String postCode; //parties.birth_date private LocalDate dob; //defendant_accounts.last_changed_date + @JsonProperty("details_changed") private LocalDate detailsChanged; //defendant_accounts.last_hearing_date + defendant_accounts.last_hearing_court_id + @JsonProperty("last_court_app_and_court_code") private String lastCourtAppAndCourtCode; //defendant_accounts.last_movement_date + @JsonProperty("last_movement") private LocalDate lastMovement; //notes.note_text = AC + @JsonProperty("comment_field") private List commentField; //notes.note_text = AA + @JsonProperty("account_notes") private String accountNotes; //defendant_accounts.prosecutor_case_reference private String pcr; //payment_terms.installment_amount / payment_terms.installment_period + @JsonProperty("payment_details") private String paymentDetails; //payment_terms.instalment_lump_sum + @JsonProperty("lump_sum") private BigDecimal lumpSum; //payment_terms.effective_date private LocalDate commencing; //payment_terms.jail_days + @JsonProperty("days_in_default") private int daysInDefault; //defendant_account.imposed_hearing_date + @JsonProperty("sentenced_date") private LocalDate sentencedDate; //defendant_accounts.last_enforcement + @JsonProperty("last_enforcement") private String lastEnforcement; //defendant_accounts.enf_override_result_id @@ -82,12 +99,14 @@ public class AccountDetailsDto implements ToJsonString { private Short enforcer; //defendant_accounts.enforcing_court_id + @JsonProperty("enforcement_court") private int enforcementCourt; //defendant_accounts.amount_imposed private BigDecimal imposed; //defendant_accounts.amount_paid + @JsonProperty("amount_paid") private BigDecimal amountPaid; //defendant_accounts.account_balance diff --git a/src/main/java/uk/gov/hmcts/opal/dto/AccountSummaryDto.java b/src/main/java/uk/gov/hmcts/opal/dto/AccountSummaryDto.java index 95f5fef5..d2c4d4b9 100644 --- a/src/main/java/uk/gov/hmcts/opal/dto/AccountSummaryDto.java +++ b/src/main/java/uk/gov/hmcts/opal/dto/AccountSummaryDto.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import java.time.LocalDate; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -15,14 +16,18 @@ @Builder public class AccountSummaryDto implements ToJsonString { /** The primary key to the entity in the database. */ + @JsonProperty("defendant_account_id") private Long defendantAccountId; /** The defendant account number. */ + @JsonProperty("account_no") private String accountNo; /** The name of the defendant, being an aggregation of surname, firstnames and title. */ private String name; /** The date of birth of the defendant. */ + @JsonProperty("date_of_birth") private LocalDate dateOfBirth; /** First line of the defendant's address. */ + @JsonProperty("address_line_1") private String addressLine1; /** The balance on the defendant account. */ private BigDecimal balance; diff --git a/src/main/java/uk/gov/hmcts/opal/dto/AddNoteDto.java b/src/main/java/uk/gov/hmcts/opal/dto/AddNoteDto.java index e72c692b..ceb37695 100644 --- a/src/main/java/uk/gov/hmcts/opal/dto/AddNoteDto.java +++ b/src/main/java/uk/gov/hmcts/opal/dto/AddNoteDto.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.opal.dto; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -13,7 +14,10 @@ @AllArgsConstructor @Jacksonized public class AddNoteDto implements ToJsonString { + @JsonProperty("associated_record_id") private String associatedRecordId; + @JsonProperty("business_unit_id") private Short businessUnitId; + @JsonProperty("note_text") private String noteText; } diff --git a/src/main/java/uk/gov/hmcts/opal/dto/DateDto.java b/src/main/java/uk/gov/hmcts/opal/dto/DateDto.java index 62d6a0bd..50b495f0 100644 --- a/src/main/java/uk/gov/hmcts/opal/dto/DateDto.java +++ b/src/main/java/uk/gov/hmcts/opal/dto/DateDto.java @@ -1,6 +1,7 @@ package uk.gov.hmcts.opal.dto; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -17,7 +18,9 @@ @AllArgsConstructor @Jacksonized public class DateDto { + @JsonProperty("day_of_month") private Integer dayOfMonth; + @JsonProperty("month_of_year") private Integer monthOfYear; private Integer year; diff --git a/src/main/java/uk/gov/hmcts/opal/dto/NoteDto.java b/src/main/java/uk/gov/hmcts/opal/dto/NoteDto.java index 2fe1fe23..d905e040 100644 --- a/src/main/java/uk/gov/hmcts/opal/dto/NoteDto.java +++ b/src/main/java/uk/gov/hmcts/opal/dto/NoteDto.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlRootElement; @@ -24,24 +25,33 @@ @XmlAccessorType(XmlAccessType.FIELD) public class NoteDto implements ToJsonString { + @JsonProperty("note_id") private Long noteId; + @JsonProperty("note_type") private String noteType; + @JsonProperty("associated_record_type") private String associatedRecordType; + @JsonProperty("associated_record_id") private String associatedRecordId; + @JsonProperty("business_unit_id") private Short businessUnitId; + @JsonProperty("note_text") private String noteText; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) + @JsonProperty("posted_date") private LocalDateTime postedDate; + @JsonProperty("posted_by") private String postedBy; + @JsonProperty("posted_by_user_id") private Long postedByUserId; } diff --git a/src/main/java/uk/gov/hmcts/opal/dto/OpalS2SRequestWrapper.java b/src/main/java/uk/gov/hmcts/opal/dto/OpalS2SRequestWrapper.java index 6e2be08b..86302e22 100644 --- a/src/main/java/uk/gov/hmcts/opal/dto/OpalS2SRequestWrapper.java +++ b/src/main/java/uk/gov/hmcts/opal/dto/OpalS2SRequestWrapper.java @@ -1,11 +1,12 @@ package uk.gov.hmcts.opal.dto; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; @Data public class OpalS2SRequestWrapper { + @JsonProperty("external_api_payload") String externalApiPayload; - } diff --git a/src/main/java/uk/gov/hmcts/opal/dto/OpalS2SResponseWrapper.java b/src/main/java/uk/gov/hmcts/opal/dto/OpalS2SResponseWrapper.java index 0415e9da..c83fe3fa 100644 --- a/src/main/java/uk/gov/hmcts/opal/dto/OpalS2SResponseWrapper.java +++ b/src/main/java/uk/gov/hmcts/opal/dto/OpalS2SResponseWrapper.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.opal.dto; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Builder; import lombok.Data; @@ -7,7 +8,9 @@ @Builder public class OpalS2SResponseWrapper { + @JsonProperty("opal_response_payload") String opalResponsePayload; + @JsonProperty("error_detail") String errorDetail; } diff --git a/src/main/java/uk/gov/hmcts/opal/dto/search/AccountSearchDto.java b/src/main/java/uk/gov/hmcts/opal/dto/search/AccountSearchDto.java index 78767bf7..c9eeed7c 100644 --- a/src/main/java/uk/gov/hmcts/opal/dto/search/AccountSearchDto.java +++ b/src/main/java/uk/gov/hmcts/opal/dto/search/AccountSearchDto.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Builder; import lombok.Data; import uk.gov.hmcts.opal.dto.DateDto; @@ -17,24 +18,30 @@ public class AccountSearchDto implements ToJsonString { /** Defendant Surname, Company Name or A/C number. */ private String surname; /** Can be either Defendant, Minor Creditor or Company. */ + @JsonProperty("search_type") private String searchType; /** Defendant Forenames. */ private String forename; /** Defendant Initials. */ private String initials; /** Defendant Date of Birth. */ + @JsonProperty("date_of_birth") private DateDto dateOfBirth; /** Defendant Address. */ + @JsonProperty("address_line") private String addressLine; /** Defendant Postcode. */ private String postcode; /** National Insurance Number. */ + @JsonProperty("ni_number") private String niNumber; /** Prosecutor Case Reference. */ private String pcr; /** Major Creditor account selection. */ + @JsonProperty("major_creditor") private String majorCreditor; /** Unsure. */ + @JsonProperty("till_number") private String tillNumber; @JsonIgnore diff --git a/src/main/java/uk/gov/hmcts/opal/dto/search/AccountSearchResultsDto.java b/src/main/java/uk/gov/hmcts/opal/dto/search/AccountSearchResultsDto.java index 444c1f13..76c82ec9 100644 --- a/src/main/java/uk/gov/hmcts/opal/dto/search/AccountSearchResultsDto.java +++ b/src/main/java/uk/gov/hmcts/opal/dto/search/AccountSearchResultsDto.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Optional; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.EqualsAndHashCode; @@ -23,12 +24,15 @@ public class AccountSearchResultsDto implements ToJsonString { /** The number of AccountSummary objects returned within this response. */ private Integer count; /** The total number of matching Accounts found in the database. */ + @JsonProperty("total_count") private Long totalCount; /** The position of the first AccountSummary in this response within the total search of the database. */ private Integer cursor; /** The maximum number of AccountSummary objects that can be returned in a single search response. */ + @JsonProperty("page_size") private final Integer pageSize = 100; /** A list of AccountSummary objects, limited to a maximum of pageSize. */ + @JsonProperty("search_results") private List searchResults; public static class AccountSearchResultsDtoBuilder { diff --git a/src/main/java/uk/gov/hmcts/opal/entity/AddressCyEntity.java b/src/main/java/uk/gov/hmcts/opal/entity/AddressCyEntity.java index a158367f..61e4fbef 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/AddressCyEntity.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/AddressCyEntity.java @@ -10,10 +10,12 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import lombok.ToString; import lombok.experimental.SuperBuilder; @Data @SuperBuilder +@ToString(callSuper = true) @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = true) diff --git a/src/main/java/uk/gov/hmcts/opal/entity/CourtEntity.java b/src/main/java/uk/gov/hmcts/opal/entity/CourtEntity.java index 2c63128a..94415f0c 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/CourtEntity.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/CourtEntity.java @@ -18,6 +18,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import lombok.ToString; import lombok.experimental.SuperBuilder; @@ -26,6 +27,7 @@ @EqualsAndHashCode(callSuper = true) @Table(name = "courts") @SuperBuilder +@ToString(callSuper = true) @NoArgsConstructor @AllArgsConstructor @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) diff --git a/src/main/java/uk/gov/hmcts/opal/entity/EnforcerEntity.java b/src/main/java/uk/gov/hmcts/opal/entity/EnforcerEntity.java index 4d738955..d1d323f3 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/EnforcerEntity.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/EnforcerEntity.java @@ -18,6 +18,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import lombok.ToString; import lombok.experimental.SuperBuilder; @Data @@ -25,6 +26,7 @@ @EqualsAndHashCode(callSuper = true) @Table(name = "enforcers") @SuperBuilder +@ToString(callSuper = true) @NoArgsConstructor @AllArgsConstructor @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) diff --git a/src/main/java/uk/gov/hmcts/opal/entity/LocalJusticeAreaEntity.java b/src/main/java/uk/gov/hmcts/opal/entity/LocalJusticeAreaEntity.java index eb1107d4..f0bd5218 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/LocalJusticeAreaEntity.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/LocalJusticeAreaEntity.java @@ -20,6 +20,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import lombok.ToString; import lombok.experimental.SuperBuilder; import uk.gov.hmcts.opal.util.LocalDateTimeAdapter; @@ -30,6 +31,7 @@ @EqualsAndHashCode(callSuper = true) @Table(name = "local_justice_areas") @SuperBuilder +@ToString(callSuper = true) @NoArgsConstructor @AllArgsConstructor @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) diff --git a/src/main/java/uk/gov/hmcts/opal/entity/MajorCreditorEntity.java b/src/main/java/uk/gov/hmcts/opal/entity/MajorCreditorEntity.java index 27f16907..c1f056bc 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/MajorCreditorEntity.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/MajorCreditorEntity.java @@ -19,6 +19,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import lombok.ToString; import lombok.experimental.SuperBuilder; @Data @@ -26,6 +27,7 @@ @EqualsAndHashCode(callSuper = true) @Table(name = "major_creditors") @SuperBuilder +@ToString(callSuper = true) @NoArgsConstructor @AllArgsConstructor @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) diff --git a/src/main/java/uk/gov/hmcts/opal/entity/PrisonEntity.java b/src/main/java/uk/gov/hmcts/opal/entity/PrisonEntity.java index 08dee7c8..0e149732 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/PrisonEntity.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/PrisonEntity.java @@ -17,6 +17,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; +import lombok.ToString; import lombok.experimental.SuperBuilder; @Data @@ -24,6 +25,7 @@ @EqualsAndHashCode(callSuper = true) @Table(name = "prisons") @SuperBuilder +@ToString(callSuper = true) @NoArgsConstructor @AllArgsConstructor @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) diff --git a/src/main/java/uk/gov/hmcts/opal/entity/projection/BusinessUnitReferenceData.java b/src/main/java/uk/gov/hmcts/opal/entity/projection/BusinessUnitReferenceData.java index 298823f6..19109825 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/projection/BusinessUnitReferenceData.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/projection/BusinessUnitReferenceData.java @@ -1,21 +1,31 @@ package uk.gov.hmcts.opal.entity.projection; +import com.fasterxml.jackson.annotation.JsonProperty; import uk.gov.hmcts.opal.entity.BusinessUnitRef; import java.util.List; -public record BusinessUnitReferenceData(Short businessUnitId, +public record BusinessUnitReferenceData( + @JsonProperty("business_unit_id") + Short businessUnitId, + + @JsonProperty("business_unit_name") String businessUnitName, + @JsonProperty("business_unit_code") String businessUnitCode, + @JsonProperty("business_unit_type") String businessUnitType, + @JsonProperty("account_number_prefix") String accountNumberPrefix, + @JsonProperty("opal_domain") String opalDomain, + @JsonProperty("welsh_language") Boolean welshLanguage, List configurationItems @@ -26,6 +36,9 @@ public Short getBusinessUnitId() { return businessUnitId; } - public record ConfigItemRefData(String itemName, String itemValue, List itemValues) {} + public record ConfigItemRefData( + @JsonProperty("item_name") String itemName, + @JsonProperty("item_value") String itemValue, + @JsonProperty("item_values") List itemValues) {} } diff --git a/src/main/java/uk/gov/hmcts/opal/entity/projection/CourtReferenceData.java b/src/main/java/uk/gov/hmcts/opal/entity/projection/CourtReferenceData.java index c3888f56..0a46094f 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/projection/CourtReferenceData.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/projection/CourtReferenceData.java @@ -1,6 +1,12 @@ package uk.gov.hmcts.opal.entity.projection; -public record CourtReferenceData(Long courtId, Short businessUnitId, Short courtCode, String name, - String nameCy, String nationalCourtCode) { +import com.fasterxml.jackson.annotation.JsonProperty; +public record CourtReferenceData( + @JsonProperty("court_id") Long courtId, + @JsonProperty("business_unit_id") Short businessUnitId, + @JsonProperty("court_code") Short courtCode, + @JsonProperty("name") String name, + @JsonProperty("name_cy") String nameCy, + @JsonProperty("national_court_code") String nationalCourtCode) { } diff --git a/src/main/java/uk/gov/hmcts/opal/entity/projection/DefendantAccountSummary.java b/src/main/java/uk/gov/hmcts/opal/entity/projection/DefendantAccountSummary.java index 775b8f89..a42975ca 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/projection/DefendantAccountSummary.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/projection/DefendantAccountSummary.java @@ -1,5 +1,6 @@ package uk.gov.hmcts.opal.entity.projection; +import com.fasterxml.jackson.annotation.JsonProperty; import uk.gov.hmcts.opal.entity.FullNameBuilder; import java.math.BigDecimal; @@ -9,29 +10,37 @@ public interface DefendantAccountSummary { /** The defendant account id used as the primary key in the database. */ + @JsonProperty("defendant_account_id") Long getDefendantAccountId(); /** The defendant account number. */ + @JsonProperty("account_number") String getAccountNumber(); /** The balance on the defendant account. */ + @JsonProperty("account_balance") BigDecimal getAccountBalance(); /** The Court (traditionally abbreviated to CT) 'Accounting Division' or 'Metropolitan Area' (MET). */ + @JsonProperty("imposing_court_id") String getImposingCourtId(); + @JsonProperty("parties") Set getParties(); interface PartyLink { + @JsonProperty("party") PartyDefendantAccountSummary getParty(); } interface PartyDefendantAccountSummary extends FullNameBuilder { /** The date of birth of the defendant. */ + @JsonProperty("date_of_birth") LocalDate getDateOfBirth(); /** First line of the defendant's address. */ + @JsonProperty("address_line_1") String getAddressLine1(); } diff --git a/src/main/java/uk/gov/hmcts/opal/entity/projection/EnforcerReferenceData.java b/src/main/java/uk/gov/hmcts/opal/entity/projection/EnforcerReferenceData.java index cbdc7f60..c439b45e 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/projection/EnforcerReferenceData.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/projection/EnforcerReferenceData.java @@ -1,4 +1,10 @@ package uk.gov.hmcts.opal.entity.projection; -public record EnforcerReferenceData(Long enforcerId, Short enforcerCode, String name, String nameCy) { +import com.fasterxml.jackson.annotation.JsonProperty; + +public record EnforcerReferenceData( + @JsonProperty("enforcer_id") Long enforcerId, + @JsonProperty("enforcer_code") Short enforcerCode, + @JsonProperty("name") String name, + @JsonProperty("name_cy") String nameCy) { } diff --git a/src/main/java/uk/gov/hmcts/opal/entity/projection/LjaReferenceData.java b/src/main/java/uk/gov/hmcts/opal/entity/projection/LjaReferenceData.java index b220b098..445a377b 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/projection/LjaReferenceData.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/projection/LjaReferenceData.java @@ -1,14 +1,21 @@ package uk.gov.hmcts.opal.entity.projection; +import com.fasterxml.jackson.annotation.JsonProperty; + public interface LjaReferenceData { + @JsonProperty("local_justice_area_id") Short getLocalJusticeAreaId(); + @JsonProperty("lja_code") String getLjaCode(); + @JsonProperty("name") String getName(); + @JsonProperty("address_line_1") String getAddressLine1(); + @JsonProperty("postcode") String getPostcode(); } diff --git a/src/main/java/uk/gov/hmcts/opal/entity/projection/MajorCreditorReferenceData.java b/src/main/java/uk/gov/hmcts/opal/entity/projection/MajorCreditorReferenceData.java index 0ffbcff4..faf5bfe1 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/projection/MajorCreditorReferenceData.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/projection/MajorCreditorReferenceData.java @@ -1,6 +1,13 @@ package uk.gov.hmcts.opal.entity.projection; -public record MajorCreditorReferenceData(Long majorCreditorId, Short businessUnitId, - String majorCreditorCode, String name, String postcode) { +import com.fasterxml.jackson.annotation.JsonProperty; +import uk.gov.hmcts.opal.dto.ToJsonString; + +public record MajorCreditorReferenceData( + @JsonProperty("major_creditor_id") Long majorCreditorId, + @JsonProperty("business_unit_id") Short businessUnitId, + @JsonProperty("major_creditor_code") String majorCreditorCode, + @JsonProperty("name") String name, + @JsonProperty("postcode") String postcode) implements ToJsonString { } diff --git a/src/main/java/uk/gov/hmcts/opal/entity/projection/OffenceReferenceData.java b/src/main/java/uk/gov/hmcts/opal/entity/projection/OffenceReferenceData.java index 9a9fd191..8642ff26 100644 --- a/src/main/java/uk/gov/hmcts/opal/entity/projection/OffenceReferenceData.java +++ b/src/main/java/uk/gov/hmcts/opal/entity/projection/OffenceReferenceData.java @@ -1,8 +1,17 @@ package uk.gov.hmcts.opal.entity.projection; +import com.fasterxml.jackson.annotation.JsonProperty; + import java.time.LocalDateTime; -public record OffenceReferenceData(Long offenceId, String getCjsCode, Short businessUnitId, - String getOffenceTitle, String getOffenceTitleCy, LocalDateTime dateUsedFrom, LocalDateTime dateUsedTo, - String offenceOas, String offenceOasCy) { +public record OffenceReferenceData( + @JsonProperty("offence_id") Long offenceId, + @JsonProperty("get_cjs_code") String getCjsCode, + @JsonProperty("business_unit_id") Short businessUnitId, + @JsonProperty("offence_title") String offenceTitle, + @JsonProperty("offence_title_cy") String offenceTitleCy, + @JsonProperty("date_used_from") LocalDateTime dateUsedFrom, + @JsonProperty("date_used_to") LocalDateTime dateUsedTo, + @JsonProperty("offence_oas") String offenceOas, + @JsonProperty("offence_oas_cy") String offenceOasCy) { } diff --git a/src/main/java/uk/gov/hmcts/opal/service/opal/DraftAccountService.java b/src/main/java/uk/gov/hmcts/opal/service/opal/DraftAccountService.java index 1ae6a6c9..805743ac 100644 --- a/src/main/java/uk/gov/hmcts/opal/service/opal/DraftAccountService.java +++ b/src/main/java/uk/gov/hmcts/opal/service/opal/DraftAccountService.java @@ -47,7 +47,7 @@ public void deleteDraftAccount(long draftAccountId, Optional ignoreMiss // attempted. So we need to retrieve the entity first and try to access any property. // This will throw an exception if the entity doesn't exist. boolean checkExists = !(ignoreMissing.orElse(false)); - if (checkExists && entity.getDraftAccountId() == null) { + if (checkExists && entity.getCreatedDate() == null) { // Will not get here, as JPA should throw an exception. But for testing, throw an Exception. throw new RuntimeException("Draft Account entity '" + draftAccountId + "' does not exist in the DB."); } else { diff --git a/src/main/java/uk/gov/hmcts/opal/service/opal/MajorCreditorService.java b/src/main/java/uk/gov/hmcts/opal/service/opal/MajorCreditorService.java index e9ebb1a8..8fc0c762 100644 --- a/src/main/java/uk/gov/hmcts/opal/service/opal/MajorCreditorService.java +++ b/src/main/java/uk/gov/hmcts/opal/service/opal/MajorCreditorService.java @@ -2,6 +2,7 @@ import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Page; @@ -20,6 +21,7 @@ import java.util.Optional; @Service +@Slf4j(topic = "MajorCreditorService") @RequiredArgsConstructor @Qualifier("majorCreditorService") public class MajorCreditorService implements MajorCreditorServiceInterface { @@ -48,6 +50,7 @@ public List searchMajorCreditors(MajorCreditorSearchDto cri ) public List getReferenceData(Optional filter, Optional businessUnitId) { + log.info(":getReferenceData: filter: {}, businessUnitId: {}", filter, businessUnitId); Sort nameSort = Sort.by(Sort.Direction.ASC, MajorCreditorEntity_.NAME); Page page = majorCreditorRepository @@ -60,12 +63,15 @@ public List getReferenceData(Optional filter } private MajorCreditorReferenceData toRefData(MajorCreditorEntity entity) { - return new MajorCreditorReferenceData( + log.info(":toRefData: entity: {}", entity); + MajorCreditorReferenceData m = new MajorCreditorReferenceData( entity.getMajorCreditorId(), entity.getBusinessUnit().getBusinessUnitId(), entity.getMajorCreditorCode(), entity.getName(), entity.getPostcode() ); + log.info(":toRefData: refData: \n{}", m.toPrettyJson()); + return m; } } diff --git a/src/main/resources/tempDetailsData.json b/src/main/resources/tempDetailsData.json index 133a1368..8b3a65ef 100644 --- a/src/main/resources/tempDetailsData.json +++ b/src/main/resources/tempDetailsData.json @@ -1,24 +1,24 @@ { - "accountNumber": "123456789", - "fullName": "Mr John K Doe", - "accountCT": "Greater London", + "account_number": "123456789", + "full_name": "Mr John K Doe", + "account_ct": "Greater London", "address": "123 Main Street, Reading, Berkshire", - "postCode": "RG12 0AA", + "post_code": "RG12 0AA", "dob": [1966, 12 , 1], - "detailsChanged": [2020, 11 , 1], - "lastCourtAppAndCourtCode": "20/09/1990 01", - "lastMovement": [2022, 11 , 1], - "commentField": ["Comment 1", "Comment 2"], + "details_changed": [2020, 11 , 1], + "last_court_app_and_court_code": "20/09/1990 01", + "last_movement": [2022, 11 , 1], + "comment_field": ["Comment 1", "Comment 2"], "pcr": "PC123456", - "paymentDetails": "1000/month", - "lumpSum": 500.00, + "payment_details": "1000/month", + "lump_sum": 500.00, "commencing": [2021, 9 , 1], - "daysInDefault": 30, - "lastEnforcement": "lastEn", + "days_in_default": 30, + "last_enforcement": "lastEn", "override": "123456", "enforcer": 1, - "enforcementCourt": 456, + "enforcement_court": 456, "imposed": 2000.00, - "amountPaid": 1000.00, + "amount_paid": 1000.00, "balance": 500.00 } diff --git a/src/main/resources/tempSearchData.json b/src/main/resources/tempSearchData.json index 96747d5e..1f7b233e 100644 --- a/src/main/resources/tempSearchData.json +++ b/src/main/resources/tempSearchData.json @@ -1,906 +1,906 @@ { "count": 100, - "totalCount": 100, + "total_count": 100, "cursor": 0, - "pageSize": 100, - "searchResults": [ + "page_size": 100, + "search_results": [ { - "defendantAccountId" : 1, - "accountNo": "16000621W ", + "defendant_account_id" : 1, + "account_no": "16000621W ", "name": "SMITH, AAA Mr ", - "dateOfBirth": [ 2001, 8, 16 ], - "addressLine1": "ASDF ", + "date_of_birth": [ 2001, 8, 16 ], + "address_line_1": "ASDF ", "balance": 0.34, "court": "West London " }, { - "defendantAccountId" : 2, - "accountNo": "18000027D ", + "defendant_account_id" : 2, + "account_no": "18000027D ", "name": "NORTH, David Mr ", - "dateOfBirth": [ 1995, 8, 16 ], - "addressLine1": "1 St. Kilda Road ", + "date_of_birth": [ 1995, 8, 16 ], + "address_line_1": "1 St. Kilda Road ", "balance": 200.00, "court": "West London " }, { - "defendantAccountId" : 3, - "accountNo": "16000398C ", + "defendant_account_id" : 3, + "account_no": "16000398C ", "name": "Smith, Joe Mr ", - "dateOfBirth": [ 1955, 8, 16 ], - "addressLine1": "123 The Road ", + "date_of_birth": [ 1955, 8, 16 ], + "address_line_1": "123 The Road ", "balance": 1000.00, "court": "West London " }, { - "defendantAccountId" : 4, - "accountNo": "16000379A ", + "defendant_account_id" : 4, + "account_no": "16000379A ", "name": "SOUTH, John Mr ", - "dateOfBirth": [ 1966, 8, 16 ], - "addressLine1": "1 London Rd ", + "date_of_birth": [ 1966, 8, 16 ], + "address_line_1": "1 London Rd ", "balance": 1100.00, "court": "West London " }, { - "defendantAccountId" : 5, - "accountNo": "15000284C ", + "defendant_account_id" : 5, + "account_no": "15000284C ", "name": "Smith, Johnny Mr ", - "dateOfBirth": [ 1989, 8, 16 ], - "addressLine1": "1 dahidsah dhsia ", + "date_of_birth": [ 1989, 8, 16 ], + "address_line_1": "1 dahidsah dhsia ", "balance": 100.00, "court": "West London " }, { - "defendantAccountId" : 6, - "accountNo": "19000245V ", + "defendant_account_id" : 6, + "account_no": "19000245V ", "name": "JOHNSON, Patrick Mr ", - "dateOfBirth": [ 1977, 8, 16 ], - "addressLine1": "55 Queens Road ", + "date_of_birth": [ 1977, 8, 16 ], + "address_line_1": "55 Queens Road ", "balance": 220.00, "court": "West London " }, { - "defendantAccountId" : 7, - "accountNo": "19000258I ", + "defendant_account_id" : 7, + "account_no": "19000258I ", "name": "Smith, Paul Mr ", - "dateOfBirth": [ 1979, 8, 16 ], - "addressLine1": "55 Queens Road ", + "date_of_birth": [ 1979, 8, 16 ], + "address_line_1": "55 Queens Road ", "balance": 100.00, "court": "West London " }, { - "defendantAccountId" : 8, - "accountNo": "15000302N ", + "defendant_account_id" : 8, + "account_no": "15000302N ", "name": "TREE, Rocky Mr ", - "dateOfBirth": [ 1984, 8, 16 ], - "addressLine1": "adsad ", + "date_of_birth": [ 1984, 8, 16 ], + "address_line_1": "adsad ", "balance": 90898.09, "court": "West London " }, { - "defendantAccountId" : 9, - "accountNo": "16000417J ", + "defendant_account_id" : 9, + "account_no": "16000417J ", "name": "SMITH1, Kwame Mr ", - "dateOfBirth": [ 1990, 8, 16 ], - "addressLine1": "Flat 2 ", + "date_of_birth": [ 1990, 8, 16 ], + "address_line_1": "Flat 2 ", "balance": 100.00, "court": "West London " }, { - "defendantAccountId" : 1, - "accountNo": "16000418F ", + "defendant_account_id" : 1, + "account_no": "16000418F ", "name": "GREEN, Ahmed Hady Marian ", - "dateOfBirth": [ 1998, 8, 16 ], - "addressLine1": "Flat 3 ", + "date_of_birth": [ 1998, 8, 16 ], + "address_line_1": "Flat 3 ", "balance": 100.00, "court": "West London " }, { - "defendantAccountId" : 2, - "accountNo": "18000035K ", + "defendant_account_id" : 2, + "account_no": "18000035K ", "name": "Smithen, David Mr ", - "dateOfBirth": [ 2004, 8, 16 ], - "addressLine1": "12 Havens Crescent ", + "date_of_birth": [ 2004, 8, 16 ], + "address_line_1": "12 Havens Crescent ", "balance": 100.67, "court": "West London" }, { - "defendantAccountId" : 3, - "accountNo": "16004421W ", + "defendant_account_id" : 3, + "account_no": "16004421W ", "name": "HARVEY, HHH Mr ", - "dateOfBirth": [ 2009, 8, 16 ], - "addressLine1": "666 ASDF ", + "date_of_birth": [ 2009, 8, 16 ], + "address_line_1": "666 ASDF ", "balance": 9.34, "court": "West London " }, { - "defendantAccountId" : 4, - "accountNo": "18440027D ", + "defendant_account_id" : 4, + "account_no": "18440027D ", "name": "Jones, David Mr ", - "dateOfBirth": [ 1994, 8, 16 ], - "addressLine1": "1 St. Kidde Road ", + "date_of_birth": [ 1994, 8, 16 ], + "address_line_1": "1 St. Kidde Road ", "balance": 206.00, "court": "Westy London " }, { - "defendantAccountId" : 5, - "accountNo": "16220398C ", + "defendant_account_id" : 5, + "account_no": "16220398C ", "name": "PETERS, Mike Mr ", - "dateOfBirth": [ 1953, 8, 16 ], - "addressLine1": "555 The Road ", + "date_of_birth": [ 1953, 8, 16 ], + "address_line_1": "555 The Road ", "balance": 1033.00, "court": "Easton London " }, { - "defendantAccountId" : 6, - "accountNo": "13300379A ", + "defendant_account_id" : 6, + "account_no": "13300379A ", "name": "Smith, James Mr ", - "dateOfBirth": [ 1969, 8, 16 ], - "addressLine1": "155 London Rd ", + "date_of_birth": [ 1969, 8, 16 ], + "address_line_1": "155 London Rd ", "balance": 1199.00, "court": "North London " }, { - "defendantAccountId" : 7, - "accountNo": "15002284C ", + "defendant_account_id" : 7, + "account_no": "15002284C ", "name": "ALLEN, PP Mr ", - "dateOfBirth": [ 1989, 2, 16 ], - "addressLine1": "1 blah dhsia ", + "date_of_birth": [ 1989, 2, 16 ], + "address_line_1": "1 blah dhsia ", "balance": 10099.00, "court": "London Town " }, { - "defendantAccountId" : 8, - "accountNo": "19000245T ", + "defendant_account_id" : 8, + "account_no": "19000245T ", "name": "Smith, Paddy Mr ", - "dateOfBirth": [ 1977, 2, 26 ], - "addressLine1": "55 Kings Road ", + "date_of_birth": [ 1977, 2, 26 ], + "address_line_1": "55 Kings Road ", "balance": 22077.00, "court": "Down London " }, { - "defendantAccountId" : 9, - "accountNo": "19000258I ", + "defendant_account_id" : 9, + "account_no": "19000258I ", "name": "Smitz, Paul Mr ", - "dateOfBirth": [ 1978, 2, 16 ], - "addressLine1": "5588 Queens Road ", + "date_of_birth": [ 1978, 2, 16 ], + "address_line_1": "5588 Queens Road ", "balance": 330.00, "court": "Big London " }, { - "defendantAccountId" : 1, - "accountNo": "88000302N ", + "defendant_account_id" : 1, + "account_no": "88000302N ", "name": "Balboa, Rocky Mr ", - "dateOfBirth": [ 1933, 8, 16 ], - "addressLine1": "The Lane ", + "date_of_birth": [ 1933, 8, 16 ], + "address_line_1": "The Lane ", "balance": 90398.09, "court": "West Town " }, { - "defendantAccountId" : 2, - "accountNo": "16064417J ", + "defendant_account_id" : 2, + "account_no": "16064417J ", "name": "JONES, Kwame Mr ", - "dateOfBirth": [ 1970, 8, 16 ], - "addressLine1": "Flat 2 ", + "date_of_birth": [ 1970, 8, 16 ], + "address_line_1": "Flat 2 ", "balance": 666.00, "court": "Village " }, { - "defendantAccountId" : 3, - "accountNo": "16000418F ", + "defendant_account_id" : 3, + "account_no": "16000418F ", "name": "TALL, Ahmed Hady Marian ", - "dateOfBirth": [ 1998, 8, 16 ], - "addressLine1": "Flat 3 ", + "date_of_birth": [ 1998, 8, 16 ], + "address_line_1": "Flat 3 ", "balance": 777.00, "court": "Town " }, { - "defendantAccountId" : 4, - "accountNo": "18000035K ", + "defendant_account_id" : 4, + "account_no": "18000035K ", "name": "CRABBE, David Mr ", - "dateOfBirth": [ 2004, 8, 16 ], - "addressLine1": "12 Havens Crescent ", + "date_of_birth": [ 2004, 8, 16 ], + "address_line_1": "12 Havens Crescent ", "balance": 199.67, "court": "Hamlet" }, { - "defendantAccountId" : 5, - "accountNo": "16770621W ", + "defendant_account_id" : 5, + "account_no": "16770621W ", "name": "SMITH, BBB Mr ", - "dateOfBirth": [ 2001, 3, 16 ], - "addressLine1": "Here ", + "date_of_birth": [ 2001, 3, 16 ], + "address_line_1": "Here ", "balance": 88.34, "court": "West London East " }, { - "defendantAccountId" : 6, - "accountNo": "18008827D ", + "defendant_account_id" : 6, + "account_no": "18008827D ", "name": "NORTH, Keith Mr ", - "dateOfBirth": [ 1999, 8, 16 ], - "addressLine1": "1 St. Road ", + "date_of_birth": [ 1999, 8, 16 ], + "address_line_1": "1 St. Road ", "balance": 299.00, "court": "Big London " }, { - "defendantAccountId" : 7, - "accountNo": "14400398C ", + "defendant_account_id" : 7, + "account_no": "14400398C ", "name": "Smith, Joey H Mr ", - "dateOfBirth": [ 1958, 8, 16 ], - "addressLine1": "467 The Road ", + "date_of_birth": [ 1958, 8, 16 ], + "address_line_1": "467 The Road ", "balance": 1999.00, "court": "Tall London " }, { - "defendantAccountId" : 8, - "accountNo": "13500379A ", + "defendant_account_id" : 8, + "account_no": "13500379A ", "name": "SOUTH, Liam Mr ", - "dateOfBirth": [ 1962, 8, 16 ], - "addressLine1": "999 London Rd ", + "date_of_birth": [ 1962, 8, 16 ], + "address_line_1": "999 London Rd ", "balance": 1100.33, "court": "Small London " }, { - "defendantAccountId" : 9, - "accountNo": "44000284C ", + "defendant_account_id" : 9, + "account_no": "44000284C ", "name": "Dave, Johnny Mr ", - "dateOfBirth": [ 1984, 2, 16 ], - "addressLine1": "1 2 3 4 5 ", + "date_of_birth": [ 1984, 2, 16 ], + "address_line_1": "1 2 3 4 5 ", "balance": 100.44, "court": "Huge London " }, { - "defendantAccountId" : 1, - "accountNo": "12800245V ", + "defendant_account_id" : 1, + "account_no": "12800245V ", "name": "JOHNSON, Patrick Mrs ", - "dateOfBirth": [ 1977, 2, 16 ], - "addressLine1": "55 Prince Road ", + "date_of_birth": [ 1977, 2, 16 ], + "address_line_1": "55 Prince Road ", "balance": 225.00, "court": "Tiny London " }, { - "defendantAccountId" : 2, - "accountNo": "19230258I ", + "defendant_account_id" : 2, + "account_no": "19230258I ", "name": "Smith, Paully Mr ", - "dateOfBirth": [ 1974, 2, 16 ], - "addressLine1": "55 Duke Road ", + "date_of_birth": [ 1974, 2, 16 ], + "address_line_1": "55 Duke Road ", "balance": 500.00, "court": "Mahoosive London " }, { - "defendantAccountId" : 3, - "accountNo": "15933302N ", + "defendant_account_id" : 3, + "account_no": "15933302N ", "name": "Bush, Rocky Mr ", - "dateOfBirth": [ 1984, 8, 22 ], - "addressLine1": "Address Line 99 ", + "date_of_birth": [ 1984, 8, 22 ], + "address_line_1": "Address Line 99 ", "balance": 9398.09, "court": "Mini London " }, { - "defendantAccountId" : 4, - "accountNo": "16023417J ", + "defendant_account_id" : 4, + "account_no": "16023417J ", "name": "Jezza, Kwame Mr ", - "dateOfBirth": [ 1996, 8, 16 ], - "addressLine1": "Flat 2987 ", + "date_of_birth": [ 1996, 8, 16 ], + "address_line_1": "Flat 2987 ", "balance": 874.00, "court": "Lonely London " }, { - "defendantAccountId" : 5, - "accountNo": "162850418F ", + "defendant_account_id" : 5, + "account_no": "162850418F ", "name": "GREEN, Day of Marian ", - "dateOfBirth": [ 1968, 3, 9 ], - "addressLine1": "Bungalow 3 ", + "date_of_birth": [ 1968, 3, 9 ], + "address_line_1": "Bungalow 3 ", "balance": 7300.00, "court": "Giant London " }, { - "defendantAccountId" : 6, - "accountNo": "19380035K ", + "defendant_account_id" : 6, + "account_no": "19380035K ", "name": "Wolfgang, David Mr ", - "dateOfBirth": [ 2005, 3, 16 ], - "addressLine1": "124 Heavens Crescent ", + "date_of_birth": [ 2005, 3, 16 ], + "address_line_1": "124 Heavens Crescent ", "balance": 9483.67, "court": "Narrow London" }, { - "defendantAccountId" : 7, - "accountNo": "94854421W ", + "defendant_account_id" : 7, + "account_no": "94854421W ", "name": "HARVEY, WWW Mr ", - "dateOfBirth": [ 2009, 4, 25 ], - "addressLine1": "666 Hells Gateway ", + "date_of_birth": [ 2009, 4, 25 ], + "address_line_1": "666 Hells Gateway ", "balance": 7779.34, "court": "Upper London " }, { - "defendantAccountId" : 8, - "accountNo": "12850027D ", + "defendant_account_id" : 8, + "account_no": "12850027D ", "name": "Jones, Mikey Mr ", - "dateOfBirth": [ 1993, 2, 26 ], - "addressLine1": "51 Park Road ", + "date_of_birth": [ 1993, 2, 26 ], + "address_line_1": "51 Park Road ", "balance": 2706.00, "court": "Lower London " }, { - "defendantAccountId" : 9, - "accountNo": "16220398C ", + "defendant_account_id" : 9, + "account_no": "16220398C ", "name": "JAMES, Mike Mr ", - "dateOfBirth": [ 1952, 8, 16 ], - "addressLine1": "777 The Road ", + "date_of_birth": [ 1952, 8, 16 ], + "address_line_1": "777 The Road ", "balance": 7033.00, "court": "Norton London " }, { - "defendantAccountId" : 1, - "accountNo": "18460379A ", + "defendant_account_id" : 1, + "account_no": "18460379A ", "name": "Black, James Mr ", - "dateOfBirth": [ 1966, 8, 16 ], - "addressLine1": "755 London Rd ", + "date_of_birth": [ 1966, 8, 16 ], + "address_line_1": "755 London Rd ", "balance": 3499.00, "court": "Soton London " }, { - "defendantAccountId" : 2, - "accountNo": "15985284C ", + "defendant_account_id" : 2, + "account_no": "15985284C ", "name": "ALLEN, EDF Mr ", - "dateOfBirth": [ 1989, 11, 16 ], - "addressLine1": "1 Hill Rd ", + "date_of_birth": [ 1989, 11, 16 ], + "address_line_1": "1 Hill Rd ", "balance": 18899.00, "court": "Bristol Town " }, { - "defendantAccountId" : 3, - "accountNo": "19830245T ", + "defendant_account_id" : 3, + "account_no": "19830245T ", "name": "White, Paddy Mr ", - "dateOfBirth": [ 1970, 2, 26 ], - "addressLine1": "55 Kings Street ", + "date_of_birth": [ 1970, 2, 26 ], + "address_line_1": "55 Kings Street ", "balance": 23377.00, "court": "Down Bristol " }, { - "defendantAccountId" : 4, - "accountNo": "19000258I ", + "defendant_account_id" : 4, + "account_no": "19000258I ", "name": "Smitz, Wolfgang Mr ", - "dateOfBirth": [ 1978, 12, 26 ], - "addressLine1": "5588 Queens Lane ", + "date_of_birth": [ 1978, 12, 26 ], + "address_line_1": "5588 Queens Lane ", "balance": 33099.00, "court": "Big Reading " }, { - "defendantAccountId" : 5, - "accountNo": "88734302N ", + "defendant_account_id" : 5, + "account_no": "88734302N ", "name": "Balboa, Stoney Mr ", - "dateOfBirth": [ 1933, 10, 22 ], - "addressLine1": "The Lane Road ", + "date_of_birth": [ 1933, 10, 22 ], + "address_line_1": "The Lane Road ", "balance": 9118.09, "court": "West Village " }, { - "defendantAccountId" : 6, - "accountNo": "16764417J ", + "defendant_account_id" : 6, + "account_no": "16764417J ", "name": "JONES, Knight Ser ", - "dateOfBirth": [ 1970, 11, 22 ], - "addressLine1": "Flat 22222222 ", + "date_of_birth": [ 1970, 11, 22 ], + "address_line_1": "Flat 22222222 ", "balance": 66622.00, "court": "Village Village " }, { - "defendantAccountId" : 7, - "accountNo": "16777418F ", + "defendant_account_id" : 7, + "account_no": "16777418F ", "name": "TALL, Jane Marian ", - "dateOfBirth": [ 1998, 10, 11 ], - "addressLine1": "House 3 ", + "date_of_birth": [ 1998, 10, 11 ], + "address_line_1": "House 3 ", "balance": 77723.00, "court": "Town Town " }, { - "defendantAccountId" : 8, - "accountNo": "18876535K ", + "defendant_account_id" : 8, + "account_no": "18876535K ", "name": "CRABBE, Marion Mr ", - "dateOfBirth": [ 2002, 5, 21 ], - "addressLine1": "99 Havens Crescent ", + "date_of_birth": [ 2002, 5, 21 ], + "address_line_1": "99 Havens Crescent ", "balance": 7199.67, "court": "Hamlet Hamlet" }, { - "defendantAccountId" : 9, - "accountNo": "19875245T ", + "defendant_account_id" : 9, + "account_no": "19875245T ", "name": "Grey, Paddy Mr ", - "dateOfBirth": [ 1979, 4, 24 ], - "addressLine1": "99 Kings Ave ", + "date_of_birth": [ 1979, 4, 24 ], + "address_line_1": "99 Kings Ave ", "balance": 26677.00, "court": "Down Cardiff " }, { - "defendantAccountId" : 1, - "accountNo": "19334258I ", + "defendant_account_id" : 1, + "account_no": "19334258I ", "name": "Jonez, Wolfgang Mr ", - "dateOfBirth": [ 1978, 2, 6 ], - "addressLine1": "5588 Queens Boulevard ", + "date_of_birth": [ 1978, 2, 6 ], + "address_line_1": "5588 Queens Boulevard ", "balance": 3369.00, "court": "Low Reading " }, { - "defendantAccountId" : 2, - "accountNo": "88734308T ", + "defendant_account_id" : 2, + "account_no": "88734308T ", "name": "Balboa, Gritty Mr ", - "dateOfBirth": [ 1933, 10, 29 ], - "addressLine1": "The Lane Street ", + "date_of_birth": [ 1933, 10, 29 ], + "address_line_1": "The Lane Street ", "balance": 911.44, "court": "Best Village " }, { - "defendantAccountId" : 3, - "accountNo": "16761117J ", + "defendant_account_id" : 3, + "account_no": "16761117J ", "name": "Lord, Knight Ser ", - "dateOfBirth": [ 1870, 11, 22 ], - "addressLine1": "Flat 3333 ", + "date_of_birth": [ 1870, 11, 22 ], + "address_line_1": "Flat 3333 ", "balance": 77722.00, "court": "Village Town " }, { - "defendantAccountId" : 4, - "accountNo": "16888418F ", + "defendant_account_id" : 4, + "account_no": "16888418F ", "name": "TALL, Jane Michelle ", - "dateOfBirth": [ 1995, 11, 11 ], - "addressLine1": "House 836", + "date_of_birth": [ 1995, 11, 11 ], + "address_line_1": "House 836", "balance": 7423.00, "court": "Town Square City " }, { - "defendantAccountId" : 5, - "accountNo": "12376535K ", + "defendant_account_id" : 5, + "account_no": "12376535K ", "name": "CRABBE, Doreen Miss ", - "dateOfBirth": [ 2003, 5, 1 ], - "addressLine1": "99 Havens Drive ", + "date_of_birth": [ 2003, 5, 1 ], + "address_line_1": "99 Havens Drive ", "balance": 199.67, "court": "Hamlet City" }, { - "defendantAccountId" : 6, - "accountNo": "16000621W ", + "defendant_account_id" : 6, + "account_no": "16000621W ", "name": "SMITH, AAA Mr ", - "dateOfBirth": [ 2001, 8, 16 ], - "addressLine1": "ASDF ", + "date_of_birth": [ 2001, 8, 16 ], + "address_line_1": "ASDF ", "balance": 0.34, "court": "West London " }, { - "defendantAccountId" : 7, - "accountNo": "18000027D ", + "defendant_account_id" : 7, + "account_no": "18000027D ", "name": "NORTH, David Mr ", - "dateOfBirth": [ 1995, 8, 16 ], - "addressLine1": "1 St. Kilda Road ", + "date_of_birth": [ 1995, 8, 16 ], + "address_line_1": "1 St. Kilda Road ", "balance": 200.00, "court": "West London " }, { - "defendantAccountId" : 8, - "accountNo": "16000398C ", + "defendant_account_id" : 8, + "account_no": "16000398C ", "name": "Smith, Joe Mr ", - "dateOfBirth": [ 1955, 8, 16 ], - "addressLine1": "123 The Road ", + "date_of_birth": [ 1955, 8, 16 ], + "address_line_1": "123 The Road ", "balance": 1000.00, "court": "West London " }, { - "defendantAccountId" : 9, - "accountNo": "16000379A ", + "defendant_account_id" : 9, + "account_no": "16000379A ", "name": "SOUTH, John Mr ", - "dateOfBirth": [ 1966, 8, 16 ], - "addressLine1": "1 London Rd ", + "date_of_birth": [ 1966, 8, 16 ], + "address_line_1": "1 London Rd ", "balance": 1100.00, "court": "West London " }, { - "defendantAccountId" : 1, - "accountNo": "15000284C ", + "defendant_account_id" : 1, + "account_no": "15000284C ", "name": "Smith, Johnny Mr ", - "dateOfBirth": [ 1989, 8, 16 ], - "addressLine1": "1 dahidsah dhsia ", + "date_of_birth": [ 1989, 8, 16 ], + "address_line_1": "1 dahidsah dhsia ", "balance": 100.00, "court": "West London " }, { - "defendantAccountId" : 2, - "accountNo": "19000245V ", + "defendant_account_id" : 2, + "account_no": "19000245V ", "name": "JOHNSON, Patrick Mr ", - "dateOfBirth": [ 1977, 8, 16 ], - "addressLine1": "55 Queens Road ", + "date_of_birth": [ 1977, 8, 16 ], + "address_line_1": "55 Queens Road ", "balance": 220.00, "court": "West London " }, { - "defendantAccountId" : 3, - "accountNo": "19000258I ", + "defendant_account_id" : 3, + "account_no": "19000258I ", "name": "Smith, Paul Mr ", - "dateOfBirth": [ 1979, 8, 16 ], - "addressLine1": "55 Queens Road ", + "date_of_birth": [ 1979, 8, 16 ], + "address_line_1": "55 Queens Road ", "balance": 100.00, "court": "West London " }, { - "defendantAccountId" : 4, - "accountNo": "15000302N ", + "defendant_account_id" : 4, + "account_no": "15000302N ", "name": "TREE, Rocky Mr ", - "dateOfBirth": [ 1984, 8, 16 ], - "addressLine1": "adsad ", + "date_of_birth": [ 1984, 8, 16 ], + "address_line_1": "adsad ", "balance": 90898.09, "court": "West London " }, { - "defendantAccountId" : 5, - "accountNo": "16000417J ", + "defendant_account_id" : 5, + "account_no": "16000417J ", "name": "SMITH1, Kwame Mr ", - "dateOfBirth": [ 1990, 8, 16 ], - "addressLine1": "Flat 2 ", + "date_of_birth": [ 1990, 8, 16 ], + "address_line_1": "Flat 2 ", "balance": 100.00, "court": "West London " }, { - "defendantAccountId" : 6, - "accountNo": "16000418F ", + "defendant_account_id" : 6, + "account_no": "16000418F ", "name": "GREEN, Ahmed Hady Marian ", - "dateOfBirth": [ 1998, 8, 16 ], - "addressLine1": "Flat 3 ", + "date_of_birth": [ 1998, 8, 16 ], + "address_line_1": "Flat 3 ", "balance": 100.00, "court": "West London " }, { - "defendantAccountId" : 7, - "accountNo": "18000035K ", + "defendant_account_id" : 7, + "account_no": "18000035K ", "name": "Smithen, David Mr ", - "dateOfBirth": [ 2004, 8, 16 ], - "addressLine1": "12 Havens Crescent ", + "date_of_birth": [ 2004, 8, 16 ], + "address_line_1": "12 Havens Crescent ", "balance": 100.67, "court": "West London" }, { - "defendantAccountId" : 8, - "accountNo": "16004421W ", + "defendant_account_id" : 8, + "account_no": "16004421W ", "name": "HARVEY, HHH Mr ", - "dateOfBirth": [ 2009, 8, 16 ], - "addressLine1": "666 ASDF ", + "date_of_birth": [ 2009, 8, 16 ], + "address_line_1": "666 ASDF ", "balance": 9.34, "court": "West London " }, { - "defendantAccountId" : 9, - "accountNo": "18440027D ", + "defendant_account_id" : 9, + "account_no": "18440027D ", "name": "Jones, David Mr ", - "dateOfBirth": [ 1994, 8, 16 ], - "addressLine1": "1 St. Kidde Road ", + "date_of_birth": [ 1994, 8, 16 ], + "address_line_1": "1 St. Kidde Road ", "balance": 206.00, "court": "Westy London " }, { - "defendantAccountId" : 1, - "accountNo": "16220398C ", + "defendant_account_id" : 1, + "account_no": "16220398C ", "name": "PETERS, Mike Mr ", - "dateOfBirth": [ 1953, 8, 16 ], - "addressLine1": "555 The Road ", + "date_of_birth": [ 1953, 8, 16 ], + "address_line_1": "555 The Road ", "balance": 1033.00, "court": "Easton London " }, { - "defendantAccountId" : 2, - "accountNo": "13300379A ", + "defendant_account_id" : 2, + "account_no": "13300379A ", "name": "Smith, James Mr ", - "dateOfBirth": [ 1969, 8, 16 ], - "addressLine1": "155 London Rd ", + "date_of_birth": [ 1969, 8, 16 ], + "address_line_1": "155 London Rd ", "balance": 1199.00, "court": "North London " }, { - "defendantAccountId" : 3, - "accountNo": "15002284C ", + "defendant_account_id" : 3, + "account_no": "15002284C ", "name": "ALLEN, PP Mr ", - "dateOfBirth": [ 1989, 2, 16 ], - "addressLine1": "1 blah dhsia ", + "date_of_birth": [ 1989, 2, 16 ], + "address_line_1": "1 blah dhsia ", "balance": 10099.00, "court": "London Town " }, { - "defendantAccountId" : 4, - "accountNo": "19000245T ", + "defendant_account_id" : 4, + "account_no": "19000245T ", "name": "Smith, Paddy Mr ", - "dateOfBirth": [ 1977, 2, 26 ], - "addressLine1": "55 Kings Road ", + "date_of_birth": [ 1977, 2, 26 ], + "address_line_1": "55 Kings Road ", "balance": 22077.00, "court": "Down London " }, { - "defendantAccountId" : 5, - "accountNo": "19000258I ", + "defendant_account_id" : 5, + "account_no": "19000258I ", "name": "Smitz, Paul Mr ", - "dateOfBirth": [ 1978, 2, 16 ], - "addressLine1": "5588 Queens Road ", + "date_of_birth": [ 1978, 2, 16 ], + "address_line_1": "5588 Queens Road ", "balance": 330.00, "court": "Big London " }, { - "defendantAccountId" : 6, - "accountNo": "88000302N ", + "defendant_account_id" : 6, + "account_no": "88000302N ", "name": "Balboa, Rocky Mr ", - "dateOfBirth": [ 1933, 8, 16 ], - "addressLine1": "The Lane ", + "date_of_birth": [ 1933, 8, 16 ], + "address_line_1": "The Lane ", "balance": 90398.09, "court": "West Town " }, { - "defendantAccountId" : 7, - "accountNo": "16064417J ", + "defendant_account_id" : 7, + "account_no": "16064417J ", "name": "JONES, Kwame Mr ", - "dateOfBirth": [ 1970, 8, 16 ], - "addressLine1": "Flat 2 ", + "date_of_birth": [ 1970, 8, 16 ], + "address_line_1": "Flat 2 ", "balance": 666.00, "court": "Village " }, { - "defendantAccountId" : 8, - "accountNo": "16000418F ", + "defendant_account_id" : 8, + "account_no": "16000418F ", "name": "TALL, Ahmed Hady Marian ", - "dateOfBirth": [ 1998, 8, 16 ], - "addressLine1": "Flat 3 ", + "date_of_birth": [ 1998, 8, 16 ], + "address_line_1": "Flat 3 ", "balance": 777.00, "court": "Town " }, { - "defendantAccountId" : 9, - "accountNo": "18000035K ", + "defendant_account_id" : 9, + "account_no": "18000035K ", "name": "CRABBE, David Mr ", - "dateOfBirth": [ 2004, 8, 16 ], - "addressLine1": "12 Havens Crescent ", + "date_of_birth": [ 2004, 8, 16 ], + "address_line_1": "12 Havens Crescent ", "balance": 199.67, "court": "Hamlet" }, { - "defendantAccountId" : 1, - "accountNo": "16770621W ", + "defendant_account_id" : 1, + "account_no": "16770621W ", "name": "SMITH, BBB Mr ", - "dateOfBirth": [ 2001, 3, 16 ], - "addressLine1": "Here ", + "date_of_birth": [ 2001, 3, 16 ], + "address_line_1": "Here ", "balance": 88.34, "court": "West London East " }, { - "defendantAccountId" : 2, - "accountNo": "18008827D ", + "defendant_account_id" : 2, + "account_no": "18008827D ", "name": "NORTH, Keith Mr ", - "dateOfBirth": [ 1999, 8, 16 ], - "addressLine1": "1 St. Road ", + "date_of_birth": [ 1999, 8, 16 ], + "address_line_1": "1 St. Road ", "balance": 299.00, "court": "Big London " }, { - "defendantAccountId" : 3, - "accountNo": "14400398C ", + "defendant_account_id" : 3, + "account_no": "14400398C ", "name": "Smith, Joey H Mr ", - "dateOfBirth": [ 1958, 8, 16 ], - "addressLine1": "467 The Road ", + "date_of_birth": [ 1958, 8, 16 ], + "address_line_1": "467 The Road ", "balance": 1999.00, "court": "Tall London " }, { - "defendantAccountId" : 4, - "accountNo": "13500379A ", + "defendant_account_id" : 4, + "account_no": "13500379A ", "name": "SOUTH, Liam Mr ", - "dateOfBirth": [ 1962, 8, 16 ], - "addressLine1": "999 London Rd ", + "date_of_birth": [ 1962, 8, 16 ], + "address_line_1": "999 London Rd ", "balance": 1100.33, "court": "Small London " }, { - "defendantAccountId" : 5, - "accountNo": "44000284C ", + "defendant_account_id" : 5, + "account_no": "44000284C ", "name": "Dave, Johnny Mr ", - "dateOfBirth": [ 1984, 2, 16 ], - "addressLine1": "1 2 3 4 5 ", + "date_of_birth": [ 1984, 2, 16 ], + "address_line_1": "1 2 3 4 5 ", "balance": 100.44, "court": "Huge London " }, { - "defendantAccountId" : 6, - "accountNo": "12800245V ", + "defendant_account_id" : 6, + "account_no": "12800245V ", "name": "JOHNSON, Patrick Mrs ", - "dateOfBirth": [ 1977, 2, 16 ], - "addressLine1": "55 Prince Road ", + "date_of_birth": [ 1977, 2, 16 ], + "address_line_1": "55 Prince Road ", "balance": 225.00, "court": "Tiny London " }, { - "defendantAccountId" : 7, - "accountNo": "19230258I ", + "defendant_account_id" : 7, + "account_no": "19230258I ", "name": "Smith, Paully Mr ", - "dateOfBirth": [ 1974, 2, 16 ], - "addressLine1": "55 Duke Road ", + "date_of_birth": [ 1974, 2, 16 ], + "address_line_1": "55 Duke Road ", "balance": 500.00, "court": "Mahoosive London " }, { - "defendantAccountId" : 8, - "accountNo": "15933302N ", + "defendant_account_id" : 8, + "account_no": "15933302N ", "name": "Bush, Rocky Mr ", - "dateOfBirth": [ 1984, 8, 22 ], - "addressLine1": "Address Line 99 ", + "date_of_birth": [ 1984, 8, 22 ], + "address_line_1": "Address Line 99 ", "balance": 9398.09, "court": "Mini London " }, { - "defendantAccountId" : 9, - "accountNo": "16023417J ", + "defendant_account_id" : 9, + "account_no": "16023417J ", "name": "Jezza, Kwame Mr ", - "dateOfBirth": [ 1996, 8, 16 ], - "addressLine1": "Flat 2987 ", + "date_of_birth": [ 1996, 8, 16 ], + "address_line_1": "Flat 2987 ", "balance": 874.00, "court": "Lonely London " }, { - "defendantAccountId" : 1, - "accountNo": "162850418F ", + "defendant_account_id" : 1, + "account_no": "162850418F ", "name": "GREEN, Day of Marian ", - "dateOfBirth": [ 1968, 3, 9 ], - "addressLine1": "Bungalow 3 ", + "date_of_birth": [ 1968, 3, 9 ], + "address_line_1": "Bungalow 3 ", "balance": 7300.00, "court": "Giant London " }, { - "defendantAccountId" : 2, - "accountNo": "19380035K ", + "defendant_account_id" : 2, + "account_no": "19380035K ", "name": "Wolfgang, David Mr ", - "dateOfBirth": [ 2005, 3, 16 ], - "addressLine1": "124 Heavens Crescent ", + "date_of_birth": [ 2005, 3, 16 ], + "address_line_1": "124 Heavens Crescent ", "balance": 9483.67, "court": "Narrow London" }, { - "defendantAccountId" : 3, - "accountNo": "94854421W ", + "defendant_account_id" : 3, + "account_no": "94854421W ", "name": "HARVEY, WWW Mr ", - "dateOfBirth": [ 2009, 4, 25 ], - "addressLine1": "666 Hells Gateway ", + "date_of_birth": [ 2009, 4, 25 ], + "address_line_1": "666 Hells Gateway ", "balance": 7779.34, "court": "Upper London " }, { - "defendantAccountId" : 4, - "accountNo": "12850027D ", + "defendant_account_id" : 4, + "account_no": "12850027D ", "name": "Jones, Mikey Mr ", - "dateOfBirth": [ 1993, 2, 26 ], - "addressLine1": "51 Park Road ", + "date_of_birth": [ 1993, 2, 26 ], + "address_line_1": "51 Park Road ", "balance": 2706.00, "court": "Lower London " }, { - "defendantAccountId" : 5, - "accountNo": "16220398C ", + "defendant_account_id" : 5, + "account_no": "16220398C ", "name": "JAMES, Mike Mr ", - "dateOfBirth": [ 1952, 8, 16 ], - "addressLine1": "777 The Road ", + "date_of_birth": [ 1952, 8, 16 ], + "address_line_1": "777 The Road ", "balance": 7033.00, "court": "Norton London " }, { - "defendantAccountId" : 6, - "accountNo": "18460379A ", + "defendant_account_id" : 6, + "account_no": "18460379A ", "name": "Black, James Mr ", - "dateOfBirth": [ 1966, 8, 16 ], - "addressLine1": "755 London Rd ", + "date_of_birth": [ 1966, 8, 16 ], + "address_line_1": "755 London Rd ", "balance": 3499.00, "court": "Soton London " }, { - "defendantAccountId" : 7, - "accountNo": "15985284C ", + "defendant_account_id" : 7, + "account_no": "15985284C ", "name": "ALLEN, EDF Mr ", - "dateOfBirth": [ 1989, 11, 16 ], - "addressLine1": "1 Hill Rd ", + "date_of_birth": [ 1989, 11, 16 ], + "address_line_1": "1 Hill Rd ", "balance": 18899.00, "court": "Bristol Town " }, { - "defendantAccountId" : 8, - "accountNo": "19830245T ", + "defendant_account_id" : 8, + "account_no": "19830245T ", "name": "White, Paddy Mr ", - "dateOfBirth": [ 1970, 2, 26 ], - "addressLine1": "55 Kings Street ", + "date_of_birth": [ 1970, 2, 26 ], + "address_line_1": "55 Kings Street ", "balance": 23377.00, "court": "Down Bristol " }, { - "defendantAccountId" : 9, - "accountNo": "19000258I ", + "defendant_account_id" : 9, + "account_no": "19000258I ", "name": "Smitz, Wolfgang Mr ", - "dateOfBirth": [ 1978, 12, 26 ], - "addressLine1": "5588 Queens Lane ", + "date_of_birth": [ 1978, 12, 26 ], + "address_line_1": "5588 Queens Lane ", "balance": 33099.00, "court": "Big Reading " }, { - "defendantAccountId" : 1, - "accountNo": "88734302N ", + "defendant_account_id" : 1, + "account_no": "88734302N ", "name": "Balboa, Stoney Mr ", - "dateOfBirth": [ 1933, 10, 22 ], - "addressLine1": "The Lane Road ", + "date_of_birth": [ 1933, 10, 22 ], + "address_line_1": "The Lane Road ", "balance": 9118.09, "court": "West Village " }, { - "defendantAccountId" : 2, - "accountNo": "16764417J ", + "defendant_account_id" : 2, + "account_no": "16764417J ", "name": "JONES, Knight Ser ", - "dateOfBirth": [ 1970, 11, 22 ], - "addressLine1": "Flat 22222222 ", + "date_of_birth": [ 1970, 11, 22 ], + "address_line_1": "Flat 22222222 ", "balance": 66622.00, "court": "Village Village " }, { - "defendantAccountId" : 3, - "accountNo": "16777418F ", + "defendant_account_id" : 3, + "account_no": "16777418F ", "name": "TALL, Jane Marian ", - "dateOfBirth": [ 1998, 10, 11 ], - "addressLine1": "House 3 ", + "date_of_birth": [ 1998, 10, 11 ], + "address_line_1": "House 3 ", "balance": 77723.00, "court": "Town Town " }, { - "defendantAccountId" : 4, - "accountNo": "18876535K ", + "defendant_account_id" : 4, + "account_no": "18876535K ", "name": "CRABBE, Marion Mr ", - "dateOfBirth": [ 2002, 5, 21 ], - "addressLine1": "99 Havens Crescent ", + "date_of_birth": [ 2002, 5, 21 ], + "address_line_1": "99 Havens Crescent ", "balance": 7199.67, "court": "Hamlet Hamlet" }, { - "defendantAccountId" : 5, - "accountNo": "19875245T ", + "defendant_account_id" : 5, + "account_no": "19875245T ", "name": "Grey, Paddy Mr ", - "dateOfBirth": [ 1979, 4, 24 ], - "addressLine1": "99 Kings Ave ", + "date_of_birth": [ 1979, 4, 24 ], + "address_line_1": "99 Kings Ave ", "balance": 26677.00, "court": "Down Cardiff " }, { - "defendantAccountId" : 6, - "accountNo": "19334258I ", + "defendant_account_id" : 6, + "account_no": "19334258I ", "name": "Jonez, Wolfgang Mr ", - "dateOfBirth": [ 1978, 2, 6 ], - "addressLine1": "5588 Queens Boulevard ", + "date_of_birth": [ 1978, 2, 6 ], + "address_line_1": "5588 Queens Boulevard ", "balance": 3369.00, "court": "Low Reading " }, { - "defendantAccountId" : 7, - "accountNo": "88734308T ", + "defendant_account_id" : 7, + "account_no": "88734308T ", "name": "Balboa, Gritty Mr ", - "dateOfBirth": [ 1933, 10, 29 ], - "addressLine1": "The Lane Street ", + "date_of_birth": [ 1933, 10, 29 ], + "address_line_1": "The Lane Street ", "balance": 911.44, "court": "Best Village " }, { - "defendantAccountId" : 8, - "accountNo": "16761117J ", + "defendant_account_id" : 8, + "account_no": "16761117J ", "name": "Lord, Knight Ser ", - "dateOfBirth": [ 1870, 11, 22 ], - "addressLine1": "Flat 3333 ", + "date_of_birth": [ 1870, 11, 22 ], + "address_line_1": "Flat 3333 ", "balance": 77722.00, "court": "Village Town " }, { - "defendantAccountId" : 9, - "accountNo": "16888418F ", + "defendant_account_id" : 9, + "account_no": "16888418F ", "name": "TALL, Jane Michelle ", - "dateOfBirth": [ 1995, 11, 11 ], - "addressLine1": "House 836", + "date_of_birth": [ 1995, 11, 11 ], + "address_line_1": "House 836", "balance": 7423.00, "court": "Town Square City " }, { - "defendantAccountId" : 1, - "accountNo": "12376535K ", + "defendant_account_id" : 1, + "account_no": "12376535K ", "name": "CRABBE, Doreen Miss ", - "dateOfBirth": [ 2003, 5, 1 ], - "addressLine1": "99 Havens Drive ", + "date_of_birth": [ 2003, 5, 1 ], + "address_line_1": "99 Havens Drive ", "balance": 199.67, "court": "Hamlet City" } diff --git a/src/test/java/uk/gov/hmcts/opal/service/opal/DraftAccountServiceTest.java b/src/test/java/uk/gov/hmcts/opal/service/opal/DraftAccountServiceTest.java index d22b009a..eda47995 100644 --- a/src/test/java/uk/gov/hmcts/opal/service/opal/DraftAccountServiceTest.java +++ b/src/test/java/uk/gov/hmcts/opal/service/opal/DraftAccountServiceTest.java @@ -19,6 +19,7 @@ import uk.gov.hmcts.opal.repository.BusinessUnitRepository; import uk.gov.hmcts.opal.repository.DraftAccountRepository; +import java.time.LocalDateTime; import java.util.List; import java.util.Optional; import java.util.function.Function; @@ -121,7 +122,7 @@ void testSubmitDraftAccounts_fail() { @Test void testDeleteDraftAccount_success() { // Arrange - DraftAccountEntity draftAccountEntity = DraftAccountEntity.builder().draftAccountId(1L).build(); + DraftAccountEntity draftAccountEntity = DraftAccountEntity.builder().createdDate(LocalDateTime.now()).build(); when(draftAccountRepository.getReferenceById(any())).thenReturn(draftAccountEntity); // Act @@ -132,7 +133,7 @@ void testDeleteDraftAccount_success() { void testDeleteDraftAccount_fail1() { // Arrange DraftAccountEntity draftAccountEntity = mock(DraftAccountEntity.class); - when(draftAccountEntity.getDraftAccountId()).thenThrow(new EntityNotFoundException("No Entity in DB")); + when(draftAccountEntity.getCreatedDate()).thenThrow(new EntityNotFoundException("No Entity in DB")); when(draftAccountRepository.getReferenceById(any())).thenReturn(draftAccountEntity); // Act