Skip to content

Commit

Permalink
DTSPB-4475 Retain and disposal initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
FeliTam committed Feb 12, 2025
1 parent bde2b9d commit 8a8d5d8
Show file tree
Hide file tree
Showing 64 changed files with 1,623 additions and 172 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def versions = [
lombok : '1.18.36',
mapStruct : '1.2.0.Final',
pact_version : '4.1.34',
probateCommonsVersion : '2.0.44',
probateCommonsVersion : '2.0.45',
probatePactCommonsVersion : '1.0.2',
restAssured : '5.5.0',
serenity : '4.2.12',
Expand Down Expand Up @@ -228,6 +228,7 @@ dependencies {
implementation group: 'com.github.hmcts', name: 'cmc-pdf-service-client', version: '8.0.1'
implementation group: 'com.github.hmcts', name: 'send-letter-client', version: '4.0.4'
implementation group: 'com.github.hmcts', name: 'life-events-client', version: '1.2.4'
implementation group: 'com.github.hmcts', name: 'idam-java-client', version: '3.0.3'
implementation group: 'com.azure', name: 'azure-storage-blob', version: '12.29.0'
implementation group: 'com.microsoft.azure', name: 'applicationinsights-core', version: '3.6.2'
implementation group: 'com.microsoft.azure', name: 'applicationinsights-runtime-attach', version: '3.6.2'
Expand Down
2 changes: 1 addition & 1 deletion charts/probate-back-office/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
description: A Helm chart for the HMCTS probate back office service
name: probate-back-office
home: https://github.com/hmcts/probate-back-office
version: 1.0.49
version: 1.0.50
maintainers:
- name: HMCTS Probate Team
email: [email protected]
Expand Down
2 changes: 2 additions & 0 deletions charts/probate-back-office/values.preview.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ java:
BACK_OFFICE_BASEURL: https://${SERVICE_NAME}.preview.platform.hmcts.net
ACA_SERVICE_API_BASEURL: http://${SERVICE_NAME}-aac-manage-case-assignment
PROBATE_POSTGRESQL_HOSTNAME_VAL: '{{ .Values.global.postgresHostname }}'
MANAGE_CASE_URL: https://xui-${SERVICE_FQDN}.preview.platform.hmcts.net/cases/case-details/<CASE_ID>
FRONTEND_URL: http://probate.aat.platform.hmcts.net/get-case/<CASE_ID>?probateType=<CASE_TYPE>

keyVaults:
probate:
Expand Down
3 changes: 2 additions & 1 deletion charts/probate-back-office/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ java:
PAYMENT_URL: http://payment-api-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal
ACA_SERVICE_API_BASEURL: http://aac-manage-case-assignment-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal
CASE_DOCUMENT_AM_URL: http://ccd-case-document-am-api-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal

PROBATE_POSTGRESQL_USER: pgadmin
PROBATE_POSTGRESQL_HOSTNAME: probatemandb-postgres-flexible-db-{{ .Values.global.environment }}.postgres.database.azure.com
PROBATE_POSTGRESQL_DATABASE: probatemandb
Expand All @@ -53,6 +52,8 @@ java:
ADHOC_JOB_DATE:
JOB_SHUTDOWN_DELAY: 10
BACK_OFFICE_BASEURL: http://probate-back-office-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal
MANAGE_CASE_URL: https://manage-case.{{ .Values.global.environment }}.platform.hmcts.net/cases/case-details/<CASE_ID>
FRONTEND_URL: https://probate.{{ .Values.global.environment }}.platform.hmcts.net/get-case/<CASE_ID>?probateType=<CASE_TYPE>
keyVaults:
probate:
secrets:
Expand Down
17 changes: 16 additions & 1 deletion src/contractTest/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ notifications:
grantDelayed: "7045b381-a087-44fe-8bb5-e5a591cb8473"
grantAwaitingDocumentation: "cc4aa69b-10fb-4a9c-9e0e-1851dfaa69e9"
sealedAndCertified: "16c9a4ce-162f-4ed1-8d70-be79616685ac"
disposalReminder: "2e29cce0-66d9-458a-82a3-20aa0e4d5112"
solicitor:
applicationReceived: "47d37cc5-4445-4725-8bf4-90441cf2bb31"
applicationReceivedNoDocs: "d09c814f-a7cd-4a4a-87b9-7c5cea2ca550"
Expand All @@ -261,6 +262,7 @@ notifications:
grantAwaitingDocumentation: "638395bf-805f-48a7-97b1-d26ea9e9334e"
noticeOfChangeReceived: "6af59aa3-b379-406f-9be4-331b8411c6d9"
sealedAndCertified: "16c9a4ce-162f-4ed1-8d70-be79616685ac"
disposalReminder: "98282437-05a3-4566-a46b-c1f465dbbc02"
welsh:
personal:
applicationReceived: "af8ba9a0-8f74-4ddf-af4c-49b9b5174fb7"
Expand All @@ -285,6 +287,7 @@ notifications:
caveatWithdrawn: "c63bc430-9868-4f10-924b-408c7ac3cbd8"
grantDelayed: "7045b381-a087-44fe-8bb5-e5a591cb8473"
grantAwaitingDocumentation: "cc4aa69b-10fb-4a9c-9e0e-1851dfaa69e9"
disposalReminder: "34fe5d9d-c57b-4bc2-9ceb-008e82cd5594"
solicitor:
applicationReceived: "c7da81e4-77c9-499e-b1a2-ebac7a83342f"
applicationReceivedNoDocs: "826892e2-76e8-473e-bb39-edec5d19fed7"
Expand All @@ -309,6 +312,7 @@ notifications:
grantDelayed: "7045b381-a087-44fe-8bb5-e5a591cb8473"
grantAwaitingDocumentation: "638395bf-805f-48a7-97b1-d26ea9e9334e"
noticeOfChangeReceived: "4f1f3c47-1d84-4584-b251-2a77d64510f2"
disposalReminder: "98282437-05a3-4566-a46b-c1f465dbbc02"

documents:
templates:
Expand Down Expand Up @@ -464,6 +468,8 @@ document:
baseurl: localhost:8080

idam:
api:
url: ${IDAM_SERVICE_HOST:http://localhost:5000}
s2s-auth:
url: ${S2S_AUTH_URL:http://localhost:4502}
totp_secret: ${S2S_AUTH_TOTP_SECRET:AAAAAAAAAAAAAAAA}
Expand Down Expand Up @@ -506,7 +512,7 @@ blobstorage:

adhocSchedulerJobDate: ${ADHOC_JOB_DATE:}
adhocSchedulerJobToDate: ${ADHOC_JOB_TO_DATE:}
shcedulerTimerShutdownDelayMinutes: ${JOB_SHUTDOWN_DELAY:0}
schedulerTimerShutdownDelayMinutes: ${JOB_SHUTDOWN_DELAY:0}

feature:
blobstorage:
Expand Down Expand Up @@ -547,3 +553,12 @@ reactivate_dormant:

grand_delay:
number_of_weeks: 12

disposal:
adhocSchedulerJobDate: ${DISPOSAL_ADHOC_JOB_DATE:}
inactivityNotificationPeriod: 90
disposalGracePeriod: 90
switchDate: ${RETENTION_POLICY_START_DATE:2024-03-04}
startDate: 1900-01-01
personalNotificationLink: http://localhost:3000
solsNotificationLink: http://localhost:3001
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import org.springframework.web.context.WebApplicationContext;
import uk.gov.hmcts.probate.model.DocumentType;
import uk.gov.hmcts.probate.model.State;
import uk.gov.hmcts.probate.model.caseaccess.Organisation;
import uk.gov.hmcts.probate.model.caseaccess.OrganisationPolicy;
import uk.gov.hmcts.probate.model.ccd.raw.AdditionalExecutorTrustCorps;
import uk.gov.hmcts.probate.model.ccd.raw.CodicilAddedDate;
import uk.gov.hmcts.probate.model.ccd.raw.CollectionMember;
Expand All @@ -30,6 +28,7 @@
import uk.gov.hmcts.probate.model.ccd.raw.EstateItem;
import uk.gov.hmcts.probate.model.ccd.raw.ScannedDocument;
import uk.gov.hmcts.probate.model.ccd.raw.SolsAddress;
import uk.gov.hmcts.probate.model.ccd.raw.TTL;
import uk.gov.hmcts.probate.model.ccd.raw.request.CallbackRequest;
import uk.gov.hmcts.probate.model.ccd.raw.request.CaseData;
import uk.gov.hmcts.probate.model.ccd.raw.request.CaseData.CaseDataBuilder;
Expand All @@ -47,6 +46,7 @@
import uk.gov.hmcts.probate.util.TestUtils;
import uk.gov.hmcts.reform.probate.model.idam.UserInfo;

import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
Expand Down Expand Up @@ -1268,17 +1268,21 @@ void shouldValidateValuesPage() throws Exception {

@Test
void shouldValidateRollback() throws Exception {
OrganisationPolicy policy = OrganisationPolicy.builder()
.organisation(Organisation.builder()
.organisationID("ABC")
.organisationName("OrgName")
.build())
.orgPolicyReference(null)
.orgPolicyCaseAssignedRole("[APPLICANTSOLICITOR]")
TTL ttl = TTL.builder()
.systemTTL(LocalDate.now())
.overrideTTL(LocalDate.now())
.suspended("No")
.build();
caseDataBuilder.applicantOrganisationPolicy(policy);
caseDataBuilder.ttl(ttl);
CaseDetails caseDetails = new CaseDetails(caseDataBuilder.build(), LAST_MODIFIED, ID);
Field caseDetailsField = CaseDetails.class.getDeclaredField("state");
caseDetailsField.setAccessible(true);
caseDetailsField.set(caseDetails, "Pending");

CallbackRequest callbackRequest = new CallbackRequest(caseDetails);
Field caseDetailsBeforeField = CallbackRequest.class.getDeclaredField("caseDetailsBefore");
caseDetailsBeforeField.setAccessible(true);
caseDetailsBeforeField.set(callbackRequest, caseDetails);

String json = OBJECT_MAPPER.writeValueAsString(callbackRequest);
mockMvc.perform(post(ROLLBACK).content(json).contentType(MediaType.APPLICATION_JSON))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class NotificationServiceIT {
private static final Long ID = 1L;
private static final String[] LAST_MODIFIED = {"2018", "1", "1", "0", "0", "0", "0"};
private static final LocalDateTime LAST_DATE_MODIFIED = LocalDateTime.now(ZoneOffset.UTC).minusYears(2);
private static final LocalDateTime CREATED_DATE = LocalDateTime.now(ZoneOffset.UTC).minusYears(3);
private static final Long CASE_ID = 12345678987654321L;
private static final String SENT_EMAIL_FILE_NAME = "sentEmail.pdf";
private static final byte[] DOC_BYTES = {(byte) 23};
Expand Down Expand Up @@ -447,7 +448,7 @@ public void setUp() throws NotificationClientException, IOException {
.grantIssuedDate("2019-05-01")
.deceasedDateOfBirth(LocalDate.of(2019, 1, 1))
.scannedDocuments(scannedDocuments)
.build(), LAST_DATE_MODIFIED, ID));
.build(), LAST_DATE_MODIFIED, CREATED_DATE, ID));

exelaCaseDataNoWillReference.add(new ReturnedCaseDetails(CaseData.builder()
.applicationType(PERSONAL)
Expand All @@ -456,7 +457,7 @@ public void setUp() throws NotificationClientException, IOException {
.grantIssuedDate("2019-05-01")
.deceasedDateOfBirth(LocalDate.of(2019, 1, 1))
.scannedDocuments(scannedDocumentsNoWill)
.build(), LAST_DATE_MODIFIED, ID));
.build(), LAST_DATE_MODIFIED, CREATED_DATE, ID));

exelaCaseDataNoSubtype.add(new ReturnedCaseDetails(CaseData.builder()
.applicationType(PERSONAL)
Expand All @@ -465,7 +466,7 @@ public void setUp() throws NotificationClientException, IOException {
.grantIssuedDate("2019-05-01")
.deceasedDateOfBirth(LocalDate.of(2019, 1, 1))
.scannedDocuments(scannedDocumentsNoSubtype)
.build(), LAST_DATE_MODIFIED, ID));
.build(), LAST_DATE_MODIFIED, CREATED_DATE, ID));

caveatRaisedCaseData = new CaveatDetails(CaveatData.builder()
.applicationType(PERSONAL)
Expand Down Expand Up @@ -1704,7 +1705,7 @@ void sendGrantDelayedEmail()
.put(PERSONALISATION_APPLICANT_NAME, personalGrantDelayedOxford.getData().getPrimaryApplicantFullName());

ReturnedCaseDetails returnedCaseDetails =
new ReturnedCaseDetails(personalGrantDelayedOxford.getData(), null, ID);
new ReturnedCaseDetails(personalGrantDelayedOxford.getData(), null, CREATED_DATE, ID);

when(pdfManagementService.generateAndUpload(any(SentEmail.class), any())).thenReturn(Document.builder()
.documentFileName(SENT_EMAIL_FILE_NAME).build());
Expand Down Expand Up @@ -1747,7 +1748,7 @@ void sendGrantDelayedAwaitingDocumentationEmail()
.put(PERSONALISATION_APPLICANT_NAME, personalGrantDelayedOxford.getData().getPrimaryApplicantFullName());

ReturnedCaseDetails returnedCaseDetails =
new ReturnedCaseDetails(personalGrantDelayedOxford.getData(), null, ID);
new ReturnedCaseDetails(personalGrantDelayedOxford.getData(), null, CREATED_DATE, ID);

when(pdfManagementService.generateAndUpload(any(SentEmail.class), any())).thenReturn(Document.builder()
.documentFileName(SENT_EMAIL_FILE_NAME).build());
Expand Down Expand Up @@ -1792,7 +1793,7 @@ void sendGrantDelayedAwaitingDocumentationSolicitorEmail()
.put(PERSONALISATION_APPLICANT_NAME, solicitorGrantDelayedOxford.getData().getPrimaryApplicantFullName());

ReturnedCaseDetails returnedCaseDetails =
new ReturnedCaseDetails(solicitorGrantDelayedOxford.getData(), null, ID);
new ReturnedCaseDetails(solicitorGrantDelayedOxford.getData(), null, CREATED_DATE, ID);

when(pdfManagementService.generateAndUpload(any(SentEmail.class), any())).thenReturn(Document.builder()
.documentFileName(SENT_EMAIL_FILE_NAME).build());
Expand Down Expand Up @@ -2189,4 +2190,32 @@ void verifyEmailPreview()

verify(pdfManagementService).generateDocmosisDocumentAndUpload(any(), eq(SENT_EMAIL));
}

@Test
void sendDisposalReminderEmail() throws NotificationClientException {
ReturnedCaseDetails returnedCaseDetails =
new ReturnedCaseDetails(personalGrantDelayedOxford.getData(), LAST_DATE_MODIFIED, CREATED_DATE, ID);
when(notificationClient.sendEmail(anyString(), anyString(), any(), anyString())).thenReturn(sendEmailResponse);
notificationService.sendDisposalReminderEmail(returnedCaseDetails);

verify(notificationClient).sendEmail(
eq("pa-disposal-reminder"),
eq("[email protected]"),
any(),
anyString());
}

@Test
void sendSolDisposalReminderEmail() throws NotificationClientException {
ReturnedCaseDetails returnedCaseDetails =
new ReturnedCaseDetails(solicitorGrantDelayedOxford.getData(), LAST_DATE_MODIFIED, CREATED_DATE, ID);
when(notificationClient.sendEmail(anyString(), anyString(), any(), anyString())).thenReturn(sendEmailResponse);
notificationService.sendDisposalReminderEmail(returnedCaseDetails);

verify(notificationClient).sendEmail(
eq("sol-disposal-reminder"),
eq("[email protected]"),
any(),
anyString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class GrantOfRepresentationPersonalisationServiceIT {
private static final Long ID = 1L;
private static final String[] LAST_MODIFIED = {"2018", "1", "1", "0", "0", "0", "0"};
private static final LocalDateTime LAST_DATE_MODIFIED = LocalDateTime.now(ZoneOffset.UTC).minusYears(2);
private static final LocalDateTime CREATED_DATE = LocalDateTime.now(ZoneOffset.UTC).minusYears(3);
private static final DateTimeFormatter EXELA_DATE = DateTimeFormatter.ofPattern("yyyyMMdd");
private static final String PERSONALISATION_APPLICANT_NAME = "applicant_name";
private static final String PERSONALISATION_DECEASED_NAME = "deceased_name";
Expand Down Expand Up @@ -129,7 +130,7 @@ public void setUp() {
.build();

caseDetails = new CaseDetails(caseData, LAST_MODIFIED, ID);
returnedCaseDetails = new ReturnedCaseDetails(caseData, LAST_DATE_MODIFIED, ID);
returnedCaseDetails = new ReturnedCaseDetails(caseData, LAST_DATE_MODIFIED, CREATED_DATE, ID);

exelaCaseData.add(new ReturnedCaseDetails(CaseData.builder()
.applicationType(PERSONAL)
Expand All @@ -139,7 +140,7 @@ public void setUp() {
.deceasedDateOfBirth(LocalDate.of(2019, 1, 1))
.scannedDocuments(scannedDocuments)
.registryLocation("Cardiff")
.build(), LAST_DATE_MODIFIED, ID));
.build(), LAST_DATE_MODIFIED, CREATED_DATE, ID));

exelaCaseDataWithCommas.add(new ReturnedCaseDetails(CaseData.builder()
.applicationType(PERSONAL)
Expand All @@ -149,7 +150,7 @@ public void setUp() {
.deceasedDateOfBirth(LocalDate.of(2019, 1, 1))
.scannedDocuments(scannedDocuments)
.registryLocation("Cardiff")
.build(), LAST_DATE_MODIFIED, ID));
.build(), LAST_DATE_MODIFIED, CREATED_DATE, ID));

exelaCaseDataTypeWill.add(new ReturnedCaseDetails(CaseData.builder()
.applicationType(PERSONAL)
Expand All @@ -159,7 +160,7 @@ public void setUp() {
.deceasedDateOfBirth(LocalDate.of(2019, 1, 1))
.scannedDocuments(scannedDocumentsTypeWill)
.registryLocation("Cardiff")
.build(), LAST_DATE_MODIFIED, ID));
.build(), LAST_DATE_MODIFIED, CREATED_DATE, ID));

exelaCaseDataNoWillReference.add(new ReturnedCaseDetails(CaseData.builder()
.applicationType(PERSONAL)
Expand All @@ -169,7 +170,7 @@ public void setUp() {
.deceasedDateOfBirth(LocalDate.of(2019, 1, 1))
.scannedDocuments(scannedDocumentsNoWill)
.registryLocation("Cardiff")
.build(), LAST_DATE_MODIFIED, ID));
.build(), LAST_DATE_MODIFIED, CREATED_DATE, ID));

exelaCaseDataNoSubtype.add(new ReturnedCaseDetails(CaseData.builder()
.applicationType(PERSONAL)
Expand All @@ -179,7 +180,7 @@ public void setUp() {
.deceasedDateOfBirth(LocalDate.of(2019, 1, 1))
.scannedDocuments(scannedDocumentsNoSubtype)
.registryLocation("Cardiff")
.build(), LAST_DATE_MODIFIED, ID));
.build(), LAST_DATE_MODIFIED, CREATED_DATE, ID));

exelaCaseDataNoDOB.add(new ReturnedCaseDetails(CaseData.builder()
.applicationType(PERSONAL)
Expand All @@ -188,7 +189,7 @@ public void setUp() {
.grantIssuedDate("2019-05-01")
.scannedDocuments(scannedDocumentsNoSubtype)
.registryLocation("Cardiff")
.build(), LAST_DATE_MODIFIED, ID));
.build(), LAST_DATE_MODIFIED, CREATED_DATE, ID));

}

