diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP
index d5a5a308605..b7c16bf6c94 100644
--- a/Jenkinsfile_CNP
+++ b/Jenkinsfile_CNP
@@ -43,7 +43,10 @@ def secrets = [
secret('ccd-importer-username', 'CCD_CONFIGURER_IMPORTER_USERNAME'),
secret('ccd-importer-password', 'CCD_CONFIGURER_IMPORTER_PASSWORD'),
secret('postgres-user', 'POSTGRES_USER'),
- secret('postgres-password', 'POSTGRES_PASSWORD')
+ secret('postgres-password', 'POSTGRES_PASSWORD'),
+ secret('default-password','DEFAULT_PASSWORD'),
+ secret('judge-default-password','JUDGE_DEFAULT_PASSWORD'),
+ secret('iac-default-password','IAC_DEFAULT_PASSWORD')
]
]
@@ -141,7 +144,7 @@ withPipeline(type, product, component) {
env.CCD_DATA_STORE_URL = "https://civil-service-data-store-staging-aat.service.core-compute-aat.internal"
env.DM_STORE_URL = "http://dm-store-aat.service.core-compute-aat.internal"
env.CIVIL_SERVICE_URL="https://civil-service-staging.aat.platform.hmcts.net"
- env.AAC_API_URL="https://manage-case-assignment-civil-service-staging-aat.service.core-compute-aat.internal"
+ env.AAC_API_URL="https://civil-service-manage-case-assignment-staging.aat.platform.hmcts.net"
}
afterAlways('functionalTest:aat') {
diff --git a/Jenkinsfile_nightly b/Jenkinsfile_nightly
index df67a421b16..4f66e24d074 100644
--- a/Jenkinsfile_nightly
+++ b/Jenkinsfile_nightly
@@ -14,6 +14,8 @@ properties([
description: 'The URL of service auth provider'),
string(name: 'CCD_DATA_STORE_URL', defaultValue: 'http://ccd-data-store-api-aat.service.core-compute-aat.internal',
description: 'The URL of ccd data store'),
+ string(name: 'AAC_API_URL', defaultValue: 'http://aac-manage-case-assignment-aat.service.core-compute-aat.internal',
+ description: 'The URL of AAC service'),
string(name: 'CIVIL_SERVICE_URL', defaultValue: 'http://civil-service-aat.service.core-compute-aat.internal',
description: 'The URL of civil service'),
string(name: 'WAIT_FOR_TIMEOUT_MS',
@@ -42,7 +44,10 @@ static Map secret(String secretName, String envVariable) {
def secrets = [
'civil-${env}': [
- secret('microservicekey-civil-service', 'S2S_SECRET')
+ secret('microservicekey-civil-service', 'S2S_SECRET'),
+ secret('default-password', 'DEFAULT_PASSWORD'),
+ secret('judge-default-password', 'JUDGE_DEFAULT_PASSWORD'),
+ secret('iac-default-password', 'IAC_DEFAULT_PASSWORD')
]
]
@@ -57,6 +62,7 @@ withNightlyPipeline(type, product, component) {
env.URL_FOR_SECURITY_SCAN = params.CIVIL_SERVICE_URL
env.TESTS_FOR_ACCESSIBILITY = true
env.NIGHTLY_RUN = true
+ env.AAC_API_URL = params.AAC_API_URL
overrideVaultEnvironments([
'aat': params.ENVIRONMENT
])
diff --git a/bin/add-roles.sh b/bin/add-roles.sh
index 0022e535dcf..c02dcf797bc 100755
--- a/bin/add-roles.sh
+++ b/bin/add-roles.sh
@@ -30,6 +30,7 @@
./bin/utils/ccd-add-role.sh "cui-admin-profile"
./bin/utils/ccd-add-role.sh "cui-nbc-profile"
./bin/utils/ccd-add-role.sh "citizen-profile"
+./bin/utils/ccd-add-role.sh "caseworker-civil-citizen-ui-pcqextractor"
roles=("solicitor" "systemupdate" "admin" "staff")
for role in "${roles[@]}"
diff --git a/build.gradle b/build.gradle
index 8dff4a80948..7035befae45 100644
--- a/build.gradle
+++ b/build.gradle
@@ -75,8 +75,8 @@ allprojects {
dependencyManagement {
dependencies {
- //CVE-2022-41881
- dependencySet(group: 'io.netty', version: '4.1.94.Final') {
+ //CVE-2023-44487
+ dependencySet(group: 'io.netty', version: '4.1.100.Final') {
entry 'netty-handler'
entry 'netty-handler-proxy'
entry 'netty-transport-native-epoll'
@@ -369,7 +369,7 @@ configurations.all {
}
dependencies {
- implementation 'com.github.hmcts:civil-commons:1.0.21'
+ implementation 'com.github.hmcts:civil-commons:1.0.33'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
@@ -401,11 +401,18 @@ dependencies {
implementation group: 'io.github.openfeign', name: 'feign-httpclient', version: '12.4'
implementation group: 'org.springframework.retry', name: 'spring-retry'
+ implementation group: 'com.github.hmcts', name: 'java-logging', version: '6.0.1'
+
implementation group: 'com.github.hmcts', name: 'ccd-client', version: '4.9.1'
implementation group: 'uk.gov.hmcts.reform', name: 'document-management-client', version: '7.0.0'
implementation group: 'uk.gov.hmcts.reform', name: 'send-letter-client', version: '3.0.3'
- implementation group: 'com.github.hmcts', name: 'fees-java-client', version: '0.0.6'
- implementation group: 'com.github.hmcts', name: 'payments-java-client', version: '1.5.2'
+ implementation('com.github.hmcts:fees-java-client:0.0.6') {
+ exclude group: 'java-logging', module: ' java-logging'
+ }
+
+ implementation('com.github.hmcts:payments-java-client:1.5.2') {
+ exclude group: 'java-logging', module: ' java-logging'
+ }
implementation group: 'uk.gov.hmcts.reform', name: 'service-auth-provider-client', version: '4.0.0'
implementation group: 'uk.gov.hmcts.reform', name: 'properties-volume-spring-boot-starter', version: '0.1.0'
implementation group: 'uk.gov.service.notify', name: 'notifications-java-client', version: '4.1.0-RELEASE'
@@ -433,8 +440,8 @@ dependencies {
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.20.0'
implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: '2.20.0'
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.10.0'
- implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '9.0.80'
- implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-websocket', version: '10.1.13'
+ implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '9.0.82'
+ implementation group: 'org.apache.tomcat.embed', name: 'tomcat-embed-websocket', version: '10.1.14'
implementation group: 'org.elasticsearch', name: 'elasticsearch', version: '7.17.9'
implementation group: 'com.networknt', name: 'json-schema-validator', version: '1.0.78'
diff --git a/charts/civil-service/Chart.yaml b/charts/civil-service/Chart.yaml
index 211625fdec0..dbf0c702042 100644
--- a/charts/civil-service/Chart.yaml
+++ b/charts/civil-service/Chart.yaml
@@ -2,13 +2,13 @@ apiVersion: v2
description: A Helm chart for civil-service App
name: civil-service
home: https://github.com/hmcts/civil-service
-version: 0.0.48
+version: 0.0.52
maintainers:
- name: HMCTS Civil team
dependencies:
- name: java
- version: 4.0.13
+ version: 5.0.0
repository: 'https://hmctspublic.azurecr.io/helm/v1/repo/'
- name: ccd
version: 8.0.29
diff --git a/charts/civil-service/values.aat.template.yaml b/charts/civil-service/values.aat.template.yaml
index cbb0fb6ab4d..a9ec5ff1c97 100644
--- a/charts/civil-service/values.aat.template.yaml
+++ b/charts/civil-service/values.aat.template.yaml
@@ -24,6 +24,9 @@ java:
- ordnance-survey-api-key
- notification-caseworker-spec-receiver
- launch-darkly-sdk-key
+ - default-password
+ - judge-default-password
+ - iac-default-password
environment:
CORE_CASE_DATA_API_URL: http://${SERVICE_NAME}-ccd-data-store-api
OIDC_ISSUER: https://forgerock-am.service.core-compute-idam-aat2.internal:8443/openam/oauth2/realms/root/realms/hmcts
@@ -42,6 +45,7 @@ java:
DOCUMENT_MANAGEMENT_SECURED: true
STITCHING_API_ENABLED: true
RELEASE_REVISION: "{{ .Release.Revision }}"
+ ACA_SERVICE_API_BASEURL: http://${SERVICE_NAME}-aac-manage-case-assignment
HMC_HEARINGS_SUBSCRIPTION_ENABLED: false
postgresql:
enabled: true
@@ -212,7 +216,7 @@ aac-manage-case-assignment:
imagePullPolicy: Always
releaseNameOverride: ${SERVICE_NAME}-aac-manage-case-assignment
image: hmctspublic.azurecr.io/aac/manage-case-assignment:latest
- ingressHost: manage-case-assignment-civil-service-staging-aat.service.core-compute-aat.internal
+ ingressHost: civil-service-manage-case-assignment-staging.aat.platform.hmcts.net
environment:
IDAM_API_URL: https://idam-api.aat.platform.hmcts.net
IDAM_OIDC_URL: https://idam-web-public.aat.platform.hmcts.net
diff --git a/charts/civil-service/values.preview.template.yaml b/charts/civil-service/values.preview.template.yaml
index cd8fd8b926f..bcc5e2468fb 100644
--- a/charts/civil-service/values.preview.template.yaml
+++ b/charts/civil-service/values.preview.template.yaml
@@ -25,6 +25,9 @@ java:
- robotics-notification-multipartyrecipient
- ordnance-survey-api-key
- notification-caseworker-spec-receiver
+ - default-password
+ - judge-default-password
+ - iac-default-password
environment:
CORE_CASE_DATA_API_URL: http://${SERVICE_NAME}-ccd-data-store-api
OIDC_ISSUER: https://forgerock-am.service.core-compute-idam-aat2.internal:8443/openam/oauth2/realms/root/realms/hmcts
@@ -49,6 +52,8 @@ java:
postgresql:
enabled: true
image:
+ registry: hmctspublic.azurecr.io
+ repository: imported/bitnami/postgresql
tag: '11.6.0'
primary:
persistence:
diff --git a/charts/civil-service/values.yaml b/charts/civil-service/values.yaml
index ff91603a2fb..54a997ceadd 100644
--- a/charts/civil-service/values.yaml
+++ b/charts/civil-service/values.yaml
@@ -64,6 +64,7 @@ java:
DOCUMENT_MANAGEMENT_SECURED: true
REST_TEMPLATE_TIMEOUT: 30000
POLLING_EVENT_EMITTER_ENABLED: false
+ WA_TOGGLE: Prod
HMC_HEARINGS_TOPIC_NAMESPACE: 'hmc-servicebus-{{ .Values.global.environment }}'
HMC_HEARINGS_TOPIC_NAME: 'hmc-to-cft-{{ .Values.global.environment }}'
HMC_HEARINGS_TOPIC_SUBSCRIPTION_NAME: 'hmc-to-civil-subscription-{{ .Values.global.environment }}'
diff --git a/config/owasp/suppressions.xml b/config/owasp/suppressions.xml
index a6482e093b1..8effe28d3c5 100644
--- a/config/owasp/suppressions.xml
+++ b/config/owasp/suppressions.xml
@@ -9,6 +9,7 @@
False positive. We don't have any reference to json-java_project:json-java
nor any reference to hutool:hutool:5.8.10. Suppressed long-term to re-assess and possibly delete.
CVE-2022-45688
+ CVE-2023-5072
Temporarily suppressing it as the latest camunda connector 1.5.6 seem to have the vulnerability.
@@ -30,7 +31,9 @@
CVE-2021-42306
CVE-2023-20861
CVE-2023-20883
-
+ CVE-2023-4586
+ CVE-2023-5072
+ CVE-2023-44487
diff --git a/docker/docmosis/templates/CV-SPC-CLM-ENG-01065-LIP.docx b/docker/docmosis/templates/CV-SPC-CLM-ENG-01065-LIP.docx
new file mode 100644
index 00000000000..74d50312e95
Binary files /dev/null and b/docker/docmosis/templates/CV-SPC-CLM-ENG-01065-LIP.docx differ
diff --git a/docker/docmosis/templates/CV-SPC-HRN-ENG-01362.docx b/docker/docmosis/templates/CV-SPC-HRN-ENG-01362.docx
new file mode 100644
index 00000000000..b825b4efff4
Binary files /dev/null and b/docker/docmosis/templates/CV-SPC-HRN-ENG-01362.docx differ
diff --git a/docker/docmosis/templates/CV-SPC-HRN-ENG-LIP-01283.docx b/docker/docmosis/templates/CV-SPC-HRN-ENG-LIP-01283.docx
new file mode 100644
index 00000000000..d01a18bcf8a
Binary files /dev/null and b/docker/docmosis/templates/CV-SPC-HRN-ENG-LIP-01283.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-DEC-ENG-01099.docx b/docker/docmosis/templates/CV-UNS-DEC-ENG-01099.docx
index 6dabc929f07..495e2390a8e 100644
Binary files a/docker/docmosis/templates/CV-UNS-DEC-ENG-01099.docx and b/docker/docmosis/templates/CV-UNS-DEC-ENG-01099.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-DEC-ENG-01283.docx b/docker/docmosis/templates/CV-UNS-DEC-ENG-01283.docx
index 5d303173c98..25eb2cf65c3 100644
Binary files a/docker/docmosis/templates/CV-UNS-DEC-ENG-01283.docx and b/docker/docmosis/templates/CV-UNS-DEC-ENG-01283.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-DEC-ENG-01323.docx b/docker/docmosis/templates/CV-UNS-DEC-ENG-01323.docx
deleted file mode 100644
index 0f348ae789b..00000000000
Binary files a/docker/docmosis/templates/CV-UNS-DEC-ENG-01323.docx and /dev/null differ
diff --git a/docker/docmosis/templates/CV-UNS-DEC-ENG-01329.docx b/docker/docmosis/templates/CV-UNS-DEC-ENG-01329.docx
new file mode 100644
index 00000000000..f0c707b7449
Binary files /dev/null and b/docker/docmosis/templates/CV-UNS-DEC-ENG-01329.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-DEC-ENG-01322.docx b/docker/docmosis/templates/CV-UNS-DEC-ENG-01376.docx
similarity index 54%
rename from docker/docmosis/templates/CV-UNS-DEC-ENG-01322.docx
rename to docker/docmosis/templates/CV-UNS-DEC-ENG-01376.docx
index e372a907373..b4696ff615f 100644
Binary files a/docker/docmosis/templates/CV-UNS-DEC-ENG-01322.docx and b/docker/docmosis/templates/CV-UNS-DEC-ENG-01376.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-GAP-ENG-01067.docx b/docker/docmosis/templates/CV-UNS-GAP-ENG-01067.docx
index 40b1316205a..bf518dcc5e4 100644
Binary files a/docker/docmosis/templates/CV-UNS-GAP-ENG-01067.docx and b/docker/docmosis/templates/CV-UNS-GAP-ENG-01067.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-GAP-ENG-01068.docx b/docker/docmosis/templates/CV-UNS-GAP-ENG-01068.docx
index d715ec57053..07e3a3b1e8c 100644
Binary files a/docker/docmosis/templates/CV-UNS-GAP-ENG-01068.docx and b/docker/docmosis/templates/CV-UNS-GAP-ENG-01068.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-GAP-ENG-01069.docx b/docker/docmosis/templates/CV-UNS-GAP-ENG-01069.docx
index 7178c49ce47..8a359232e14 100644
Binary files a/docker/docmosis/templates/CV-UNS-GAP-ENG-01069.docx and b/docker/docmosis/templates/CV-UNS-GAP-ENG-01069.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-GAP-ENG-01070.docx b/docker/docmosis/templates/CV-UNS-GAP-ENG-01070.docx
index f2a28ab1f0b..3e9445b398d 100644
Binary files a/docker/docmosis/templates/CV-UNS-GAP-ENG-01070.docx and b/docker/docmosis/templates/CV-UNS-GAP-ENG-01070.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-GAP-ENG-01071.docx b/docker/docmosis/templates/CV-UNS-GAP-ENG-01071.docx
index 1d62230dd42..57e6930dbe3 100644
Binary files a/docker/docmosis/templates/CV-UNS-GAP-ENG-01071.docx and b/docker/docmosis/templates/CV-UNS-GAP-ENG-01071.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-GAP-ENG-01072.docx b/docker/docmosis/templates/CV-UNS-GAP-ENG-01072.docx
index ea860531487..d8f67ebaeec 100644
Binary files a/docker/docmosis/templates/CV-UNS-GAP-ENG-01072.docx and b/docker/docmosis/templates/CV-UNS-GAP-ENG-01072.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-GAP-ENG-01073.docx b/docker/docmosis/templates/CV-UNS-GAP-ENG-01073.docx
index 7c1e209c543..75da4c61c2c 100644
Binary files a/docker/docmosis/templates/CV-UNS-GAP-ENG-01073.docx and b/docker/docmosis/templates/CV-UNS-GAP-ENG-01073.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-GAP-ENG-01074.docx b/docker/docmosis/templates/CV-UNS-GAP-ENG-01074.docx
index 103eb0221db..d0ee5a8ec54 100644
Binary files a/docker/docmosis/templates/CV-UNS-GAP-ENG-01074.docx and b/docker/docmosis/templates/CV-UNS-GAP-ENG-01074.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-GAP-ENG-01075.docx b/docker/docmosis/templates/CV-UNS-GAP-ENG-01075.docx
index c3c550658b0..6cd12684e8a 100644
Binary files a/docker/docmosis/templates/CV-UNS-GAP-ENG-01075.docx and b/docker/docmosis/templates/CV-UNS-GAP-ENG-01075.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-GAP-ENG-01076.docx b/docker/docmosis/templates/CV-UNS-GAP-ENG-01076.docx
index 3eb45c9cadb..8c4163027d4 100644
Binary files a/docker/docmosis/templates/CV-UNS-GAP-ENG-01076.docx and b/docker/docmosis/templates/CV-UNS-GAP-ENG-01076.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-GAP-ENG-01077.docx b/docker/docmosis/templates/CV-UNS-GAP-ENG-01077.docx
index 5ea73c5f3b1..d042f3bedbe 100644
Binary files a/docker/docmosis/templates/CV-UNS-GAP-ENG-01077.docx and b/docker/docmosis/templates/CV-UNS-GAP-ENG-01077.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-GAP-ENG-01078.docx b/docker/docmosis/templates/CV-UNS-GAP-ENG-01078.docx
index 8b1a1541fc9..40d0ed38627 100644
Binary files a/docker/docmosis/templates/CV-UNS-GAP-ENG-01078.docx and b/docker/docmosis/templates/CV-UNS-GAP-ENG-01078.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-HNO-ENG-01196.docx b/docker/docmosis/templates/CV-UNS-HNO-ENG-01196.docx
index 4ba5177d719..5653fd8cecd 100644
Binary files a/docker/docmosis/templates/CV-UNS-HNO-ENG-01196.docx and b/docker/docmosis/templates/CV-UNS-HNO-ENG-01196.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-HNO-ENG-01197.docx b/docker/docmosis/templates/CV-UNS-HNO-ENG-01197.docx
index 12ca8fd309d..0199cf37ecc 100644
Binary files a/docker/docmosis/templates/CV-UNS-HNO-ENG-01197.docx and b/docker/docmosis/templates/CV-UNS-HNO-ENG-01197.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-HNO-ENG-01198.docx b/docker/docmosis/templates/CV-UNS-HNO-ENG-01198.docx
index 5c95cf2cc0d..c04509eb39b 100644
Binary files a/docker/docmosis/templates/CV-UNS-HNO-ENG-01198.docx and b/docker/docmosis/templates/CV-UNS-HNO-ENG-01198.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-HNO-ENG-01199.docx b/docker/docmosis/templates/CV-UNS-HNO-ENG-01199.docx
index 6f544923fe7..c09c508bf8c 100644
Binary files a/docker/docmosis/templates/CV-UNS-HNO-ENG-01199.docx and b/docker/docmosis/templates/CV-UNS-HNO-ENG-01199.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-HRN-ENG-01247-10180.docx b/docker/docmosis/templates/CV-UNS-HRN-ENG-01247-10180.docx
new file mode 100644
index 00000000000..ddd7238dc38
Binary files /dev/null and b/docker/docmosis/templates/CV-UNS-HRN-ENG-01247-10180.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-HRN-ENG-01343.docx b/docker/docmosis/templates/CV-UNS-HRN-ENG-01343.docx
index 9c1ef57554a..764c8978843 100644
Binary files a/docker/docmosis/templates/CV-UNS-HRN-ENG-01343.docx and b/docker/docmosis/templates/CV-UNS-HRN-ENG-01343.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-STD-ENG-01305.docx b/docker/docmosis/templates/CV-UNS-STD-ENG-01305.docx
deleted file mode 100644
index 5b9f9a8e208..00000000000
Binary files a/docker/docmosis/templates/CV-UNS-STD-ENG-01305.docx and /dev/null differ
diff --git a/docker/docmosis/templates/CV-UNS-STD-ENG-01308.docx b/docker/docmosis/templates/CV-UNS-STD-ENG-01308.docx
deleted file mode 100644
index 30558f74753..00000000000
Binary files a/docker/docmosis/templates/CV-UNS-STD-ENG-01308.docx and /dev/null differ
diff --git a/docker/docmosis/templates/CV-UNS-STD-ENG-01324.docx b/docker/docmosis/templates/CV-UNS-STD-ENG-01324.docx
deleted file mode 100644
index 3223146dcd6..00000000000
Binary files a/docker/docmosis/templates/CV-UNS-STD-ENG-01324.docx and /dev/null differ
diff --git a/docker/docmosis/templates/CV-UNS-STD-ENG-01325.docx b/docker/docmosis/templates/CV-UNS-STD-ENG-01325.docx
deleted file mode 100644
index 58f8ae436f8..00000000000
Binary files a/docker/docmosis/templates/CV-UNS-STD-ENG-01325.docx and /dev/null differ
diff --git a/docker/docmosis/templates/CV-UNS-STD-ENG-01326.docx b/docker/docmosis/templates/CV-UNS-STD-ENG-01326.docx
deleted file mode 100644
index 182c66aa1d3..00000000000
Binary files a/docker/docmosis/templates/CV-UNS-STD-ENG-01326.docx and /dev/null differ
diff --git a/docker/docmosis/templates/CV-UNS-STD-ENG-01377.docx b/docker/docmosis/templates/CV-UNS-STD-ENG-01377.docx
new file mode 100644
index 00000000000..1f2a4fa3a0e
Binary files /dev/null and b/docker/docmosis/templates/CV-UNS-STD-ENG-01377.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-STD-ENG-01378.docx b/docker/docmosis/templates/CV-UNS-STD-ENG-01378.docx
new file mode 100644
index 00000000000..7fd14c6e545
Binary files /dev/null and b/docker/docmosis/templates/CV-UNS-STD-ENG-01378.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-STD-ENG-01380.docx b/docker/docmosis/templates/CV-UNS-STD-ENG-01380.docx
new file mode 100644
index 00000000000..edadb96d535
Binary files /dev/null and b/docker/docmosis/templates/CV-UNS-STD-ENG-01380.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-STD-ENG-01381.docx b/docker/docmosis/templates/CV-UNS-STD-ENG-01381.docx
new file mode 100644
index 00000000000..47f36303d60
Binary files /dev/null and b/docker/docmosis/templates/CV-UNS-STD-ENG-01381.docx differ
diff --git a/docker/docmosis/templates/CV-UNS-STD-ENG-01382.docx b/docker/docmosis/templates/CV-UNS-STD-ENG-01382.docx
new file mode 100644
index 00000000000..04d6afcfac7
Binary files /dev/null and b/docker/docmosis/templates/CV-UNS-STD-ENG-01382.docx differ
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/cases/CasesControllerTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/cases/CasesControllerTest.java
index 5e951ab7ef7..627fda38600 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/cases/CasesControllerTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/cases/CasesControllerTest.java
@@ -12,18 +12,19 @@
import uk.gov.hmcts.reform.civil.exceptions.CaseDataInvalidException;
import uk.gov.hmcts.reform.civil.exceptions.CaseNotFoundException;
import uk.gov.hmcts.reform.civil.exceptions.UserNotFoundOnCaseException;
-import uk.gov.hmcts.reform.civil.exceptions.CaseNotFoundException;
-import uk.gov.hmcts.reform.civil.exceptions.UserNotFoundOnCaseException;
import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.bulkclaims.CaseworkerSubmitEventDTo;
import uk.gov.hmcts.reform.civil.model.citizenui.DashboardClaimInfo;
import uk.gov.hmcts.reform.civil.model.citizenui.DashboardResponse;
+import uk.gov.hmcts.reform.civil.model.citizenui.dto.ExtendedDeadlineDto;
import uk.gov.hmcts.reform.civil.model.citizenui.dto.EventDto;
+import uk.gov.hmcts.reform.civil.model.repaymentplan.ClaimantProposedPlan;
import uk.gov.hmcts.reform.civil.service.CoreCaseDataService;
import uk.gov.hmcts.reform.civil.service.RoleAssignmentsService;
import uk.gov.hmcts.reform.civil.service.bulkclaims.CaseworkerCaseEventService;
import uk.gov.hmcts.reform.civil.service.citizen.events.CaseEventService;
+import uk.gov.hmcts.reform.civil.service.citizen.repaymentplan.RepaymentPlanDecisionService;
import uk.gov.hmcts.reform.civil.service.citizenui.DashboardClaimInfoService;
import uk.gov.hmcts.reform.civil.service.citizenui.responsedeadline.DeadlineExtensionCalculatorService;
import uk.gov.hmcts.reform.civil.ras.model.RoleAssignmentResponse;
@@ -40,11 +41,15 @@
import java.util.Map;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+import static uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec.IMMEDIATELY;
+import static uk.gov.hmcts.reform.civil.model.citizenui.dto.RepaymentDecisionType.IN_FAVOUR_OF_CLAIMANT;
public class CasesControllerTest extends BaseIntegrationTest {
@@ -68,6 +73,7 @@ public class CasesControllerTest extends BaseIntegrationTest {
private static final String CALCULATE_DEADLINE_URL = "/cases/response/deadline";
private static final String AGREED_RESPONSE_DEADLINE_DATE_URL = "/cases/response/agreeddeadline/{claimId}";
private static final String USER_CASE_ROLES = "/cases/{caseId}/userCaseRoles";
+ private static final String COURT_DECISION_URL = "/cases/{caseId}/courtDecision";
private static final List claimResults =
Collections.singletonList(DashboardClaimInfo.builder()
.claimAmount(new BigDecimal(
@@ -117,6 +123,9 @@ public class CasesControllerTest extends BaseIntegrationTest {
@MockBean
private UserInformationService userInformationService;
+ @MockBean
+ private RepaymentPlanDecisionService repaymentPlanDecisionService;
+
@Test
@SneakyThrows
public void shouldReturnHttp200() {
@@ -219,10 +228,10 @@ void shouldSubmitEventSuccessfully() {
@SneakyThrows
void shouldCalculateDeadlineSuccessfully() {
LocalDate extensionDate = LocalDate.of(2022, 6, 6);
- when(deadlineExtensionCalculatorService.calculateExtendedDeadline(any())).thenReturn(extensionDate);
+ when(deadlineExtensionCalculatorService.calculateExtendedDeadline(any(), anyInt())).thenReturn(extensionDate);
doPost(
BEARER_TOKEN,
- extensionDate,
+ ExtendedDeadlineDto.builder().responseDate(extensionDate).plusDays(5).build(),
CALCULATE_DEADLINE_URL
)
.andExpect(content().json(toJson(extensionDate)))
@@ -410,4 +419,14 @@ void shouldThrowUserNotFoundOnCaseExceptionWhenRolesIsEmpty() {
}
+ @Test
+ @SneakyThrows
+ void shouldReturnDecisionMadeForTheClaimantRepaymentPlan() {
+ //Given
+ given(repaymentPlanDecisionService.getCalculatedDecision(any(), any())).willReturn(IN_FAVOUR_OF_CLAIMANT);
+ //When
+ doPost(BEARER_TOKEN, ClaimantProposedPlan.builder().proposedRepaymentType(IMMEDIATELY).build(), COURT_DECISION_URL, "1")
+ .andExpect(status().isOk());
+ }
+
}
diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/cases/HearingValuesControllerTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/cases/HearingValuesControllerTest.java
index 3b7051d357b..3b993d3ecdb 100644
--- a/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/cases/HearingValuesControllerTest.java
+++ b/src/integrationTest/java/uk/gov/hmcts/reform/civil/controllers/cases/HearingValuesControllerTest.java
@@ -4,7 +4,7 @@
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.mock.mockito.MockBean;
import uk.gov.hmcts.reform.civil.controllers.BaseIntegrationTest;
-import uk.gov.hmcts.reform.civil.exceptions.PartyIdsUpdatedException;
+import uk.gov.hmcts.reform.civil.exceptions.MissingFieldsUpdatedException;
import uk.gov.hmcts.reform.civil.model.HearingValuesRequest;
import uk.gov.hmcts.reform.civil.exceptions.CaseNotFoundException;
import uk.gov.hmcts.reform.civil.model.hearingvalues.ServiceHearingValuesModel;
@@ -55,7 +55,7 @@ public void shouldReturnHttp400_whenCaseNotFoundExceptionThrown() {
@SneakyThrows
public void shouldReturnHttp404_whenPartyIdsUpdatedExceptionThrown() {
when(hearingValuesService.getValues(anyLong(), anyString(), anyString()))
- .thenThrow(PartyIdsUpdatedException.class);
+ .thenThrow(MissingFieldsUpdatedException.class);
HearingValuesRequest requestBody = HearingValuesRequest.builder().caseReference(1L).hearingId("hearingid").build();
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/advice/ControllerExceptionHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/advice/ControllerExceptionHandler.java
index 398d3e4c2e7..863716d2741 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/advice/ControllerExceptionHandler.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/advice/ControllerExceptionHandler.java
@@ -11,7 +11,7 @@
import uk.gov.hmcts.reform.civil.documentmanagement.DocumentUploadException;
import uk.gov.hmcts.reform.civil.exceptions.CaseDataInvalidException;
import uk.gov.hmcts.reform.civil.exceptions.CaseNotFoundException;
-import uk.gov.hmcts.reform.civil.exceptions.PartyIdsUpdatedException;
+import uk.gov.hmcts.reform.civil.exceptions.MissingFieldsUpdatedException;
import uk.gov.hmcts.reform.civil.exceptions.UserNotFoundOnCaseException;
import uk.gov.hmcts.reform.civil.service.pininpost.exception.PinNotMatchException;
import uk.gov.hmcts.reform.civil.service.search.exceptions.SearchServiceCaseNotFoundException;
@@ -50,10 +50,10 @@ public ResponseEntity
")
.append("If you do not pay immediately, ").append(applicantName)
- .append(" can either:
")
- .append("")
- .append("- ask you to sign a settlement agreement to formalise the repayment plan
")
- .append("- request a county court judgment against you
")
- .append("
")
+ .append(" can request a county court judgment against you.")
.append("If ")
.append(applicantName);
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/spec/response/confirmation/PartialAdmitPayImmediatelyConfirmationText.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/spec/response/confirmation/PartialAdmitPayImmediatelyConfirmationText.java
index 2c67ef199a5..795c06132bc 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/spec/response/confirmation/PartialAdmitPayImmediatelyConfirmationText.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/spec/response/confirmation/PartialAdmitPayImmediatelyConfirmationText.java
@@ -2,6 +2,7 @@
import org.springframework.stereotype.Component;
import uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec;
+import uk.gov.hmcts.reform.civil.enums.RespondentResponseTypeSpec;
import uk.gov.hmcts.reform.civil.handler.callback.user.spec.RespondToClaimConfirmationTextSpecGenerator;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.RespondToClaimAdmitPartLRspec;
@@ -41,8 +42,14 @@ public Optional generateTextFor(CaseData caseData) {
.append(formattedWhenBePaid).append("")
.append("keep proof of any payments you make")
.append("make sure ").append(applicantName).append(" tells the court that you've paid").append("")
- .append("")
- .append("Contact ")
+ .append("");
+ if (caseData.getRespondent2() == null && caseData.getApplicant2() == null) {
+ if (!RespondentResponseTypeSpec.PART_ADMISSION.equals(caseData.getRespondent1ClaimResponseTypeForSpec())) {
+ sb.append("
If you do not pay:
")
+ .append("If you do not pay, the claimant can request a County Court Judgment against you.
");
+ }
+ }
+ sb.append("Contact ")
.append(applicantName);
if (applicantName.endsWith("s")) {
sb.append("'");
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/spec/response/confirmation/PartialAdmitSetDateConfirmationText.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/spec/response/confirmation/PartialAdmitSetDateConfirmationText.java
index e6ab2b4e24a..c694bceb407 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/spec/response/confirmation/PartialAdmitSetDateConfirmationText.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/spec/response/confirmation/PartialAdmitSetDateConfirmationText.java
@@ -91,25 +91,25 @@ public Optional generateTextFor(CaseData caseData) {
.append("Because you've said you will not pay immediately, ")
.append(applicantName)
- .append(" can either:
")
- .append("")
- .append("- ask you to sign a settlement agreement to formalise the repayment plan
")
- .append("- request a county court judgment against you for £")
- .append(admitOwed).append("
")
- .append("
")
+ .append(" can request a county court judgment against you for £")
+ .append(admitOwed).append(".
")
.append("If ")
.append(applicantName)
.append(" disagrees that you only owe £")
.append(admitOwed)
- .append("
")
- .append("We'll ask if they want to try mediation. ")
- .append("If they agree we'll contact you to arrange a call with the mediator.
")
- .append(
- "If they do not want to try mediation the court will review the case for the full amount of £")
- .append(totalClaimAmount).append(".
")
-
- .append("If ")
+ .append("
");
+ if (caseData.hasDefendantAgreedToFreeMediation()) {
+ sb.append("We'll ask if they want to try mediation. ")
+ .append("If they agree we'll contact you to arrange a call with the mediator.
")
+ .append(
+ "If they do not want to try mediation the court will review the case for the full amount of £")
+ .append(totalClaimAmount).append(".
");
+ } else {
+ sb.append("The court will review the case for the full amount of £")
+ .append(totalClaimAmount).append(".
");
+ }
+ sb.append("If ")
.append(applicantName)
.append(" rejects your offer to pay by ")
.append(DateFormatHelper.formatLocalDate(whenWillYouPay, DATE))
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/spec/response/confirmation/RepayPlanConfirmationText.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/spec/response/confirmation/RepayPlanConfirmationText.java
index ef04052829a..8ff66d373c0 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/spec/response/confirmation/RepayPlanConfirmationText.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/spec/response/confirmation/RepayPlanConfirmationText.java
@@ -74,7 +74,6 @@ public Optional generateTextFor(CaseData caseData) {
}
sb.append("request a county court judgment against you")
.append("")
-
.append("If ")
.append(applicantName);
if (caseData.getApplicant2() != null) {
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/strategy/translateddocuments/UploadTranslatedDocumentDefaultStrategy.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/strategy/translateddocuments/UploadTranslatedDocumentDefaultStrategy.java
index f264ee32e85..2406f9c3b39 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/strategy/translateddocuments/UploadTranslatedDocumentDefaultStrategy.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/callback/user/strategy/translateddocuments/UploadTranslatedDocumentDefaultStrategy.java
@@ -10,14 +10,13 @@
import uk.gov.hmcts.reform.civil.documentmanagement.model.CaseDocument;
import uk.gov.hmcts.reform.civil.model.BusinessProcess;
import uk.gov.hmcts.reform.civil.model.CaseData;
+import uk.gov.hmcts.reform.civil.model.citizenui.CaseDataLiP;
import uk.gov.hmcts.reform.civil.model.citizenui.TranslatedDocument;
import uk.gov.hmcts.reform.civil.model.common.Element;
import uk.gov.hmcts.reform.civil.service.SystemGeneratedDocumentService;
import java.util.List;
-import java.util.Optional;
-
-import static uk.gov.hmcts.reform.civil.enums.CaseState.AWAITING_APPLICANT_INTENTION;
+import java.util.Objects;
@Component
@RequiredArgsConstructor
@@ -28,33 +27,27 @@ public class UploadTranslatedDocumentDefaultStrategy implements UploadTranslated
@Override
public CallbackResponse uploadDocument(CallbackParams callbackParams) {
- List> updatedDocumentList = updateSystemGeneratedDocumentsWithTranslationDocument(
+ List> updatedDocumentList = updateSystemGeneratedDocumentsWithTranslationDocuments(
callbackParams);
+ CaseDataLiP caseDataLip = callbackParams.getCaseData().getCaseDataLiP();
+
+ if (Objects.nonNull(caseDataLip)) {
+ caseDataLip.setTranslatedDocuments(null);
+ }
+
CaseData updatedCaseData = callbackParams.getCaseData().toBuilder().systemGeneratedCaseDocuments(
- updatedDocumentList)
- .respondent1ClaimResponseDocumentSpec(getTranslatedDocumentAsCaseDocument(callbackParams))
+ updatedDocumentList)
+ .caseDataLiP(caseDataLip)
.businessProcess(BusinessProcess.ready(CaseEvent.UPLOAD_TRANSLATED_DOCUMENT)).build();
+
return AboutToStartOrSubmitCallbackResponse.builder()
- .state(AWAITING_APPLICANT_INTENTION.name())
.data(updatedCaseData.toMap(objectMapper))
.build();
}
- private List> updateSystemGeneratedDocumentsWithTranslationDocument(CallbackParams callbackParams) {
+ private List> updateSystemGeneratedDocumentsWithTranslationDocuments(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData();
- Optional translatedDocument = caseData.getTranslatedDocument();
- return translatedDocument.map(document -> systemGeneratedDocumentService.getSystemGeneratedDocumentsWithAddedDocument(
- document.getFile(),
- document.getCorrespondingDocumentType(),
- callbackParams
- )).orElse(caseData.getSystemGeneratedCaseDocuments());
- }
-
- private CaseDocument getTranslatedDocumentAsCaseDocument(CallbackParams callbackParams) {
- Optional translatedDocument = callbackParams.getCaseData().getTranslatedDocument();
- return translatedDocument.map(document -> CaseDocument.toCaseDocument(
- document.getFile(),
- document.getCorrespondingDocumentType()
- )).orElse(null);
+ List> translatedDocuments = caseData.getTranslatedDocuments();
+ return systemGeneratedDocumentService.getSystemGeneratedDocumentsWithAddedDocument(translatedDocuments, callbackParams);
}
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/event/BundleCreationTriggerEventHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/event/BundleCreationTriggerEventHandler.java
index 2389582acf2..abf03c46ba8 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/event/BundleCreationTriggerEventHandler.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/event/BundleCreationTriggerEventHandler.java
@@ -2,7 +2,6 @@
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import uk.gov.hmcts.reform.ccd.client.model.CaseDataContent;
@@ -21,6 +20,7 @@
import uk.gov.hmcts.reform.civil.utils.ElementUtils;
import java.time.LocalDateTime;
+import java.time.ZoneId;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -35,7 +35,6 @@
@AllArgsConstructor
public class BundleCreationTriggerEventHandler {
- @Autowired
private BundleCreationService bundleCreationService;
private final CoreCaseDataService coreCaseDataService;
private final CaseDetailsConverter caseDetailsConverter;
@@ -67,12 +66,12 @@ IdValue prepareNewBundle(uk.gov.hmcts.reform.civil.model.bundle.Bundle b
Bundle result = Bundle.builder()
.bundleHearingDate(Optional.of(caseData.getHearingDate()))
.stitchedDocument(Optional.ofNullable(bundle.getValue().getStitchedDocument()))
- .filename(bundle.getValue().getFileName())
+ .fileName(bundle.getValue().getFileName())
.title(bundle.getValue().getTitle())
.description(null != bundle.getValue().getDescription()
? Optional.of(bundle.getValue().getDescription()).get() : "")
.stitchStatus(Optional.ofNullable(bundle.getValue().getStitchStatus()))
- .createdOn(Optional.of(LocalDateTime.now()))
+ .createdOn(Optional.of(LocalDateTime.now(ZoneId.of("Europe/London"))))
.id(bundle.getValue().getId()).build();
return new IdValue<>(result.getId(), result);
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/event/EvidenceUploadNotificationEventHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/event/EvidenceUploadNotificationEventHandler.java
index ed52e4d8582..84adb0d19a8 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/event/EvidenceUploadNotificationEventHandler.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/event/EvidenceUploadNotificationEventHandler.java
@@ -4,7 +4,10 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
+import uk.gov.hmcts.reform.ccd.client.model.CaseDataContent;
import uk.gov.hmcts.reform.ccd.client.model.CaseDetails;
+import uk.gov.hmcts.reform.ccd.client.model.Event;
+import uk.gov.hmcts.reform.ccd.client.model.StartEventResponse;
import uk.gov.hmcts.reform.civil.event.EvidenceUploadNotificationEvent;
import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter;
import uk.gov.hmcts.reform.civil.model.CaseData;
@@ -12,6 +15,10 @@
import uk.gov.hmcts.reform.civil.notification.EvidenceUploadRespondentNotificationHandler;
import uk.gov.hmcts.reform.civil.service.CoreCaseDataService;
+import java.util.Map;
+
+import static uk.gov.hmcts.reform.civil.callback.CaseEvent.EVIDENCE_UPLOAD_CHECK;
+
@Slf4j
@Service
@RequiredArgsConstructor
@@ -50,5 +57,19 @@ public void sendEvidenceUploadNotification(EvidenceUploadNotificationEvent event
} catch (Exception e) {
log.warn("Failed to send email notification to respondent solicitor2 for case '{}'", event.getCaseId());
}
+ // null notificationText so it cleared each day, for any future evidence uploads
+ StartEventResponse startEventResponse = coreCaseDataService.startUpdate(event.getCaseId().toString(), EVIDENCE_UPLOAD_CHECK);
+ CaseDataContent caseContent = getCaseContent(startEventResponse);
+ coreCaseDataService.submitUpdate(event.getCaseId().toString(), caseContent);
+ }
+
+ private CaseDataContent getCaseContent(StartEventResponse startEventResponse) {
+ Map data = startEventResponse.getCaseDetails().getData();
+ data.put("notificationText", "NULLED");
+ return CaseDataContent.builder()
+ .eventToken(startEventResponse.getToken())
+ .event(Event.builder().id(startEventResponse.getEventId()).build())
+ .data(data)
+ .build();
}
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/event/StitchingCompleteCallbackHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/event/StitchingCompleteCallbackHandler.java
new file mode 100644
index 00000000000..71201b2e620
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/event/StitchingCompleteCallbackHandler.java
@@ -0,0 +1,61 @@
+package uk.gov.hmcts.reform.civil.handler.event;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import uk.gov.hmcts.reform.ccd.client.model.AboutToStartOrSubmitCallbackResponse;
+import uk.gov.hmcts.reform.ccd.client.model.CallbackResponse;
+import uk.gov.hmcts.reform.civil.callback.Callback;
+import uk.gov.hmcts.reform.civil.callback.CallbackHandler;
+import uk.gov.hmcts.reform.civil.callback.CallbackParams;
+import uk.gov.hmcts.reform.civil.callback.CaseEvent;
+import uk.gov.hmcts.reform.civil.enums.DocCategory;
+import uk.gov.hmcts.reform.civil.model.CaseData;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_START;
+import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
+import static uk.gov.hmcts.reform.civil.callback.CallbackType.SUBMITTED;
+import static uk.gov.hmcts.reform.civil.callback.CaseEvent.asyncStitchingComplete;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class StitchingCompleteCallbackHandler extends CallbackHandler {
+
+ private static final List EVENTS = List.of(asyncStitchingComplete);
+ private final ObjectMapper objectMapper;
+
+ @Override
+ protected Map callbacks() {
+ return Map.of(
+ callbackKey(ABOUT_TO_START), this::emptyCallbackResponse,
+ callbackKey(ABOUT_TO_SUBMIT), this::triggerUpdateBundleCategoryId,
+ callbackKey(SUBMITTED), this::emptySubmittedCallbackResponse
+ );
+ }
+
+ @Override
+ public List handledEvents() {
+ return EVENTS;
+ }
+
+ private CallbackResponse triggerUpdateBundleCategoryId(final CallbackParams callbackParams) {
+ CaseData caseData = callbackParams.getCaseData();
+ caseData.getCaseBundles().forEach(bundleIdValue -> bundleIdValue
+ .getValue().getStitchedDocument().ifPresent(
+ (document) -> {
+ if (Objects.isNull(document.getCategoryID())) {
+ document.setCategoryID(DocCategory.BUNDLES.getValue());
+ }
+ }
+ ));
+ return AboutToStartOrSubmitCallbackResponse.builder()
+ .data(caseData.toMap(objectMapper))
+ .build();
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/UpdateFromGACaseEventTaskHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/UpdateFromGACaseEventTaskHandler.java
index 7a1c766c57c..5a4e14a3ce4 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/UpdateFromGACaseEventTaskHandler.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/handler/tasks/UpdateFromGACaseEventTaskHandler.java
@@ -100,6 +100,7 @@ private Map getUpdatedCaseData(CaseData civilCaseData, CaseData
updateDocCollectionField(output, civilCaseData, generalAppCaseData, "writtenRepConcurrent");
updateDocCollectionField(output, civilCaseData, generalAppCaseData, "consentOrder");
updateDocCollectionField(output, civilCaseData, generalAppCaseData, gaDraft);
+ updateDocCollectionField(output, civilCaseData, generalAppCaseData, "gaResp");
updateDocCollection(output, generalAppCaseData, "gaRespondDoc", civilCaseData, "gaRespondDoc");
} catch (Exception e) {
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/helpers/bundle/BundleFileNameHelper.java b/src/main/java/uk/gov/hmcts/reform/civil/helpers/bundle/BundleFileNameHelper.java
index ca7dfe2808b..907a344b774 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/helpers/bundle/BundleFileNameHelper.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/helpers/bundle/BundleFileNameHelper.java
@@ -7,6 +7,7 @@
import uk.gov.hmcts.reform.civil.model.caseprogression.UploadEvidenceWitness;
import uk.gov.hmcts.reform.civil.model.common.Element;
+import java.util.Collections;
import java.util.List;
public class BundleFileNameHelper {
@@ -21,37 +22,37 @@ protected static List> getWitnessDocsByPartyAndDo
case WITNESS_STATEMENT : {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentWitnessStatement() != null
- ? caseData.getDocumentWitnessStatement() : null;
+ ? caseData.getDocumentWitnessStatement() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentWitnessStatementApp2() != null
- ? caseData.getDocumentWitnessStatementApp2() : null;
+ ? caseData.getDocumentWitnessStatementApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentWitnessStatementRes() != null
- ? caseData.getDocumentWitnessStatementRes() : null;
+ ? caseData.getDocumentWitnessStatementRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentWitnessStatementRes2() != null
- ? caseData.getDocumentWitnessStatementRes2() : null;
+ ? caseData.getDocumentWitnessStatementRes2() : Collections.emptyList();
};
}
case WITNESS_SUMMARY : {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentWitnessSummary() != null
- ? caseData.getDocumentWitnessSummary() : null;
+ ? caseData.getDocumentWitnessSummary() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentWitnessSummaryApp2() != null
- ? caseData.getDocumentWitnessSummaryApp2() : null;
+ ? caseData.getDocumentWitnessSummaryApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentWitnessSummaryRes() != null
- ? caseData.getDocumentWitnessSummaryRes() : null;
+ ? caseData.getDocumentWitnessSummaryRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentWitnessSummaryRes2() != null
- ? caseData.getDocumentWitnessSummaryRes2() : null;
+ ? caseData.getDocumentWitnessSummaryRes2() : Collections.emptyList();
};
}
case NOTICE_OF_INTENTION : {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentHearsayNotice() != null
- ? caseData.getDocumentHearsayNotice() : null;
+ ? caseData.getDocumentHearsayNotice() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentHearsayNoticeApp2() != null
- ? caseData.getDocumentHearsayNoticeApp2() : null;
+ ? caseData.getDocumentHearsayNoticeApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentHearsayNoticeRes() != null
- ? caseData.getDocumentHearsayNoticeRes() : null;
+ ? caseData.getDocumentHearsayNoticeRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentHearsayNoticeRes2() != null
- ? caseData.getDocumentHearsayNoticeRes2() : null;
+ ? caseData.getDocumentHearsayNoticeRes2() : Collections.emptyList();
};
}
default: return null;
@@ -65,49 +66,49 @@ protected static List> getExpertDocsByPartyAndDocT
case EXPERT_REPORT : {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentExpertReport() != null
- ? caseData.getDocumentExpertReport() : null;
+ ? caseData.getDocumentExpertReport() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentExpertReportApp2() != null
- ? caseData.getDocumentExpertReportApp2() : null;
+ ? caseData.getDocumentExpertReportApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentExpertReportRes() != null
- ? caseData.getDocumentExpertReportRes() : null;
+ ? caseData.getDocumentExpertReportRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentExpertReportRes2() != null
- ? caseData.getDocumentExpertReportRes2() : null;
+ ? caseData.getDocumentExpertReportRes2() : Collections.emptyList();
};
}
case QUESTIONS_FOR_EXPERTS: {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentQuestions() != null
- ? caseData.getDocumentQuestions() : null;
+ ? caseData.getDocumentQuestions() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentQuestionsApp2() != null
- ? caseData.getDocumentQuestionsApp2() : null;
+ ? caseData.getDocumentQuestionsApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentQuestionsRes() != null
- ? caseData.getDocumentQuestionsRes() : null;
+ ? caseData.getDocumentQuestionsRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentQuestionsRes2() != null
- ? caseData.getDocumentQuestionsRes2() : null;
+ ? caseData.getDocumentQuestionsRes2() : Collections.emptyList();
};
}
case ANSWERS_FOR_EXPERTS: {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentAnswers() != null
- ? caseData.getDocumentAnswers() : null;
+ ? caseData.getDocumentAnswers() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentAnswersApp2() != null
- ? caseData.getDocumentAnswersApp2() : null;
+ ? caseData.getDocumentAnswersApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentAnswersRes() != null
- ? caseData.getDocumentAnswersRes() : null;
+ ? caseData.getDocumentAnswersRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentAnswersRes2() != null
- ? caseData.getDocumentAnswersRes2() : null;
+ ? caseData.getDocumentAnswersRes2() : Collections.emptyList();
};
}
case JOINT_STATEMENT: {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentJointStatement() != null
- ? caseData.getDocumentJointStatement() : null;
+ ? caseData.getDocumentJointStatement() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentJointStatementApp2() != null
- ? caseData.getDocumentJointStatementApp2() : null;
+ ? caseData.getDocumentJointStatementApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentJointStatementRes() != null
- ? caseData.getDocumentJointStatementRes() : null;
+ ? caseData.getDocumentJointStatementRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentJointStatementRes2() != null
- ? caseData.getDocumentJointStatementRes2() : null;
+ ? caseData.getDocumentJointStatementRes2() : Collections.emptyList();
};
}
default: return null;
@@ -121,85 +122,85 @@ protected static List> getEvidenceUploadDocs
case DOCUMENTS_FOR_DISCLOSURE: {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentForDisclosure() != null
- ? caseData.getDocumentForDisclosure() : null;
+ ? caseData.getDocumentForDisclosure() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentForDisclosureApp2() != null
- ? caseData.getDocumentForDisclosureApp2() : null;
+ ? caseData.getDocumentForDisclosureApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentForDisclosureRes() != null
- ? caseData.getDocumentForDisclosureRes() : null;
+ ? caseData.getDocumentForDisclosureRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentForDisclosureRes2() != null
- ? caseData.getDocumentForDisclosureRes2() : null;
+ ? caseData.getDocumentForDisclosureRes2() : Collections.emptyList();
};
}
case DISCLOSURE_LIST: {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentDisclosureList() != null
- ? caseData.getDocumentDisclosureList() : null;
+ ? caseData.getDocumentDisclosureList() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentDisclosureListApp2() != null
- ? caseData.getDocumentDisclosureListApp2() : null;
+ ? caseData.getDocumentDisclosureListApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentDisclosureListRes() != null
- ? caseData.getDocumentDisclosureListRes() : null;
+ ? caseData.getDocumentDisclosureListRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentDisclosureListRes2() != null
- ? caseData.getDocumentDisclosureListRes2() : null;
+ ? caseData.getDocumentDisclosureListRes2() : Collections.emptyList();
};
}
case DOCUMENTS_REFERRED: {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentReferredInStatement() != null
- ? caseData.getDocumentReferredInStatement() : null;
+ ? caseData.getDocumentReferredInStatement() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentReferredInStatementApp2() != null
- ? caseData.getDocumentReferredInStatementApp2() : null;
+ ? caseData.getDocumentReferredInStatementApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentReferredInStatementRes() != null
- ? caseData.getDocumentReferredInStatementRes() : null;
+ ? caseData.getDocumentReferredInStatementRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentReferredInStatementRes2() != null
- ? caseData.getDocumentReferredInStatementRes2() : null;
+ ? caseData.getDocumentReferredInStatementRes2() : Collections.emptyList();
};
}
case DOCUMENTARY: {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentEvidenceForTrial() != null
- ? caseData.getDocumentEvidenceForTrial() : null;
+ ? caseData.getDocumentEvidenceForTrial() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentEvidenceForTrialApp2() != null
- ? caseData.getDocumentEvidenceForTrialApp2() : null;
+ ? caseData.getDocumentEvidenceForTrialApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentEvidenceForTrialRes() != null
- ? caseData.getDocumentEvidenceForTrialRes() : null;
+ ? caseData.getDocumentEvidenceForTrialRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentEvidenceForTrialRes2() != null
- ? caseData.getDocumentEvidenceForTrialRes2() : null;
+ ? caseData.getDocumentEvidenceForTrialRes2() : Collections.emptyList();
};
}
case CASE_SUMMARY: {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentCaseSummary() != null
- ? caseData.getDocumentCaseSummary() : null;
+ ? caseData.getDocumentCaseSummary() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentCaseSummaryApp2() != null
- ? caseData.getDocumentCaseSummaryApp2() : null;
+ ? caseData.getDocumentCaseSummaryApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentCaseSummaryRes() != null
- ? caseData.getDocumentCaseSummaryRes() : null;
+ ? caseData.getDocumentCaseSummaryRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentCaseSummaryRes2() != null
- ? caseData.getDocumentCaseSummaryRes2() : null;
+ ? caseData.getDocumentCaseSummaryRes2() : Collections.emptyList();
};
}
case COSTS: {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentCosts() != null
- ? caseData.getDocumentCosts() : null;
+ ? caseData.getDocumentCosts() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentCostsApp2() != null
- ? caseData.getDocumentCostsApp2() : null;
+ ? caseData.getDocumentCostsApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentCostsRes() != null
- ? caseData.getDocumentCostsRes() : null;
+ ? caseData.getDocumentCostsRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentCostsRes2() != null
- ? caseData.getDocumentCostsRes2() : null;
+ ? caseData.getDocumentCostsRes2() : Collections.emptyList();
};
}
case SKELETON_ARGUMENT: {
return switch (partyType) {
case CLAIMANT1 -> caseData.getDocumentSkeletonArgument() != null
- ? caseData.getDocumentSkeletonArgument() : null;
+ ? caseData.getDocumentSkeletonArgument() : Collections.emptyList();
case CLAIMANT2 -> caseData.getDocumentSkeletonArgumentApp2() != null
- ? caseData.getDocumentSkeletonArgumentApp2() : null;
+ ? caseData.getDocumentSkeletonArgumentApp2() : Collections.emptyList();
case DEFENDANT1 -> caseData.getDocumentSkeletonArgumentRes() != null
- ? caseData.getDocumentSkeletonArgumentRes() : null;
+ ? caseData.getDocumentSkeletonArgumentRes() : Collections.emptyList();
case DEFENDANT2 -> caseData.getDocumentSkeletonArgumentRes2() != null
- ? caseData.getDocumentSkeletonArgumentRes2() : null;
+ ? caseData.getDocumentSkeletonArgumentRes2() : Collections.emptyList();
};
}
default: return null;
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/helpers/bundle/BundleRequestMapper.java b/src/main/java/uk/gov/hmcts/reform/civil/helpers/bundle/BundleRequestMapper.java
index feaa58aec78..8267d327903 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/helpers/bundle/BundleRequestMapper.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/helpers/bundle/BundleRequestMapper.java
@@ -27,17 +27,24 @@
import uk.gov.hmcts.reform.civil.documentmanagement.model.DocumentType;
import uk.gov.hmcts.reform.civil.utils.ElementUtils;
-import java.time.LocalDate;
import java.util.Arrays;
import java.util.Collections;
+import java.util.Collection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.TreeMap;
+
+import java.time.LocalDate;
+
import java.util.stream.Collectors;
import java.util.stream.IntStream;
+import static uk.gov.hmcts.reform.civil.enums.CaseCategory.SPEC_CLAIM;
import static uk.gov.hmcts.reform.civil.helpers.bundle.BundleFileNameHelper.getEvidenceUploadDocsByPartyAndDocType;
import static uk.gov.hmcts.reform.civil.helpers.bundle.BundleFileNameHelper.getExpertDocsByPartyAndDocType;
import static uk.gov.hmcts.reform.civil.helpers.bundle.BundleFileNameHelper.getWitnessDocsByPartyAndDocType;
@@ -71,7 +78,7 @@ public BundleCreateRequest mapCaseDataToBundleCreateRequest(CaseData caseData,
private String generateFileName(CaseData caseData) {
String applicantName = caseData.getApplicant1().isIndividual()
? caseData.getApplicant1().getIndividualLastName() : caseData.getApplicant1().getPartyName();
- String respondentName = caseData.getApplicant1().isIndividual()
+ String respondentName = caseData.getRespondent1().isIndividual()
? caseData.getRespondent1().getIndividualLastName() : caseData.getRespondent1().getPartyName();
return applicantName + " v " + respondentName +
"-" + DateFormatHelper.formatLocalDate(caseData.getHearingDate(), "ddMMyyyy");
@@ -103,7 +110,6 @@ private BundlingCaseData mapCaseData(CaseData caseData, String bundleConfigFileN
.defendant2CostsBudgets(mapCostBudgetDocs(caseData, PartyType.DEFENDANT2))
.applicant1(caseData.getApplicant1())
.respondent1(caseData.getRespondent1())
- .courtLocation(caseData.getHearingLocation().getValue().getLabel())
.hearingDate(null != caseData.getHearingDate()
? DateFormatHelper.formatLocalDate(caseData.getHearingDate(), "dd-MM-yyyy") : null)
.ccdCaseReference(caseData.getCcdCaseReference())
@@ -112,16 +118,42 @@ private BundlingCaseData mapCaseData(CaseData caseData, String bundleConfigFileN
return bundlingCaseData;
}
+ private List mapParticularsOfClaimDocs(CaseData caseData) {
+ List bundlingRequestDocuments = new ArrayList<>();
+ if (Objects.nonNull(caseData.getServedDocumentFiles())
+ && Objects.nonNull((caseData.getServedDocumentFiles().getParticularsOfClaimDocument()))) {
+ caseData.getServedDocumentFiles()
+ .getParticularsOfClaimDocument()
+ .forEach(poc -> bundlingRequestDocuments.add(
+ buildBundlingRequestDoc(getParticularsOfClaimName(caseData),
+ poc.getValue(), "")));
+ }
+ return bundlingRequestDocuments;
+ }
+
+ private String getParticularsOfClaimName(CaseData caseData) {
+ LocalDate pocDate;
+ if (SPEC_CLAIM.equals(caseData.getCaseAccessCategory())) {
+ pocDate = caseData.getIssueDate();
+ } else if (Objects.nonNull(caseData.getClaimDetailsNotificationDate())) {
+ pocDate = caseData.getClaimDetailsNotificationDate().toLocalDate();
+ } else {
+ pocDate = caseData.getSubmittedDate().toLocalDate();
+ }
+ return generateDocName(BundleFileNameList.PARTICULARS_OF_CLAIM.getDisplayName(),
+ null, null, pocDate);
+ }
+
private List> mapJointStatementOfExperts(CaseData caseData) {
List bundlingRequestDocuments = new ArrayList<>();
Arrays.stream(PartyType.values()).toList().forEach(partyType -> {
- List allJointExpertsNames = getAllExpertsNames(partyType, EvidenceUploadFiles.JOINT_STATEMENT,
+ Set allJointExpertsNames = getAllExpertsNames(partyType, EvidenceUploadFiles.JOINT_STATEMENT,
caseData);
bundlingRequestDocuments.addAll(getAllExpertReports(partyType, EvidenceUploadFiles.JOINT_STATEMENT, caseData,
BundleFileNameList.JOINT_STATEMENTS_OF_EXPERTS, allJointExpertsNames
));
- bundlingRequestDocuments.addAll(getAllExpertReports(partyType, EvidenceUploadFiles.QUESTIONS_FOR_EXPERTS, caseData,
- BundleFileNameList.QUESTIONS_TO, allJointExpertsNames));
+ bundlingRequestDocuments.addAll(getAllOtherPartyQuestions(partyType, caseData,
+ allJointExpertsNames));
bundlingRequestDocuments.addAll(getAllExpertReports(partyType, EvidenceUploadFiles.ANSWERS_FOR_EXPERTS, caseData,
BundleFileNameList.REPLIES_FROM, allJointExpertsNames));
});
@@ -163,27 +195,127 @@ private List> mapDisclosedDocs(CaseData caseDat
private List> mapExpertEvidenceDocs(CaseData caseData, PartyType partyType) {
List bundlingRequestDocuments = new ArrayList<>();
- List allExpertsNames = getAllExpertsNames(partyType, EvidenceUploadFiles.EXPERT_REPORT, caseData);
+ Set allExpertsNames = getAllExpertsNames(partyType, EvidenceUploadFiles.EXPERT_REPORT, caseData);
+ Set allJointExpertsNames = getAllExpertsNames(partyType, EvidenceUploadFiles.JOINT_STATEMENT,
+ caseData);
bundlingRequestDocuments.addAll(getAllExpertReports(partyType, EvidenceUploadFiles.EXPERT_REPORT, caseData,
BundleFileNameList.EXPERT_EVIDENCE, allExpertsNames));
- bundlingRequestDocuments.addAll(getAllExpertReports(partyType, EvidenceUploadFiles.QUESTIONS_FOR_EXPERTS,
- caseData, BundleFileNameList.QUESTIONS_TO, allExpertsNames));
+
+ bundlingRequestDocuments.addAll(getAllOtherPartyQuestions(partyType,
+ caseData, allExpertsNames));
bundlingRequestDocuments.addAll(getAllExpertReports(partyType, EvidenceUploadFiles.ANSWERS_FOR_EXPERTS,
caseData, BundleFileNameList.REPLIES_FROM, allExpertsNames));
- List allJointExpertsNames = getAllExpertsNames(partyType, EvidenceUploadFiles.JOINT_STATEMENT,
- caseData);
- bundlingRequestDocuments.addAll(getAllRemainingExpertReports(partyType,
- EvidenceUploadFiles.QUESTIONS_FOR_EXPERTS, caseData,
- BundleFileNameList.QUESTIONS_TO, allExpertsNames, allJointExpertsNames));
+ bundlingRequestDocuments.addAll(getAllRemainingExpertQuestions(partyType,
+ EvidenceUploadFiles.QUESTIONS_FOR_EXPERTS, caseData));
bundlingRequestDocuments.addAll(getAllRemainingExpertReports(partyType, EvidenceUploadFiles.ANSWERS_FOR_EXPERTS,
caseData,
BundleFileNameList.REPLIES_FROM, allExpertsNames, allJointExpertsNames));
return ElementUtils.wrapElements(bundlingRequestDocuments);
}
+ private List getAllRemainingExpertQuestions(PartyType partyType,
+ EvidenceUploadFiles questionsForExperts, CaseData caseData) {
+ List bundlingRequestDocuments = new ArrayList<>();
+ List> listOfDocsOtherPartyQues = getExpertDocsByPartyAndDocType(partyType,
+ questionsForExperts, caseData);
+ Set allExpertFromOtherParty1 = getAllExpertFromOtherParty(partyType, EvidenceUploadFiles.EXPERT_REPORT,
+ caseData, true);
+ Set allExpertFromOtherParty2 = getAllExpertFromOtherParty(partyType, EvidenceUploadFiles.EXPERT_REPORT,
+ caseData, false);
+ Set allJointExpertsFromOtherParty1 = getAllExpertFromOtherParty(partyType, EvidenceUploadFiles.JOINT_STATEMENT,
+ caseData, true);
+ Set allJointExpertsFromOtherParty2 = getAllExpertFromOtherParty(partyType, EvidenceUploadFiles.JOINT_STATEMENT,
+ caseData, false);
+ Party otherParty1;
+ Party otherParty2;
+ if (partyType.equals(PartyType.CLAIMANT1) || partyType.equals(PartyType.CLAIMANT2)) {
+ otherParty1 = getPartyByPartyType(PartyType.DEFENDANT1, caseData);
+ otherParty2 = getPartyByPartyType(PartyType.DEFENDANT2, caseData);
+
+ } else {
+ otherParty1 = getPartyByPartyType(PartyType.CLAIMANT1, caseData);
+ otherParty2 = getPartyByPartyType(PartyType.CLAIMANT2, caseData);
+ }
+ List> tempList = new ArrayList<>();
+ listOfDocsOtherPartyQues.forEach(expertElement -> {
+ if (!((matchParty(expertElement.getValue().getExpertOptionOtherParty(), otherParty1)
+ && matchType(expertElement.getValue().getExpertOptionName(), allExpertFromOtherParty1, false))
+ || (matchParty(expertElement.getValue().getExpertOptionOtherParty(), otherParty2)
+ && matchType(expertElement.getValue().getExpertOptionName(), allExpertFromOtherParty2, false))
+ || (matchParty(expertElement.getValue().getExpertOptionOtherParty(), otherParty1)
+ && matchType(expertElement.getValue().getExpertOptionName(), allJointExpertsFromOtherParty1, false))
+ || (matchParty(expertElement.getValue().getExpertOptionOtherParty(), otherParty2)
+ && matchType(expertElement.getValue().getExpertOptionName(), allJointExpertsFromOtherParty2, false)))) {
+ tempList.add(expertElement);
+ }
+ });
+ bundlingRequestDocuments.addAll(covertExpertEvidenceTypeToBundleRequestDocs(
+ tempList, BundleFileNameList.QUESTIONS_TO.getDisplayName(),
+ EvidenceUploadFiles.QUESTIONS_FOR_EXPERTS.name()));
+
+ return bundlingRequestDocuments;
+ }
+
+ private Set getAllExpertFromOtherParty(PartyType partyType, EvidenceUploadFiles expertReport,
+ CaseData caseData, boolean isDefendant1) {
+ if (partyType.equals(PartyType.CLAIMANT1) || partyType.equals(PartyType.CLAIMANT2)) {
+ return getAllExpertsNames(isDefendant1 ? PartyType.DEFENDANT1 : PartyType.DEFENDANT2,
+ expertReport, caseData);
+ } else {
+ return getAllExpertsNames(isDefendant1 ? PartyType.CLAIMANT1 : PartyType.CLAIMANT2,
+ expertReport, caseData);
+ }
+ }
+
+ private List getAllOtherPartyQuestions(PartyType partyType,
+ CaseData caseData,
+ Set allExpertsNames) {
+ List bundlingRequestDocuments = new ArrayList<>();
+ List> questionsFromOtherPartyDocs = getAllDocsFromOtherParty(partyType, caseData,
+ EvidenceUploadFiles.QUESTIONS_FOR_EXPERTS
+ );
+ if (!questionsFromOtherPartyDocs.isEmpty()) {
+ List> tempList = questionsFromOtherPartyDocs.stream().filter(expertElement -> matchType(
+ expertElement.getValue().getExpertOptionName(), allExpertsNames, false
+ ))
+ .filter(expertElement -> matchParty(
+ expertElement.getValue().getExpertOptionOtherParty(),
+ getPartyByPartyType(partyType, caseData)
+ )).collect(Collectors.toList());
+ if (!tempList.isEmpty()) {
+ Map>> expertReportMap = groupExpertStatementsByName(tempList);
+ expertReportMap.forEach((expertName, expertEvidenceList) -> bundlingRequestDocuments.addAll(covertExpertEvidenceTypeToBundleRequestDocs(
+ expertEvidenceList, BundleFileNameList.QUESTIONS_TO.getDisplayName(), EvidenceUploadFiles.QUESTIONS_FOR_EXPERTS.name())));
+ }
+ }
+ return bundlingRequestDocuments;
+ }
+
+ private boolean matchParty(String expertOptionOtherParty, Party party) {
+ if (party != null && party.getPartyName() != null && expertOptionOtherParty.equalsIgnoreCase(party.getPartyName())) {
+ return true;
+ }
+ return party != null && party.isIndividual() && party.getIndividualFirstName() != null && expertOptionOtherParty.equalsIgnoreCase(
+ party.getIndividualFirstName());
+ }
+
+ private List> getAllDocsFromOtherParty(PartyType partyType, CaseData caseData,
+ EvidenceUploadFiles evidenceUploadFileType) {
+ List> list = new ArrayList<>();
+ if (partyType.equals(PartyType.CLAIMANT1) || partyType.equals(PartyType.CLAIMANT2)) {
+ list.addAll(getExpertDocsByPartyAndDocType(PartyType.DEFENDANT1,
+ evidenceUploadFileType, caseData));
+ list.addAll(getExpertDocsByPartyAndDocType(PartyType.DEFENDANT2, evidenceUploadFileType, caseData));
+ } else {
+ list.addAll(getExpertDocsByPartyAndDocType(PartyType.CLAIMANT1, evidenceUploadFileType, caseData));
+ list.addAll(getExpertDocsByPartyAndDocType(PartyType.CLAIMANT2, evidenceUploadFileType, caseData));
+ }
+ return list;
+ }
+
private List getAllRemainingExpertReports(PartyType partyType,
EvidenceUploadFiles evidenceUploadFiles, CaseData caseData,
- BundleFileNameList bundleFileNameList, List allExpertsNames, List allJointExpertsNames) {
+ BundleFileNameList bundleFileNameList, Set allExpertsNames, Set allJointExpertsNames) {
List bundlingRequestDocuments = new ArrayList<>();
Map>> expertReportMap =
groupExpertStatementsByName(getExpertDocsByPartyAndDocType(partyType, evidenceUploadFiles, caseData));
@@ -203,20 +335,20 @@ private List getAllRemainingExpertReports(PartyType par
return bundlingRequestDocuments;
}
- private List getAllExpertsNames(PartyType partyType, EvidenceUploadFiles evidenceUploadFileType,
+ private Set getAllExpertsNames(PartyType partyType, EvidenceUploadFiles evidenceUploadFileType,
CaseData caseData) {
- List> expertsList = getExpertDocsByPartyAndDocType(partyType, evidenceUploadFileType, caseData);
+ List> expertsList = getExpertDocsByPartyAndDocType(partyType,
+ evidenceUploadFileType, caseData);
if (expertsList != null) {
- return expertsList.stream().map(expertElement -> expertElement.getValue().getExpertOptionName())
- .collect(Collectors.toList());
- } else {
- return Collections.emptyList();
+ return expertsList.stream().map(expertElement -> expertElement.getValue().getExpertOptionName().trim().toLowerCase())
+ .collect(Collectors.toSet());
}
+ return Collections.emptySet();
}
private List getAllExpertReports(PartyType partyType, EvidenceUploadFiles evidenceUploadFiles,
CaseData caseData, BundleFileNameList bundleFileNameList,
- List allExpertsNames) {
+ Set allExpertsNames) {
List bundlingRequestDocuments = new ArrayList<>();
Map>> expertReportMap =
groupExpertStatementsByName(getExpertDocsByPartyAndDocType(partyType, evidenceUploadFiles, caseData));
@@ -236,11 +368,10 @@ private List getAllExpertReports(PartyType partyType, E
private Map>> groupExpertStatementsByName(
List> documentExpertReport) {
- Map>> expertStatementMap = new HashMap>>();
+ Map>> expertStatementMap = new TreeMap<>();
if (documentExpertReport != null) {
expertStatementMap = documentExpertReport.stream().collect(Collectors
- .groupingBy(uploadEvidenceWitnessElement -> uploadEvidenceWitnessElement
+ .groupingBy(uploadEvidenceExpertElement -> uploadEvidenceExpertElement
.getValue().getExpertOptionName().trim().toLowerCase()));
}
return expertStatementMap;
@@ -261,6 +392,10 @@ private List> mapWitnessStatements(CaseData cas
bundlingRequestDocuments.addAll(covertWitnessEvidenceToBundleRequestDocs(getWitnessDocsByPartyAndDocType(partyType, EvidenceUploadFiles.WITNESS_SUMMARY, caseData),
BundleFileNameList.WITNESS_SUMMARY.getDisplayName(),
EvidenceUploadFiles.WITNESS_SUMMARY.name(), partyType, false));
+ bundlingRequestDocuments.addAll(covertEvidenceUploadTypeToBundleRequestDocs(getEvidenceUploadDocsByPartyAndDocType(partyType,
+ EvidenceUploadFiles.DOCUMENTS_REFERRED, caseData),
+ BundleFileNameList.DOC_REFERRED_TO.getDisplayName(),
+ EvidenceUploadFiles.DOCUMENTS_REFERRED.name(), partyType));
bundlingRequestDocuments.addAll(covertWitnessEvidenceToBundleRequestDocs(getWitnessDocsByPartyAndDocType(partyType, EvidenceUploadFiles.NOTICE_OF_INTENTION, caseData),
BundleFileNameList.HEARSAY_NOTICE.getDisplayName(),
EvidenceUploadFiles.NOTICE_OF_INTENTION.name(), partyType, false));
@@ -346,7 +481,7 @@ private void sortEvidenceUploadByDate(List>
private void sortExpertListByDate(List> expertEvidence,
boolean sortByCreatedDate) {
expertEvidence.sort(Comparator.comparing(
- uploadEvidenceWitnessElement -> uploadEvidenceWitnessElement.getValue().getExpertOptionUploadDate(),
+ uploadEvidenceExpertElement -> uploadEvidenceExpertElement.getValue().getExpertOptionUploadDate(),
Comparator.reverseOrder()
));
}
@@ -396,20 +531,20 @@ private List> mapOrdersDocument(CaseData caseDa
bundlingRequestDocuments.addAll(mapSystemGeneratedCaseDocument(caseData.getDirectionOrderDocStaff(),
BundleFileNameList.ORDER.getDisplayName()));
}
- if (caseData.getFinalOrderDocument() != null) {
- bundlingRequestDocuments.add(buildBundlingRequestDoc(caseData.getFinalOrderDocument().getDocumentFileName(), caseData.getFinalOrderDocument(), ""));
- }
+
return ElementUtils.wrapElements(bundlingRequestDocuments);
}
private List> mapStatementOfcaseDocs(CaseData caseData) {
List bundlingRequestDocuments = new ArrayList<>();
- log.info("System generated docs : " + caseData.getSystemGeneratedCaseDocuments());
bundlingRequestDocuments.addAll(mapSystemGeneratedCaseDocument(caseData.getSystemGeneratedCaseDocuments().stream()
.filter(caseDocumentElement -> caseDocumentElement.getValue().getDocumentType()
- .equals(DocumentType.SEALED_CLAIM)).collect(
- Collectors.toList()),
+ .equals(DocumentType.SEALED_CLAIM)
+ && null != caseDocumentElement.getValue().getDocumentLink().getCategoryID()
+ && caseDocumentElement.getValue().getDocumentLink().getCategoryID().equals("detailsOfClaim"))
+ .collect(Collectors.toList()),
BundleFileNameList.CLAIM_FORM.getDisplayName()));
+ bundlingRequestDocuments.addAll(mapParticularsOfClaimDocs(caseData));
List> clAndDfDocList = caseData.getDefendantResponseDocuments();
clAndDfDocList.addAll(caseData.getClaimantResponseDocuments());
List> sortedDefendantDefenceAndClaimantReply =
@@ -529,11 +664,11 @@ public List> filterDocumentaryEvidenceForTri
)).collect(Collectors.toList());
}
- private boolean matchType(String typeOfDocument, List displayNames, boolean doesNotMatchType) {
+ private boolean matchType(String name, Collection displayNames, boolean doesNotMatchType) {
if (doesNotMatchType) {
- return displayNames.stream().noneMatch(s -> s.equalsIgnoreCase(typeOfDocument.trim()));
+ return displayNames.stream().noneMatch(s -> s.equalsIgnoreCase(name.trim()));
} else {
- return displayNames.stream().anyMatch(s -> s.equalsIgnoreCase(typeOfDocument.trim()));
+ return displayNames.stream().anyMatch(s -> s.equalsIgnoreCase(name.trim()));
}
}
@@ -578,14 +713,18 @@ private List covertEvidenceUploadTypeToBundleRequestDoc
PartyType party) {
List bundlingRequestDocuments = new ArrayList<>();
if (evidenceUploadDocList != null) {
- if (documentType.equals(EvidenceUploadFiles.CASE_SUMMARY.name()) || documentType.equals(EvidenceUploadFiles.SKELETON_ARGUMENT.name())) {
+ if (documentType.equals(EvidenceUploadFiles.CASE_SUMMARY.name())
+ || documentType.equals(EvidenceUploadFiles.SKELETON_ARGUMENT.name())
+ || documentType.equals(EvidenceUploadFiles.COSTS.name())) {
sortEvidenceUploadByDate(evidenceUploadDocList, true);
} else {
sortEvidenceUploadByDate(evidenceUploadDocList, false);
}
evidenceUploadDocList.forEach(uploadEvidenceDocumentTypeElement -> {
- String docName = getFileNameBaseOnType(fileNamePrefix, uploadEvidenceDocumentTypeElement, documentType, party);
+ String docName = getFileNameBaseOnType(fileNamePrefix, uploadEvidenceDocumentTypeElement,
+ documentType, party,
+ String.valueOf(evidenceUploadDocList.indexOf(uploadEvidenceDocumentTypeElement) + 1));
bundlingRequestDocuments.add(buildBundlingRequestDoc(docName, uploadEvidenceDocumentTypeElement.getValue().getDocumentUpload(), documentType));
});
}
@@ -593,7 +732,7 @@ private List covertEvidenceUploadTypeToBundleRequestDoc
}
private String getFileNameBaseOnType(String fileNamePrefix, Element uploadEvidence,
- String documentType, PartyType party) {
+ String documentType, PartyType party, String index) {
if (fileNamePrefix.equals(DOC_FILE_NAME)) {
return uploadEvidence.getValue().getDocumentUpload().getDocumentFileName()
.substring(0, uploadEvidence.getValue().getDocumentUpload().getDocumentFileName().lastIndexOf("."));
@@ -610,10 +749,19 @@ private String getFileNameBaseOnType(String fileNamePrefix, Element 30) {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/Bundle.java b/src/main/java/uk/gov/hmcts/reform/civil/model/Bundle.java
index 32e17980b6c..7aff2555707 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/Bundle.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/Bundle.java
@@ -29,7 +29,7 @@ public class Bundle implements MappableObject {
private YesOrNo hasCoversheets;
private YesOrNo hasTableOfContents;
- private String filename;
+ private String fileName;
//Added for case progression trial bundling
private Optional createdOn;
@@ -72,7 +72,7 @@ public Bundle(
Optional stitchedDocument,
YesOrNo hasCoversheets,
YesOrNo hasTableOfContents,
- String filename
+ String fileName
) {
this.id = id;
this.title = title;
@@ -83,7 +83,7 @@ public Bundle(
this.stitchedDocument = stitchedDocument;
this.hasCoversheets = hasCoversheets;
this.hasTableOfContents = hasTableOfContents;
- this.filename = filename;
+ this.fileName = fileName;
}
@@ -123,8 +123,8 @@ public YesOrNo getHasTableOfContents() {
return hasTableOfContents;
}
- public String getFilename() {
- return filename;
+ public String getFileName() {
+ return fileName;
}
public Optional getCreatedOn() {
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/CCJPaymentDetails.java b/src/main/java/uk/gov/hmcts/reform/civil/model/CCJPaymentDetails.java
index 529d66ec762..3820e1befd6 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/CCJPaymentDetails.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/CCJPaymentDetails.java
@@ -33,4 +33,7 @@ public class CCJPaymentDetails {
private BigDecimal ccjJudgmentFixedCostAmount;
private YesOrNo ccjJudgmentFixedCostOption;
private String ccjJudgmentStatement;
+ @JsonFormat(shape = JsonFormat.Shape.STRING)
+ private BigDecimal ccjJudgmentLipInterest;
+
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/CaseData.java b/src/main/java/uk/gov/hmcts/reform/civil/model/CaseData.java
index 99734b0293c..953b02321d3 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/CaseData.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/CaseData.java
@@ -40,6 +40,7 @@
import uk.gov.hmcts.reform.civil.model.breathing.BreathingSpaceInfo;
import uk.gov.hmcts.reform.civil.model.caseprogression.FreeFormOrderValues;
import uk.gov.hmcts.reform.civil.model.citizenui.CaseDataLiP;
+import uk.gov.hmcts.reform.civil.model.citizenui.HelpWithFees;
import uk.gov.hmcts.reform.civil.model.citizenui.RespondentLiPResponse;
import uk.gov.hmcts.reform.civil.model.citizenui.ManageDocument;
import uk.gov.hmcts.reform.civil.model.common.DynamicList;
@@ -81,10 +82,16 @@
import uk.gov.hmcts.reform.civil.model.interestcalc.InterestClaimOptions;
import uk.gov.hmcts.reform.civil.model.interestcalc.InterestClaimUntilType;
import uk.gov.hmcts.reform.civil.model.interestcalc.SameRateInterestSelection;
+import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentInstalmentDetails;
+import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentRecordedReason;
+import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentStatusDetails;
+import uk.gov.hmcts.reform.civil.model.judgmentonline.PaymentPlanSelection;
+import uk.gov.hmcts.reform.civil.model.judgmentonline.JudgmentPaidInFull;
import uk.gov.hmcts.reform.civil.model.sdo.DisposalHearingFinalDisposalHearingTimeDJ;
import uk.gov.hmcts.reform.civil.model.sdo.DisposalHearingHearingNotesDJ;
import uk.gov.hmcts.reform.civil.model.sdo.DisposalHearingOrderMadeWithoutHearingDJ;
import uk.gov.hmcts.reform.civil.model.sdo.OtherDetails;
+import uk.gov.hmcts.reform.civil.model.transferonlinecase.TransferCaseDetails;
import uk.gov.hmcts.reform.civil.service.DeadlinesCalculator;
import uk.gov.hmcts.reform.civil.utils.MonetaryConversions;
@@ -101,6 +108,7 @@
import java.util.stream.Stream;
import static java.util.Objects.nonNull;
+import static java.util.Optional.ofNullable;
import static uk.gov.hmcts.reform.civil.enums.AllocatedTrack.FAST_CLAIM;
import static uk.gov.hmcts.reform.civil.enums.AllocatedTrack.SMALL_CLAIM;
import static uk.gov.hmcts.reform.civil.enums.BusinessProcessStatus.FINISHED;
@@ -520,6 +528,7 @@ public boolean hasNoOngoingBusinessProcess() {
private List> trialHearingAddNewDirectionsDJ;
private HearingMethodTelephoneHearingDJ disposalHearingMethodTelephoneHearingDJ;
private HearingMethodVideoConferenceDJ disposalHearingMethodVideoConferenceHearingDJ;
+ private String featureToggleWA;
private String caseManagementOrderSelection;
private Document orderSDODocumentDJ;
@@ -563,9 +572,12 @@ public boolean hasNoOngoingBusinessProcess() {
//case progression
private final List> documentAndName;
+ private final List> documentAndNameToAdd;
private final List> documentAndNote;
+ private final List> documentAndNoteToAdd;
private final CaseNoteType caseNoteType;
- private final String caseNoteTypeNoteTA;
+ private final String caseNoteTA;
+ private final List> caseNotesTA;
private final LocalDateTime noteAdditionDateTime;
private final String caseTypeFlag;
private final String witnessStatementFlag;
@@ -595,8 +607,10 @@ public boolean hasNoOngoingBusinessProcess() {
private final FreeFormOrderValues orderOnCourtInitiative;
private final FreeFormOrderValues orderWithoutNotice;
private final OrderOnCourtsList orderOnCourtsList;
+ private final String freeFormHearingNotes;
+
+ private CaseDocument finalOrderDocument;
- private Document finalOrderDocument;
@Builder.Default
private final List> finalOrderDocumentCollection = new ArrayList<>();
@@ -605,6 +619,22 @@ public boolean hasNoOngoingBusinessProcess() {
private final String sdtRequestIdFromSdt;
private final List> sdtRequestId;
+ //Judgments Online
+ private JudgmentRecordedReason joJudgmentRecordReason;
+ private JudgmentStatusDetails joJudgmentStatusDetails;
+ private LocalDate joOrderMadeDate;
+ private String joAmountOrdered;
+ private String joAmountCostOrdered;
+ private YesOrNo joIsRegisteredWithRTL;
+ private PaymentPlanSelection joPaymentPlanSelection;
+ private JudgmentInstalmentDetails joJudgmentInstalmentDetails;
+ private LocalDate joPaymentToBeMadeByDate;
+ private YesOrNo joIsLiveJudgmentExists;
+ private LocalDate joSetAsideDate;
+ private JudgmentPaidInFull joJudgmentPaidInFull;
+
+ private final TransferCaseDetails transferCaseDetails;
+
/**
* There are several fields that can hold the I2P of applicant1 depending
* on multiparty scenario, which complicates all conditions depending on it.
@@ -823,24 +853,36 @@ public boolean isRespondent1NotRepresented() {
return NO.equals(getRespondent1Represented());
}
+ @JsonIgnore
+ public boolean isApplicant1NotRepresented() {
+ return NO.equals(getApplicant1Represented());
+ }
+
@JsonIgnore
public boolean isLRvLipOneVOne() {
return isRespondent1NotRepresented()
+ && !isApplicant1NotRepresented()
+ && isOneVOne(this);
+ }
+
+ @JsonIgnore
+ public boolean isLipvLipOneVOne() {
+ return isRespondent1NotRepresented()
+ && isApplicant1NotRepresented()
&& isOneVOne(this);
}
@JsonIgnore
public boolean isJudgementDateNotPermitted() {
- return nonNull(getRespondent1ResponseDate())
- && getRespondent1ResponseDate()
- .toLocalDate().plusDays(5).atTime(DeadlinesCalculator.END_OF_BUSINESS_DAY).isAfter(LocalDateTime.now());
+ return nonNull(getRespondToClaimAdmitPartLRspec().getWhenWillThisAmountBePaid())
+ && getRespondToClaimAdmitPartLRspec().getWhenWillThisAmountBePaid()
+ .atTime(DeadlinesCalculator.END_OF_BUSINESS_DAY).isAfter(LocalDateTime.now());
}
@JsonIgnore
- public String setUpJudgementFormattedPermittedDate() {
+ public String setUpJudgementFormattedPermittedDate(LocalDate extendedRespondent1ResponseDate) {
if (isJudgementDateNotPermitted()) {
- return formatLocalDateTime(getRespondent1ResponseDate()
- .toLocalDate().plusDays(5).atTime(DeadlinesCalculator.END_OF_BUSINESS_DAY), DATE_TIME_AT);
+ return formatLocalDateTime(extendedRespondent1ResponseDate.atTime(DeadlinesCalculator.END_OF_BUSINESS_DAY), DATE_TIME_AT);
}
return null;
}
@@ -982,13 +1024,19 @@ public List> getRecurringIncomeForRespondent1() {
@JsonIgnore
public List> getRecurringExpensesForRespondent1() {
if (isFullAdmitClaimSpec()) {
- return Optional.ofNullable(getRespondent1DQ()).map(Respondent1DQ::getRespondent1DQRecurringExpensesFA).orElse(
- null);
+ return Optional.ofNullable(getRespondent1DQ()).map(Respondent1DQ::getRespondent1DQRecurringExpensesFA)
+ .orElse(
+ null);
}
return Optional.ofNullable(getRespondent1DQ()).map(Respondent1DQ::getRespondent1DQRecurringExpenses).orElse(
null);
}
+ @JsonIgnore
+ public List> getManageDocumentsList() {
+ return Optional.ofNullable(getManageDocuments()).orElse(new ArrayList<>());
+ }
+
@JsonIgnore
public boolean getApplicant1ResponseDeadlinePassed() {
return getApplicant1ResponseDeadline() != null
@@ -1000,4 +1048,52 @@ && getApplicant1ResponseDeadline().isBefore(LocalDateTime.now())
public String getApplicant1Email() {
return getApplicant1().getPartyEmail() != null ? getApplicant1().getPartyEmail() : getClaimantUserDetails().getEmail();
}
+
+ @JsonIgnore
+ public String getHelpWithFeesReferenceNumber() {
+ return Optional.ofNullable(getCaseDataLiP())
+ .map(CaseDataLiP::getHelpWithFees)
+ .map(HelpWithFees::getHelpWithFeesReferenceNumber).orElse(null);
+ }
+
+ @JsonIgnore
+ public Address getRespondent1CorrespondenceAddress() {
+ return Optional.ofNullable(getCaseDataLiP())
+ .map(CaseDataLiP::getRespondent1LiPResponse)
+ .map(RespondentLiPResponse::getRespondent1LiPCorrespondenceAddress)
+ .orElse(null);
+ }
+
+ @JsonIgnore
+ public String getCurrentCamundaBusinessProcessName() {
+ return ofNullable(getBusinessProcess())
+ .map(BusinessProcess::getCamundaEvent)
+ .orElse(null);
+ }
+
+ @JsonIgnore
+ public boolean isTranslatedDocumentUploaded() {
+ if (getSystemGeneratedCaseDocuments() != null) {
+ return getSystemGeneratedCaseDocuments().stream()
+ .filter(systemGeneratedCaseDocument -> systemGeneratedCaseDocument.getValue()
+ .getDocumentType().equals(DocumentType.DEFENCE_TRANSLATED_DOCUMENT)).findAny().isPresent();
+ }
+ return false;
+ }
+
+ @JsonIgnore
+ public boolean isRespondentSolicitorRegistered() {
+ return YesOrNo.YES.equals(getRespondent1OrgRegistered());
+ }
+
+ @JsonIgnore
+ public String getRespondent1Email() {
+ if (isRespondent1NotRepresented()) {
+ return getRespondent1().getPartyEmail();
+ }
+ if (isRespondentSolicitorRegistered()) {
+ return getRespondentSolicitor1EmailAddress();
+ }
+ return null;
+ }
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/CaseDataParent.java b/src/main/java/uk/gov/hmcts/reform/civil/model/CaseDataParent.java
index 6db3eb1fbbe..5db7728550f 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/CaseDataParent.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/CaseDataParent.java
@@ -31,6 +31,7 @@
import uk.gov.hmcts.reform.civil.enums.dj.HearingMethodVideoConferenceDJ;
import uk.gov.hmcts.reform.civil.enums.dq.Language;
import uk.gov.hmcts.reform.civil.enums.finalorders.AssistedCostTypesList;
+import uk.gov.hmcts.reform.civil.enums.finalorders.FinalOrdersJudgePapers;
import uk.gov.hmcts.reform.civil.enums.finalorders.FinalOrderToggle;
import uk.gov.hmcts.reform.civil.enums.finalorders.HearingLengthFinalOrderList;
import uk.gov.hmcts.reform.civil.enums.finalorders.OrderMadeOnTypes;
@@ -140,11 +141,14 @@
import uk.gov.hmcts.reform.civil.model.sdo.TrialHearingHearingNotesDJ;
import uk.gov.hmcts.reform.civil.model.sdo.TrialHearingTimeDJ;
import uk.gov.hmcts.reform.civil.model.sdo.TrialOrderMadeWithoutHearingDJ;
+import uk.gov.hmcts.reform.civil.model.transferonlinecase.NotSuitableSdoOptions;
+import uk.gov.hmcts.reform.civil.model.transferonlinecase.TocTransferCaseReason;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
@@ -307,6 +311,8 @@ public class CaseDataParent implements MappableObject {
private CaseDocument sdoOrderDocument;
+ private final YesOrNo eaCourtLocation;
+
// sdo ui flags
private final YesOrNo setSmallClaimsFlag;
private final YesOrNo setFastTrackFlag;
@@ -437,6 +443,7 @@ public boolean isApplicantNotRepresented() {
private final CertificateOfService cosNotifyClaimDefendant1;
private final CertificateOfService cosNotifyClaimDefendant2;
+ private final String notificationText;
private final List disclosureSelectionEvidence;
private final List disclosureSelectionEvidenceRes;
private final List witnessSelectionEvidence;
@@ -527,9 +534,13 @@ public boolean isApplicantNotRepresented() {
private final List> applicantWitnesses;
private final List> respondent1Witnesses;
private final List> respondent2Witnesses;
- private final List> applicantSolOrgIndividuals;
- private final List> respondent1SolOrgIndividuals;
- private final List> applicant1SolOrgIndividuals;
+ private final List> applicant1LRIndividuals;
+ private final List> respondent1LRIndividuals;
+ private final List> respondent2LRIndividuals;
+ private final List> applicant1OrgIndividuals;
+ private final List> applicant2OrgIndividuals;
+ private final List> respondent1OrgIndividuals;
+ private final List> respondent2OrgIndividuals;
private List disposalHearingDisclosureOfDocumentsDJToggle;
private List disposalHearingWitnessOfFactDJToggle;
@@ -615,6 +626,7 @@ public boolean isApplicantNotRepresented() {
private YesOrNo finalOrderMadeSelection;
private OrderMade finalOrderDateHeardComplex;
+ private List finalOrderJudgePapers;
private List finalOrderJudgeHeardFrom;
private FinalOrderRepresentation finalOrderRepresentation;
private List finalOrderRecitals;
@@ -698,12 +710,36 @@ public boolean isApplicantNotRepresented() {
private List> applicant2UnavailableDatesForTab;
private List> respondent1UnavailableDatesForTab;
private List> respondent2UnavailableDatesForTab;
+ private String pcqId;
+
+ // TOC
+ private String reasonForTransfer;
+ private DynamicList transferCourtLocationList;
+ private NotSuitableSdoOptions notSuitableSdoOptions;
+ private TocTransferCaseReason tocTransferCaseReason;
@JsonUnwrapped
private final UpdateDetailsForm updateDetailsForm;
private FastTrackAllocation fastTrackAllocation;
+ /**
+ * used to temporary hold addresses.
+ */
+ private final Address tempCorrespondenceAddress1;
+ /**
+ * used with tempCorrespondenceAddress1.
+ */
+ private final YesOrNo tempCorrespondenceAddress1Required;
+ /**
+ * used to temporary hold addresses.
+ */
+ private final Address tempCorrespondenceAddress2;
+ /**
+ * used with tempCorrespondenceAddress2.
+ */
+ private final YesOrNo tempCorrespondenceAddress2Required;
+
@JsonIgnore
public boolean isResponseAcceptedByClaimant() {
return applicant1AcceptAdmitAmountPaidSpec == YesOrNo.YES
@@ -749,8 +785,10 @@ public boolean hasClaimantAgreedToFreeMediation() {
}
@JsonIgnore
- public Optional getTranslatedDocument() {
- return Optional.ofNullable(getCaseDataLiP()).map(CaseDataLiP::getTranslatedDocument);
+ public List> getTranslatedDocuments() {
+ return Optional.ofNullable(getCaseDataLiP())
+ .map(CaseDataLiP::getTranslatedDocuments)
+ .orElse(Collections.emptyList());
}
@JsonIgnore
@@ -759,9 +797,4 @@ public boolean hasClaimantNotAgreedToFreeMediation() {
.map(CaseDataLiP::getApplicant1ClaimMediationSpecRequiredLip)
.filter(ClaimantMediationLip::hasClaimantNotAgreedToFreeMediation).isPresent();
}
-
- @JsonIgnore
- public boolean isTranslatedDocumentUploaded() {
- return getCaseDataLiP() != null && getCaseDataLiP().getTranslatedDocument() != null;
- }
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/CourtLocation.java b/src/main/java/uk/gov/hmcts/reform/civil/model/CourtLocation.java
index ba9d45f53d9..1037a0b4e5a 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/CourtLocation.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/CourtLocation.java
@@ -14,13 +14,16 @@ public class CourtLocation {
private final String applicantPreferredCourt;
private final DynamicList applicantPreferredCourtLocationList;
private final CaseLocationCivil caseLocation;
+ private final String reasonForHearingAtSpecificCourt;
@JsonCreator
CourtLocation(@JsonProperty("applicantPreferredCourt") String applicantPreferredCourt,
@JsonProperty("applicantPreferredCourtLocationList") DynamicList applicantPreferredCourtLocationList,
- @JsonProperty("caseLocation") CaseLocationCivil caseLocation) {
+ @JsonProperty("caseLocation") CaseLocationCivil caseLocation,
+ @JsonProperty("reasonForHearingAtSpecificCourt") String reasonForHearingAtSpecificCourt) {
this.applicantPreferredCourt = applicantPreferredCourt;
this.applicantPreferredCourtLocationList = applicantPreferredCourtLocationList;
this.caseLocation = caseLocation;
+ this.reasonForHearingAtSpecificCourt = reasonForHearingAtSpecificCourt;
}
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/PartnerAndDependentsLRspec.java b/src/main/java/uk/gov/hmcts/reform/civil/model/PartnerAndDependentsLRspec.java
index 3a2f81843ce..896d2b7009f 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/PartnerAndDependentsLRspec.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/PartnerAndDependentsLRspec.java
@@ -1,5 +1,6 @@
package uk.gov.hmcts.reform.civil.model;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Builder;
import lombok.Data;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
@@ -16,4 +17,9 @@ public class PartnerAndDependentsLRspec {
private final YesOrNo supportedAnyoneFinancialRequired;
private final String supportPeopleNumber;
private final String supportPeopleDetails;
+
+ @JsonIgnore
+ public boolean hasPartner() {
+ return YesOrNo.YES == liveWithPartnerRequired;
+ }
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/Party.java b/src/main/java/uk/gov/hmcts/reform/civil/model/Party.java
index 7b1bb165d06..32382122fad 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/Party.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/Party.java
@@ -14,6 +14,7 @@
import javax.validation.constraints.PastOrPresent;
import java.time.LocalDate;
import java.util.List;
+import java.util.Optional;
import static uk.gov.hmcts.reform.civil.model.Party.Type.INDIVIDUAL;
import static uk.gov.hmcts.reform.civil.model.Party.Type.SOLE_TRADER;
@@ -101,4 +102,14 @@ public boolean isCompany() {
public boolean isOrganisation() {
return ORGANISATION.equals(getType());
}
+
+ @JsonIgnore
+ public boolean isCompanyOROrganisation() {
+ return this.isCompany() || this.isOrganisation();
+ }
+
+ @JsonIgnore
+ public LocalDate getDateOfBirth() {
+ return Optional.ofNullable(individualDateOfBirth).orElse(soleTraderDateOfBirth);
+ }
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/RespondToClaim.java b/src/main/java/uk/gov/hmcts/reform/civil/model/RespondToClaim.java
index bed5151df2b..deaecdf25c5 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/RespondToClaim.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/RespondToClaim.java
@@ -1,6 +1,7 @@
package uk.gov.hmcts.reform.civil.model;
import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Builder;
import lombok.Data;
import uk.gov.hmcts.reform.civil.validation.groups.PaymentDateGroup;
@@ -23,4 +24,11 @@ public class RespondToClaim {
private final LocalDate whenWasThisAmountPaid;
private final PaymentMethod howWasThisAmountPaid;
private final String howWasThisAmountPaidOther;
+
+ @JsonIgnore
+ public String getExplanationOnHowTheAmountWasPaid() {
+ return getHowWasThisAmountPaid() == PaymentMethod.OTHER
+ ? getHowWasThisAmountPaidOther()
+ : getHowWasThisAmountPaid().getHumanFriendly();
+ }
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/UpdateDetailsForm.java b/src/main/java/uk/gov/hmcts/reform/civil/model/UpdateDetailsForm.java
index 82f48651bb7..33b489f1fec 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/UpdateDetailsForm.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/UpdateDetailsForm.java
@@ -1,6 +1,5 @@
package uk.gov.hmcts.reform.civil.model;
-import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -11,17 +10,18 @@
import java.util.List;
@Data
-@Builder
+@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
public class UpdateDetailsForm {
- @JsonProperty("partyChosen")
private DynamicList partyChosen;
-
- @JsonProperty("additionalUnavailableDates")
- private List> additionalUnavailableDates;
-
- @JsonProperty("hidePartyChoice")
+ private String partyChosenId;
+ private String partyChosenType;
private YesOrNo hidePartyChoice;
+ private List> additionalUnavailableDates;
+ private List> updateExpertsDetailsForm;
+ private List> updateWitnessesDetailsForm;
+ private YesOrNo manageContactDetailsEventUsed;
}
+
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/UpdatePartyDetailsForm.java b/src/main/java/uk/gov/hmcts/reform/civil/model/UpdatePartyDetailsForm.java
new file mode 100644
index 00000000000..5955d276a92
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/UpdatePartyDetailsForm.java
@@ -0,0 +1,16 @@
+package uk.gov.hmcts.reform.civil.model;
+
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder(toBuilder = true)
+public class UpdatePartyDetailsForm {
+
+ private String firstName;
+ private String lastName;
+ private String phoneNumber;
+ private String emailAddress;
+ private String partyId;
+ private String fieldOfExpertise;
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/account/AccountSimple.java b/src/main/java/uk/gov/hmcts/reform/civil/model/account/AccountSimple.java
index fc57ab9c138..8c2908f3cfe 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/account/AccountSimple.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/account/AccountSimple.java
@@ -1,18 +1,26 @@
package uk.gov.hmcts.reform.civil.model.account;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.SuperBuilder;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
import java.math.BigDecimal;
import javax.validation.constraints.NotNull;
@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@SuperBuilder
public class AccountSimple {
/**
* balance in pounds.
*/
@NotNull
+ @JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal balance;
/**
* true if joint account, false if not, null if unknown.
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/allowance/DisabilityAllowance.java b/src/main/java/uk/gov/hmcts/reform/civil/model/allowance/DisabilityAllowance.java
new file mode 100644
index 00000000000..a3222ed60a4
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/allowance/DisabilityAllowance.java
@@ -0,0 +1,41 @@
+package uk.gov.hmcts.reform.civil.model.allowance;
+
+import lombok.Getter;
+
+import java.util.Arrays;
+import java.util.function.Predicate;
+
+@Getter
+public enum DisabilityAllowance {
+
+ SINGLE(139.75, DisabilityParam::disabledSingle),
+ COUPLE(199.12, DisabilityParam::disabledCouple),
+ SEVERE_DISABILITY_SINGLE(
+ 268.01,
+ DisabilityParam::disabledSeverelySingle
+ ),
+ SEVERE_DISABILITY_COUPLE(
+ 536.03,
+ DisabilityParam::disabledSeverelyCouple
+ ),
+ DISABLED_DEPENDANT(260.26, DisabilityParam::disabledDependant),
+ CARER(149.93, DisabilityParam::isCarer),
+ NO_DISABILITY(0.0, DisabilityParam::notDisabled);
+
+ private double allowance;
+ private final Predicate disabilityMatcher;
+
+ DisabilityAllowance(double allowance, Predicate disabilityMatcher) {
+ this.allowance = allowance;
+ this.disabilityMatcher = disabilityMatcher;
+ }
+
+ public static double getDisabilityAllowance(DisabilityParam disabilityParam) {
+ if (disabilityParam == null) {
+ return NO_DISABILITY.getAllowance();
+ }
+ return Arrays.stream(DisabilityAllowance.values())
+ .filter(disabilityAllowance -> disabilityAllowance.disabilityMatcher.test(disabilityParam))
+ .mapToDouble(DisabilityAllowance::getAllowance).sum();
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/allowance/DisabilityParam.java b/src/main/java/uk/gov/hmcts/reform/civil/model/allowance/DisabilityParam.java
new file mode 100644
index 00000000000..af0873ad0f6
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/allowance/DisabilityParam.java
@@ -0,0 +1,37 @@
+package uk.gov.hmcts.reform.civil.model.allowance;
+
+import lombok.Builder;
+
+@Builder
+public record DisabilityParam(boolean disabled, boolean hasPartner, boolean severelyDisabled, boolean dependant,
+ boolean carer) {
+
+ public boolean disabledSingle() {
+ return disabled && !hasPartner && !severelyDisabled;
+ }
+
+ public boolean disabledCouple() {
+ return disabled && hasPartner && !severelyDisabled;
+ }
+
+ public boolean disabledSeverelySingle() {
+ return !hasPartner && severelyDisabled;
+ }
+
+ public boolean disabledSeverelyCouple() {
+ return hasPartner && severelyDisabled;
+ }
+
+ public boolean disabledDependant() {
+ return dependant;
+ }
+
+ public boolean notDisabled() {
+ return !disabled && !severelyDisabled && !dependant && !carer;
+ }
+
+ public boolean isCarer() {
+ return carer;
+ }
+
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/allowance/PensionerAllowance.java b/src/main/java/uk/gov/hmcts/reform/civil/model/allowance/PensionerAllowance.java
new file mode 100644
index 00000000000..2c1863ea11e
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/allowance/PensionerAllowance.java
@@ -0,0 +1,26 @@
+package uk.gov.hmcts.reform.civil.model.allowance;
+
+import lombok.Getter;
+
+@Getter
+public enum PensionerAllowance {
+
+ SINGLE(335.83),
+ COUPLE(502.66);
+
+ private double allowance;
+
+ PensionerAllowance(double allowance) {
+ this.allowance = allowance;
+ }
+
+ public static double getPensionerAllowance(boolean pensioner, boolean partnerPensioner) {
+ if ((pensioner && !partnerPensioner) || (!pensioner && partnerPensioner)) {
+ return SINGLE.allowance;
+ }
+ if (pensioner) {
+ return COUPLE.allowance;
+ }
+ return 0.0;
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/allowance/PersonalAllowance.java b/src/main/java/uk/gov/hmcts/reform/civil/model/allowance/PersonalAllowance.java
new file mode 100644
index 00000000000..cfb335811d1
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/allowance/PersonalAllowance.java
@@ -0,0 +1,41 @@
+package uk.gov.hmcts.reform.civil.model.allowance;
+
+import lombok.Getter;
+
+@Getter
+public enum PersonalAllowance {
+
+ SINGLE_UNDER_25(250.90),
+ SINGLE_OVER_25(316.76),
+ COUPLES_UNDER_18(379.16),
+ COUPLES_UNDER_18_UNDER_25(250.90),
+ COUPLES_UNDER_18_OVER_25(316.76),
+ COUPLES_OVER_18(497.68);
+
+ private double allowance;
+
+ PersonalAllowance(double allowance) {
+ this.allowance = allowance;
+ }
+
+ public static PersonalAllowance getPersonalAllowance(int age, boolean hasPartner, boolean partnerOver18) {
+ boolean under25 = 25 > age;
+ boolean over25 = 25 <= age;
+ if (hasPartner && over25 && partnerOver18) {
+ return COUPLES_OVER_18;
+ }
+ if (hasPartner && over25 && !partnerOver18) {
+ return COUPLES_UNDER_18_OVER_25;
+ }
+ if (hasPartner && under25 && !partnerOver18) {
+ return COUPLES_UNDER_18_UNDER_25;
+ }
+ if (!hasPartner && under25) {
+ return SINGLE_UNDER_25;
+ }
+ if (!hasPartner && over25) {
+ return SINGLE_OVER_25;
+ }
+ return COUPLES_UNDER_18;
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/bundle/BundlingCaseData.java b/src/main/java/uk/gov/hmcts/reform/civil/model/bundle/BundlingCaseData.java
index f48b855eb55..f37439ded9c 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/bundle/BundlingCaseData.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/bundle/BundlingCaseData.java
@@ -22,6 +22,8 @@ public class BundlingCaseData {
private final List> trialDocuments;
@JsonProperty("statementsOfCaseDocuments")
private final List> statementsOfCaseDocuments;
+ @JsonProperty("particularsOfClaim")
+ private final List> particularsOfClaim;
@JsonProperty("ordersDocuments")
private final List> ordersDocuments;
@JsonProperty("claimant1WitnessStatements")
@@ -60,8 +62,6 @@ public class BundlingCaseData {
private final List> defendant2CostsBudgets;
@JsonProperty("systemGeneratedCaseDocuments")
private final List> systemGeneratedCaseDocuments;
- @JsonProperty("courtLocation")
- private final String courtLocation;
@JsonProperty("applicant1")
private final Party applicant1;
@JsonProperty("hasApplicant2")
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/caseprogression/UploadEvidenceDocumentType.java b/src/main/java/uk/gov/hmcts/reform/civil/model/caseprogression/UploadEvidenceDocumentType.java
index 35391068829..3d02a3d2e44 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/caseprogression/UploadEvidenceDocumentType.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/caseprogression/UploadEvidenceDocumentType.java
@@ -8,6 +8,7 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
+import java.time.ZoneId;
@Data
@Builder(toBuilder = true)
@@ -19,6 +20,6 @@ public class UploadEvidenceDocumentType {
private LocalDate documentIssuedDate;
private Document documentUpload;
@Builder.Default
- private LocalDateTime createdDatetime = LocalDateTime.now();
+ private LocalDateTime createdDatetime = LocalDateTime.now(ZoneId.of("Europe/London"));
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/caseprogression/UploadEvidenceExpert.java b/src/main/java/uk/gov/hmcts/reform/civil/model/caseprogression/UploadEvidenceExpert.java
index b079f50e1e7..ead048028b5 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/caseprogression/UploadEvidenceExpert.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/caseprogression/UploadEvidenceExpert.java
@@ -8,6 +8,7 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
+import java.time.ZoneId;
@Data
@Builder(toBuilder = true)
@@ -24,5 +25,5 @@ public class UploadEvidenceExpert {
private LocalDate expertOptionUploadDate;
private Document expertDocument;
@Builder.Default
- private LocalDateTime createdDatetime = LocalDateTime.now();
+ private LocalDateTime createdDatetime = LocalDateTime.now(ZoneId.of("Europe/London"));
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/caseprogression/UploadEvidenceWitness.java b/src/main/java/uk/gov/hmcts/reform/civil/model/caseprogression/UploadEvidenceWitness.java
index a8e0b54df4d..fcbc4bd4f51 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/caseprogression/UploadEvidenceWitness.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/caseprogression/UploadEvidenceWitness.java
@@ -8,6 +8,7 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
+import java.time.ZoneId;
@Data
@Builder(toBuilder = true)
@@ -19,5 +20,5 @@ public class UploadEvidenceWitness {
private LocalDate witnessOptionUploadDate;
private Document witnessOptionDocument;
@Builder.Default
- private LocalDateTime createdDatetime = LocalDateTime.now();
+ private LocalDateTime createdDatetime = LocalDateTime.now(ZoneId.of("Europe/London"));
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/AdditionalLipPartyDetails.java b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/AdditionalLipPartyDetails.java
new file mode 100644
index 00000000000..96b5781f0cd
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/AdditionalLipPartyDetails.java
@@ -0,0 +1,17 @@
+package uk.gov.hmcts.reform.civil.model.citizenui;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import uk.gov.hmcts.reform.civil.model.Address;
+
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class AdditionalLipPartyDetails {
+
+ private Address correspondenceAddress;
+ private String contactPerson;
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CaseDataLiP.java b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CaseDataLiP.java
index e07709adab7..b66b6b1ffbc 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CaseDataLiP.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CaseDataLiP.java
@@ -6,7 +6,9 @@
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
+import uk.gov.hmcts.reform.civil.model.common.Element;
+import java.util.List;
import java.util.Optional;
@Data
@@ -19,11 +21,17 @@ public class CaseDataLiP {
private RespondentLiPResponse respondent1LiPResponse;
@JsonProperty("applicant1LiPResponse")
private ClaimantLiPResponse applicant1LiPResponse;
- private TranslatedDocument translatedDocument;
+ private List> translatedDocuments;
@JsonProperty("respondent1LiPFinancialDetails")
private FinancialDetailsLiP respondent1LiPFinancialDetails;
@JsonProperty("applicant1ClaimMediationSpecRequiredLip")
private ClaimantMediationLip applicant1ClaimMediationSpecRequiredLip;
+ @JsonProperty("helpWithFees")
+ private HelpWithFees helpWithFees;
+ @JsonProperty("respondent1AdditionalLipPartyDetails")
+ private AdditionalLipPartyDetails respondent1AdditionalLipPartyDetails;
+ @JsonProperty("applicant1AdditionalLipPartyDetails")
+ private AdditionalLipPartyDetails applicant1AdditionalLipPartyDetails;
@JsonIgnore
public boolean hasClaimantAgreedToFreeMediation() {
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdDashboardClaimMatcher.java b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdDashboardClaimMatcher.java
index ea118401122..fe45e29d735 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdDashboardClaimMatcher.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/CcdDashboardClaimMatcher.java
@@ -9,6 +9,7 @@
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.sdo.FastTrackHearingTime;
import uk.gov.hmcts.reform.civil.model.sdo.SmallClaimsHearing;
+import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
import java.time.LocalDate;
import java.time.LocalTime;
@@ -21,10 +22,11 @@ public class CcdDashboardClaimMatcher implements Claim {
private static final LocalTime FOUR_PM = LocalTime.of(16, 1, 0);
private CaseData caseData;
+ private FeatureToggleService featureToggleService;
@Override
public boolean hasResponsePending() {
- return caseData.getRespondent1ResponseDate() == null;
+ return caseData.getRespondent1ResponseDate() == null && !isPaperResponse();
}
@Override
@@ -75,7 +77,8 @@ public boolean hasResponseDeadlineBeenExtended() {
@Override
public boolean isEligibleForCCJ() {
return caseData.getRespondent1ResponseDeadline() != null
- && caseData.getRespondent1ResponseDeadline().isBefore(LocalDate.now().atTime(FOUR_PM));
+ && caseData.getRespondent1ResponseDeadline().isBefore(LocalDate.now().atTime(FOUR_PM))
+ && caseData.getPaymentTypeSelection() == null;
}
@Override
@@ -117,7 +120,12 @@ public boolean isProceedOffline() {
@Override
public boolean isPaperResponse() {
- return false;
+ if (!featureToggleService.isLipVLipEnabled()) {
+ return false;
+ }
+
+ return Objects.nonNull(caseData.getTakenOfflineDate()) && Objects.nonNull(caseData.getCcdState())
+ && caseData.getCcdState().equals(CaseState.PROCEEDS_IN_HERITAGE_SYSTEM);
}
@Override
@@ -208,7 +216,7 @@ private boolean isBeforeFastTrackHearing() {
@Override
public boolean isMoreDetailsRequired() {
- return hasSdoBeenDrawn() && isBeforeHearing();
+ return hasSdoBeenDrawn() && isBeforeHearing() && featureToggleService.isCaseProgressionEnabled();
}
@Override
@@ -275,8 +283,15 @@ public boolean isPartialAdmissionRejected() {
@Override
public boolean isSDOOrderCreated() {
- return hasSdoBeenDrawn() && noHearingScheduled() && caseData.getHearingDate() == null
+ return caseData.getHearingDate() == null
&& CaseState.CASE_PROGRESSION.equals(caseData.getCcdState());
}
+ @Override
+ public boolean isClaimantDefaultJudgement() {
+ return caseData.getRespondent1ResponseDeadline() != null
+ && caseData.getRespondent1ResponseDeadline().isBefore(LocalDate.now().atTime(FOUR_PM))
+ && caseData.getPaymentTypeSelection() != null;
+ }
+
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/Claim.java b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/Claim.java
index 3a0a07b0c42..f8a6c0c3202 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/Claim.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/Claim.java
@@ -80,4 +80,6 @@ public interface Claim {
boolean isSDOOrderCreated();
+ boolean isClaimantDefaultJudgement();
+
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/DashboardClaimStatus.java b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/DashboardClaimStatus.java
index 4e16833975d..83716bcd9a8 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/DashboardClaimStatus.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/DashboardClaimStatus.java
@@ -33,6 +33,9 @@ public enum DashboardClaimStatus {
CLAIM_ENDED(
Claim::hasClaimEnded
),
+ RESPONSE_BY_POST(
+ Claim::isPaperResponse
+ ),
WAITING_COURT_REVIEW(
Claim::isCourtReviewing
),
@@ -64,6 +67,9 @@ public enum DashboardClaimStatus {
REQUESTED_COUNTRY_COURT_JUDGEMENT(
Claim::claimantRequestedCountyCourtJudgement
),
+ DEFAULT_JUDGEMENT(
+ Claim::isClaimantDefaultJudgement
+ ),
RESPONSE_OVERDUE(
Claim::hasResponsePendingOverdue
),
@@ -91,9 +97,6 @@ public enum DashboardClaimStatus {
PROCEED_OFFLINE(
Claim::isProceedOffline
),
- RESPONSE_BY_POST(
- Claim::isPaperResponse
- ),
CHANGE_BY_DEFENDANT(
Claim::hasChangeRequestFromDefendant
),
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/DocumentTypeMapper.java b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/DocumentTypeMapper.java
new file mode 100644
index 00000000000..b83682daab2
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/DocumentTypeMapper.java
@@ -0,0 +1,18 @@
+package uk.gov.hmcts.reform.civil.model.citizenui;
+
+import uk.gov.hmcts.reform.civil.documentmanagement.model.DocumentType;
+
+public final class DocumentTypeMapper {
+
+ private DocumentTypeMapper() {
+ }
+
+ public static ManageDocumentType mapDocumentTypeToManageDocumentType(DocumentType documentType) {
+ switch (documentType) {
+ case MEDIATION_AGREEMENT:
+ return ManageDocumentType.MEDIATION_AGREEMENT;
+ default:
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/HelpWithFees.java b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/HelpWithFees.java
new file mode 100644
index 00000000000..d5b6809ae9e
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/HelpWithFees.java
@@ -0,0 +1,17 @@
+package uk.gov.hmcts.reform.civil.model.citizenui;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import uk.gov.hmcts.reform.civil.enums.YesOrNo;
+
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class HelpWithFees {
+
+ private YesOrNo helpWithFee;
+ private String helpWithFeesReferenceNumber;
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/ManageDocumentType.java b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/ManageDocumentType.java
index 5c9d3bff56f..7ad1db47a80 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/ManageDocumentType.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/ManageDocumentType.java
@@ -4,5 +4,6 @@ public enum ManageDocumentType {
N9A_PAPER_ADMISSION_FULL_OR_PART,
N9B_PAPER_DEFENCE_OR_COUNTERCLAIM,
N9_REQUEST_MORE_TIME,
- OTHER
+ OTHER,
+ MEDIATION_AGREEMENT
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/RespondentLiPResponse.java b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/RespondentLiPResponse.java
index 4eb9ba8a266..0c92b3d64f9 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/RespondentLiPResponse.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/RespondentLiPResponse.java
@@ -20,5 +20,4 @@ public class RespondentLiPResponse {
private DQExtraDetailsLip respondent1DQExtraDetails;
private HearingSupportLip respondent1DQHearingSupportLip;
private String respondent1ResponseLanguage;
- private String helpWithFeesReferenceNumberLip;
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/dto/ExtendedDeadlineDto.java b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/dto/ExtendedDeadlineDto.java
new file mode 100644
index 00000000000..58c4a1182de
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/dto/ExtendedDeadlineDto.java
@@ -0,0 +1,18 @@
+package uk.gov.hmcts.reform.civil.model.citizenui.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDate;
+
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ExtendedDeadlineDto {
+
+ private LocalDate responseDate;
+ private Integer plusDays;
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/dto/RepaymentDecisionType.java b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/dto/RepaymentDecisionType.java
new file mode 100644
index 00000000000..30354909e22
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/citizenui/dto/RepaymentDecisionType.java
@@ -0,0 +1,13 @@
+package uk.gov.hmcts.reform.civil.model.citizenui.dto;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+public enum RepaymentDecisionType {
+ IN_FAVOUR_OF_CLAIMANT,
+ IN_FAVOUR_OF_DEFENDANT;
+
+ @JsonIgnore
+ public boolean isInFavourOfDefendant() {
+ return this == IN_FAVOUR_OF_DEFENDANT;
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/common/DynamicList.java b/src/main/java/uk/gov/hmcts/reform/civil/model/common/DynamicList.java
index 1fe3e01a3f6..075db0e94a5 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/common/DynamicList.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/common/DynamicList.java
@@ -16,7 +16,7 @@
*/
@Data
@Jacksonized
-@Builder
+@Builder(toBuilder = true)
public class DynamicList {
/**
@@ -39,18 +39,20 @@ public static DynamicList fromList(List list) {
}
/**
- * Sometimes a dynamic list can be prepopulated with a value.
+ * A dynamic list can be pre-populated with a code and value.
*
* @param list the original list of items
+ * @param toCode (optional) how to populate the DynamicListElement code, defaults to random UUID
* @param toLabel how to create the label
* @param value (optional) value to be selected
* @param type of element
* @return dynamic list, possibly with value set
*/
- public static DynamicList fromList(List list, Function toLabel, T value, boolean sort) {
+ public static DynamicList fromList(List list, Function toCode, Function toLabel, T value, boolean sort) {
List items = list.stream()
- .map(toLabel)
- .map(DynamicListElement::dynamicElement)
+ .map(item -> toCode != null
+ ? DynamicListElement.dynamicElementFromCode(toCode.apply(item), toLabel.apply(item))
+ : DynamicListElement.dynamicElement(toLabel.apply(item)))
.collect(toList());
int index = value != null ? list.indexOf(value) : -1;
@@ -68,6 +70,19 @@ public static DynamicList fromList(List list, Function toLabel
return DynamicList.builder().listItems(items).value(chosen).build();
}
+ /**
+ * Sometimes a dynamic list can be pre-populated with a value.
+ *
+ * @param list the original list of items
+ * @param toLabel how to create the label
+ * @param value (optional) value to be selected
+ * @param type of element
+ * @return dynamic list, possibly with value set
+ */
+ public static DynamicList fromList(List list, Function toLabel, T value, boolean sort) {
+ return fromList(list, null, toLabel, value, sort);
+ }
+
public static DynamicList fromDynamicListElementList(List list) {
return DynamicList.builder().listItems(list).value(DynamicListElement.EMPTY).build();
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/casepogression/JudgeFinalOrderForm.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/casepogression/JudgeFinalOrderForm.java
index 5b12973a95e..4bc540ec2ea 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/casepogression/JudgeFinalOrderForm.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/casepogression/JudgeFinalOrderForm.java
@@ -28,39 +28,33 @@ public class JudgeFinalOrderForm implements MappableObject {
private final String withoutNoticeSelectionText;
private final LocalDate withoutNoticeSelectionDate;
private final YesOrNo finalOrderMadeSelection;
- private final LocalDate finalOrderHeardDate;
- private final String finalOrderRepresented;
- private final boolean claimantAttended;
- private final boolean defendantAttended;
- private final String judgeHeardFromClaimantTextIfAttended;
- private final String judgeHeardFromDefendantTextIfAttended;
- private final String judgeHeardClaimantNotAttendedText;
- private final String judgeHeardDefendantNotAttendedText;
private final String otherRepresentedText;
- private final boolean judgeConsideredPapers;
+ private final String judgeConsideredPapers;
private final boolean recordedToggle;
private final String recordedText;
private final String orderedText;
private final String costSelection;
- private final String costReservedText;
- private final LocalDate paidByDate;
- private final YesOrNo costProtection;
- private final String costAmount;
- private final String bespokeText;
+ private final String costsReservedText;
+ private final String bespokeCostText;
private final boolean furtherHearingToggle;
+ private final boolean furtherHearingToToggle;
private final LocalDate furtherHearingFromDate;
private final LocalDate furtherHearingToDate;
private final String furtherHearingLength;
- private final String furtherHearingLocation;
+ private LocalDate datesToAvoid;
+ private final String furtherHearingLocationDefault;
+ private final Boolean showFurtherHearingLocationAlt;
+ private final String furtherHearingLocationAlt;
private final String furtherHearingMethod;
- private final boolean appealToggle;
- private final String appealFor;
- private final boolean appealGranted;
- private final String appealReason;
- private final String orderWithoutNotice;
- private final LocalDate orderInitiativeOrWithoutNoticeDate;
- private final YesOrNo isReason;
- private final String reasonText;
+ private final String hearingNotes;
+ private final String appealGranted;
+ private final String claimantOrDefendantAppeal;
+ private final String tableAorB;
+ private final LocalDate appealDate;
+ private final String showInitiativeOrWithoutNotice;
+ private final LocalDate initiativeDate;
+ private final LocalDate withoutNoticeDate;
+ private final String reasonsText;
private final String judgeNameTitle;
private final String courtLocation;
private final String courtName;
@@ -68,4 +62,19 @@ public class JudgeFinalOrderForm implements MappableObject {
private final String claimant2Name;
private final String defendant1Name;
private final String defendant2Name;
+ private final String claimantNum;
+ private final String defendantNum;
+ private final String orderMadeDate;
+ private final String claimantAttendsOrRepresented;
+ private final String claimantTwoAttendsOrRepresented;
+ private final String defendantAttendsOrRepresented;
+ private final String defendantTwoAttendsOrRepresented;
+ private final String summarilyAssessed;
+ private final LocalDate summarilyAssessedDate;
+ private final String detailedAssessment;
+ private final String interimPayment;
+ private final LocalDate interimPaymentDate;
+ private final String qcosProtection;
+ private final String costsProtection;
+ private final Boolean finalOrderJudgeHeardFrom;
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/AccountSimpleTemplateData.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/AccountSimpleTemplateData.java
index 764d54c0c00..779cfbf2c32 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/AccountSimpleTemplateData.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/AccountSimpleTemplateData.java
@@ -1,11 +1,13 @@
package uk.gov.hmcts.reform.civil.model.docmosis.common;
import lombok.AllArgsConstructor;
-import lombok.Builder;
import lombok.Getter;
+import lombok.experimental.SuperBuilder;
import uk.gov.hmcts.reform.civil.model.account.AccountSimple;
-@Builder
+import java.math.RoundingMode;
+
+@SuperBuilder
@AllArgsConstructor
@Getter
public class AccountSimpleTemplateData extends AccountSimple {
@@ -15,7 +17,7 @@ public class AccountSimpleTemplateData extends AccountSimple {
public AccountSimpleTemplateData(AccountSimple data, int index) {
setAccountType(data.getAccountType());
setJointAccount(data.getJointAccount());
- setBalance(data.getBalance());
+ setBalance(data.getBalance().setScale(2, RoundingMode.CEILING));
this.index = index;
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/DebtTemplateData.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/DebtTemplateData.java
index 8d4123ef8e1..539721893bb 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/DebtTemplateData.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/DebtTemplateData.java
@@ -1,5 +1,6 @@
package uk.gov.hmcts.reform.civil.model.docmosis.common;
+import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Builder;
import lombok.Data;
@@ -15,15 +16,17 @@
public class DebtTemplateData {
private final String debtOwedTo;
+ @JsonFormat(shape = JsonFormat.Shape.STRING)
private final BigDecimal poundsOwed;
+ @JsonFormat(shape = JsonFormat.Shape.STRING)
private final BigDecimal paidPerMonth;
@JsonIgnore
public static DebtTemplateData loanDebtFrom(final LoanCardDebtLRspec debt) {
return DebtTemplateData.builder()
.debtOwedTo(debt.getLoanCardDebtDetail())
- .paidPerMonth(MonetaryConversions.penniesToPounds(debt.getMonthlyPayment()))
- .poundsOwed(MonetaryConversions.penniesToPounds(debt.getTotalOwed()))
+ .paidPerMonth((MonetaryConversions.penniesToPounds(debt.getMonthlyPayment())).setScale(2, RoundingMode.CEILING))
+ .poundsOwed((MonetaryConversions.penniesToPounds(debt.getTotalOwed())).setScale(2, RoundingMode.CEILING))
.build();
}
@@ -33,18 +36,22 @@ public static DebtTemplateData generalDebtFrom(final DebtLRspec debtLRspec) {
.debtOwedTo(debtLRspec.getDebtType().getLabel());
switch (debtLRspec.getPaymentFrequency()) {
case ONCE_THREE_WEEKS:
- builder.paidPerMonth(MonetaryConversions.penniesToPounds(debtLRspec.getPaymentAmount()
+ builder.paidPerMonth((MonetaryConversions.penniesToPounds(debtLRspec.getPaymentAmount()
.multiply(BigDecimal.valueOf(4))
- .divide(BigDecimal.valueOf(3), RoundingMode.CEILING)));
+ .divide(BigDecimal.valueOf(3), RoundingMode.CEILING)))
+ .setScale(2, RoundingMode.CEILING));
break;
case ONCE_TWO_WEEKS:
- builder.paidPerMonth(MonetaryConversions.penniesToPounds(debtLRspec.getPaymentAmount().multiply(BigDecimal.valueOf(2))));
+ builder.paidPerMonth((MonetaryConversions.penniesToPounds(debtLRspec.getPaymentAmount().multiply(BigDecimal.valueOf(2))))
+ .setScale(2, RoundingMode.CEILING));
break;
case ONCE_ONE_WEEK:
- builder.paidPerMonth(MonetaryConversions.penniesToPounds(debtLRspec.getPaymentAmount().multiply(BigDecimal.valueOf(4))));
+ builder.paidPerMonth((MonetaryConversions.penniesToPounds(debtLRspec.getPaymentAmount().multiply(BigDecimal.valueOf(4))))
+ .setScale(2, RoundingMode.CEILING));
break;
default:
- builder.paidPerMonth(MonetaryConversions.penniesToPounds(debtLRspec.getPaymentAmount()));
+ builder.paidPerMonth((MonetaryConversions.penniesToPounds(debtLRspec.getPaymentAmount()))
+ .setScale(2, RoundingMode.CEILING));
break;
}
return builder.build();
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/EventTemplateData.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/EventTemplateData.java
index ecdf9e730c3..f7eb4640fc0 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/EventTemplateData.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/EventTemplateData.java
@@ -1,10 +1,17 @@
package uk.gov.hmcts.reform.civil.model.docmosis.common;
import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Builder;
import lombok.Getter;
+import uk.gov.hmcts.reform.civil.model.TimelineOfEvents;
import java.time.LocalDate;
+import java.util.Collection;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
@Getter
@Builder
@@ -13,4 +20,15 @@ public class EventTemplateData {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy")
private LocalDate date;
private String explanation;
+
+ @JsonIgnore
+ public static List toEventTemplateDataList(List timelineOfEvents) {
+ return Optional.ofNullable(timelineOfEvents).map(Collection::stream)
+ .orElseGet(Stream::empty)
+ .map(event ->
+ EventTemplateData.builder()
+ .date(event.getValue().getTimelineDate())
+ .explanation(event.getValue().getTimelineDescription())
+ .build()).collect(Collectors.toList());
+ }
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/EvidenceTemplateData.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/EvidenceTemplateData.java
index 5ba60570c6e..9bed100ca02 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/EvidenceTemplateData.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/EvidenceTemplateData.java
@@ -6,7 +6,10 @@
import lombok.Getter;
import uk.gov.hmcts.reform.civil.model.Evidence;
+import java.util.Collection;
+import java.util.List;
import java.util.Optional;
+import java.util.stream.Stream;
@Getter
@Builder
@@ -22,6 +25,14 @@ public static EvidenceTemplateData toEvidenceTemplateData(Evidence evidence) {
.build();
}
+ @JsonIgnore
+ public static List toEvidenceTemplateDataList(List evidenceList) {
+ return Optional.ofNullable(evidenceList).map(Collection::stream)
+ .orElseGet(Stream::empty)
+ .map(evidence -> EvidenceTemplateData.toEvidenceTemplateData(evidence))
+ .toList();
+ }
+
@JsonProperty("displayTypeValue")
public String getDisplayTypeValue() {
return Optional.ofNullable(type).map(type -> getDisplayValueFromEvidenceType(type)).orElse("");
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/Party.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/Party.java
index ab1d81bbc03..b142e43c1e9 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/Party.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/Party.java
@@ -22,4 +22,14 @@ public class Party {
private final String litigationFriendPhoneNumber;
private final String litigationFriendEmailAddress;
private final String legalRepHeading;
+
+ public static Party toLipParty(uk.gov.hmcts.reform.civil.model.Party party) {
+ return Party.builder()
+ .name(party.getPartyName())
+ .emailAddress(party.getPartyEmail())
+ .type(party.getType().getDisplayValue())
+ .phoneNumber(party.getPartyPhone())
+ .primaryAddress(party.getPrimaryAddress())
+ .build();
+ }
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/ReasonMoneyTemplateData.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/ReasonMoneyTemplateData.java
index 68ab66218ff..9dff0a37efe 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/ReasonMoneyTemplateData.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/common/ReasonMoneyTemplateData.java
@@ -1,5 +1,6 @@
package uk.gov.hmcts.reform.civil.model.docmosis.common;
+import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Builder;
import lombok.Data;
@@ -10,6 +11,7 @@
import uk.gov.hmcts.reform.civil.utils.MonetaryConversions;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.util.Map;
import static java.util.Map.entry;
@@ -72,6 +74,8 @@ public class ReasonMoneyTemplateData {
);
private String type;
+
+ @JsonFormat(shape = JsonFormat.Shape.STRING)
private BigDecimal amountPounds;
@JsonIgnore
@@ -80,7 +84,7 @@ public static ReasonMoneyTemplateData toReasonMoneyTemplateData(RecurringIncomeL
.type(item.getType() == IncomeTypeLRspec.OTHER
? "Other: " + item.getTypeOtherDetails()
: INCOME_TYPE_LIP_RESPONSE.get(item.getType()))
- .amountPounds(MonetaryConversions.penniesToPounds(item.getAmount()))
+ .amountPounds((MonetaryConversions.penniesToPounds(item.getAmount())).setScale(2, RoundingMode.CEILING))
.build();
}
@@ -90,7 +94,7 @@ public static ReasonMoneyTemplateData toReasonMoneyTemplateData(RecurringExpense
.type(item.getType() == ExpenseTypeLRspec.OTHER
? "Other: " + item.getTypeOtherDetails()
: EXPENSE_TYPE_LIP_RESPONSE.get(item.getType()))
- .amountPounds(MonetaryConversions.penniesToPounds(item.getAmount()))
+ .amountPounds((MonetaryConversions.penniesToPounds(item.getAmount())).setScale(2, RoundingMode.CEILING))
.build();
}
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/dj/DefaultJudgmentSDOOrderForm.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/dj/DefaultJudgmentSDOOrderForm.java
index a117f8d87eb..3172d11f184 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/dj/DefaultJudgmentSDOOrderForm.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/dj/DefaultJudgmentSDOOrderForm.java
@@ -77,6 +77,7 @@ public class DefaultJudgmentSDOOrderForm implements MappableObject {
private final TrialHousingDisrepair trialHousingDisrepair;
private final List> trialHearingAddNewDirectionsDJ;
private final LocationRefData hearingLocation;
+ private final LocationRefData caseManagementLocation;
//additional data for hearings
private final boolean disposalHearingDisclosureOfDocumentsDJAddSection;
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/dq/DirectionsQuestionnaireForm.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/dq/DirectionsQuestionnaireForm.java
index ad9729d1116..586966fd40d 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/dq/DirectionsQuestionnaireForm.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/dq/DirectionsQuestionnaireForm.java
@@ -29,7 +29,7 @@
import java.util.List;
@Getter
-@Builder
+@Builder(toBuilder = true)
@AllArgsConstructor
@EqualsAndHashCode
@ToString
@@ -66,8 +66,10 @@ public class DirectionsQuestionnaireForm implements MappableObject {
private final VulnerabilityQuestions vulnerabilityQuestions;
private final String statementOfTruthText;
private final Address respondent1LiPCorrespondenceAddress;
+ private final Address applicant1LiPCorrespondenceAddress;
private final LipExperts lipExperts;
private final LipExtraDQ lipExtraDQ;
private final List hearingLipSupportRequirements;
+ private final String lipStatementOfTruthName;
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/dq/HearingLipSupportRequirements.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/dq/HearingLipSupportRequirements.java
index d3ae6517b96..db0b261e85c 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/dq/HearingLipSupportRequirements.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/dq/HearingLipSupportRequirements.java
@@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Builder;
import lombok.Data;
+import uk.gov.hmcts.reform.civil.model.citizenui.HearingSupportLip;
import uk.gov.hmcts.reform.civil.model.dq.RequirementsLip;
import java.util.Collection;
@@ -32,4 +33,13 @@ public static HearingLipSupportRequirements toHearingSupportRequirements(Require
: HearingLipSupportRequirements.builder().build();
}
+
+ @JsonIgnore
+ public static List toHearingSupportRequirementsList(Optional hearingSupportLip) {
+ return hearingSupportLip.map(HearingSupportLip::getUnwrappedRequirementsLip)
+ .map(Collection::stream)
+ .map(items -> items.map(item -> toHearingSupportRequirements(item))
+ .toList())
+ .orElse(Collections.emptyList());
+ }
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/hearing/HearingForm.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/hearing/HearingForm.java
index d6f5897da1c..3a1fa19368c 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/hearing/HearingForm.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/hearing/HearingForm.java
@@ -37,6 +37,7 @@ public class HearingForm implements MappableObject {
private final String defendant2Reference;
private final boolean claimant2exists;
private final boolean defendant2exists;
+ private final String listingOrRelisting;
private final String claimReferenceNumber;
private final CorrectEmail emailAddress;
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sdo/SdoDocumentFormDisposal.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sdo/SdoDocumentFormDisposal.java
index e16e8812d54..f309d8ed97e 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sdo/SdoDocumentFormDisposal.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sdo/SdoDocumentFormDisposal.java
@@ -69,6 +69,7 @@ public class SdoDocumentFormDisposal implements MappableObject {
private final String disposalHearingMethodTelephoneHearing;
private final String disposalHearingMethodVideoConferenceHearing;
private final LocationRefData hearingLocation;
+ private final LocationRefData caseManagementLocation;
private final DisposalHearingBundle disposalHearingBundle;
private final String disposalHearingBundleTypeText;
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sdo/SdoDocumentFormFast.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sdo/SdoDocumentFormFast.java
index 7aee5880ebf..343dc4380ec 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sdo/SdoDocumentFormFast.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sdo/SdoDocumentFormFast.java
@@ -82,6 +82,7 @@ public class SdoDocumentFormFast implements MappableObject {
private final String fastTrackMethodTelephoneHearing;
private final String fastTrackMethodVideoConferenceHearing;
private final LocationRefData hearingLocation;
+ private final LocationRefData caseManagementLocation;
private final FastTrackBuildingDispute fastTrackBuildingDispute;
private final FastTrackClinicalNegligence fastTrackClinicalNegligence;
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sdo/SdoDocumentFormSmall.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sdo/SdoDocumentFormSmall.java
index 553e427b912..80f9937e0fa 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sdo/SdoDocumentFormSmall.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sdo/SdoDocumentFormSmall.java
@@ -67,6 +67,7 @@ public class SdoDocumentFormSmall implements MappableObject {
private final SmallClaimsDocuments smallClaimsDocuments;
private final SmallClaimsWitnessStatement smallClaimsWitnessStatement;
private final LocationRefData hearingLocation;
+ private final LocationRefData caseManagementLocation;
private final SmallClaimsCreditHire smallClaimsCreditHire;
private final SmallClaimsRoadTrafficAccident smallClaimsRoadTrafficAccident;
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sealedclaim/ResponseRepaymentDetailsForm.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sealedclaim/ResponseRepaymentDetailsForm.java
new file mode 100644
index 00000000000..ae474fb8326
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sealedclaim/ResponseRepaymentDetailsForm.java
@@ -0,0 +1,155 @@
+package uk.gov.hmcts.reform.civil.model.docmosis.sealedclaim;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec;
+import uk.gov.hmcts.reform.civil.enums.RespondentResponseTypeSpec;
+import uk.gov.hmcts.reform.civil.enums.YesOrNo;
+import uk.gov.hmcts.reform.civil.model.CaseData;
+import uk.gov.hmcts.reform.civil.model.RepaymentPlanLRspec;
+import uk.gov.hmcts.reform.civil.model.RespondToClaim;
+import uk.gov.hmcts.reform.civil.model.citizenui.CaseDataLiP;
+import uk.gov.hmcts.reform.civil.model.docmosis.common.EventTemplateData;
+import uk.gov.hmcts.reform.civil.model.docmosis.common.EvidenceTemplateData;
+import uk.gov.hmcts.reform.civil.model.docmosis.common.RepaymentPlanTemplateData;
+import uk.gov.hmcts.reform.civil.utils.MonetaryConversions;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.List;
+import java.util.Optional;
+
+import static uk.gov.hmcts.reform.civil.enums.RespondentResponseTypeSpec.COUNTER_CLAIM;
+
+@Getter
+@Builder(toBuilder = true)
+@AllArgsConstructor
+@EqualsAndHashCode
+public class ResponseRepaymentDetailsForm {
+
+ private final String amountToPay;
+ private final String howMuchWasPaid;
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy")
+ @JsonSerialize(using = LocalDateSerializer.class)
+ private final LocalDate paymentDate;
+ private final String paymentHow;
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy")
+ @JsonSerialize(using = LocalDateSerializer.class)
+ private final LocalDate payBy;
+ private final String whyNotPayImmediately;
+ private final RepaymentPlanTemplateData repaymentPlan;
+ private final RespondentResponseTypeSpec responseType;
+ private final String freeTextWhyReject;
+ private final String whyReject;
+ private final List timelineEventList;
+ private final String timelineComments;
+ private final List evidenceList;
+ private final String evidenceComments;
+ private final boolean mediation;
+ private final RespondentResponsePartAdmissionPaymentTimeLRspec howToPay;
+
+ public String getResponseTypeDisplay() {
+ return Optional.ofNullable(responseType).map(RespondentResponseTypeSpec::getDisplayedValue).orElse("");
+ }
+
+ public static ResponseRepaymentDetailsForm toSealedClaimResponseCommonContent(CaseData caseData) {
+ ResponseRepaymentDetailsForm.ResponseRepaymentDetailsFormBuilder builder = ResponseRepaymentDetailsForm.builder();
+
+ if (caseData.getRespondent1ClaimResponseTypeForSpec() != null) {
+ builder.howToPay(caseData.getDefenceAdmitPartPaymentTimeRouteRequired());
+ switch (caseData.getRespondent1ClaimResponseTypeForSpec()) {
+ case FULL_ADMISSION -> addRepaymentMethod(caseData, builder, caseData.getTotalClaimAmount());
+ case PART_ADMISSION -> partAdmissionData(caseData, builder);
+ case FULL_DEFENCE -> fullDefenceData(caseData, builder);
+ case COUNTER_CLAIM -> builder.whyReject(COUNTER_CLAIM.name());
+ default -> builder.whyReject(null);
+ }
+ }
+
+ return builder
+ .whyNotPayImmediately(caseData.getResponseToClaimAdmitPartWhyNotPayLRspec())
+ .responseType(caseData.getRespondent1ClaimResponseTypeForSpec())
+ .mediation(caseData.getResponseClaimMediationSpecRequired() == YesOrNo.YES)
+ .build();
+ }
+
+ private static void addRepaymentMethod(CaseData caseData, ResponseRepaymentDetailsFormBuilder builder, BigDecimal totalAmount) {
+ if (caseData.isPayImmediately()) {
+ addPayByDatePayImmediately(builder, totalAmount, caseData.getRespondToClaimAdmitPartLRspec().getWhenWillThisAmountBePaid());
+ } else if (caseData.isPayByInstallment()) {
+ addRepaymentPlan(caseData, builder, totalAmount);
+ } else if (caseData.isPayBySetDate()) {
+ addPayBySetDate(caseData, builder, totalAmount);
+ }
+ }
+
+ private static void addPayBySetDate(CaseData caseData, ResponseRepaymentDetailsForm.ResponseRepaymentDetailsFormBuilder builder, BigDecimal totalClaimAmount) {
+ builder.payBy(caseData.getRespondToClaimAdmitPartLRspec().getWhenWillThisAmountBePaid())
+ .amountToPay(totalClaimAmount + "")
+ .whyNotPayImmediately(caseData.getResponseToClaimAdmitPartWhyNotPayLRspec());
+ }
+
+ private static void addPayByDatePayImmediately(ResponseRepaymentDetailsFormBuilder builder, BigDecimal totalClaimAmount, LocalDate responseDate) {
+ builder.payBy(responseDate).amountToPay(totalClaimAmount + "");
+ }
+
+ private static void addRepaymentPlan(CaseData caseData, ResponseRepaymentDetailsForm.ResponseRepaymentDetailsFormBuilder builder, BigDecimal totalClaimAmount) {
+ RepaymentPlanLRspec repaymentPlan = caseData.getRespondent1RepaymentPlan();
+ if (repaymentPlan != null) {
+ builder.repaymentPlan(RepaymentPlanTemplateData.builder()
+ .paymentFrequencyDisplay(repaymentPlan.getPaymentFrequencyDisplay())
+ .firstRepaymentDate(repaymentPlan.getFirstRepaymentDate())
+ .paymentAmount(MonetaryConversions.penniesToPounds(repaymentPlan.getPaymentAmount()))
+ .build())
+ .payBy(repaymentPlan.finalPaymentBy(totalClaimAmount))
+ .whyNotPayImmediately(caseData.getResponseToClaimAdmitPartWhyNotPayLRspec());
+ }
+ }
+
+ private static void alreadyPaid(CaseData caseData, ResponseRepaymentDetailsForm.ResponseRepaymentDetailsFormBuilder builder) {
+ RespondToClaim respondToClaim = caseData.getResponseToClaim();
+ String howMuchWasPaidAsString = MonetaryConversions.penniesToPounds(respondToClaim.getHowMuchWasPaid()) + "";
+ builder.whyReject("ALREADY_PAID")
+ .howMuchWasPaid(howMuchWasPaidAsString)
+ .paymentDate(respondToClaim.getWhenWasThisAmountPaid())
+ .paymentHow(respondToClaim.getExplanationOnHowTheAmountWasPaid());
+ }
+
+ private static void addDetailsOnWhyClaimIsRejected(CaseData caseData, ResponseRepaymentDetailsForm.ResponseRepaymentDetailsFormBuilder builder) {
+ Optional caseDataLiPOptional = Optional.ofNullable(caseData.getCaseDataLiP());
+ builder.freeTextWhyReject(caseData.getDetailsOfWhyDoesYouDisputeTheClaim())
+ .timelineComments(caseDataLiPOptional.map(CaseDataLiP::getTimeLineComment).orElse(
+ ""))
+ .timelineEventList(EventTemplateData.toEventTemplateDataList(caseData.getSpecResponseTimelineOfEvents()))
+ .evidenceComments(caseDataLiPOptional.map(CaseDataLiP::getEvidenceComment).orElse(
+ ""))
+ .evidenceList(EvidenceTemplateData.toEvidenceTemplateDataList(caseData.getSpecResponselistYourEvidenceList()));
+ }
+
+ private static void fullDefenceData(CaseData caseData, ResponseRepaymentDetailsForm.ResponseRepaymentDetailsFormBuilder builder) {
+ addDetailsOnWhyClaimIsRejected(caseData, builder);
+ if (caseData.hasDefendantPayedTheAmountClaimed()) {
+ alreadyPaid(caseData, builder);
+ } else if (caseData.isClaimBeingDisputed()) {
+ builder.whyReject("DISPUTE");
+ }
+ }
+
+ private static void partAdmissionData(CaseData caseData, ResponseRepaymentDetailsFormBuilder builder) {
+ addDetailsOnWhyClaimIsRejected(caseData, builder);
+ if (caseData.getSpecDefenceAdmittedRequired() == YesOrNo.YES) {
+ alreadyPaid(caseData, builder);
+ } else {
+ addRepaymentMethod(
+ caseData,
+ builder,
+ MonetaryConversions.penniesToPounds(caseData.getRespondToAdmittedClaimOwingAmount())
+ );
+ }
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sealedclaim/SealedClaimLipResponseForm.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sealedclaim/SealedClaimLipResponseForm.java
index 3dddb485b64..91c0bfdda51 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sealedclaim/SealedClaimLipResponseForm.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sealedclaim/SealedClaimLipResponseForm.java
@@ -8,33 +8,24 @@
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
-import uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec;
-import uk.gov.hmcts.reform.civil.enums.RespondentResponseTypeSpec;
-import uk.gov.hmcts.reform.civil.enums.YesOrNo;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.ChildrenByAgeGroupLRspec;
import uk.gov.hmcts.reform.civil.model.EmployerDetailsLRspec;
import uk.gov.hmcts.reform.civil.model.PartnerAndDependentsLRspec;
-import uk.gov.hmcts.reform.civil.model.PaymentMethod;
-import uk.gov.hmcts.reform.civil.model.RespondToClaim;
import uk.gov.hmcts.reform.civil.model.Respondent1CourtOrderDetails;
import uk.gov.hmcts.reform.civil.model.Respondent1DebtLRspec;
import uk.gov.hmcts.reform.civil.model.Respondent1EmployerDetailsLRspec;
import uk.gov.hmcts.reform.civil.model.Respondent1SelfEmploymentLRspec;
-import uk.gov.hmcts.reform.civil.model.citizenui.CaseDataLiP;
import uk.gov.hmcts.reform.civil.model.common.MappableObject;
import uk.gov.hmcts.reform.civil.model.docmosis.LipFormParty;
import uk.gov.hmcts.reform.civil.model.docmosis.common.AccommodationTemplate;
import uk.gov.hmcts.reform.civil.model.docmosis.common.AccountSimpleTemplateData;
import uk.gov.hmcts.reform.civil.model.docmosis.common.DebtTemplateData;
-import uk.gov.hmcts.reform.civil.model.docmosis.common.EventTemplateData;
-import uk.gov.hmcts.reform.civil.model.docmosis.common.EvidenceTemplateData;
import uk.gov.hmcts.reform.civil.model.docmosis.common.ReasonMoneyTemplateData;
-import uk.gov.hmcts.reform.civil.model.docmosis.common.RepaymentPlanTemplateData;
import uk.gov.hmcts.reform.civil.utils.ElementUtils;
import uk.gov.hmcts.reform.civil.utils.MonetaryConversions;
-import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collection;
@@ -45,10 +36,8 @@
import java.util.stream.IntStream;
import java.util.stream.Stream;
-import static uk.gov.hmcts.reform.civil.enums.RespondentResponseTypeSpec.COUNTER_CLAIM;
-
@Getter
-@Builder
+@Builder(toBuilder = true)
@AllArgsConstructor
@EqualsAndHashCode
public class SealedClaimLipResponseForm implements MappableObject {
@@ -59,29 +48,9 @@ public class SealedClaimLipResponseForm implements MappableObject {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy")
@JsonSerialize(using = LocalDateSerializer.class)
private final LocalDate generationDate;
- private final String amountToPay;
- private final String howMuchWasPaid;
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy")
- @JsonSerialize(using = LocalDateSerializer.class)
- private final LocalDate paymentDate;
- private final String paymentHow;
- private final RespondentResponsePartAdmissionPaymentTimeLRspec howToPay;
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy")
- @JsonSerialize(using = LocalDateSerializer.class)
- private final LocalDate payBy;
- private final String whyNotPayImmediately;
- private final RepaymentPlanTemplateData repaymentPlan;
- private final RespondentResponseTypeSpec responseType;
- private final String whyReject;
- private final String freeTextWhyReject;
private final LipFormParty claimant1;
private final LipFormParty defendant1;
private final LipFormParty defendant2;
- private final List timelineEventList;
- private final String timelineComments;
- private final List evidenceList;
- private final String evidenceComments;
- private final boolean mediation;
private final AccommodationTemplate whereTheyLive;
private final PartnerAndDependentsLRspec partnerAndDependent;
private final List employerDetails;
@@ -91,10 +60,8 @@ public class SealedClaimLipResponseForm implements MappableObject {
private final List debtList;
private final List incomeList;
private final List expenseList;
-
- public String getResponseTypeDisplay() {
- return responseType.getDisplayedValue();
- }
+ //repayment details for repayment plan that are common between LR and LiP
+ private final ResponseRepaymentDetailsForm commonDetails;
public boolean isCurrentlyWorking() {
return (employerDetails != null && !employerDetails.isEmpty())
@@ -110,7 +77,6 @@ public int getNumberOfChildren() {
public static SealedClaimLipResponseForm toTemplate(final CaseData caseData) {
SealedClaimLipResponseForm.SealedClaimLipResponseFormBuilder builder = SealedClaimLipResponseForm.builder()
.generationDate(LocalDate.now())
- .responseType(caseData.getRespondent1ClaimResponseTypeForSpec())
.claimReferenceNumber(caseData.getLegacyCaseReference())
.claimant1(LipFormParty.toLipDefenceParty(caseData.getApplicant1()))
.defendant1(LipFormParty.toLipDefenceParty(
@@ -118,26 +84,14 @@ public static SealedClaimLipResponseForm toTemplate(final CaseData caseData) {
caseData.getRespondent1CorrespondanceAddress()
))
.defendant2(LipFormParty.toLipDefenceParty(caseData.getRespondent2()))
- .mediation(caseData.getResponseClaimMediationSpecRequired() == YesOrNo.YES)
- .whyNotPayImmediately(caseData.getResponseToClaimAdmitPartWhyNotPayLRspec())
.partnerAndDependent(caseData.getRespondent1PartnerAndDependent())
- .debtList(mapToDebtList(caseData.getSpecDefendant1Debts()));
+ .debtList(mapToDebtList(caseData.getSpecDefendant1Debts()))
+ .commonDetails(ResponseRepaymentDetailsForm.toSealedClaimResponseCommonContent(caseData));
addSolicitorDetails(caseData, builder);
addEmployeeDetails(caseData, builder);
addFinancialDetails(caseData, builder);
addSelfEmploymentDetails(caseData, builder);
addCourtOrderDetails(caseData, builder);
-
- if (caseData.getRespondent1ClaimResponseTypeForSpec() != null) {
- builder.howToPay(caseData.getDefenceAdmitPartPaymentTimeRouteRequired());
- switch (caseData.getRespondent1ClaimResponseTypeForSpec()) {
- case FULL_ADMISSION -> addRepaymentMethod(caseData, builder, caseData.getTotalClaimAmount());
- case PART_ADMISSION -> partAdmissionData(caseData, builder);
- case FULL_DEFENCE -> fullDefenceData(caseData, builder);
- case COUNTER_CLAIM -> builder.whyReject(COUNTER_CLAIM.name());
- default -> builder.whyReject(null);
- }
- }
return builder.build();
}
@@ -157,110 +111,22 @@ private static void addEmployeeDetails(final CaseData caseData, SealedClaimLipRe
}
- private static void addPayBySetDate(CaseData caseData, SealedClaimLipResponseFormBuilder builder, BigDecimal totalClaimAmount) {
- builder.payBy(caseData.getRespondToClaimAdmitPartLRspec().getWhenWillThisAmountBePaid())
- .amountToPay(totalClaimAmount + "")
- .whyNotPayImmediately(caseData.getResponseToClaimAdmitPartWhyNotPayLRspec());
- }
-
- private static void addPayByDatePayImmediately(SealedClaimLipResponseFormBuilder builder, BigDecimal totalClaimAmount) {
- builder.payBy(LocalDate.now()
- .plusDays(RespondentResponsePartAdmissionPaymentTimeLRspec.DAYS_TO_PAY_IMMEDIATELY))
- .amountToPay(totalClaimAmount + "");
- }
-
- private static void addRepaymentPlan(CaseData caseData, SealedClaimLipResponseFormBuilder builder, BigDecimal totalClaimAmount) {
- if (caseData.getRespondent1RepaymentPlan() != null) {
- builder.repaymentPlan(RepaymentPlanTemplateData.builder()
- .paymentFrequencyDisplay(caseData.getRespondent1RepaymentPlan().getPaymentFrequencyDisplay())
- .firstRepaymentDate(caseData.getRespondent1RepaymentPlan().getFirstRepaymentDate())
- .paymentAmount(MonetaryConversions.penniesToPounds(caseData.getRespondent1RepaymentPlan().getPaymentAmount()))
- .build())
- .payBy(caseData.getRespondent1RepaymentPlan()
- .finalPaymentBy(totalClaimAmount))
- .whyNotPayImmediately(caseData.getResponseToClaimAdmitPartWhyNotPayLRspec());
- }
- }
-
- private static void alreadyPaid(CaseData caseData, SealedClaimLipResponseFormBuilder builder) {
- RespondToClaim respondToClaim = caseData.getResponseToClaim();
- builder.whyReject("ALREADY_PAID")
- .howMuchWasPaid(MonetaryConversions.penniesToPounds(respondToClaim.getHowMuchWasPaid()) + "")
- .paymentDate(respondToClaim.getWhenWasThisAmountPaid())
- .paymentHow(respondToClaim.getHowWasThisAmountPaid() == PaymentMethod.OTHER
- ? respondToClaim.getHowWasThisAmountPaidOther()
- : respondToClaim.getHowWasThisAmountPaid()
- .getHumanFriendly());
- }
-
- private static void addDetailsOnWhyClaimIsRejected(CaseData caseData, SealedClaimLipResponseFormBuilder builder) {
- builder.freeTextWhyReject(caseData.getDetailsOfWhyDoesYouDisputeTheClaim())
- .timelineComments(Optional.ofNullable(caseData.getCaseDataLiP()).map(CaseDataLiP::getTimeLineComment).orElse(
- ""))
- .timelineEventList(Optional.ofNullable(caseData.getSpecResponseTimelineOfEvents()).map(Collection::stream)
- .orElseGet(Stream::empty)
- .map(event ->
- EventTemplateData.builder()
- .date(event.getValue().getTimelineDate())
- .explanation(event.getValue().getTimelineDescription())
- .build()).collect(Collectors.toList()))
- .evidenceComments(Optional.ofNullable(caseData.getCaseDataLiP()).map(CaseDataLiP::getEvidenceComment).orElse(
- ""))
- .evidenceList(Optional.ofNullable(caseData.getSpecResponselistYourEvidenceList()).map(Collection::stream)
- .orElseGet(Stream::empty)
- .map(evidence -> EvidenceTemplateData.toEvidenceTemplateData(evidence))
- .toList());
- }
-
- private static void fullDefenceData(CaseData caseData, SealedClaimLipResponseForm.SealedClaimLipResponseFormBuilder builder) {
- addDetailsOnWhyClaimIsRejected(caseData, builder);
- if (caseData.hasDefendantPayedTheAmountClaimed()) {
- alreadyPaid(caseData, builder);
- } else if (caseData.isClaimBeingDisputed()) {
- builder.whyReject("DISPUTE");
- }
- }
-
- @JsonIgnore
- private static void partAdmissionData(CaseData caseData, SealedClaimLipResponseForm.SealedClaimLipResponseFormBuilder builder) {
- addDetailsOnWhyClaimIsRejected(caseData, builder);
- if (caseData.getSpecDefenceAdmittedRequired() == YesOrNo.YES) {
- alreadyPaid(caseData, builder);
- } else {
- addRepaymentMethod(
- caseData,
- builder,
- MonetaryConversions.penniesToPounds(caseData.getRespondToAdmittedClaimOwingAmount())
- );
- }
- }
-
private static void addSelfEmploymentDetails(CaseData caseData, SealedClaimLipResponseForm.SealedClaimLipResponseFormBuilder builder) {
Optional.ofNullable(caseData.getSpecDefendant1SelfEmploymentDetails())
.ifPresent(selfEmployDetails ->
builder.selfEmployment(Respondent1SelfEmploymentLRspec.builder()
.amountOwed(selfEmployDetails.getAmountOwed() != null
- ? MonetaryConversions.penniesToPounds(
- selfEmployDetails.getAmountOwed())
+ ? (MonetaryConversions.penniesToPounds(
+ selfEmployDetails.getAmountOwed())).setScale(2, RoundingMode.CEILING)
: null)
- .annualTurnover(MonetaryConversions.penniesToPounds(
- selfEmployDetails.getAnnualTurnover()))
+ .annualTurnover((MonetaryConversions.penniesToPounds(
+ selfEmployDetails.getAnnualTurnover())).setScale(2, RoundingMode.CEILING))
.jobTitle(selfEmployDetails.getJobTitle())
.reason(selfEmployDetails.getReason())
.build())
);
}
- private static void addRepaymentMethod(CaseData caseData, SealedClaimLipResponseFormBuilder builder, BigDecimal totalAmount) {
- if (caseData.isPayImmediately()) {
- addPayByDatePayImmediately(builder, totalAmount);
- } else if (caseData.isPayByInstallment()) {
- addRepaymentPlan(caseData, builder, totalAmount);
- } else if (caseData.isPayBySetDate()) {
- addPayBySetDate(caseData, builder, totalAmount);
- }
- }
-
@JsonIgnore
private static List mapToDebtList(Respondent1DebtLRspec debtLRspec) {
return Optional.ofNullable(debtLRspec).map(debt -> createDebtList(debt)).orElse(Collections.emptyList());
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sealedclaim/SealedClaimResponseFormForSpec.java b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sealedclaim/SealedClaimResponseFormForSpec.java
index 9a99eac06dd..dcfda51f46a 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sealedclaim/SealedClaimResponseFormForSpec.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/docmosis/sealedclaim/SealedClaimResponseFormForSpec.java
@@ -42,4 +42,6 @@ public class SealedClaimResponseFormForSpec implements MappableObject {
private final String paymentMethod;
private final String hearingCourtLocation;
private final StatementOfTruth statementOfTruth;
+ //repayment details for repayment plan that are common between LR and LiP
+ private final ResponseRepaymentDetailsForm commonDetails;
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/documents/DocumentAndNote.java b/src/main/java/uk/gov/hmcts/reform/civil/model/documents/DocumentAndNote.java
index 33cb4c343cf..fee4c6e850a 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/documents/DocumentAndNote.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/documents/DocumentAndNote.java
@@ -7,6 +7,7 @@
import uk.gov.hmcts.reform.civil.documentmanagement.model.Document;
import java.time.LocalDateTime;
+import java.time.ZoneId;
@Data
@Builder(toBuilder = true)
@@ -18,6 +19,6 @@ public class DocumentAndNote {
private Document document;
private String documentNote;
@Builder.Default
- private LocalDateTime createdDateTime = LocalDateTime.now();
+ private LocalDateTime createdDateTime = LocalDateTime.now(ZoneId.of("Europe/London"));
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/documents/DocumentWithName.java b/src/main/java/uk/gov/hmcts/reform/civil/model/documents/DocumentWithName.java
index 3538f61d331..9aabf622994 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/documents/DocumentWithName.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/documents/DocumentWithName.java
@@ -7,6 +7,7 @@
import uk.gov.hmcts.reform.civil.documentmanagement.model.Document;
import java.time.LocalDateTime;
+import java.time.ZoneId;
@Data
@Builder(toBuilder = true)
@@ -17,5 +18,5 @@ public class DocumentWithName {
private Document document;
private String documentName;
@Builder.Default
- private LocalDateTime createdDateTime = LocalDateTime.now();
+ private LocalDateTime createdDateTime = LocalDateTime.now(ZoneId.of("Europe/London"));
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Applicant1DQ.java b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Applicant1DQ.java
index 8f83c1cf8f5..6c168e24c1e 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Applicant1DQ.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Applicant1DQ.java
@@ -38,6 +38,13 @@ public class Applicant1DQ implements DQ {
private FutureApplications applicant1DQFutureApplications;
private WelshLanguageRequirements applicant1DQLanguageLRspec;
+ private RemoteHearing remoteHearing;
+
+ @JsonProperty("applicant1DQRemoteHearing")
+ public RemoteHearing getRemoteHearing() {
+ return remoteHearing;
+ }
+
@Override
@JsonProperty("applicant1DQFileDirectionsQuestionnaire")
public FileDirectionsQuestionnaire getFileDirectionQuestionnaire() {
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Applicant2DQ.java b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Applicant2DQ.java
index 0d2725c5ce6..ade4eb1624b 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Applicant2DQ.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Applicant2DQ.java
@@ -36,6 +36,13 @@ public class Applicant2DQ implements DQ {
private StatementOfTruth applicant2DQStatementOfTruth;
private VulnerabilityQuestions applicant2DQVulnerabilityQuestions;
+ private RemoteHearing remoteHearing;
+
+ @JsonProperty("applicant2DQRemoteHearing")
+ public RemoteHearing getRemoteHearing() {
+ return remoteHearing;
+ }
+
@Override
@JsonProperty("applicant2DQFileDirectionsQuestionnaire")
public FileDirectionsQuestionnaire getFileDirectionQuestionnaire() {
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/DQ.java b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/DQ.java
index ec307cf08c3..ce8b2d3b9ac 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/DQ.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/DQ.java
@@ -67,6 +67,8 @@ default SmallClaimHearing getSmallClaimHearing(SmallClaimHearing smallClaimHeari
FurtherInformation getFurtherInformation();
+ RemoteHearing getRemoteHearing();
+
WelshLanguageRequirements getWelshLanguageRequirements();
RemoteHearingLRspec getRemoteHearingLRspec();
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Expert.java b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Expert.java
index b2460f9c437..3dd7e0951d1 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Expert.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Expert.java
@@ -11,6 +11,7 @@
@Builder(toBuilder = true)
public class Expert {
+ private final String partyID;
private final String name;
private final String firstName;
private final String lastName;
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/ExpertDetails.java b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/ExpertDetails.java
index 6f01984ce90..61f9f1bc60d 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/ExpertDetails.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/ExpertDetails.java
@@ -7,9 +7,10 @@
import java.math.BigDecimal;
@Data
-@Builder
+@Builder(toBuilder = true)
public class ExpertDetails {
+ private final String partyID;
private final String expertName;
private final String firstName;
private final String lastName;
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/RemoteHearing.java b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/RemoteHearing.java
new file mode 100644
index 00000000000..05bb53133be
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/RemoteHearing.java
@@ -0,0 +1,15 @@
+package uk.gov.hmcts.reform.civil.model.dq;
+
+import lombok.Builder;
+import lombok.Data;
+import uk.gov.hmcts.reform.civil.enums.YesOrNo;
+
+@Data
+@Builder(toBuilder = true)
+
+public class RemoteHearing {
+
+ @Deprecated(forRemoval = true)
+ private final YesOrNo remoteHearingRequested;
+ private final String reasonForRemoteHearing;
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Respondent1DQ.java b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Respondent1DQ.java
index 1051eebf933..198c2f682e3 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Respondent1DQ.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Respondent1DQ.java
@@ -36,6 +36,7 @@ public class Respondent1DQ implements DQ {
private Hearing respondent1DQHearingFastClaim;
private Document respondent1DQDraftDirections;
private RequestedCourt respondent1DQRequestedCourt;
+ private RemoteHearing respondent1DQRemoteHearing;
private RemoteHearingLRspec respondent1DQRemoteHearingLRspec;
private HearingSupport respondent1DQHearingSupport;
private FurtherInformation respondent1DQFurtherInformation;
@@ -211,4 +212,10 @@ public WelshLanguageRequirements getWelshLanguageRequirementsLRspec() {
public VulnerabilityQuestions getVulnerabilityQuestions() {
return respondent1DQVulnerabilityQuestions;
}
+
+ @Override
+ @JsonProperty("respondent1DQRemoteHearing")
+ public RemoteHearing getRemoteHearing() {
+ return respondent1DQRemoteHearing;
+ }
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Respondent2DQ.java b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Respondent2DQ.java
index 3fadd378414..fcc36003bd7 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Respondent2DQ.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Respondent2DQ.java
@@ -33,6 +33,8 @@ public class Respondent2DQ implements DQ {
private SmallClaimHearing respondent2DQHearingSmallClaim;
private Document respondent2DQDraftDirections;
private RequestedCourt respondent2DQRequestedCourt;
+
+ private RemoteHearing respondent2DQRemoteHearing;
private RemoteHearingLRspec respondent2DQRemoteHearingLRspec;
private HearingSupport respondent2DQHearingSupport;
private YesOrNo respondent2DQCarerAllowanceCredit;
@@ -174,4 +176,10 @@ public VulnerabilityQuestions getVulnerabilityQuestions() {
public WelshLanguageRequirements getWelshLanguageRequirementsLRspec() {
return respondent2DQLanguageLRspec;
}
+
+ @Override
+ @JsonProperty("respondent2DQRemoteHearing")
+ public RemoteHearing getRemoteHearing() {
+ return respondent2DQRemoteHearing;
+ }
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Witness.java b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Witness.java
index c359608e116..e3ab4102dc0 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Witness.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/dq/Witness.java
@@ -9,6 +9,7 @@
@Builder (toBuilder = true)
public class Witness {
+ private final String partyID;
@Deprecated
private final String name;
private final String firstName;
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/AppealGrantedRefused.java b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/AppealGrantedRefused.java
index 36c81ea4f27..ed46f5ab5ca 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/AppealGrantedRefused.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/AppealGrantedRefused.java
@@ -4,6 +4,7 @@
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
+import uk.gov.hmcts.reform.civil.enums.finalorders.ApplicationAppealList;
@Data
@Builder(toBuilder = true)
@@ -13,4 +14,6 @@ public class AppealGrantedRefused {
private AppealChoiceSecondDropdown appealChoiceSecondDropdownA;
private AppealChoiceSecondDropdown appealChoiceSecondDropdownB;
+ private ApplicationAppealList circuitOrHighCourtList;
+ private ApplicationAppealList circuitOrHighCourtListRefuse;
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/AssistedOrderCostDetails.java b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/AssistedOrderCostDetails.java
index 33faee68da8..f155ce3dd26 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/AssistedOrderCostDetails.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/AssistedOrderCostDetails.java
@@ -1,12 +1,15 @@
package uk.gov.hmcts.reform.civil.model.finalorders;
+import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
+import uk.gov.hmcts.reform.civil.enums.finalorders.CostEnums;
+import java.math.BigDecimal;
import java.time.LocalDate;
@Data
@@ -21,4 +24,13 @@ public class AssistedOrderCostDetails {
@JsonProperty("makeAnOrderForCostsQOCSYesOrNo")
private YesOrNo makeAnOrderForCostsYesOrNo;
private String besPokeCostDetailsText;
+ private CostEnums makeAnOrderForCostsList;
+ private CostEnums assistedOrderClaimantDefendantFirstDropdown;
+ @JsonFormat(shape = JsonFormat.Shape.STRING)
+ private BigDecimal assistedOrderCostsFirstDropdownAmount;
+ @JsonFormat(shape = JsonFormat.Shape.STRING)
+ private BigDecimal assistedOrderAssessmentThirdDropdownAmount;
+ private CostEnums assistedOrderAssessmentSecondDropdownList1;
+ private CostEnums assistedOrderAssessmentSecondDropdownList2;
+
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/ClaimantAndDefendantHeard.java b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/ClaimantAndDefendantHeard.java
index 664a65d3282..1aa8e57cd03 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/ClaimantAndDefendantHeard.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/ClaimantAndDefendantHeard.java
@@ -14,9 +14,13 @@
public class ClaimantAndDefendantHeard {
private FinalOrdersClaimantRepresentationList typeRepresentationClaimantList;
+ private FinalOrdersClaimantRepresentationList typeRepresentationClaimantListTwo;
private TrialNoticeProcedure trialProcedureClaimantComplex;
private FinalOrdersDefendantRepresentationList typeRepresentationDefendantList;
+ private FinalOrdersDefendantRepresentationList typeRepresentationDefendantTwoList;
private TrialNoticeProcedure trialProcedureComplex;
+ private TrialNoticeProcedure trialProcedureDefTwoComplex;
+ private TrialNoticeProcedure trialProcedClaimTwoComplex;
private String detailsRepresentationText;
private String typeRepresentationClaimantOneDynamic;
private String typeRepresentationClaimantTwoDynamic;
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/DatesFinalOrders.java b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/DatesFinalOrders.java
index 3821ee9efab..d308d99dcd2 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/DatesFinalOrders.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/DatesFinalOrders.java
@@ -17,5 +17,6 @@ public class DatesFinalOrders {
private LocalDate dateRangeFrom;
private LocalDate dateRangeTo;
private LocalDate datesToAvoidDates;
+ private String bespokeRangeTextArea;
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/FinalOrderAppeal.java b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/FinalOrderAppeal.java
index 79283e45adf..fa76be671e0 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/FinalOrderAppeal.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/FinalOrderAppeal.java
@@ -16,5 +16,6 @@ public class FinalOrderAppeal {
private AppealList list;
private String otherText;
private ApplicationAppealList applicationList;
- private AppealGrantedRefused appealGrantedRefusedDropdown;
+ private AppealGrantedRefused appealGrantedDropdown;
+ private AppealGrantedRefused appealRefusedDropdown;
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/FinalOrderRepresentation.java b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/FinalOrderRepresentation.java
index 33ea7592ddc..01eec5cf72a 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/FinalOrderRepresentation.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/FinalOrderRepresentation.java
@@ -5,9 +5,6 @@
import lombok.Data;
import lombok.NoArgsConstructor;
import uk.gov.hmcts.reform.civil.enums.finalorders.FinalOrderRepresentationList;
-import uk.gov.hmcts.reform.civil.enums.finalorders.FinalOrdersJudgePapers;
-
-import java.util.List;
@Data
@Builder(toBuilder = true)
@@ -18,5 +15,4 @@ public class FinalOrderRepresentation {
private FinalOrderRepresentationList typeRepresentationList;
private ClaimantAndDefendantHeard typeRepresentationComplex;
private ClaimantAndDefendantHeard typeRepresentationOtherComplex;
- private List typeRepresentationJudgePapersList;
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/OrderMade.java b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/OrderMade.java
index 82242b8f932..60f157331e8 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/OrderMade.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/OrderMade.java
@@ -13,6 +13,7 @@ public class OrderMade {
private DatesFinalOrders singleDateSelection;
private DatesFinalOrders dateRangeSelection;
+ private DatesFinalOrders bespokeRangeSelection;
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/TrialNoticeProcedure.java b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/TrialNoticeProcedure.java
index d8d556af2a0..5f10b9d9647 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/TrialNoticeProcedure.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/finalorders/TrialNoticeProcedure.java
@@ -13,5 +13,7 @@
public class TrialNoticeProcedure {
private FinalOrdersClaimantDefendantNotAttending list;
+ private FinalOrdersClaimantDefendantNotAttending listClaimTwo;
private FinalOrdersClaimantDefendantNotAttending listDef;
+ private FinalOrdersClaimantDefendantNotAttending listDefTwo;
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/genapplication/CaseLocationCivil.java b/src/main/java/uk/gov/hmcts/reform/civil/model/genapplication/CaseLocationCivil.java
index edc224ba820..20bc4d13f5a 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/model/genapplication/CaseLocationCivil.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/genapplication/CaseLocationCivil.java
@@ -14,4 +14,6 @@ public class CaseLocationCivil {
private String region;
private String siteName;
private String baseLocation;
+ private String address;
+ private String postcode;
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentInstalmentDetails.java b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentInstalmentDetails.java
new file mode 100644
index 00000000000..5ee21faea66
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentInstalmentDetails.java
@@ -0,0 +1,19 @@
+package uk.gov.hmcts.reform.civil.model.judgmentonline;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDate;
+
+@Data
+@Builder(toBuilder = true)
+@NoArgsConstructor
+@AllArgsConstructor
+public class JudgmentInstalmentDetails {
+
+ private String instalmentAmount;
+ private PaymentFrequency paymentFrequency;
+ private LocalDate firstInstalmentDate;
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentPaidInFull.java b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentPaidInFull.java
new file mode 100644
index 00000000000..5e98a2cd895
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentPaidInFull.java
@@ -0,0 +1,19 @@
+package uk.gov.hmcts.reform.civil.model.judgmentonline;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDate;
+import java.util.List;
+
+@Data
+@Builder(toBuilder = true)
+@NoArgsConstructor
+@AllArgsConstructor
+public class JudgmentPaidInFull {
+
+ private LocalDate dateOfFullPaymentMade;
+ private List confirmFullPaymentMade;
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentRTLStatus.java b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentRTLStatus.java
new file mode 100644
index 00000000000..bc28c7672ab
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentRTLStatus.java
@@ -0,0 +1,18 @@
+package uk.gov.hmcts.reform.civil.model.judgmentonline;
+
+public enum JudgmentRTLStatus {
+ REGISTRATION("R"),
+ CANCELLATION("C"),
+ SATISFACTION("S"),
+ MODIFIED("M");
+
+ private String rtlState;
+
+ JudgmentRTLStatus(String rtlState) {
+ this.rtlState = rtlState;
+ }
+
+ public String getRtlState() {
+ return rtlState;
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentRecordedReason.java b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentRecordedReason.java
new file mode 100644
index 00000000000..f6ab0d8d390
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentRecordedReason.java
@@ -0,0 +1,6 @@
+package uk.gov.hmcts.reform.civil.model.judgmentonline;
+
+public enum JudgmentRecordedReason {
+ DETERMINATION_OF_MEANS,
+ JUDGE_ORDER
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentStatusDetails.java b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentStatusDetails.java
new file mode 100644
index 00000000000..95ff71895ff
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentStatusDetails.java
@@ -0,0 +1,19 @@
+package uk.gov.hmcts.reform.civil.model.judgmentonline;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDateTime;
+
+@Data
+@Builder(toBuilder = true)
+@NoArgsConstructor
+@AllArgsConstructor
+public class JudgmentStatusDetails {
+
+ private JudgmentStatusType judgmentStatusTypes;
+ private LocalDateTime lastUpdatedDate;
+ private String joRtlState;
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentStatusType.java b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentStatusType.java
new file mode 100644
index 00000000000..1bd0d66a2c1
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/JudgmentStatusType.java
@@ -0,0 +1,10 @@
+package uk.gov.hmcts.reform.civil.model.judgmentonline;
+
+public enum JudgmentStatusType {
+ REQUESTED,
+ ISSUED,
+ MODIFIED,
+ SET_ASIDE,
+ CANCELLED,
+ SATISFIED
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/PaymentFrequency.java b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/PaymentFrequency.java
new file mode 100644
index 00000000000..880e9cf0398
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/PaymentFrequency.java
@@ -0,0 +1,7 @@
+package uk.gov.hmcts.reform.civil.model.judgmentonline;
+
+public enum PaymentFrequency {
+ MONTHLY,
+ EVERY_TWO_WEEKS,
+ WEEKLY;
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/PaymentPlanSelection.java b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/PaymentPlanSelection.java
new file mode 100644
index 00000000000..a2bedebfba3
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/judgmentonline/PaymentPlanSelection.java
@@ -0,0 +1,7 @@
+package uk.gov.hmcts.reform.civil.model.judgmentonline;
+
+public enum PaymentPlanSelection {
+ PAY_IN_INSTALMENTS,
+ PAY_BY_DATE,
+ PAY_IMMEDIATELY
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/repaymentplan/ClaimantProposedPlan.java b/src/main/java/uk/gov/hmcts/reform/civil/model/repaymentplan/ClaimantProposedPlan.java
new file mode 100644
index 00000000000..c325b34b416
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/repaymentplan/ClaimantProposedPlan.java
@@ -0,0 +1,56 @@
+package uk.gov.hmcts.reform.civil.model.repaymentplan;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Builder;
+import lombok.Data;
+import uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec;
+import uk.gov.hmcts.reform.civil.model.RepaymentPlanLRspec;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Optional;
+
+import static uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec.BY_SET_DATE;
+import static uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec.IMMEDIATELY;
+import static uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec.SUGGESTION_OF_REPAYMENT_PLAN;
+import static uk.gov.hmcts.reform.civil.utils.MonetaryConversions.penniesToPounds;
+import static uk.gov.hmcts.reform.civil.utils.PaymentFrequencyCalculator.calculatePaymentPerMonth;
+
+@Data
+@Builder
+public class ClaimantProposedPlan {
+
+ private RepaymentPlanLRspec repaymentPlanLRspec;
+ private RespondentResponsePartAdmissionPaymentTimeLRspec proposedRepaymentType;
+ private LocalDate repaymentByDate;
+
+ @JsonIgnore
+ public LocalDate getRepaymentDate(BigDecimal totalClaimAmount) {
+ return Optional.ofNullable(repaymentPlanLRspec).map(repaymentPlan -> repaymentPlan.finalPaymentBy(totalClaimAmount))
+ .orElse(repaymentByDate);
+ }
+
+ @JsonIgnore
+ public double getCalculatedPaymentPerMonthFromRepaymentPlan() {
+ return calculatePaymentPerMonth(
+ penniesToPounds(repaymentPlanLRspec.getPaymentAmount()).doubleValue(),
+ repaymentPlanLRspec.getRepaymentFrequency()
+ );
+ }
+
+ @JsonIgnore
+ public boolean hasProposedPayImmediately() {
+ return IMMEDIATELY == proposedRepaymentType;
+ }
+
+ @JsonIgnore
+ public boolean hasProposedPayBySetDate() {
+ return BY_SET_DATE == proposedRepaymentType;
+ }
+
+ @JsonIgnore
+ public boolean hasProposedPayByInstallments() {
+ return SUGGESTION_OF_REPAYMENT_PLAN == proposedRepaymentType;
+ }
+
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/transferonlinecase/NotSuitableSdoOptions.java b/src/main/java/uk/gov/hmcts/reform/civil/model/transferonlinecase/NotSuitableSdoOptions.java
new file mode 100644
index 00000000000..6b61911868d
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/transferonlinecase/NotSuitableSdoOptions.java
@@ -0,0 +1,9 @@
+package uk.gov.hmcts.reform.civil.model.transferonlinecase;
+
+import lombok.Getter;
+
+@Getter
+public enum NotSuitableSdoOptions {
+ CHANGE_LOCATION,
+ OTHER_REASONS
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/transferonlinecase/TocTransferCaseReason.java b/src/main/java/uk/gov/hmcts/reform/civil/model/transferonlinecase/TocTransferCaseReason.java
new file mode 100644
index 00000000000..df2805c0e69
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/transferonlinecase/TocTransferCaseReason.java
@@ -0,0 +1,15 @@
+package uk.gov.hmcts.reform.civil.model.transferonlinecase;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@Builder(toBuilder = true)
+@NoArgsConstructor
+@AllArgsConstructor
+public class TocTransferCaseReason {
+
+ private String reasonForCaseTransferJudgeTxt;
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/model/transferonlinecase/TransferCaseDetails.java b/src/main/java/uk/gov/hmcts/reform/civil/model/transferonlinecase/TransferCaseDetails.java
new file mode 100644
index 00000000000..09a3a38aa03
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/model/transferonlinecase/TransferCaseDetails.java
@@ -0,0 +1,15 @@
+package uk.gov.hmcts.reform.civil.model.transferonlinecase;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@Builder(toBuilder = true)
+@NoArgsConstructor
+@AllArgsConstructor
+public class TransferCaseDetails {
+
+ private String reasonForTransferCaseTxt;
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/notification/EvidenceUploadApplicantNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/notification/EvidenceUploadApplicantNotificationHandler.java
index 5a5c2c8e67d..06d1bcbee18 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/notification/EvidenceUploadApplicantNotificationHandler.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/notification/EvidenceUploadApplicantNotificationHandler.java
@@ -11,6 +11,8 @@
import java.util.Map;
+import static java.util.Objects.nonNull;
+
@Service
@RequiredArgsConstructor
public class EvidenceUploadApplicantNotificationHandler implements NotificationData {
@@ -24,12 +26,14 @@ public void notifyApplicantEvidenceUpload(CaseData caseData) throws Notification
boolean isApplicantLip = isApplicantLip(caseData);
//Send email to Applicant
- notificationService.sendMail(
- getEmail(caseData, isApplicantLip),
- getTemplate(caseData, isApplicantLip),
- addProperties(caseData),
- getReference(caseData)
- );
+ if (nonNull(caseData.getNotificationText()) && !caseData.getNotificationText().equals("NULLED")) {
+ notificationService.sendMail(
+ getEmail(caseData, isApplicantLip),
+ getTemplate(caseData, isApplicantLip),
+ addProperties(caseData),
+ getReference(caseData)
+ );
+ }
}
private static String getReference(CaseData caseData) {
@@ -53,7 +57,8 @@ private boolean isApplicantLip(CaseData caseData) {
@Override
public Map addProperties(CaseData caseData) {
return Map.of(
- CLAIM_REFERENCE_NUMBER, caseData.getLegacyCaseReference()
+ CLAIM_REFERENCE_NUMBER, caseData.getLegacyCaseReference(),
+ UPLOADED_DOCUMENTS, caseData.getNotificationText()
);
}
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/notification/EvidenceUploadRespondentNotificationHandler.java b/src/main/java/uk/gov/hmcts/reform/civil/notification/EvidenceUploadRespondentNotificationHandler.java
index eb6758fa47c..a8a7dc43178 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/notification/EvidenceUploadRespondentNotificationHandler.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/notification/EvidenceUploadRespondentNotificationHandler.java
@@ -11,6 +11,7 @@
import java.util.Map;
+import static java.util.Objects.nonNull;
import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO;
@Service
@@ -41,7 +42,7 @@ public void notifyRespondentEvidenceUpload(CaseData caseData, boolean isForRespo
isRespondentLip = true;
}
- if (null != email) {
+ if (null != email && nonNull(caseData.getNotificationText()) && !caseData.getNotificationText().equals("NULLED")) {
notificationService.sendMail(
email,
getTemplate(isRespondentLip),
@@ -62,7 +63,8 @@ public String getTemplate(boolean isRespondentLip) {
@Override
public Map addProperties(CaseData caseData) {
return Map.of(
- CLAIM_REFERENCE_NUMBER, caseData.getLegacyCaseReference()
- );
+ CLAIM_REFERENCE_NUMBER, caseData.getLegacyCaseReference(),
+ UPLOADED_DOCUMENTS, caseData.getNotificationText()
+ );
}
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/CaseNoteService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/CaseNoteService.java
index f98a37f68e4..4c6f63654eb 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/service/CaseNoteService.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/CaseNoteService.java
@@ -7,7 +7,6 @@
import uk.gov.hmcts.reform.idam.client.IdamClient;
import uk.gov.hmcts.reform.idam.client.models.UserDetails;
-import java.time.LocalDateTime;
import java.util.List;
import static com.google.common.collect.Lists.newArrayList;
@@ -19,21 +18,29 @@
public class CaseNoteService {
private final IdamClient idamClient;
+ private final Time time;
public CaseNote buildCaseNote(String authorisation, String note) {
UserDetails userDetails = idamClient.getUserDetails(authorisation);
return CaseNote.builder()
.createdBy(userDetails.getFullName())
- .createdOn(LocalDateTime.now())
+ .createdOn(time.now())
.note(note)
.build();
}
- public List> addNoteToList(CaseNote caseNote, List> caseNotes) {
+ public List> addNoteToListStart(CaseNote caseNote, List> caseNotes) {
List> updatedCaseNotes = ofNullable(caseNotes).orElse(newArrayList());
updatedCaseNotes.add(0, element(caseNote));
return updatedCaseNotes;
}
+
+ public List> addNoteToListEnd(CaseNote caseNote, List> caseNotes) {
+ List> updatedCaseNotes = ofNullable(caseNotes).orElse(newArrayList());
+ updatedCaseNotes.add(element(caseNote));
+
+ return updatedCaseNotes;
+ }
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/FeatureToggleService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/FeatureToggleService.java
index bb9cea58385..f4aa4bc5382 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/service/FeatureToggleService.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/FeatureToggleService.java
@@ -71,4 +71,21 @@ public boolean isUpdateContactDetailsEnabled() {
public boolean isLipVLipEnabled() {
return featureToggleApi.isFeatureEnabled("cuiReleaseTwoEnabled");
}
+
+ public boolean isLocationWhiteListedForCaseProgression(String locationEpimms) {
+ return featureToggleApi.isFeatureEnabledForLocation("case-progression-location-whitelist", locationEpimms,
+ true);
+ }
+
+ public boolean isTransferOnlineCaseEnabled() {
+ return featureToggleApi.isFeatureEnabled("isTransferOnlineCaseEnabled");
+ }
+
+ public boolean isCaseProgressionEnabled() {
+ return featureToggleApi.isFeatureEnabled("cui-case-progression");
+ }
+
+ public boolean isEarlyAdoptersEnabled() {
+ return featureToggleApi.isFeatureEnabled("early-adopters");
+ }
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/GenAppStateHelperService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/GenAppStateHelperService.java
index 2569a7ad87b..f0d0abaf206 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/service/GenAppStateHelperService.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/GenAppStateHelperService.java
@@ -14,6 +14,7 @@
import uk.gov.hmcts.reform.civil.model.genapplication.GADetailsRespondentSol;
import uk.gov.hmcts.reform.civil.model.genapplication.GeneralApplication;
import uk.gov.hmcts.reform.civil.model.genapplication.GeneralApplicationsDetails;
+import uk.gov.hmcts.reform.civil.referencedata.model.LocationRefData;
import java.util.ArrayList;
import java.util.HashMap;
@@ -31,6 +32,7 @@ public class GenAppStateHelperService {
private final CoreCaseDataService coreCaseDataService;
private final CaseDetailsConverter caseDetailsConverter;
+ private final InitiateGeneralApplicationService genAppService;
private final ObjectMapper objectMapper;
@@ -69,16 +71,19 @@ public boolean triggerEvent(CaseData caseData, CaseEvent event) {
return true;
}
- public CaseData updateApplicationLocationDetailsInClaim(CaseData caseData) {
+ public CaseData updateApplicationLocationDetailsInClaim(CaseData caseData, String authToken) {
if (!Collections.isEmpty(caseData.getGeneralApplications())) {
List genApps = new ArrayList<>();
CaseData finalCaseData = caseData;
+ LocationRefData locationDetails = genAppService.getWorkAllocationLocationDetails(finalCaseData.getCaseManagementLocation().getBaseLocation(), authToken);
caseData.getGeneralApplications().forEach(generalApplicationElement -> {
GeneralApplication generalApplication = generalApplicationElement.getValue();
generalApplication.getCaseManagementLocation().setBaseLocation(finalCaseData.getCaseManagementLocation().getBaseLocation());
generalApplication.getCaseManagementLocation().setRegion(finalCaseData.getCaseManagementLocation().getRegion());
- generalApplication.getCaseManagementLocation().setSiteName(finalCaseData.getLocationName());
+ generalApplication.getCaseManagementLocation().setSiteName(locationDetails.getSiteName());
+ generalApplication.getCaseManagementLocation().setAddress(locationDetails.getCourtAddress());
+ generalApplication.getCaseManagementLocation().setPostcode(locationDetails.getPostcode());
Map genAppMap = generalApplication.toMap(objectMapper);
genAppMap.put("isCcmccLocation", YesOrNo.NO);
generalApplication = objectMapper.convertValue(genAppMap, GeneralApplication.class);
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/GeneralAppFeesService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/GeneralAppFeesService.java
index ec252f3c5eb..889de7d1e51 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/service/GeneralAppFeesService.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/GeneralAppFeesService.java
@@ -52,7 +52,7 @@ public class GeneralAppFeesService {
protected static final List ADJOURN_TYPES
= List.of(GeneralApplicationTypes.ADJOURN_HEARING);
protected static final List SD_CONSENT_TYPES
- = List.of(GeneralApplicationTypes.SETTLE_OR_DISCONTINUE_CONSENT);
+ = List.of(GeneralApplicationTypes.SETTLE_BY_CONSENT);
public Fee getFeeForGA(CaseData caseData) {
Fee result = Fee.builder().calculatedAmountInPence(BigDecimal.valueOf(Integer.MAX_VALUE)).build();
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/InitiateGeneralApplicationService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/InitiateGeneralApplicationService.java
index cd60c0cb9a8..f70a80f9ad5 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/service/InitiateGeneralApplicationService.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/InitiateGeneralApplicationService.java
@@ -4,10 +4,6 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.stereotype.Service;
-import uk.gov.hmcts.reform.authorisation.generators.AuthTokenGenerator;
-import uk.gov.hmcts.reform.ccd.client.CaseAccessDataStoreApi;
-import uk.gov.hmcts.reform.ccd.model.CaseAssignedUserRolesResource;
-import uk.gov.hmcts.reform.civil.config.CrossAccessUserConfiguration;
import uk.gov.hmcts.reform.civil.documentmanagement.model.Document;
import uk.gov.hmcts.reform.civil.enums.CaseCategory;
import uk.gov.hmcts.reform.civil.enums.CaseState;
@@ -32,9 +28,9 @@
import uk.gov.hmcts.reform.civil.model.genapplication.GAUnavailabilityDates;
import uk.gov.hmcts.reform.civil.model.genapplication.GAUrgencyRequirement;
import uk.gov.hmcts.reform.civil.model.genapplication.GeneralApplication;
-import uk.gov.hmcts.reform.civil.prd.client.OrganisationApi;
import uk.gov.hmcts.reform.civil.referencedata.LocationRefDataService;
import uk.gov.hmcts.reform.civil.referencedata.model.LocationRefData;
+import uk.gov.hmcts.reform.civil.utils.UserRoleCaching;
import uk.gov.hmcts.reform.idam.client.models.UserDetails;
import java.time.LocalDate;
@@ -62,6 +58,8 @@
import static uk.gov.hmcts.reform.civil.model.Party.Type.INDIVIDUAL;
import static uk.gov.hmcts.reform.civil.model.Party.Type.SOLE_TRADER;
import static uk.gov.hmcts.reform.civil.utils.ElementUtils.element;
+import static uk.gov.hmcts.reform.civil.utils.UserRoleUtils.isRespondentSolicitorOne;
+import static uk.gov.hmcts.reform.civil.utils.UserRoleUtils.isRespondentSolicitorTwo;
@Service
@RequiredArgsConstructor
@@ -71,14 +69,8 @@ public class InitiateGeneralApplicationService {
private final InitiateGeneralApplicationServiceHelper helper;
private final GeneralAppsDeadlinesCalculator deadlinesCalculator;
- private final CaseAccessDataStoreApi caseAccessDataStoreApi;
- private final UserService userService;
- private final CrossAccessUserConfiguration crossAccessUserConfiguration;
-
- private final OrganisationApi organisationApi;
- private final AuthTokenGenerator authTokenGenerator;
+ private final UserRoleCaching userRoleCaching;
private final LocationRefDataService locationRefDataService;
- private final FeatureToggleService featureToggleService;
private static final int NUMBER_OF_DEADLINE_DAYS = 5;
public static final String GA_DOC_CATEGORY_ID = "applications";
@@ -95,7 +87,7 @@ public class InitiateGeneralApplicationService {
+ "you must provide at least one valid Date from";
public static final String INVALID_UNAVAILABILITY_RANGE = "Unavailability Date From cannot be after "
+ "Unavailability Date to. Please enter valid range.";
- public static final String INVALID_SETTLE_OR_DISCONTINUE_CONSENT = "Settle or Discontinue by consent " +
+ public static final String INVALID_SETTLE_BY_CONSENT = "Settle by consent " +
"must have been agreed with the respondent " +
"before raising the application";
@@ -115,6 +107,8 @@ public CaseData buildCaseData(CaseData.CaseDataBuilder dataBuilder, CaseData cas
.generalAppPBADetails(GAPbaDetails.builder().build())
.generalAppDetailsOfOrder(EMPTY)
.generalAppReasonsOfOrder(EMPTY)
+ .generalAppParentClaimantIsApplicant(null)
+ .generalAppVaryJudgementType(null)
.generalAppN245FormUpload(Document.builder().build())
.generalAppHearingDate(GAHearingDateGAspec.builder().build())
.generalAppInformOtherParty(GAInformOtherParty.builder().build())
@@ -185,6 +179,13 @@ private GeneralApplication buildApplication(CaseData.CaseDataBuilder dataBuilder
Pair caseLocation = getWorkAllocationLocation(caseData, authToken);
//Setting Work Allocation location and location name
+ if (Objects.isNull(caseLocation.getLeft().getSiteName())
+ && Objects.nonNull(caseLocation.getLeft().getBaseLocation())) {
+ LocationRefData locationDetails = getWorkAllocationLocationDetails(caseLocation.getLeft().getBaseLocation(), authToken);
+ caseLocation.getLeft().setSiteName(locationDetails.getSiteName());
+ caseLocation.getLeft().setAddress(locationDetails.getCourtAddress());
+ caseLocation.getLeft().setPostcode(locationDetails.getPostcode());
+ }
applicationBuilder.caseManagementLocation(caseLocation.getLeft());
applicationBuilder.isCcmccLocation(caseLocation.getRight() ? YES : NO);
applicationBuilder.locationName(hasSDOBeenMade(caseData.getCcdState())
@@ -301,35 +302,16 @@ private void validateUnavailableDates(List errors,
}
}
- public boolean respondentAssigned(CaseData caseData) {
+ public boolean respondentAssigned(CaseData caseData, String authToken) {
String caseId = caseData.getCcdCaseReference().toString();
- CaseAssignedUserRolesResource userRoles = getUserRolesOnCase(caseId);
+ List userRoles = userRoleCaching.getUserRoles(authToken, caseId);
List respondentCaseRoles = getRespondentCaseRoles(caseData);
-
- for (String respondentCaseRole : respondentCaseRoles) {
- if (userRoles.getCaseAssignedUserRoles() == null
- || userRoles.getCaseAssignedUserRoles().stream()
- .noneMatch(a -> a.getCaseRole() != null && respondentCaseRole.equals(a.getCaseRole()))) {
- return false;
- }
- }
- return true;
+ return !(userRoles.isEmpty() || !isRespondentSolicitorOne(respondentCaseRoles)
+ || (respondentCaseRoles.size() > 1 && !isRespondentSolicitorTwo(respondentCaseRoles)));
}
- public boolean isGAApplicantSameAsParentCaseClaimant(CaseData caseData, UserDetails userDetails) {
- return helper.isGAApplicantSameAsParentCaseClaimant(caseData, userDetails);
- }
-
- private CaseAssignedUserRolesResource getUserRolesOnCase(String caseId) {
- String accessToken = userService.getAccessToken(
- crossAccessUserConfiguration.getUserName(),
- crossAccessUserConfiguration.getPassword()
- );
- return caseAccessDataStoreApi.getUserRoles(
- accessToken,
- authTokenGenerator.generate(),
- List.of(caseId)
- );
+ public boolean isGAApplicantSameAsParentCaseClaimant(CaseData caseData, String authToken) {
+ return helper.isGAApplicantSameAsParentCaseClaimant(caseData, authToken);
}
private List getRespondentCaseRoles(CaseData caseData) {
@@ -368,6 +350,8 @@ public Pair getWorkAllocationLocation(CaseData caseD
.region(ccmccLocation.getRegionId())
.baseLocation(ccmccLocation.getEpimmsId())
.siteName(ccmccLocation.getSiteName())
+ .address(ccmccLocation.getCourtAddress())
+ .postcode(ccmccLocation.getPostcode())
.build();
return Pair.of(courtLocation, true);
}
@@ -394,6 +378,15 @@ private CaseLocationCivil getClaimant1PreferredLocation(CaseData caseData) {
.build();
}
+ public LocationRefData getWorkAllocationLocationDetails(String baseLocation, String authToken) {
+ List locationDetails = locationRefDataService.getCourtLocationsByEpimmsId(authToken, baseLocation);
+ if (locationDetails != null && !locationDetails.isEmpty()) {
+ return locationDetails.get(0);
+ } else {
+ return LocationRefData.builder().build();
+ }
+ }
+
private boolean isDefendant1RespondedFirst(CaseData caseData) {
return caseData.getRespondent2ResponseDate() == null
|| (caseData.getRespondent1ResponseDate() != null
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/InitiateGeneralApplicationServiceHelper.java b/src/main/java/uk/gov/hmcts/reform/civil/service/InitiateGeneralApplicationServiceHelper.java
index a0071a7879b..d6d35fe839d 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/service/InitiateGeneralApplicationServiceHelper.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/InitiateGeneralApplicationServiceHelper.java
@@ -13,6 +13,8 @@
import uk.gov.hmcts.reform.civil.model.common.Element;
import uk.gov.hmcts.reform.civil.model.genapplication.GASolicitorDetailsGAspec;
import uk.gov.hmcts.reform.civil.model.genapplication.GeneralApplication;
+import uk.gov.hmcts.reform.civil.utils.UserRoleCaching;
+import uk.gov.hmcts.reform.civil.utils.UserRoleUtils;
import uk.gov.hmcts.reform.idam.client.models.UserDetails;
import java.util.ArrayList;
@@ -33,6 +35,7 @@
public class InitiateGeneralApplicationServiceHelper {
private final CaseAccessDataStoreApi caseAccessDataStoreApi;
+ private final UserRoleCaching userRoleCaching;
private final AuthTokenGenerator authTokenGenerator;
private final UserService userService;
private final CrossAccessUserConfiguration crossAccessUserConfiguration;
@@ -228,24 +231,20 @@ public String getApplicantPartyName(CaseAssignedUserRolesResource userRoles, Use
return EMPTY;
}
- public boolean isGAApplicantSameAsParentCaseClaimant(CaseData caseData, UserDetails userDetails) {
+ public boolean isGAApplicantSameAsParentCaseClaimant(CaseData caseData, String authToken) {
String parentCaseId = caseData.getCcdCaseReference().toString();
+ List userRolesCaching = userRoleCaching.getUserRoles(authToken, parentCaseId);
- CaseAssignedUserRolesResource userRoles = getUserRoles(parentCaseId);
-
- List applicantSolicitor = getApplicantSolicitor(userRoles, userDetails);
+ boolean isApplicantSolicitor = UserRoleUtils.isApplicantSolicitor(userRolesCaching);
String applicant1OrgCaseRole = caseData.getApplicant1OrganisationPolicy().getOrgPolicyCaseAssignedRole();
- if (!CollectionUtils.isEmpty(applicantSolicitor) && applicantSolicitor.size() == 1) {
-
- CaseAssignedUserRole applnSol = applicantSolicitor.get(0);
+ if (!CollectionUtils.isEmpty(userRolesCaching) && userRolesCaching.size() == 1 && isApplicantSolicitor) {
- if (applnSol.getCaseRole() != null) {
+ String applnSol = userRolesCaching.get(0);
- if (applnSol.getCaseRole().equals(applicant1OrgCaseRole)) {
- return true;
- }
+ if (applnSol != null && applnSol.equals(applicant1OrgCaseRole)) {
+ return true;
}
}
@@ -257,13 +256,6 @@ public CaseAssignedUserRolesResource getUserRoles(String parentCaseId) {
getCaaAccessToken(), authTokenGenerator.generate(), List.of(parentCaseId));
}
- public List getApplicantSolicitor(CaseAssignedUserRolesResource userRoles,
- UserDetails userDetails) {
- return userRoles.getCaseAssignedUserRoles().stream()
- .filter(CA -> CA.getUserId().equals(userDetails.getId()))
- .collect(Collectors.toList());
- }
-
public String getCaaAccessToken() {
return userService.getAccessToken(
crossAccessUserConfiguration.getUserName(),
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/JudgementService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/JudgementService.java
index f585e3836a7..3917b350b4d 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/service/JudgementService.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/JudgementService.java
@@ -31,8 +31,11 @@ public CCJPaymentDetails buildJudgmentAmountSummaryDetails(CaseData caseData) {
.ccjJudgmentAmountInterestToDate(ccjJudgmentInterest(caseData))
.ccjPaymentPaidSomeAmountInPounds(ccjJudgmentPaidAmount(caseData))
.ccjJudgmentFixedCostAmount(ccjJudgmentFixedCost(caseData))
- .ccjJudgmentFixedCostOption(caseData.getCcjPaymentDetails().getCcjJudgmentFixedCostOption())
+ .ccjJudgmentFixedCostOption(caseData.getCcjPaymentDetails()
+ .getCcjJudgmentFixedCostOption())
.ccjJudgmentStatement(ccjJudgmentStatement(caseData))
+ .ccjPaymentPaidSomeOption(caseData.getCcjPaymentDetails().getCcjPaymentPaidSomeOption())
+ .ccjJudgmentLipInterest(caseData.getCcjPaymentDetails().getCcjJudgmentLipInterest())
.build();
}
@@ -53,7 +56,8 @@ private BigDecimal ccjJudgmentClaimAmount(CaseData caseData) {
}
private BigDecimal ccjJudgmentClaimFee(CaseData caseData) {
- return MonetaryConversions.penniesToPounds(caseData.getClaimFee().getCalculatedAmountInPence());
+ return caseData.isLipvLipOneVOne() ? caseData.getCcjPaymentDetails().getCcjJudgmentAmountClaimFee() :
+ MonetaryConversions.penniesToPounds(caseData.getClaimFee().getCalculatedAmountInPence());
}
private BigDecimal ccjJudgmentPaidAmount(CaseData caseData) {
@@ -66,13 +70,14 @@ private BigDecimal ccjJudgmentFixedCost(CaseData caseData) {
}
private BigDecimal ccjJudgmentInterest(CaseData caseData) {
- return caseData.getTotalInterest();
+ return caseData.isLipvLipOneVOne() ? caseData.getCcjPaymentDetails().getCcjJudgmentLipInterest() :
+ caseData.getTotalInterest();
}
private BigDecimal ccjJudgementSubTotal(CaseData caseData) {
return ccjJudgmentClaimAmount(caseData)
.add(ccjJudgmentClaimFee(caseData))
- .add(caseData.getTotalInterest())
+ .add(ccjJudgmentInterest(caseData))
.add(ccjJudgmentFixedCost(caseData));
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/OrganisationDetailsService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/OrganisationDetailsService.java
index 43ce135e229..03b9e801d48 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/service/OrganisationDetailsService.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/OrganisationDetailsService.java
@@ -18,4 +18,13 @@ public String getApplicantLegalOrganizationName(CaseData caseData) {
return organisation.map(Organisation::getName).orElse(caseData.getApplicantSolicitor1ClaimStatementOfTruth().getName());
}
+ public String getRespondentLegalOrganizationName(CaseData caseData) {
+ Optional organisation = organisationService.findOrganisationById(
+ caseData.getRespondent1OrganisationId());
+ String respondentLegalOrganizationName = null;
+ if (organisation.isPresent()) {
+ respondentLegalOrganizationName = organisation.get().getName();
+ }
+ return respondentLegalOrganizationName;
+ }
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/SendSDOBulkPrintService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/SendSDOBulkPrintService.java
index 0d5a8052915..01bb544ac5e 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/service/SendSDOBulkPrintService.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/SendSDOBulkPrintService.java
@@ -23,7 +23,7 @@ public class SendSDOBulkPrintService {
private final DocumentDownloadService documentDownloadService;
private static final String SDO_ORDER_PACK_LETTER_TYPE = "sdo-order-pack";
- public void sendSDOToDefendantLIP(CaseData caseData) {
+ public void sendSDOToDefendantLIP(String authorisation, CaseData caseData) {
if (caseData.getSystemGeneratedCaseDocuments() != null && !caseData.getSystemGeneratedCaseDocuments().isEmpty()) {
Optional> caseDocument = caseData.getSDODocument();
@@ -32,7 +32,7 @@ public void sendSDOToDefendantLIP(CaseData caseData) {
String documentId = documentUrl.substring(documentUrl.lastIndexOf("/") + 1);
byte[] letterContent;
try {
- letterContent = documentDownloadService.downloadDocument(documentId).file().getInputStream().readAllBytes();
+ letterContent = documentDownloadService.downloadDocument(authorisation, documentId).file().getInputStream().readAllBytes();
} catch (IOException e) {
log.error("Failed getting letter content for SDO ");
throw new DocumentDownloadException(caseDocument.get().getValue().getDocumentName(), e);
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/SystemGeneratedDocumentService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/SystemGeneratedDocumentService.java
index b5e8945298b..9b9a958aa32 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/service/SystemGeneratedDocumentService.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/SystemGeneratedDocumentService.java
@@ -5,12 +5,12 @@
import org.springframework.stereotype.Service;
import uk.gov.hmcts.reform.civil.callback.CallbackParams;
import uk.gov.hmcts.reform.civil.documentmanagement.model.CaseDocument;
-import uk.gov.hmcts.reform.civil.documentmanagement.model.Document;
-import uk.gov.hmcts.reform.civil.documentmanagement.model.DocumentType;
import uk.gov.hmcts.reform.civil.model.CaseData;
+import uk.gov.hmcts.reform.civil.model.citizenui.TranslatedDocument;
import uk.gov.hmcts.reform.civil.model.common.Element;
import java.util.List;
+import java.util.Objects;
import static uk.gov.hmcts.reform.civil.utils.ElementUtils.element;
@@ -18,17 +18,23 @@
@Scope(value = "prototype", proxyMode = ScopedProxyMode.TARGET_CLASS)
public class SystemGeneratedDocumentService {
- public List> getSystemGeneratedDocumentsWithAddedDocument(Document document, DocumentType documentType, CallbackParams callbackParams) {
- CaseData caseData = callbackParams.getCaseData();
+ public List> getSystemGeneratedDocumentsWithAddedDocument(CaseDocument caseDocument, CaseData caseData) {
List> systemGeneratedDocuments = caseData.getSystemGeneratedCaseDocuments();
- CaseDocument caseDocument = CaseDocument.toCaseDocument(document, documentType);
systemGeneratedDocuments.add(element(caseDocument));
return systemGeneratedDocuments;
}
- public List> getSystemGeneratedDocumentsWithAddedDocument(CaseDocument caseDocument, CaseData caseData) {
+ public List> getSystemGeneratedDocumentsWithAddedDocument(List> translatedDocuments, CallbackParams callbackParams) {
+
+ CaseData caseData = callbackParams.getCaseData();
List> systemGeneratedDocuments = caseData.getSystemGeneratedCaseDocuments();
- systemGeneratedDocuments.add(element(caseDocument));
+ if (Objects.nonNull(translatedDocuments)) {
+ for (Element translateDocument : translatedDocuments) {
+ CaseDocument caseDocument = CaseDocument.toCaseDocument(translateDocument.getValue().getFile(), translateDocument.getValue().getCorrespondingDocumentType());
+ systemGeneratedDocuments.add(element(caseDocument));
+ }
+ }
return systemGeneratedDocuments;
}
+
}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/UpdateCaseManagementDetailsService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/UpdateCaseManagementDetailsService.java
new file mode 100644
index 00000000000..b37adcba484
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/UpdateCaseManagementDetailsService.java
@@ -0,0 +1,118 @@
+package uk.gov.hmcts.reform.civil.service.citizen;
+
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import uk.gov.hmcts.reform.civil.callback.CallbackParams;
+import uk.gov.hmcts.reform.civil.enums.MultiPartyScenario;
+import uk.gov.hmcts.reform.civil.helpers.LocationHelper;
+import uk.gov.hmcts.reform.civil.model.CaseData;
+import uk.gov.hmcts.reform.civil.model.CaseManagementCategory;
+import uk.gov.hmcts.reform.civil.model.CaseManagementCategoryElement;
+import uk.gov.hmcts.reform.civil.model.common.Element;
+import uk.gov.hmcts.reform.civil.model.dq.RequestedCourt;
+import uk.gov.hmcts.reform.civil.referencedata.LocationRefDataService;
+import uk.gov.hmcts.reform.civil.referencedata.model.LocationRefData;
+import uk.gov.hmcts.reform.civil.utils.CourtLocationUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+import static uk.gov.hmcts.reform.civil.callback.CallbackParams.Params.BEARER_TOKEN;
+import static uk.gov.hmcts.reform.civil.enums.MultiPartyScenario.getMultiPartyScenario;
+import static uk.gov.hmcts.reform.civil.utils.ElementUtils.element;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class UpdateCaseManagementDetailsService {
+
+ private final LocationHelper locationHelper;
+ private final LocationRefDataService locationRefDataService;
+ private final CourtLocationUtils courtLocationUtils;
+
+ public void updateCaseManagementDetails(CaseData.CaseDataBuilder, ?> builder, CallbackParams callbackParams) {
+ CaseData caseData = callbackParams.getCaseData();
+ final List availableLocations = fetchLocationData(callbackParams);
+
+ updateApplicant1RequestedCourtDetails(caseData, builder, availableLocations);
+ updateRespondent1RequestedCourtDetails(caseData, builder, availableLocations);
+
+ caseData = builder.build();
+ locationHelper.getCaseManagementLocation(caseData)
+ .ifPresent(requestedCourt -> locationHelper.updateCaseManagementLocation(
+ builder,
+ requestedCourt,
+ () -> locationRefDataService.getCourtLocationsForDefaultJudgments(callbackParams.getParams().get(
+ CallbackParams.Params.BEARER_TOKEN).toString())
+ ));
+
+ builder.caseNameHmctsInternal(caseParticipants(caseData).toString());
+
+ CaseManagementCategoryElement civil =
+ CaseManagementCategoryElement.builder().code("Civil").label("Civil").build();
+ List> itemList = new ArrayList<>();
+ itemList.add(element(civil));
+ builder.caseManagementCategory(
+ CaseManagementCategory.builder().value(civil).list_items(itemList).build());
+
+ }
+
+ private void updateApplicant1RequestedCourtDetails(CaseData caseData, CaseData.CaseDataBuilder, ?> builder, List availableLocations) {
+ Optional.ofNullable(caseData.getApplicant1DQ())
+ .ifPresent(dq -> Optional.ofNullable(dq.getApplicant1DQRequestedCourt())
+ .ifPresent(requestedCourt -> builder.applicant1DQ(
+ dq.toBuilder().applicant1DQRequestedCourt(correctCaseLocation(requestedCourt, availableLocations))
+ .build())));
+ }
+
+ private void updateRespondent1RequestedCourtDetails(CaseData caseData, CaseData.CaseDataBuilder, ?> builder, List availableLocations) {
+ Optional.ofNullable(caseData.getRespondent1DQ())
+ .ifPresent(dq -> Optional.ofNullable(dq.getRespondent1DQRequestedCourt())
+ .ifPresent(requestedCourt -> builder.respondent1DQ(
+ dq.toBuilder().respondent1DQRequestedCourt(correctCaseLocation(requestedCourt, availableLocations))
+ .build())));
+ }
+
+ private RequestedCourt correctCaseLocation(RequestedCourt requestedCourt, List locations) {
+ String locationLabel = requestedCourt.getCaseLocation().getBaseLocation();
+ LocationRefData preferredLocation = locations.stream()
+ .filter(locationRefData -> courtLocationUtils.checkLocation(locationRefData, locationLabel))
+ .findFirst().orElseThrow(RuntimeException::new);
+ return requestedCourt.toBuilder()
+ .responseCourtCode(preferredLocation.getCourtLocationCode())
+ .caseLocation(LocationHelper.buildCaseLocation(preferredLocation))
+ .build();
+ }
+
+ private List fetchLocationData(CallbackParams callbackParams) {
+ String authToken = callbackParams.getParams().get(BEARER_TOKEN).toString();
+ return locationRefDataService.getCourtLocationsForDefaultJudgments(authToken);
+ }
+
+ private StringBuilder caseParticipants(CaseData caseData) {
+ StringBuilder participantString = new StringBuilder();
+ MultiPartyScenario multiPartyScenario = getMultiPartyScenario(caseData);
+ if (multiPartyScenario.equals(MultiPartyScenario.ONE_V_TWO_ONE_LEGAL_REP)
+ || multiPartyScenario.equals(MultiPartyScenario.ONE_V_TWO_TWO_LEGAL_REP)) {
+ participantString.append(caseData.getApplicant1().getPartyName())
+ .append(" v ").append(caseData.getRespondent1().getPartyName())
+ .append(" and ").append(caseData.getRespondent2().getPartyName());
+
+ } else if (multiPartyScenario.equals(MultiPartyScenario.TWO_V_ONE)) {
+ participantString.append(caseData.getApplicant1().getPartyName())
+ .append(" and ").append(caseData.getApplicant2().getPartyName())
+ .append(" v ")
+ .append(caseData.getRespondent1().getPartyName());
+
+ } else {
+ participantString.append(caseData.getApplicant1().getPartyName())
+ .append(" v ")
+ .append(caseData.getRespondent1().getPartyName());
+ }
+ return participantString;
+
+ }
+
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/AllowanceCalculator.java b/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/AllowanceCalculator.java
new file mode 100644
index 00000000000..399d1816a0b
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/AllowanceCalculator.java
@@ -0,0 +1,113 @@
+package uk.gov.hmcts.reform.civil.service.citizen.repaymentplan;
+
+import org.springframework.stereotype.Component;
+import uk.gov.hmcts.reform.civil.enums.YesOrNo;
+import uk.gov.hmcts.reform.civil.model.CaseData;
+import uk.gov.hmcts.reform.civil.model.ChildrenByAgeGroupLRspec;
+import uk.gov.hmcts.reform.civil.model.PartnerAndDependentsLRspec;
+import uk.gov.hmcts.reform.civil.model.Party;
+import uk.gov.hmcts.reform.civil.model.UnemployedComplexTypeLRspec;
+import uk.gov.hmcts.reform.civil.model.allowance.DisabilityAllowance;
+import uk.gov.hmcts.reform.civil.model.allowance.DisabilityParam;
+import uk.gov.hmcts.reform.civil.model.allowance.PensionerAllowance;
+import uk.gov.hmcts.reform.civil.model.allowance.PersonalAllowance;
+import uk.gov.hmcts.reform.civil.model.citizenui.FinancialDetailsLiP;
+import uk.gov.hmcts.reform.civil.model.dq.Respondent1DQ;
+
+import java.time.LocalDate;
+import java.time.Period;
+import java.util.Optional;
+
+@Component
+public class AllowanceCalculator {
+
+ public static final double DEPENDANT_MONTHLY_ALLOWANCE = 289.90;
+ public static final String RETIRED = "RETIRED";
+
+ public double calculateAllowance(CaseData caseData) {
+ Optional partnerAndDependantInformation = Optional.ofNullable(caseData.getRespondent1PartnerAndDependent());
+ Optional defendantFinancialDetailsLiP = Optional.ofNullable(caseData.getCaseDataLiP().getRespondent1LiPFinancialDetails());
+ double personalAllowance = calculatePersonalAllowance(
+ partnerAndDependantInformation,
+ caseData.getRespondent1()
+ );
+ double dependantsAllowance = calculateDependantsAllowance(partnerAndDependantInformation);
+ double disabilityAllowance = calculateDisabilityAllowance(
+ partnerAndDependantInformation,
+ caseData.getDisabilityPremiumPayments(),
+ caseData.getSevereDisabilityPremiumPayments(),
+ caseData.getRespondent1DQ(),
+ defendantFinancialDetailsLiP
+ );
+ double pensionerAllowance = calculatePensionerAllowance(
+ defendantFinancialDetailsLiP,
+ caseData.getRespondToClaimAdmitPartUnemployedLRspec()
+ );
+ return personalAllowance + dependantsAllowance + disabilityAllowance + pensionerAllowance;
+ }
+
+ private double calculatePersonalAllowance(Optional partnerAndDependantInformation, Party defendant) {
+ int defendantAge = calculateDefendantAge(defendant);
+ boolean hasPartner = getHasPartner(partnerAndDependantInformation);
+ boolean partnerOver18 = YesOrNo.YES == partnerAndDependantInformation.map(PartnerAndDependentsLRspec::getPartnerAgedOver).orElse(
+ null);
+ return PersonalAllowance.getPersonalAllowance(defendantAge, hasPartner, partnerOver18).getAllowance();
+ }
+
+ private boolean getHasPartner(Optional partnerAndDependantInformation) {
+ return partnerAndDependantInformation.map(PartnerAndDependentsLRspec::hasPartner).orElse(false);
+ }
+
+ private double calculateDependantsAllowance(Optional partnerAndDependantInformation) {
+ int numberOfSupportedPeople = partnerAndDependantInformation.map(PartnerAndDependentsLRspec::getSupportPeopleNumber)
+ .map(Integer::parseInt).orElse(0);
+ int numberOfChildren = partnerAndDependantInformation.map(PartnerAndDependentsLRspec::getHowManyChildrenByAgeGroup)
+ .map(ChildrenByAgeGroupLRspec::getTotalChildren).orElse(0);
+ return DEPENDANT_MONTHLY_ALLOWANCE * (numberOfSupportedPeople + numberOfChildren);
+ }
+
+ private double calculateDisabilityAllowance(Optional partnerAndDependantInformation,
+ YesOrNo disabilityPremiumPayments,
+ YesOrNo severeDisability,
+ Respondent1DQ respondent1DQ,
+ Optional financialDetailsLiP) {
+ boolean disabled = YesOrNo.YES == disabilityPremiumPayments;
+ boolean severelyDisabled = YesOrNo.YES == severeDisability
+ || YesOrNo.YES == financialDetailsLiP.map(FinancialDetailsLiP::getPartnerSevereDisabilityLiP).orElse(YesOrNo.NO);
+ boolean hasPartner = getHasPartner(partnerAndDependantInformation);
+ boolean dependantDisabled = YesOrNo.YES == partnerAndDependantInformation.map(PartnerAndDependentsLRspec::getReceiveDisabilityPayments).orElse(
+ YesOrNo.NO);
+ YesOrNo carerOption = getCarerOption(respondent1DQ);
+ boolean carer = YesOrNo.YES == carerOption;
+ return DisabilityAllowance
+ .getDisabilityAllowance(new DisabilityParam(
+ disabled,
+ hasPartner,
+ severelyDisabled,
+ dependantDisabled,
+ carer
+ ));
+
+ }
+
+ private YesOrNo getCarerOption(Respondent1DQ respondent1DQ) {
+ if (respondent1DQ == null) {
+ return YesOrNo.NO;
+ }
+ return Optional.ofNullable(respondent1DQ.getRespondent1DQCarerAllowanceCreditFullAdmission())
+ .orElse(respondent1DQ.getRespondent1DQCarerAllowanceCredit());
+ }
+
+ private double calculatePensionerAllowance(Optional financialDetailsLiP, UnemployedComplexTypeLRspec unemployedType) {
+ boolean partnerPensioner = YesOrNo.YES == financialDetailsLiP.map(FinancialDetailsLiP::getPartnerPensionLiP).orElse(YesOrNo.NO);
+ boolean defendantPensioner = RETIRED.equals(Optional.ofNullable(unemployedType)
+ .map(UnemployedComplexTypeLRspec::getUnemployedComplexTypeRequired).orElse(""));
+ return PensionerAllowance.getPensionerAllowance(defendantPensioner, partnerPensioner);
+ }
+
+ private int calculateDefendantAge(Party defendant) {
+ LocalDate dateOfBirth = defendant.getDateOfBirth();
+ LocalDate now = LocalDate.now();
+ return dateOfBirth != null ? Period.between(now, dateOfBirth).getYears() : 0;
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/ExpenditureCalculator.java b/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/ExpenditureCalculator.java
new file mode 100644
index 00000000000..be8d185fe39
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/ExpenditureCalculator.java
@@ -0,0 +1,78 @@
+package uk.gov.hmcts.reform.civil.service.citizen.repaymentplan;
+
+import org.springframework.stereotype.Component;
+import uk.gov.hmcts.reform.civil.enums.YesOrNo;
+import uk.gov.hmcts.reform.civil.model.DebtLRspec;
+import uk.gov.hmcts.reform.civil.model.LoanCardDebtLRspec;
+import uk.gov.hmcts.reform.civil.model.Respondent1CourtOrderDetails;
+import uk.gov.hmcts.reform.civil.model.Respondent1DebtLRspec;
+import uk.gov.hmcts.reform.civil.model.common.Element;
+import uk.gov.hmcts.reform.civil.model.dq.RecurringExpenseLRspec;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static uk.gov.hmcts.reform.civil.utils.ElementUtils.unwrapElementsNullSafe;
+import static uk.gov.hmcts.reform.civil.utils.MonetaryConversions.penniesToPounds;
+import static uk.gov.hmcts.reform.civil.utils.PaymentFrequencyCalculator.calculatePaymentPerMonth;
+
+@Component
+public class ExpenditureCalculator {
+
+ public double calculateTotalExpenditure(List> recurringExpenseElementList,
+ Respondent1DebtLRspec respondent1DebtLRspec,
+ List> courtOrderDetailsElementList) {
+ double calculatedResult = calculateTotalMonthlyExpenses(recurringExpenseElementList)
+ + calculateTotalMonthlyDebt(respondent1DebtLRspec)
+ + calculateCourtOrders(courtOrderDetailsElementList);
+ return BigDecimal.valueOf(calculatedResult).setScale(2, RoundingMode.HALF_UP).doubleValue();
+ }
+
+ private double calculateTotalMonthlyExpenses(List> recurringExpenseElementList) {
+ List expenses = unwrapElementsNullSafe(recurringExpenseElementList);
+ return expenses.stream()
+ .mapToDouble(expense -> calculatePaymentPerMonth(
+ penniesToPounds(expense.getAmount()).doubleValue(),
+ expense.getFrequency()
+ ))
+ .sum();
+ }
+
+ private double calculateCourtOrders(List> courtOrderDetailsElementList) {
+ List courtOrderDetails = unwrapElementsNullSafe(courtOrderDetailsElementList);
+ return !courtOrderDetails.isEmpty() ? courtOrderDetails.stream().map(item -> penniesToPounds(item.getMonthlyInstalmentAmount()))
+ .collect(Collectors.summingDouble(BigDecimal::doubleValue)) : 0.0;
+ }
+
+ private double calculateTotalMonthlyDebt(Respondent1DebtLRspec respondent1DebtLRspec) {
+ if (respondent1DebtLRspec == null) {
+ return 0.0;
+ }
+ if (YesOrNo.YES == respondent1DebtLRspec.getHasLoanCardDebt()) {
+ return calculateCreditCardDebts(respondent1DebtLRspec.getLoanCardDebtDetails())
+ + calculateDebts(respondent1DebtLRspec.getDebtDetails());
+ }
+ return calculateDebts(respondent1DebtLRspec.getDebtDetails());
+ }
+
+ private double calculateCreditCardDebts(List> loanCardDebtDetails) {
+ List cardDebtList = unwrapElementsNullSafe(loanCardDebtDetails);
+ return cardDebtList.stream()
+ .map(LoanCardDebtLRspec::getMonthlyPayment)
+ .map(debt -> penniesToPounds(debt))
+ .collect(Collectors.summingDouble(BigDecimal::doubleValue));
+ }
+
+ private double calculateDebts(List> debtDetails) {
+ List debts = unwrapElementsNullSafe(debtDetails);
+ return debts.stream()
+ .mapToDouble(debt -> calculatePaymentPerMonth(
+ penniesToPounds(debt.getPaymentAmount()).doubleValue(),
+ debt.getPaymentFrequency()
+ ))
+ .sum();
+ }
+
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/IncomeCalculator.java b/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/IncomeCalculator.java
new file mode 100644
index 00000000000..3f6719dee02
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/IncomeCalculator.java
@@ -0,0 +1,55 @@
+package uk.gov.hmcts.reform.civil.service.citizen.repaymentplan;
+
+import org.springframework.stereotype.Component;
+import uk.gov.hmcts.reform.civil.model.Respondent1SelfEmploymentLRspec;
+import uk.gov.hmcts.reform.civil.model.account.AccountSimple;
+import uk.gov.hmcts.reform.civil.model.common.Element;
+import uk.gov.hmcts.reform.civil.model.dq.RecurringIncomeLRspec;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import static uk.gov.hmcts.reform.civil.utils.ElementUtils.unwrapElementsNullSafe;
+import static uk.gov.hmcts.reform.civil.utils.MonetaryConversions.penniesToPounds;
+import static uk.gov.hmcts.reform.civil.utils.PaymentFrequencyCalculator.calculatePaymentPerMonth;
+
+@Component
+public class IncomeCalculator {
+
+ public double calculateTotalMonthlyIncome(List> bankAccountElements,
+ List> recurringIncomeElements,
+ Respondent1SelfEmploymentLRspec specDefendant1SelfEmploymentDetails) {
+ double result = calculateRegularIncome(recurringIncomeElements)
+ + calculateTotalSavings(bankAccountElements)
+ + calculateMonthlyIncomeFromAnnualTurnover(specDefendant1SelfEmploymentDetails);
+ return BigDecimal.valueOf(result).setScale(2, RoundingMode.HALF_UP).doubleValue();
+ }
+
+ private double calculateTotalSavings(List> bankAccountElements) {
+ List bankAccounts = unwrapElementsNullSafe(bankAccountElements);
+ return bankAccounts.stream().filter(item -> item.getBalance().compareTo(BigDecimal.ZERO) > 0)
+ .map(AccountSimple::getBalance).collect(Collectors.summingDouble(BigDecimal::doubleValue));
+ }
+
+ private double calculateRegularIncome(List> recurringIncomeElements) {
+ List recurringIncomes = unwrapElementsNullSafe(recurringIncomeElements);
+ return recurringIncomes.stream().filter(income -> income.getAmount().compareTo(BigDecimal.ZERO) > 0)
+ .mapToDouble(this::calculateIncomePerMonth).sum();
+ }
+
+ private double calculateMonthlyIncomeFromAnnualTurnover(Respondent1SelfEmploymentLRspec specDefendant1SelfEmploymentDetails) {
+ return Optional.ofNullable(specDefendant1SelfEmploymentDetails)
+ .map(selfEmploymentDetails -> BigDecimal.valueOf(penniesToPounds(selfEmploymentDetails.getAnnualTurnover()).doubleValue() / 12)
+ .setScale(2, RoundingMode.HALF_UP)
+ .doubleValue())
+ .orElse(0.0);
+ }
+
+ private double calculateIncomePerMonth(RecurringIncomeLRspec income) {
+ double incomeAmount = penniesToPounds(income.getAmount()).doubleValue();
+ return calculatePaymentPerMonth(incomeAmount, income.getFrequency());
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/RepaymentPlanDecisionCalculator.java b/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/RepaymentPlanDecisionCalculator.java
new file mode 100644
index 00000000000..d6bb205bbc9
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/RepaymentPlanDecisionCalculator.java
@@ -0,0 +1,96 @@
+package uk.gov.hmcts.reform.civil.service.citizen.repaymentplan;
+
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec;
+import uk.gov.hmcts.reform.civil.model.CaseData;
+import uk.gov.hmcts.reform.civil.model.RepaymentPlanLRspec;
+import uk.gov.hmcts.reform.civil.model.citizenui.dto.RepaymentDecisionType;
+import uk.gov.hmcts.reform.civil.model.repaymentplan.ClaimantProposedPlan;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Optional;
+
+import static uk.gov.hmcts.reform.civil.enums.RespondentResponsePartAdmissionPaymentTimeLRspec.BY_SET_DATE;
+
+@Service
+@RequiredArgsConstructor
+public class RepaymentPlanDecisionCalculator {
+
+ private final IncomeCalculator incomeCalculator;
+ private final ExpenditureCalculator expenditureCalculator;
+ private final AllowanceCalculator allowanceCalculator;
+
+ public RepaymentDecisionType calculateRepaymentDecision(CaseData caseData, ClaimantProposedPlan claimantProposedPlan) {
+ double disposableIncome = calculateDisposableIncome(caseData);
+ BigDecimal claimTotalAmount = Optional.ofNullable(caseData.getRespondToAdmittedClaimOwingAmountPounds()).orElse(
+ caseData.getTotalClaimAmount());
+
+ if (claimantProposedPlan.hasProposedPayImmediately()) {
+ return calculateDecisionBasedOnAmountAndDisposableIncome(claimTotalAmount.doubleValue(), disposableIncome);
+ }
+ if (claimantProposedPlan.hasProposedPayBySetDate()) {
+ RepaymentDecisionType repaymentDecisionType = calculateDecisionBasedOnAmountAndDisposableIncome(
+ claimTotalAmount.doubleValue(),
+ disposableIncome
+ );
+ if (repaymentDecisionType.isInFavourOfDefendant()) {
+ LocalDate proposedDefendantRepaymentDate = getProposedDefendantRepaymentDate(
+ caseData,
+ claimTotalAmount
+ );
+ return calculateDecisionBasedOnProposedDate(
+ proposedDefendantRepaymentDate,
+ claimantProposedPlan.getRepaymentByDate()
+ );
+ }
+ return repaymentDecisionType;
+ }
+ if (claimantProposedPlan.hasProposedPayByInstallments()) {
+ return calculateDecisionBasedOnAmountAndDisposableIncome(
+ claimantProposedPlan.getCalculatedPaymentPerMonthFromRepaymentPlan(),
+ disposableIncome
+ );
+ }
+ return RepaymentDecisionType.IN_FAVOUR_OF_DEFENDANT;
+ }
+
+ private LocalDate getProposedDefendantRepaymentDate(CaseData caseData, BigDecimal claimTotalAmount) {
+ RespondentResponsePartAdmissionPaymentTimeLRspec respondentResponseType = caseData.getDefenceAdmitPartPaymentTimeRouteRequired();
+ RepaymentPlanLRspec defendantRepaymentPlan = caseData.getRespondent1RepaymentPlan();
+ return respondentResponseType == BY_SET_DATE
+ ? caseData.getRespondToClaimAdmitPartLRspec().getWhenWillThisAmountBePaid() : defendantRepaymentPlan.finalPaymentBy(
+ claimTotalAmount);
+ }
+
+ private RepaymentDecisionType calculateDecisionBasedOnAmountAndDisposableIncome(double totalAmount, double disposableIncome) {
+ if (totalAmount > disposableIncome) {
+ return RepaymentDecisionType.IN_FAVOUR_OF_DEFENDANT;
+ }
+ return RepaymentDecisionType.IN_FAVOUR_OF_CLAIMANT;
+ }
+
+ private RepaymentDecisionType calculateDecisionBasedOnProposedDate(LocalDate defendantProposedDate, LocalDate claimantProposedDate) {
+ if (claimantProposedDate.isAfter(defendantProposedDate)) {
+ return RepaymentDecisionType.IN_FAVOUR_OF_CLAIMANT;
+ }
+ return RepaymentDecisionType.IN_FAVOUR_OF_DEFENDANT;
+ }
+
+ private double calculateDisposableIncome(CaseData caseData) {
+ double calculatedIncome = incomeCalculator.calculateTotalMonthlyIncome(
+ caseData.getRespondent1DQ().getRespondent1BankAccountList(),
+ caseData.getRecurringIncomeForRespondent1(),
+ caseData.getSpecDefendant1SelfEmploymentDetails()
+ );
+ double calculatedExpenditure = expenditureCalculator.calculateTotalExpenditure(
+ caseData.getRecurringExpensesForRespondent1(),
+ caseData.getSpecDefendant1Debts(),
+ caseData.getRespondent1CourtOrderDetails()
+ );
+ double calculatedAllowance = allowanceCalculator.calculateAllowance(caseData);
+ return calculatedIncome - calculatedExpenditure - calculatedAllowance;
+ }
+
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/RepaymentPlanDecisionService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/RepaymentPlanDecisionService.java
new file mode 100644
index 00000000000..e279e33b039
--- /dev/null
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/citizen/repaymentplan/RepaymentPlanDecisionService.java
@@ -0,0 +1,22 @@
+package uk.gov.hmcts.reform.civil.service.citizen.repaymentplan;
+
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import uk.gov.hmcts.reform.ccd.client.model.CaseDetails;
+import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter;
+import uk.gov.hmcts.reform.civil.model.CaseData;
+import uk.gov.hmcts.reform.civil.model.citizenui.dto.RepaymentDecisionType;
+import uk.gov.hmcts.reform.civil.model.repaymentplan.ClaimantProposedPlan;
+
+@Service
+@RequiredArgsConstructor
+public class RepaymentPlanDecisionService {
+
+ private final CaseDetailsConverter caseDetailsConverter;
+ private final RepaymentPlanDecisionCalculator repaymentPlanDecisionCalculator;
+
+ public RepaymentDecisionType getCalculatedDecision(final CaseDetails caseDetails, final ClaimantProposedPlan claimantProposedPlan) {
+ CaseData caseData = caseDetailsConverter.toCaseData(caseDetails);
+ return repaymentPlanDecisionCalculator.calculateRepaymentDecision(caseData, claimantProposedPlan);
+ }
+}
diff --git a/src/main/java/uk/gov/hmcts/reform/civil/service/citizenui/DashboardClaimInfoService.java b/src/main/java/uk/gov/hmcts/reform/civil/service/citizenui/DashboardClaimInfoService.java
index 9c27668ad36..058ab6c0eb8 100644
--- a/src/main/java/uk/gov/hmcts/reform/civil/service/citizenui/DashboardClaimInfoService.java
+++ b/src/main/java/uk/gov/hmcts/reform/civil/service/citizenui/DashboardClaimInfoService.java
@@ -12,6 +12,7 @@
import uk.gov.hmcts.reform.civil.model.citizenui.DashboardClaimStatusFactory;
import uk.gov.hmcts.reform.civil.model.citizenui.DashboardResponse;
import uk.gov.hmcts.reform.civil.service.CoreCaseDataService;
+import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
import uk.gov.hmcts.reform.civil.service.claimstore.ClaimStoreService;
import java.time.LocalDateTime;
@@ -20,6 +21,7 @@
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
+import java.util.Optional;
import java.util.stream.Collectors;
import static java.util.Objects.nonNull;
@@ -29,17 +31,13 @@
@RequiredArgsConstructor
public class DashboardClaimInfoService {
+ private static final int CASES_PER_PAGE = 10;
+
+ private final CaseDetailsConverter caseDetailsConverter;
private final ClaimStoreService claimStoreService;
private final CoreCaseDataService coreCaseDataService;
- private final CaseDetailsConverter caseDetailsConverter;
private final DashboardClaimStatusFactory dashboardClaimStatusFactory;
- private static final int CASES_PER_PAGE = 10;
-
- private List getClaimsForClaimant(String authorisation, String claimantId) {
- log.info("-----------calling ocmc claimant claims-------------");
- List ocmcClaims = claimStoreService.getClaimsForClaimant(authorisation, claimantId);
- return ocmcClaims;
- }
+ private final FeatureToggleService featureToggleService;
public List getOcmcDefendantClaims(String authorisation, String defendantId) {
log.info("-----------calling ocmc getOCMCDefendantClaims()-------------");
@@ -63,22 +61,35 @@ public DashboardResponse getDashboardDefendantResponse(String authorisation, Str
public DashboardResponse getDashboardClaimantResponse(String authorisation, String claimantId, int currentPage) {
List ocmcClaims = getClaimsForClaimant(authorisation, claimantId);
+
int startIndex = (currentPage - 1) * CASES_PER_PAGE;
- var ccdData = coreCaseDataService.getCCDClaimsForLipClaimant(authorisation, startIndex);
- int totalPages = getTotalPagesToBeListed(ccdData.getTotal() + ocmcClaims.size());
+ SearchResult ccdData = null;
+
+ if (featureToggleService.isLipVLipEnabled()) {
+ ccdData = coreCaseDataService.getCCDClaimsForLipClaimant(authorisation, startIndex);
+ }
+
+ int totalPages = getTotalPagesToBeListed(getCcdClaimsCount(ccdData) + ocmcClaims.size());
List currentPageItems = currentPage <= totalPages
? getDashboardItemsForCurrentPage(ocmcClaims, currentPage, ccdData) :
Collections.emptyList();
return DashboardResponse.builder().totalPages(totalPages).claims(currentPageItems).build();
}
+ private List getClaimsForClaimant(String authorisation, String claimantId) {
+ log.info("-----------calling ocmc claimant claims-------------");
+ List ocmcClaims = claimStoreService.getClaimsForClaimant(authorisation, claimantId);
+ return ocmcClaims;
+ }
+
private List getDashboardItemsForCurrentPage(List