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);
}
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);
}
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));
}
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));
}
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));
}
Aggregations