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-14056 Send Respondent notify when Judge Uncloaks #1374

Merged
merged 31 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0b3dc35
CIV-14060 notify app to pay additional fee uncloak
pliao-hmcts Jun 7, 2024
3160849
Merge branch 'master' into feat/CIV-14060
pliao-hmcts Jun 11, 2024
3e07b93
Merge branch 'master' into feat/CIV-14060
rajakm Jun 17, 2024
77587db
CIV-14056 Send Respondent notify when Judge Uncloaks
karthick-mohanasundaram-HMCTS Jun 26, 2024
3c56a97
Merge branch 'master' into feat/CIV-14056
karthick-mohanasundaram-HMCTS Jul 1, 2024
c78399e
CIV-14056 Populate data for caseTitle mapping
karthick-mohanasundaram-HMCTS Jul 1, 2024
ce2b06b
Merge branch 'master' into feat/CIV-14056
karthick-mohanasundaram-HMCTS Jul 1, 2024
0b75f0e
Revert temp log
karthick-mohanasundaram-HMCTS Jul 2, 2024
addb487
update featuretoggle revert
karthick-mohanasundaram-HMCTS Jul 2, 2024
15ab6c9
add template log
karthick-mohanasundaram-HMCTS Jul 2, 2024
0c07805
Merge branch 'master' into feat/CIV-14056
karthick-mohanasundaram-HMCTS Jul 3, 2024
b0c1de2
CIV-14056 Revert Logs statement
karthick-mohanasundaram-HMCTS Jul 4, 2024
4a70666
CIV-14056 email notification template lip
karthick-mohanasundaram-HMCTS Jul 9, 2024
25f74e1
Merge branch 'master' into feat/CIV-14056
karthick-mohanasundaram-HMCTS Jul 9, 2024
8149483
CIV-14056 Lip Email notification
karthick-mohanasundaram-HMCTS Jul 10, 2024
c67be7a
remove comment
karthick-mohanasundaram-HMCTS Jul 10, 2024
0b9032a
Fix sonar
karthick-mohanasundaram-HMCTS Jul 10, 2024
2eadbbe
Add log
karthick-mohanasundaram-HMCTS Jul 10, 2024
03f1bc6
remove unused variable
karthick-mohanasundaram-HMCTS Jul 10, 2024
46f3d56
Fix sonar duplication code block
karthick-mohanasundaram-HMCTS Jul 10, 2024
83c0cee
fix sonar issue
karthick-mohanasundaram-HMCTS Jul 10, 2024
9fcc68c
update docuploadnotificationservice
karthick-mohanasundaram-HMCTS Jul 10, 2024
220358a
update condition
karthick-mohanasundaram-HMCTS Jul 10, 2024
1052aac
Fix addln payment
karthick-mohanasundaram-HMCTS Jul 11, 2024
d1afe0e
Merge branch 'master' into feat/CIV-14056
manish14836 Jul 11, 2024
fc4b044
Update JudicialNotificationService
karthick-mohanasundaram-HMCTS Jul 13, 2024
d16ffe1
Merge branch 'feat/CIV-14056' of https://github.com/hmcts/civil-gener…
karthick-mohanasundaram-HMCTS Jul 13, 2024
44b6141
Merge branch 'master' into feat/CIV-14056
karthick-mohanasundaram-HMCTS Jul 13, 2024
d502a06
update judicial notificaiton service
karthick-mohanasundaram-HMCTS Jul 13, 2024
5613412
CIV-14056 Change to respondent name
karthick-mohanasundaram-HMCTS Jul 16, 2024
b1ca41c
Revert launchdarkly key
karthick-mohanasundaram-HMCTS Jul 22, 2024
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 @@ -20,6 +20,9 @@ public class NotificationsProperties {
@NotEmpty
private String lipGeneralAppRespondentEmailTemplate;

@NotEmpty
private String lipGeneralAppApplicantEmailTemplate;

@NotEmpty
private String withNoticeUpdateRespondentEmailTemplate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public List<CaseEvent> handledEvents() {

private CallbackResponse judicialDecisionNotification(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData();

try {
caseData = judicialNotificationService.sendNotification(caseData, SOLICITOR_TYPE);
} catch (NotificationException notificationException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public interface NotificationData {
String GA_REQUEST_FOR_INFORMATION_DEADLINE = "requestForInformationDeadline";
String GA_HEARING_DATE = "hearingDate";
String GA_HEARING_TIME = "hearingTime";
String GA_LIP_APPLICANT_NAME = "applicantName";
String GA_LIP_RESP_NAME = "respondentName";
String CASE_TITLE = "ClaimantvDefendant";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,32 @@
import uk.gov.hmcts.reform.civil.model.CaseData;

import java.util.Map;
import java.util.Objects;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import static java.lang.String.format;
import static java.util.Objects.nonNull;
import static uk.gov.hmcts.reform.civil.enums.YesOrNo.NO;

@Service
@RequiredArgsConstructor
public class DocUploadNotificationService implements NotificationData {

private final NotificationService notificationService;
private final NotificationsProperties notificationProperties;
private static final String REFERENCE_TEMPLATE_DOC_UPLOAD = "general-apps-notice-of-document-upload-%s";
private final GaForLipService gaForLipService;
private final Map<String, String> customProps;

public void notifyApplicantEvidenceUpload(CaseData caseData) throws NotificationException {
String email = caseData.getGeneralAppApplnSolicitor().getEmail();
if (null != email) {
notificationService.sendMail(
email,
notificationProperties.getEvidenceUploadTemplate(),
gaForLipService.isLipApp(caseData) ? notificationProperties.getLipGeneralAppApplicantEmailTemplate()
: notificationProperties.getEvidenceUploadTemplate(),
addProperties(caseData),
String.format(
REFERENCE_TEMPLATE_DOC_UPLOAD,
Expand All @@ -37,7 +45,9 @@ public void notifyRespondentEvidenceUpload(CaseData caseData) throws Notificatio
respondentSolicitor -> {
notificationService.sendMail(
respondentSolicitor.getValue().getEmail(),
notificationProperties.getEvidenceUploadTemplate(),
gaForLipService.isLipResp(caseData)
? notificationProperties.getLipGeneralAppRespondentEmailTemplate()
: notificationProperties.getEvidenceUploadTemplate(),
addProperties(caseData),
String.format(
REFERENCE_TEMPLATE_DOC_UPLOAD,
Expand All @@ -49,8 +59,52 @@ public void notifyRespondentEvidenceUpload(CaseData caseData) throws Notificatio

@Override
public Map<String, String> addProperties(CaseData caseData) {
return Map.of(
CASE_REFERENCE, caseData.getCcdCaseReference().toString()
);

if (gaForLipService.isGaForLip(caseData)) {
String caseTitle = getAllPartyNames(caseData);
customProps.put(
CASE_TITLE,
Objects.requireNonNull(caseTitle)
);
}
if (gaForLipService.isLipApp(caseData)) {
String isLipAppName = caseData.getApplicantPartyName();

customProps.put(GA_LIP_APPLICANT_NAME, Objects.requireNonNull(isLipAppName));

} else if (gaForLipService.isLipResp(caseData)) {

String isLipRespondentName = caseData.getDefendant1PartyName();
customProps.put(
GA_LIP_RESP_NAME,
Objects.requireNonNull(isLipRespondentName)
);
} else {
customProps.remove(GA_LIP_APPLICANT_NAME);
customProps.remove(GA_LIP_RESP_NAME);
customProps.remove(CASE_TITLE);
}

customProps.put(CASE_REFERENCE, caseData.getCcdCaseReference().toString());
return customProps;
}

public static String getAllPartyNames(CaseData caseData) {
return format("%s v %s%s",
caseData.getClaimant1PartyName(),
caseData.getDefendant1PartyName(),
nonNull(caseData.getDefendant2PartyName())
&& (NO.equals(caseData.getRespondent2SameLegalRepresentative())
|| Objects.isNull(caseData.getRespondent2SameLegalRepresentative()))
? ", " + caseData.getDefendant2PartyName() : "");
}

public String getSurname(CaseData caseData) {
String surname = "";

if (caseData.getGeneralAppRespondentSolicitors().get(0).getValue().getSurname().isPresent()) {
surname = caseData.getGeneralAppRespondentSolicitors().get(0).getValue().getSurname().orElse("");
}
return surname;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

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

import static uk.gov.hmcts.reform.civil.enums.YesOrNo.YES;
import static uk.gov.hmcts.reform.civil.helpers.DateFormatHelper.DATE;
Expand Down Expand Up @@ -121,21 +122,21 @@ private void sendNotificationToGeneralAppRespondent(CaseData caseData, String re
@Override
public Map<String, String> addProperties(CaseData caseData) {
String lipRespName = "";
String caseTitle = "";
if (gaForLipService.isLipResp(caseData)) {
lipRespName = caseData
.getGeneralAppRespondentSolicitors().get(0).getValue().getForename()
+ " " + caseData
.getGeneralAppRespondentSolicitors().get(0).getValue().getSurname().orElse("");

lipRespName = caseData.getDefendant1PartyName();
caseTitle = JudicialFinalDecisionHandler.getAllPartyNames(caseData);

}
String caseTitle = JudicialFinalDecisionHandler.getAllPartyNames(caseData);
return Map.of(
APPLICANT_REFERENCE, YES.equals(caseData.getParentClaimantIsApplicant()) ? "claimant" : "respondent",
CASE_REFERENCE, caseData.getGeneralAppParentCaseLink().getCaseReference(),
GA_NOTIFICATION_DEADLINE, DateFormatHelper
.formatLocalDateTime(caseData
.getGeneralAppNotificationDeadlineDate(), DATE),
GA_LIP_RESP_NAME, lipRespName,
CASE_TITLE, caseTitle
CASE_TITLE, Objects.requireNonNull(caseTitle)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.springframework.stereotype.Service;
import uk.gov.hmcts.reform.civil.config.properties.notification.NotificationsProperties;
import uk.gov.hmcts.reform.civil.handler.callback.camunda.notification.NotificationData;
import uk.gov.hmcts.reform.civil.handler.callback.user.JudicialFinalDecisionHandler;
import uk.gov.hmcts.reform.civil.helpers.CaseDetailsConverter;
import uk.gov.hmcts.reform.civil.helpers.DateFormatHelper;
import uk.gov.hmcts.reform.civil.model.CaseData;
Expand All @@ -14,6 +15,7 @@
import java.time.LocalTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import static uk.gov.hmcts.reform.civil.helpers.DateFormatHelper.DATE;

Expand All @@ -27,6 +29,8 @@ public class HearingScheduledNotificationService implements NotificationData {
private final NotificationsProperties notificationProperties;
private final SolicitorEmailValidation solicitorEmailValidation;
private final CoreCaseDataService coreCaseDataService;
private final Map<String, String> customProps;
private final GaForLipService gaForLipService;
private static final String REFERENCE_TEMPLATE_HEARING = "general-apps-notice-of-hearing-%s";

@Override
Expand All @@ -35,19 +39,42 @@ public Map<String, String> addProperties(CaseData caseData) {
int hours = Integer.parseInt(hourMinute.substring(0, 2));
int minutes = Integer.parseInt(hourMinute.substring(2, 4));
LocalTime hearingTime = LocalTime.of(hours, minutes, 0);
return Map.of(
CASE_REFERENCE, caseData.getGeneralAppParentCaseLink().getCaseReference(),
GA_HEARING_DATE, DateFormatHelper.formatLocalDate(
caseData.getGaHearingNoticeDetail().getHearingDate(),
DATE
),
GA_HEARING_TIME, hearingTime.toString()
);

customProps.put(CASE_REFERENCE, caseData.getGeneralAppParentCaseLink().getCaseReference());
customProps.put(GA_HEARING_DATE, DateFormatHelper
.formatLocalDate(caseData.getGaHearingNoticeDetail().getHearingDate(), DATE));
customProps.put(GA_HEARING_TIME, hearingTime.toString());

if (gaForLipService.isLipApp(caseData)) {
String isLipAppName = caseData.getApplicantPartyName();
customProps.put(
GA_LIP_APPLICANT_NAME,
Objects.requireNonNull(isLipAppName)
);
customProps.remove(GA_LIP_RESP_NAME);
}

if (gaForLipService.isLipResp(caseData)) {
String isLipRespondentName = caseData.getDefendant1PartyName();
customProps.remove(GA_LIP_APPLICANT_NAME);
customProps.put(GA_LIP_RESP_NAME, Objects.requireNonNull(isLipRespondentName));
}

if (gaForLipService.isGaForLip(caseData)) {
customProps.put(CASE_TITLE, Objects.requireNonNull(JudicialFinalDecisionHandler
.getAllPartyNames(caseData)));
} else {
customProps.remove(CASE_TITLE);
customProps.remove(GA_LIP_APPLICANT_NAME);
customProps.remove(GA_LIP_RESP_NAME);
}

return customProps;
}

private void sendNotification(CaseData caseData, String recipient) throws NotificationException {
private void sendNotification(CaseData caseData, String recipient, String template) throws NotificationException {
try {
notificationService.sendMail(recipient, notificationProperties.getHearingNoticeTemplate(),
notificationService.sendMail(recipient, template,
addProperties(caseData),
String.format(REFERENCE_TEMPLATE_HEARING,
caseData.getGeneralAppParentCaseLink().getCaseReference()));
Expand All @@ -64,7 +91,10 @@ public CaseData sendNotificationForClaimant(CaseData caseData) throws Notificati

caseData = solicitorEmailValidation.validateSolicitorEmail(civilCaseData, caseData);

sendNotification(caseData, caseData.getGeneralAppApplnSolicitor().getEmail());
sendNotification(caseData, caseData.getGeneralAppApplnSolicitor().getEmail(),
gaForLipService.isLipApp(caseData)
? notificationProperties.getLipGeneralAppApplicantEmailTemplate()
: notificationProperties.getHearingNoticeTemplate());

return caseData;
}
Expand All @@ -82,7 +112,9 @@ public CaseData sendNotificationForDefendant(CaseData caseData) throws Notificat
CaseData updatedCaseData = caseData;
respondentSolicitor.forEach((respondent) -> sendNotification(
updatedCaseData,
respondent.getValue().getEmail()));
respondent.getValue().getEmail(), gaForLipService.isLipResp(updatedCaseData)
? notificationProperties.getLipGeneralAppRespondentEmailTemplate()
: notificationProperties.getHearingNoticeTemplate()));

return caseData;
}
Expand Down
Loading
Loading