Expand Down
17 changes: 15 additions & 2 deletions src/integrationTest/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ notifications:
grantDelayed: "pa-grantDelayed"
grantAwaitingDocumentation: "pa-grantAwaitingDoc"
sealedAndCertified: "sealed-and-certified"
disposalReminder: "pa-disposal-reminder"
solicitor:
applicationReceived: "sol-application-received"
applicationReceivedNoDocs: "sol-application-received-no-docs"
Expand All @@ -186,6 +187,7 @@ notifications:
grantAwaitingDocumentation: "sols-grantAwaitingDoc"
noticeOfChangeReceived: "sols-noc"
sealedAndCertified: "sealed-and-certified"
disposalReminder: "sol-disposal-reminder"
welsh:
personal:
applicationReceived: "pa-application-received-welsh"
Expand All @@ -209,6 +211,7 @@ notifications:
grantDelayed: "pa-grantDelayed-welsh"
grantAwaitingDocumentation: "pa-grantAwaitingDoc-welsh"
sealedAndCertified: "sealed-and-certified"
disposalReminder: "pa-disposal-reminder-welsh"
solicitor:
applicationReceived: "sol-application-received-welsh"
applicationReceivedNoDocs: "sol-application-received-no-docs-welsh"
Expand All @@ -230,6 +233,7 @@ notifications:
grantAwaitingDocumentation: "sols-grantAwaitingDoc-welsh"
noticeOfChangeReceived: "sols-noc"
sealedAndCertified: "sealed-and-certified"
disposalReminder: "sol-disposal-reminder-welsh"

