Search in sources :

Example 1 with SolsAddress

use of uk.gov.hmcts.probate.model.ccd.raw.SolsAddress in project probate-back-office by hmcts.

the class DeceasedAddressValidationRule method validate.

@Override
public List<FieldErrorResponse> validate(CCDData ccdData) {
    Set<FieldErrorResponse> errors = new HashSet<>();
    SolsAddress address = ccdData.getDeceased().getAddress();
    if (address == null || Strings.isNullOrEmpty(address.getAddressLine1())) {
        errors.add(businessValidationMessageService.generateError(BUSINESS_ERROR, "deceasedAddressIsNull"));
    }
    return new ArrayList<>(errors);
}
Also used : SolsAddress(uk.gov.hmcts.probate.model.ccd.raw.SolsAddress) ArrayList(java.util.ArrayList) FieldErrorResponse(uk.gov.hmcts.probate.exception.model.FieldErrorResponse) HashSet(java.util.HashSet)

Example 2 with SolsAddress

use of uk.gov.hmcts.probate.model.ccd.raw.SolsAddress in project probate-back-office by hmcts.

the class BusinessValidationControllerTest method setup.

@Before
public void setup() {
    mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
    OBJECT_MAPPER.registerModule(new JavaTimeModule());
    SolsAddress solsAddress = SolsAddress.builder().addressLine1(SOLICITOR_FIRM_LINE1).postCode(SOLICITOR_FIRM_POSTCODE).build();
    caseDataBuilder = CaseData.builder().deceasedDateOfBirth(DOB).deceasedDateOfDeath(DOD).deceasedForenames(FORENAME).deceasedSurname(SURNAME).deceasedAddress(DECEASED_ADDRESS).deceasedAnyOtherNames(DECEASED_OTHER_NAMES).deceasedDomicileInEngWales(DECEASED_DOM_UK).primaryApplicantForenames(PRIMARY_FORENAMES).primaryApplicantSurname(PRIMARY_SURNAME).primaryApplicantAddress(PRIMARY_ADDRESS).primaryApplicantIsApplying(PRIMARY_APPLICANT_APPLYING).primaryApplicantHasAlias(PRIMARY_APPLICANT_HAS_ALIAS).otherExecutorExists(OTHER_EXEC_EXISTS).solsWillType(WILL_TYPE_PROBATE).willExists(WILL_EXISTS).willAccessOriginal(WILL_ACCESS_ORIGINAL).ihtNetValue(NET).ihtGrossValue(GROSS).solsSolicitorAppReference(SOLICITOR_APP_REFERENCE).willHasCodicils(WILL_HAS_CODICILS).willNumberOfCodicils(NUMBER_OF_CODICILS).solsSolicitorFirmName(SOLICITOR_FIRM_NAME).solsSolicitorAddress(solsAddress).ukEstate(UK_ESTATE).willDispose(YES).englishWill(NO).appointExec(YES).ihtFormId(IHT_FORM).solsSOTForenames(SOLICITOR_FORENAMES).solsSOTSurname(SOLICITOR_SURNAME).solsSolicitorIsExec(YES).solsSolicitorIsApplying(YES).solsSolicitorNotApplyingReason(SOLS_NOT_APPLYING_REASON).solsSOTJobTitle(SOLICITOR_JOB_TITLE).solsPaymentMethods(PAYMENT_METHOD).solsPBANumber(DynamicList.builder().value(DynamicListItem.builder().code("PBA1234").build()).build()).applicationFee(APPLICATION_FEE).feeForUkCopies(FEE_FOR_UK_COPIES).feeForNonUkCopies(FEE_FOR_NON_UK_COPIES).extraCopiesOfGrant(EXTRA_UK).outsideUKGrantCopies(EXTRA_OUTSIDE_UK).totalFee(TOTAL_FEE).scannedDocuments(SCANNED_DOCUMENTS_LIST);
    OrganisationEntityResponse organisationEntityResponse = new OrganisationEntityResponse();
    organisationEntityResponse.setOrganisationIdentifier("ORG_ID");
    organisationEntityResponse.setName("ORGANISATION_NAME");
    doReturn(organisationEntityResponse).when(organisationsRetrievalService).getOrganisationEntity(AUTH_TOKEN);
}
Also used : SolsAddress(uk.gov.hmcts.probate.model.ccd.raw.SolsAddress) JavaTimeModule(com.fasterxml.jackson.datatype.jsr310.JavaTimeModule) OrganisationEntityResponse(uk.gov.hmcts.probate.model.payments.pba.OrganisationEntityResponse) Before(org.junit.Before)

Example 3 with SolsAddress

use of uk.gov.hmcts.probate.model.ccd.raw.SolsAddress in project probate-back-office by hmcts.

the class BulkPrintServiceTest method testSuccessfulSendToBulkPrintWithSixExtraCopies.

