diff --git a/src/integrationTest/java/uk/gov/hmcts/sptribs/caseworker/event/CaseworkerDocumentManagementAmendIT.java b/src/integrationTest/java/uk/gov/hmcts/sptribs/caseworker/event/CaseworkerDocumentManagementAmendIT.java new file mode 100644 index 0000000000..e7c95678ed --- /dev/null +++ b/src/integrationTest/java/uk/gov/hmcts/sptribs/caseworker/event/CaseworkerDocumentManagementAmendIT.java @@ -0,0 +1,168 @@ +package uk.gov.hmcts.sptribs.caseworker.event; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.web.servlet.MockMvc; +import uk.gov.hmcts.ccd.sdk.type.Document; +import uk.gov.hmcts.sptribs.caseworker.model.CloseCase; +import uk.gov.hmcts.sptribs.ciccase.model.CaseData; +import uk.gov.hmcts.sptribs.ciccase.model.CicCase; +import uk.gov.hmcts.sptribs.common.config.WebMvcConfig; +import uk.gov.hmcts.sptribs.testutil.IdamWireMock; + +import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson; +import static net.javacrumbs.jsonunit.assertj.JsonAssertions.json; +import static net.javacrumbs.jsonunit.core.Option.IGNORING_EXTRA_FIELDS; +import static org.springframework.http.MediaType.APPLICATION_JSON; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static uk.gov.hmcts.sptribs.caseworker.util.EventConstants.CASEWORKER_DOCUMENT_MANAGEMENT_AMEND; +import static uk.gov.hmcts.sptribs.document.model.DocumentType.APPLICATION_FORM; +import static uk.gov.hmcts.sptribs.document.model.DocumentType.WITNESS_STATEMENT; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.ABOUT_TO_START_URL; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.ABOUT_TO_SUBMIT_URL; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.AUTHORIZATION; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.SERVICE_AUTHORIZATION; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.SUBMITTED_URL; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.TEST_AUTHORIZATION_TOKEN; +import static uk.gov.hmcts.sptribs.testutil.TestDataHelper.callbackRequest; +import static uk.gov.hmcts.sptribs.testutil.TestDataHelper.caseData; +import static uk.gov.hmcts.sptribs.testutil.TestDataHelper.getCaseworkerCICDocumentList; +import static uk.gov.hmcts.sptribs.testutil.TestResourceUtil.expectedResponse; + +@ExtendWith(SpringExtension.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@AutoConfigureMockMvc +@ContextConfiguration(initializers = {IdamWireMock.PropertiesInitializer.class}) +@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD) +public class CaseworkerDocumentManagementAmendIT { + + @Autowired + private MockMvc mockMvc; + + @Autowired + private ObjectMapper objectMapper; + + @MockBean + private WebMvcConfig webMvcConfig; + + private static final String CASEWORKER_DOCUMENT_MANAGEMENT_AMEND_ABOUT_TO_START_RESPONSE = + "classpath:responses/caseworker-document-management-amend-about-to-start-response.json"; + private static final String CASEWORKER_DOCUMENT_MANAGEMENT_AMEND_ABOUT_TO_SUBMIT_RESPONSE = + "classpath:responses/caseworker-document-management-amend-about-to-submit-response.json"; + + private static final String CONFIRMATION_HEADER = "$.confirmation_header"; + + @BeforeAll + static void setUp() { + IdamWireMock.start(); + } + + @AfterAll + static void tearDown() { + IdamWireMock.stopAndReset(); + } + + @Test + void shouldPopulateAmendDocumentsListOnAboutToStart() throws Exception { + final CaseData caseData = CaseData.builder() + .cicCase(CicCase.builder() + .applicantDocumentsUploaded(getCaseworkerCICDocumentList("evidence.pdf", APPLICATION_FORM)) + .build() + ) + .closeCase(CloseCase.builder() + .documents(getCaseworkerCICDocumentList()) + .build() + ) + .build(); + + String response = mockMvc.perform(post(ABOUT_TO_START_URL) + .contentType(APPLICATION_JSON) + .header(SERVICE_AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .header(AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .content(objectMapper.writeValueAsString( + callbackRequest( + caseData, + CASEWORKER_DOCUMENT_MANAGEMENT_AMEND))) + .accept(APPLICATION_JSON)) + .andExpect( + status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + assertThatJson(response) + .when(IGNORING_EXTRA_FIELDS) + .isEqualTo(json(expectedResponse(CASEWORKER_DOCUMENT_MANAGEMENT_AMEND_ABOUT_TO_START_RESPONSE))); + } + + @Test + void shouldAmendDocumentsOnAboutToSubmit() throws Exception { + final CaseData caseData = CaseData.builder() + .cicCase(CicCase.builder() + .selectedDocumentType("CASE") + .selectedDocumentEmailContent("some amended email content") + .selectedDocumentLink(Document.builder() + .filename("test.pdf") + .binaryUrl("http://url/") + .url("http://url/") + .build()) + .selectedDocumentCategory(WITNESS_STATEMENT) + .applicantDocumentsUploaded(getCaseworkerCICDocumentList()) + .build() + ) + .build(); + + String response = mockMvc.perform(post(ABOUT_TO_SUBMIT_URL) + .contentType(APPLICATION_JSON) + .header(SERVICE_AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .header(AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .content(objectMapper.writeValueAsString( + callbackRequest( + caseData, + CASEWORKER_DOCUMENT_MANAGEMENT_AMEND))) + .accept(APPLICATION_JSON)) + .andExpect( + status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + assertThatJson(response) + .when(IGNORING_EXTRA_FIELDS) + .isEqualTo(json(expectedResponse(CASEWORKER_DOCUMENT_MANAGEMENT_AMEND_ABOUT_TO_SUBMIT_RESPONSE))); + } + + @Test + void shouldReturnConfirmationMessageOnSubmitted() throws Exception { + String response = mockMvc.perform(post(SUBMITTED_URL) + .contentType(APPLICATION_JSON) + .header(SERVICE_AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .header(AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .content(objectMapper.writeValueAsString( + callbackRequest( + caseData(), + CASEWORKER_DOCUMENT_MANAGEMENT_AMEND))) + .accept(APPLICATION_JSON)) + .andExpect( + status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + assertThatJson(response) + .inPath(CONFIRMATION_HEADER) + .isString() + .contains("# Document Updated"); + } +} diff --git a/src/integrationTest/java/uk/gov/hmcts/sptribs/caseworker/event/CaseworkerDocumentManagementIT.java b/src/integrationTest/java/uk/gov/hmcts/sptribs/caseworker/event/CaseworkerDocumentManagementIT.java new file mode 100644 index 0000000000..309c18ac78 --- /dev/null +++ b/src/integrationTest/java/uk/gov/hmcts/sptribs/caseworker/event/CaseworkerDocumentManagementIT.java @@ -0,0 +1,119 @@ +package uk.gov.hmcts.sptribs.caseworker.event; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.web.servlet.MockMvc; +import uk.gov.hmcts.sptribs.caseworker.model.DocumentManagement; +import uk.gov.hmcts.sptribs.ciccase.model.CaseData; +import uk.gov.hmcts.sptribs.common.config.WebMvcConfig; +import uk.gov.hmcts.sptribs.testutil.IdamWireMock; + +import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson; +import static net.javacrumbs.jsonunit.assertj.JsonAssertions.json; +import static net.javacrumbs.jsonunit.core.Option.IGNORING_EXTRA_FIELDS; +import static org.springframework.http.MediaType.APPLICATION_JSON; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static uk.gov.hmcts.sptribs.caseworker.util.EventConstants.CASEWORKER_DOCUMENT_MANAGEMENT; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.ABOUT_TO_SUBMIT_URL; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.AUTHORIZATION; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.SERVICE_AUTHORIZATION; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.SUBMITTED_URL; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.TEST_AUTHORIZATION_TOKEN; +import static uk.gov.hmcts.sptribs.testutil.TestDataHelper.callbackRequest; +import static uk.gov.hmcts.sptribs.testutil.TestDataHelper.caseData; +import static uk.gov.hmcts.sptribs.testutil.TestDataHelper.getCaseworkerCICDocumentUploadList; +import static uk.gov.hmcts.sptribs.testutil.TestResourceUtil.expectedResponse; + +@ExtendWith(SpringExtension.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@AutoConfigureMockMvc +@ContextConfiguration(initializers = {IdamWireMock.PropertiesInitializer.class}) +@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD) +public class CaseworkerDocumentManagementIT { + + @Autowired + private MockMvc mockMvc; + + @Autowired + private ObjectMapper objectMapper; + + @MockBean + private WebMvcConfig webMvcConfig; + + private static final String CASEWORKER_DOCUMENT_MANAGEMENT_ABOUT_TO_SUBMIT_RESPONSE = + "classpath:responses/caseworker-document-management-about-to-submit-response.json"; + + private static final String CONFIRMATION_HEADER = "$.confirmation_header"; + + @BeforeAll + static void setUp() { + IdamWireMock.start(); + } + + @AfterAll + static void tearDown() { + IdamWireMock.stopAndReset(); + } + + @Test + void shouldAddNewDocumentToAllCaseworkerCICDocumentListOnAboutToSubmit() throws Exception { + final CaseData caseData = caseData(); + DocumentManagement documentManagement = DocumentManagement.builder() + .caseworkerCICDocumentUpload(getCaseworkerCICDocumentUploadList("file.pdf")) + .build(); + caseData.setNewDocManagement(documentManagement); + + String response = mockMvc.perform(post(ABOUT_TO_SUBMIT_URL) + .contentType(APPLICATION_JSON) + .header(SERVICE_AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .header(AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .content(objectMapper.writeValueAsString( + callbackRequest( + caseData, + CASEWORKER_DOCUMENT_MANAGEMENT))) + .accept(APPLICATION_JSON)) + .andExpect( + status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + assertThatJson(response) + .when(IGNORING_EXTRA_FIELDS) + .isEqualTo(json(expectedResponse(CASEWORKER_DOCUMENT_MANAGEMENT_ABOUT_TO_SUBMIT_RESPONSE))); + } + + @Test + void shouldReturnConfirmationMessageOnSubmitted() throws Exception { + String response = mockMvc.perform(post(SUBMITTED_URL) + .contentType(APPLICATION_JSON) + .header(SERVICE_AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .header(AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .content(objectMapper.writeValueAsString( + callbackRequest( + caseData(), + CASEWORKER_DOCUMENT_MANAGEMENT))) + .accept(APPLICATION_JSON)) + .andExpect( + status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + assertThatJson(response) + .inPath(CONFIRMATION_HEADER) + .isString() + .contains("# Case Updated"); + } +} diff --git a/src/integrationTest/java/uk/gov/hmcts/sptribs/caseworker/event/CaseworkerDocumentManagementRemoveIT.java b/src/integrationTest/java/uk/gov/hmcts/sptribs/caseworker/event/CaseworkerDocumentManagementRemoveIT.java new file mode 100644 index 0000000000..dd0cbd4321 --- /dev/null +++ b/src/integrationTest/java/uk/gov/hmcts/sptribs/caseworker/event/CaseworkerDocumentManagementRemoveIT.java @@ -0,0 +1,188 @@ +package uk.gov.hmcts.sptribs.caseworker.event; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.web.servlet.MockMvc; +import uk.gov.hmcts.ccd.sdk.type.Document; +import uk.gov.hmcts.ccd.sdk.type.ListValue; +import uk.gov.hmcts.sptribs.caseworker.model.CaseIssueDecision; +import uk.gov.hmcts.sptribs.caseworker.model.CaseIssueFinalDecision; +import uk.gov.hmcts.sptribs.caseworker.model.CloseCase; +import uk.gov.hmcts.sptribs.caseworker.model.Order; +import uk.gov.hmcts.sptribs.ciccase.model.CaseData; +import uk.gov.hmcts.sptribs.ciccase.model.CicCase; +import uk.gov.hmcts.sptribs.common.config.WebMvcConfig; +import uk.gov.hmcts.sptribs.document.model.CICDocument; +import uk.gov.hmcts.sptribs.testutil.IdamWireMock; + +import java.util.List; + +import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson; +import static net.javacrumbs.jsonunit.assertj.JsonAssertions.json; +import static net.javacrumbs.jsonunit.core.Option.IGNORING_EXTRA_FIELDS; +import static org.springframework.http.MediaType.APPLICATION_JSON; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static uk.gov.hmcts.sptribs.caseworker.util.EventConstants.CASEWORKER_DOCUMENT_MANAGEMENT_AMEND; +import static uk.gov.hmcts.sptribs.caseworker.util.EventConstants.CASEWORKER_DOCUMENT_MANAGEMENT_REMOVE; +import static uk.gov.hmcts.sptribs.document.model.DocumentType.APPLICATION_FORM; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.ABOUT_TO_START_URL; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.ABOUT_TO_SUBMIT_URL; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.AUTHORIZATION; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.SERVICE_AUTHORIZATION; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.SUBMITTED_URL; +import static uk.gov.hmcts.sptribs.testutil.TestConstants.TEST_AUTHORIZATION_TOKEN; +import static uk.gov.hmcts.sptribs.testutil.TestDataHelper.callbackRequest; +import static uk.gov.hmcts.sptribs.testutil.TestDataHelper.caseData; +import static uk.gov.hmcts.sptribs.testutil.TestDataHelper.getCICDocumentList; +import static uk.gov.hmcts.sptribs.testutil.TestDataHelper.getCaseworkerCICDocumentList; +import static uk.gov.hmcts.sptribs.testutil.TestResourceUtil.expectedResponse; + +@ExtendWith(SpringExtension.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@AutoConfigureMockMvc +@ContextConfiguration(initializers = {IdamWireMock.PropertiesInitializer.class}) +@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD) +public class CaseworkerDocumentManagementRemoveIT { + + @Autowired + private MockMvc mockMvc; + + @Autowired + private ObjectMapper objectMapper; + + @MockBean + private WebMvcConfig webMvcConfig; + + private static final String CASEWORKER_DOCUMENT_MANAGEMENT_REMOVE_ABOUT_TO_START_RESPONSE = + "classpath:responses/caseworker-document-management-remove-about-to-start-response.json"; + + private static final String CONFIRMATION_HEADER = "$.confirmation_header"; + + @BeforeAll + static void setUp() { + IdamWireMock.start(); + } + + @AfterAll + static void tearDown() { + IdamWireMock.stopAndReset(); + } + + @Test + void shouldPopulateDocumentListsInCicCaseDataObjectOnAboutToStart() throws Exception { + final Order order = Order.builder() + .uploadedFile(getCICDocumentList("test.pdf")) + .build(); + final ListValue orderListValue = new ListValue<>(); + orderListValue.setValue(order); + final CICDocument doc = CICDocument.builder() + .documentLink(Document.builder() + .url("url1") + .binaryUrl("url1") + .filename("name1") + .build() + ).build(); + final CaseData caseData = CaseData.builder() + .cicCase(CicCase.builder() + .orderList(List.of(orderListValue)) + .applicantDocumentsUploaded(getCaseworkerCICDocumentList("evidence.pdf", APPLICATION_FORM)) + .build() + ) + .closeCase(CloseCase.builder() + .documents(getCaseworkerCICDocumentList()) + .build() + ) + .caseIssueFinalDecision(CaseIssueFinalDecision.builder() + .document(doc) + .build() + ) + .caseIssueDecision(CaseIssueDecision.builder() + .decisionDocument(doc) + .build() + ) + .build(); + + String response = mockMvc.perform(post(ABOUT_TO_START_URL) + .contentType(APPLICATION_JSON) + .header(SERVICE_AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .header(AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .content(objectMapper.writeValueAsString( + callbackRequest( + caseData, + CASEWORKER_DOCUMENT_MANAGEMENT_AMEND))) + .accept(APPLICATION_JSON)) + .andExpect( + status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + assertThatJson(response) + .when(IGNORING_EXTRA_FIELDS) + .isEqualTo(json(expectedResponse(CASEWORKER_DOCUMENT_MANAGEMENT_REMOVE_ABOUT_TO_START_RESPONSE))); + } + + @Test + void shouldClearRemovedDocumentListOnAboutToSubmit() throws Exception { + final CaseData caseData = CaseData.builder() + .cicCase(CicCase.builder() + .removedDocumentList(getCaseworkerCICDocumentList()) + .build() + ) + .build(); + + String response = mockMvc.perform(post(ABOUT_TO_SUBMIT_URL) + .contentType(APPLICATION_JSON) + .header(SERVICE_AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .header(AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .content(objectMapper.writeValueAsString( + callbackRequest( + caseData, + CASEWORKER_DOCUMENT_MANAGEMENT_REMOVE))) + .accept(APPLICATION_JSON)) + .andExpect( + status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + assertThatJson(response) + .inPath("$.data.cicCaseRemovedDocumentList") + .isArray() + .isEmpty(); + } + + @Test + void shouldReturnConfirmationMessageOnSubmitted() throws Exception { + String response = mockMvc.perform(post(SUBMITTED_URL) + .contentType(APPLICATION_JSON) + .header(SERVICE_AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .header(AUTHORIZATION, TEST_AUTHORIZATION_TOKEN) + .content(objectMapper.writeValueAsString( + callbackRequest( + caseData(), + CASEWORKER_DOCUMENT_MANAGEMENT_REMOVE))) + .accept(APPLICATION_JSON)) + .andExpect( + status().isOk()) + .andReturn() + .getResponse() + .getContentAsString(); + + assertThatJson(response) + .inPath(CONFIRMATION_HEADER) + .isString() + .contains("# Case Updated"); + } +} diff --git a/src/integrationTest/java/uk/gov/hmcts/sptribs/caseworker/event/CaseworkerIssueCaseIT.java b/src/integrationTest/java/uk/gov/hmcts/sptribs/caseworker/event/CaseworkerIssueCaseIT.java index 5a1b0affe9..2eedf1ae1b 100644 --- a/src/integrationTest/java/uk/gov/hmcts/sptribs/caseworker/event/CaseworkerIssueCaseIT.java +++ b/src/integrationTest/java/uk/gov/hmcts/sptribs/caseworker/event/CaseworkerIssueCaseIT.java @@ -87,5 +87,4 @@ void shouldSuccessfullyAIssueCase() throws Exception { content().json(expectedResponse(CASEWORKER_ISSUE_CASE_RESPONSE)) ); } - } diff --git a/src/integrationTest/resources/responses/caseworker-document-management-about-to-submit-response.json b/src/integrationTest/resources/responses/caseworker-document-management-about-to-submit-response.json new file mode 100644 index 0000000000..73b68b36cd --- /dev/null +++ b/src/integrationTest/resources/responses/caseworker-document-management-about-to-submit-response.json @@ -0,0 +1,17 @@ +{ + "data": { + "allCaseworkerCICDocument": [ + { + "value": { + "documentCategory": "Linked docs", + "documentEmailContent": "some email content", + "documentLink": { + "document_filename": "file.pdf", + "category_id": "L" + }, + "date": "${json-unit.any-string}" + } + } + ] + } +} diff --git a/src/integrationTest/resources/responses/caseworker-document-management-amend-about-to-start-response.json b/src/integrationTest/resources/responses/caseworker-document-management-amend-about-to-start-response.json new file mode 100644 index 0000000000..4e6bdd2abd --- /dev/null +++ b/src/integrationTest/resources/responses/caseworker-document-management-amend-about-to-start-response.json @@ -0,0 +1,40 @@ +{ + "data": { + "cicCaseAmendDocumentList": { + "list_items": [ + { + "code": "${json-unit.any-string}", + "label": "CASE--evidence.pdf--A - Application Form" + }, + { + "code": "${json-unit.any-string}", + "label": "CLOSE-CASE--test.pdf--L - Linked docs" + } + ] + }, + "cicCaseApplicantDocumentsUploaded": [ + { + "value": { + "documentCategory": "ApplicationForm", + "documentEmailContent": "some email content", + "documentLink": { + "document_filename": "evidence.pdf" + } + } + } + ], + "closeDocuments": [ + { + "value": { + "documentCategory": "Linked docs", + "documentEmailContent": "some email content", + "documentLink": { + "document_url": "http://url/", + "document_filename": "test.pdf", + "document_binary_url": "http://url/" + } + } + } + ] + } +} diff --git a/src/integrationTest/resources/responses/caseworker-document-management-amend-about-to-submit-response.json b/src/integrationTest/resources/responses/caseworker-document-management-amend-about-to-submit-response.json new file mode 100644 index 0000000000..44d39c9ebc --- /dev/null +++ b/src/integrationTest/resources/responses/caseworker-document-management-amend-about-to-submit-response.json @@ -0,0 +1,18 @@ +{ + "data": { + "cicCaseSelectedDocumentType": "CASE", + "cicCaseApplicantDocumentsUploaded": [ + { + "value": { + "documentCategory": "Witness Statement", + "documentEmailContent": "some amended email content", + "documentLink": { + "document_url": "http://url/", + "document_filename": "test.pdf", + "document_binary_url": "http://url/" + } + } + } + ] + } +} diff --git a/src/integrationTest/resources/responses/caseworker-document-management-remove-about-to-start-response.json b/src/integrationTest/resources/responses/caseworker-document-management-remove-about-to-start-response.json new file mode 100644 index 0000000000..5813e55cae --- /dev/null +++ b/src/integrationTest/resources/responses/caseworker-document-management-remove-about-to-start-response.json @@ -0,0 +1,70 @@ +{ + "data": { + "cicCaseOrderList": [ + { + "value": { + "uploadedFile": [ + { + "value": { + "documentEmailContent": "some email content", + "documentLink": { + "document_filename": "test.pdf" + } + } + } + ] + } + } + ], + "cicCaseAmendDocumentList": { + "list_items": [ + { + "code": "${json-unit.any-string}", + "label": "CASE--evidence.pdf--A - Application Form" + }, + { + "code": "${json-unit.any-string}", + "label": "CLOSE-CASE--test.pdf--L - Linked docs" + } + ] + }, + "cicCaseApplicantDocumentsUploaded": [ + { + "value": { + "documentCategory": "ApplicationForm", + "documentEmailContent": "some email content", + "documentLink": { + "document_filename": "evidence.pdf" + } + } + } + ], + "caseIssueDecisionDecisionDocument": { + "documentLink": { + "document_url": "url1", + "document_filename": "name1", + "document_binary_url": "url1" + } + }, + "caseIssueFinalDecisionDocument": { + "documentLink": { + "document_url": "url1", + "document_filename": "name1", + "document_binary_url": "url1" + } + }, + "closeDocuments": [ + { + "value": { + "documentCategory": "Linked docs", + "documentEmailContent": "some email content", + "documentLink": { + "document_url": "http://url/", + "document_filename": "test.pdf", + "document_binary_url": "http://url/" + } + } + } + ] + } +}