documents:
templates:
Expand Down Expand Up @@ -448,7 +452,7 @@ blobstorage:

adhocSchedulerJobDate: ${ADHOC_JOB_DATE:}
adhocSchedulerJobToDate: ${ADHOC_JOB_TO_DATE:}
shcedulerTimerShutdownDelayMinutes: ${JOB_SHUTDOWN_DELAY:0}
schedulerTimerShutdownDelayMinutes: ${JOB_SHUTDOWN_DELAY:0}

feature:
blobstorage:
Expand Down Expand Up @@ -485,4 +489,13 @@ reactivate_dormant:
minus_days: 1

grand_delay:
number_of_weeks: 12
number_of_weeks: 12

disposal:
adhocSchedulerJobDate: ${DISPOSAL_ADHOC_JOB_DATE:}
inactivityNotificationPeriod: ${INACTIVITY_NOTIFICATION_PERIOD:90}
disposalGracePeriod: ${DISPOSAL_GRACE_PERIOD:90}
switchDate: ${RETENTION_POLICY_START_DATE:2024-03-04}
startDate: 1900-01-01
personalNotificationLink: ${FRONTEND_URL:http://localhost:3000}
solsNotificationLink: ${MANAGE_CASE_URL:http://localhost:3001}
Loading

0 comments on commit 8a8d5d8

Please sign in to comment.