@Test
public void testSuccessfulSendToBulkPrintWithSixExtraCopies() {
    SolsAddress address = SolsAddress.builder().addressLine1("Address 1").addressLine2("Address 2").postCode("EC2").country("UK").build();
    CaseData caseData = CaseData.builder().primaryApplicantForenames("first").primaryApplicantSurname("last").primaryApplicantAddress(address).extraCopiesOfGrant(6L).build();
    CallbackRequest callbackRequest = new CallbackRequest(new CaseDetails(caseData, null, 0L));
    DocumentLink documentLink = DocumentLink.builder().documentUrl("http://localhost").build();
    Document document = Document.builder().documentFileName("test.pdf").documentGeneratedBy("test").documentType(DocumentType.DIGITAL_GRANT).documentDateAdded(LocalDate.now()).documentLink(documentLink).build();
    Document coverSheet = Document.builder().documentFileName("test.pdf").documentGeneratedBy("test").documentDateAdded(LocalDate.now()).documentLink(documentLink).build();
    UUID uuid = UUID.randomUUID();
    SendLetterResponse sendLetterResponse = new SendLetterResponse(uuid);
    when(sendLetterApiMock.sendLetter(anyString(), any(LetterV3.class))).thenReturn(sendLetterResponse);
    when(documentTransformer.hasDocumentWithType(Collections.singletonList(document), DocumentType.DIGITAL_GRANT)).thenReturn(true);
    SendLetterResponse response = bulkPrintService.sendToBulkPrintForGrant(callbackRequest, document, coverSheet);
    verify(sendLetterApiMock).sendLetter(anyString(), any(LetterV3.class));
    assertNotNull(response);
    assertThat(response.letterId, is(uuid));
}
Also used : LetterV3(uk.gov.hmcts.reform.sendletter.api.model.v3.LetterV3) CallbackRequest(uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest) CaveatCallbackRequest(uk.gov.hmcts.probate.model.ccd.caveat.request.CaveatCallbackRequest) ResponseCaseData(uk.gov.hmcts.probate.model.ccd.raw.response.ResponseCaseData) CaseData(uk.gov.hmcts.probate.model.ccd.raw.request.CaseData) SolsAddress(uk.gov.hmcts.probate.model.ccd.raw.SolsAddress) CaseDetails(uk.gov.hmcts.probate.model.ccd.raw.request.CaseDetails) Document(uk.gov.hmcts.probate.model.ccd.raw.Document) UUID(java.util.UUID) DocumentLink(uk.gov.hmcts.probate.model.ccd.raw.DocumentLink) SendLetterResponse(uk.gov.hmcts.reform.sendletter.api.SendLetterResponse) Test(org.junit.Test)

Example 4 with SolsAddress

use of uk.gov.hmcts.probate.model.ccd.raw.SolsAddress in project probate-back-office by hmcts.

the class BulkPrintServiceTest method sendToBulkPrintWith50ExtraCopiesWIG.

@Test
public void sendToBulkPrintWith50ExtraCopiesWIG() {
    SolsAddress address = SolsAddress.builder().addressLine1("Address 1").addressLine2("Address 2").postCode("EC2").country("UK").build();
    CaseData caseData = CaseData.builder().primaryApplicantForenames("first").primaryApplicantSurname("last").primaryApplicantAddress(address).extraCopiesOfGrant(50L).build();
    CallbackRequest callbackRequest = new CallbackRequest(new CaseDetails(caseData, null, 0L));
    DocumentLink documentLink = DocumentLink.builder().documentUrl("http://localhost").build();
    Document document = Document.builder().documentFileName("test.pdf").documentGeneratedBy("test").documentType(DocumentType.WELSH_INTESTACY_GRANT).documentDateAdded(LocalDate.now()).documentLink(documentLink).build();
    Document coverSheet = Document.builder().documentFileName("test.pdf").documentGeneratedBy("test").documentDateAdded(LocalDate.now()).documentLink(documentLink).build();
    UUID uuid = UUID.randomUUID();
    SendLetterResponse sendLetterResponse = new SendLetterResponse(uuid);
    when(sendLetterApiMock.sendLetter(anyString(), any(LetterV3.class))).thenReturn(sendLetterResponse);
    when(documentTransformer.hasDocumentWithType(Collections.singletonList(document), DocumentType.WELSH_INTESTACY_GRANT)).thenReturn(true);
    SendLetterResponse response = bulkPrintService.sendToBulkPrintForGrant(callbackRequest, document, coverSheet);
    verify(sendLetterApiMock).sendLetter(anyString(), any(LetterV3.class));
    assertNotNull(response);
    assertThat(response.letterId, is(uuid));
}
Also used : LetterV3(uk.gov.hmcts.reform.sendletter.api.model.v3.LetterV3) CallbackRequest(uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest) CaveatCallbackRequest(uk.gov.hmcts.probate.model.ccd.caveat.request.CaveatCallbackRequest) ResponseCaseData(uk.gov.hmcts.probate.model.ccd.raw.response.ResponseCaseData) CaseData(uk.gov.hmcts.probate.model.ccd.raw.request.CaseData) SolsAddress(uk.gov.hmcts.probate.model.ccd.raw.SolsAddress) CaseDetails(uk.gov.hmcts.probate.model.ccd.raw.request.CaseDetails) Document(uk.gov.hmcts.probate.model.ccd.raw.Document) UUID(java.util.UUID) DocumentLink(uk.gov.hmcts.probate.model.ccd.raw.DocumentLink) SendLetterResponse(uk.gov.hmcts.reform.sendletter.api.SendLetterResponse) Test(org.junit.Test)

