Skip to content

Commit

Permalink
Merge branch 'master' into feat/CIV-16608
Browse files Browse the repository at this point in the history
  • Loading branch information
kalachandrasekar1 committed Feb 28, 2025
2 parents 7256271 + 969ef1a commit 991bddc
Show file tree
Hide file tree
Showing 9 changed files with 280 additions and 242 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def versions = [
jackson : '2.18.2',
testcontainers : '1.20.3',
pdfbox : '3.0.2',
tika : '2.9.2'
tika : '2.9.3'
]

allprojects {
Expand Down
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 @@ -168,7 +168,7 @@ private boolean isApplicantLip(CaseData caseData) {
}

private String getRecipient(CaseData caseData, boolean isApplicantLip) {
return isApplicantLip ? caseData.getClaimantUserDetails().getEmail()
return isApplicantLip ? caseData.getApplicant1().getPartyEmail()
: caseData.getApplicantSolicitor1UserDetails().getEmail();
}

Expand Down
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
Loading

0 comments on commit 991bddc

Please sign in to comment.