Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIV-16288 Implement email notifications #6201

Merged
merged 23 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
85e0f90
add login new template
LeonardoPalmeiro Feb 17, 2025
e697cf2
add PARTY_REFERENCES
LeonardoPalmeiro Feb 18, 2025
7b1364a
add unit tests
LeonardoPalmeiro Feb 18, 2025
2e72035
Merge branch 'master' into feature/CIV-16255-Claimant-is-not-proceeding
LeonardoPalmeiro Feb 18, 2025
700d2c1
add the new code
LeonardoPalmeiro Feb 18, 2025
a76c190
fix unit test
LeonardoPalmeiro Feb 19, 2025
2daa214
fix checkStyle
LeonardoPalmeiro Feb 19, 2025
a3ec2af
fix unit test
LeonardoPalmeiro Feb 19, 2025
184663c
Merge branch 'master' into feature/CIV-16255-Claimant-is-not-proceeding
LeonardoPalmeiro Feb 19, 2025
cb0459a
Merge branch 'master' into feature/CIV-16255-Claimant-is-not-proceeding
LeonardoPalmeiro Feb 20, 2025
1458aee
Merge branch 'master' into feature/CIV-16255-Claimant-is-not-proceeding
LeonardoPalmeiro Feb 20, 2025
e37b127
fix the FULL_DEFENCE issue.
LeonardoPalmeiro Feb 21, 2025
c5513a2
fix the FULL_DEFENCE issue.
LeonardoPalmeiro Feb 21, 2025
ede9b4c
fix checkstyle
LeonardoPalmeiro Feb 21, 2025
5ce05f1
fix issue on preview
LeonardoPalmeiro Feb 24, 2025
ebef34f
Merge branch 'master' into feature/CIV-16255-Claimant-is-not-proceeding
LeonardoPalmeiro Feb 24, 2025
355af5c
fix checkstyle
LeonardoPalmeiro Feb 24, 2025
715218e
add unit test
LeonardoPalmeiro Feb 24, 2025
a866d98
CIV-16288 Implement email notifications
paul-pearson Feb 25, 2025
20c0255
CIV-16288 Remove unused import
paul-pearson Feb 25, 2025
b416bd6
Merge branch 'master' into CIV-16288-3
paul-pearson Feb 25, 2025
9ca22a6
CIV-16288 Fix states paid scenario
paul-pearson Feb 25, 2025
6e2a220
CIV-16288 Remove unused import
paul-pearson Feb 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,23 @@
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.YesOrNo;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.notify.NotificationService;
import uk.gov.hmcts.reform.civil.notify.NotificationsProperties;
import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
import uk.gov.hmcts.reform.civil.service.OrganisationService;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.NOTIFY_LIP_RESPONDENT_CLAIMANT_CONFIRM_TO_PROCEED;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.NOTIFY_LIP_RESPONDENT_CLAIMANT_CONFIRM_TO_PROCEED_TRANSLATED_DOC;
import static uk.gov.hmcts.reform.civil.constants.SpecJourneyConstantLRSpec.HAS_PAID_THE_AMOUNT_CLAIMED;
import static uk.gov.hmcts.reform.civil.enums.RespondentResponseTypeSpec.FULL_DEFENCE;
import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO;
import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES;
import static uk.gov.hmcts.reform.civil.utils.NotificationUtils.buildPartiesReferencesEmailSubject;
import static uk.gov.hmcts.reform.civil.utils.NotificationUtils.getRespondentLegalOrganizationName;
import static uk.gov.hmcts.reform.civil.utils.NotificationUtils.shouldSendMediationNotificationDefendant1LRCarm;
Expand Down Expand Up @@ -54,7 +56,7 @@ private CallbackResponse notifyRespondentForClaimantConfirmsToProceed(CallbackPa
boolean shouldSendEmailToDefendantLR = shouldSendMediationNotificationDefendant1LRCarm(caseData, carmEnabled);
if (shouldSendNotification(caseData, callbackParams.getRequest().getEventId())) {
notificationService.sendMail(
shouldSendEmailToDefendantLR || isIntermediateOrMultiClaimProceedForLipVsLR(caseData)
shouldSendEmailToDefendantLR || isClaimProceedForLipVsLR(caseData) || isClaimantNotProceedLipVsLRWithNoc(caseData)
? caseData.getRespondentSolicitor1EmailAddress() : caseData.getRespondent1().getPartyEmail(),
getEmailTemplate(caseData, shouldSendEmailToDefendantLR),
addProperties(caseData),
Expand All @@ -65,8 +67,13 @@ private CallbackResponse notifyRespondentForClaimantConfirmsToProceed(CallbackPa
}

private String getEmailTemplate(CaseData caseData, boolean shouldSendEmailToDefendantLR) {
if (isIntermediateOrMultiClaimProceedForLipVsLR(caseData)) {
return notificationsProperties.getRespondentSolicitorNotifyToProceedSpecWithAction();
if (isClaimProceedForLipVsLR(caseData)) {
return caseData.isSmallClaim()
? notificationsProperties.getRespondentSolicitorNotifyToProceedInMediation()
: notificationsProperties.getRespondentSolicitorNotifyToProceedSpecWithAction();
}
if (isClaimantNotProceedLipVsLRWithNoc(caseData)) {
return notificationsProperties.getRespondentSolicitorNotifyNotToProceedSpec();
}
if (shouldSendEmailToDefendantLR) {
return notificationsProperties.getNotifyDefendantLRForMediation();
Expand Down Expand Up @@ -103,7 +110,7 @@ public List<CaseEvent> handledEvents() {
@Override
public Map<String, String> addProperties(CaseData caseData) {

if (isIntermediateOrMultiClaimProceedForLipVsLR(caseData)) {
if (isClaimProceedForLipVsLR(caseData)) {
return Map.of(PARTY_REFERENCES, buildPartiesReferencesEmailSubject(caseData),
CLAIM_REFERENCE_NUMBER,
caseData.getCcdCaseReference().toString(),
Expand All @@ -112,7 +119,19 @@ public Map<String, String> addProperties(CaseData caseData) {
caseData.getRespondent1OrganisationPolicy(),
organisationService
),
APPLICANT_ONE_NAME, getPartyNameBasedOnType(caseData.getApplicant1())
APPLICANT_ONE_NAME, getPartyNameBasedOnType(caseData.getApplicant1()),
CASEMAN_REF, caseData.getLegacyCaseReference()
);
}
if (isClaimantNotProceedLipVsLRWithNoc(caseData)) {
return Map.of(PARTY_REFERENCES, buildPartiesReferencesEmailSubject(caseData),
CLAIM_REFERENCE_NUMBER,
caseData.getCcdCaseReference().toString(),
CLAIM_LEGAL_ORG_NAME_SPEC,
getRespondentLegalOrganizationName(
caseData.getRespondent1OrganisationPolicy(),
organisationService
)
);
}
if (shouldSendMediationNotificationDefendant1LRCarm(
Expand All @@ -123,7 +142,13 @@ APPLICANT_ONE_NAME, getPartyNameBasedOnType(caseData.getApplicant1())
CLAIM_REFERENCE_NUMBER,
caseData.getCcdCaseReference().toString(),
CLAIM_LEGAL_ORG_NAME_SPEC,
getRespondentLegalOrganizationName(caseData.getRespondent1OrganisationPolicy(), organisationService)
getRespondentLegalOrganizationName(caseData.getRespondent1OrganisationPolicy(), organisationService),
APPLICANT_ONE_NAME,
getPartyNameBasedOnType(caseData.getApplicant1()),
CASEMAN_REF,
caseData.getLegacyCaseReference(),
PARTY_REFERENCES,
buildPartiesReferencesEmailSubject(caseData)
);
}
return Map.of(
Expand All @@ -132,12 +157,24 @@ RESPONDENT_NAME, getPartyNameBasedOnType(caseData.getRespondent1())
);
}

private boolean isIntermediateOrMultiClaimProceedForLipVsLR(CaseData caseData) {
List<String> responseClaimTrack = Arrays.asList("INTERMEDIATE_CLAIM", "MULTI_CLAIM");
return responseClaimTrack.contains(caseData.getResponseClaimTrack())
&& caseData.isLipvLROneVOne()
&& caseData.getApplicant1ProceedWithClaim().equals(
YesOrNo.YES)
private boolean isFullDefenceStatesPaid(CaseData caseData) {
return HAS_PAID_THE_AMOUNT_CLAIMED.equals(caseData.getDefenceRouteRequired())
&& FULL_DEFENCE.equals(caseData.getRespondent1ClaimResponseTypeForSpec());
}

private boolean isClaimProceedForLipVsLR(CaseData caseData) {
return caseData.isLipvLROneVOne()
&& ((isFullDefenceStatesPaid(caseData) && NO.equals(caseData.getCaseDataLiP().getApplicant1SettleClaim()))
|| YES.equals(caseData.getApplicant1ProceedWithClaim()))
&& featureToggleService.isDefendantNoCOnlineForCase(caseData);
}

private boolean isClaimantNotProceedLipVsLRWithNoc(CaseData caseData) {
return caseData.isLipvLROneVOne()
&& (
(isFullDefenceStatesPaid(caseData) && YES.equals(caseData.getCaseDataLiP().getApplicant1SettleClaim()))
|| NO.equals(caseData.getApplicant1ProceedWithClaim()))
&& featureToggleService.isDefendantNoCOnlineForCase(caseData);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ public class NotificationsProperties {
@NotEmpty
private String respondentSolicitorNotifyToProceedSpecWithAction;

@NotEmpty
private String respondentSolicitorNotifyToProceedInMediation;

@NotEmpty
private String applicantSolicitor1DefaultJudgmentReceived;

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ notifications:
respondentSolicitorNotifyToProceedSpec: "3ff54f97-76de-47a1-a381-680e2830fba8"
claimantSolicitorConfirmsToProceedSpecWithAction: "5d20822e-3a92-458d-94aa-2e989e192c7e"
respondentSolicitorNotifyToProceedSpecWithAction: "78856c57-8f78-4d5e-9abe-66f6cb0f07d6"
respondentSolicitorNotifyToProceedInMediation: "e231e271-93b9-49e8-99d3-5b3ceac4b3af"
applicantSolicitor1DefaultJudgmentReceived: "bceecea2-b70e-4288-be31-0a4203b31f3e"
claimantSolicitorCounterClaimForSpec: "082c6017-9bcf-4227-bc0a-bcfec2b8ebf4"
respondentSolicitorCounterClaimForSpec: "cb31a195-2a9f-4229-9abf-7f4935260ee1"
Expand Down
Loading