Example 5 with SolsAddress

use of uk.gov.hmcts.probate.model.ccd.raw.SolsAddress in project probate-back-office by hmcts.

the class BulkPrintServiceTest method shouldSendToBulkPrintForReprint.

@Test
public void shouldSendToBulkPrintForReprint() {
    SolsAddress address = SolsAddress.builder().addressLine1("Address 1").addressLine2("Address 2").postCode("EC2").country("UK").build();
    CaseData caseData = CaseData.builder().primaryApplicantForenames("first").primaryApplicantSurname("last").primaryApplicantAddress(address).reprintNumberOfCopies("10").build();
    CallbackRequest callbackRequest = new CallbackRequest(new CaseDetails(caseData, null, 0L));
    DocumentLink documentLink = DocumentLink.builder().documentUrl("http://localhost").build();
    Document grant = Document.builder().documentFileName("test.pdf").documentGeneratedBy("test").documentType(DocumentType.DIGITAL_GRANT).documentDateAdded(LocalDate.now()).documentLink(documentLink).build();
    Document coverSheet = Document.builder().documentFileName("test.pdf").documentGeneratedBy("test").documentDateAdded(LocalDate.now()).documentLink(documentLink).build();
    UUID uuid = UUID.randomUUID();
    SendLetterResponse sendLetterResponse = new SendLetterResponse(uuid);
    List<String> errors = new ArrayList<>();
    CallbackResponse callbackResponse = CallbackResponse.builder().data(responseCaseData).errors(errors).build();
    when(sendLetterApiMock.sendLetter(anyString(), letterV3ArgumentCaptor.capture())).thenReturn(sendLetterResponse);
    when(eventValidationService.validateBulkPrintResponse(eq(uuid.toString()), any())).thenReturn(callbackResponse);
    SendLetterResponse response = bulkPrintService.sendDocumentsForReprint(callbackRequest, grant, coverSheet);
    assertEquals(sendLetterResponse, response);
    assertEquals(1, letterV3ArgumentCaptor.getValue().documents.get(0).copies);
    assertEquals(10, letterV3ArgumentCaptor.getValue().documents.get(1).copies);
    verify(sendLetterApiMock).sendLetter(anyString(), any(LetterV3.class));
}
Also used : CallbackRequest(uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest) CaveatCallbackRequest(uk.gov.hmcts.probate.model.ccd.caveat.request.CaveatCallbackRequest) ResponseCaseData(uk.gov.hmcts.probate.model.ccd.raw.response.ResponseCaseData) CaseData(uk.gov.hmcts.probate.model.ccd.raw.request.CaseData) SolsAddress(uk.gov.hmcts.probate.model.ccd.raw.SolsAddress) CallbackResponse(uk.gov.hmcts.probate.model.ccd.raw.response.CallbackResponse) CaseDetails(uk.gov.hmcts.probate.model.ccd.raw.request.CaseDetails) ArrayList(java.util.ArrayList) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Document(uk.gov.hmcts.probate.model.ccd.raw.Document) DocumentLink(uk.gov.hmcts.probate.model.ccd.raw.DocumentLink) SendLetterResponse(uk.gov.hmcts.reform.sendletter.api.SendLetterResponse) LetterV3(uk.gov.hmcts.reform.sendletter.api.model.v3.LetterV3) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

SolsAddress (uk.gov.hmcts.probate.model.ccd.raw.SolsAddress)28 Test (org.junit.Test)19 CaseData (uk.gov.hmcts.probate.model.ccd.raw.request.CaseData)15 CaveatCallbackRequest (uk.gov.hmcts.probate.model.ccd.caveat.request.CaveatCallbackRequest)14 Document (uk.gov.hmcts.probate.model.ccd.raw.Document)14 CallbackRequest (uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest)14 CaseDetails (uk.gov.hmcts.probate.model.ccd.raw.request.CaseDetails)14 ResponseCaseData (uk.gov.hmcts.probate.model.ccd.raw.response.ResponseCaseData)14 DocumentLink (uk.gov.hmcts.probate.model.ccd.raw.DocumentLink)13 ArrayList (java.util.ArrayList)12 LetterV3 (uk.gov.hmcts.reform.sendletter.api.model.v3.LetterV3)12 SendLetterResponse (uk.gov.hmcts.reform.sendletter.api.SendLetterResponse)11 UUID (java.util.UUID)9 CollectionMember (uk.gov.hmcts.probate.model.ccd.raw.CollectionMember)6 CallbackResponse (uk.gov.hmcts.probate.model.ccd.raw.response.CallbackResponse)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 FieldErrorResponse (uk.gov.hmcts.probate.exception.model.FieldErrorResponse)4 AdditionalExecutorTrustCorps (uk.gov.hmcts.probate.model.ccd.raw.AdditionalExecutorTrustCorps)4 Before (org.junit.Before)3 JavaTimeModule (com.fasterxml.jackson.datatype.jsr310.JavaTimeModule)2