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 11 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 @@ -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 @@ -32,7 +32,7 @@ public boolean isFeatureEnabled(String feature, LDUser user) {
}

public boolean isGaForLipsEnabled() {
return internalClient.boolVariation("GaForLips", createLDUser().build(), false);
karthick-mohanasundaram-HMCTS marked this conversation as resolved.
Show resolved Hide resolved
return internalClient.boolVariation("GaForLips", createLDUser().build(), true);
}

public boolean isOrganisationOnboarded(String orgId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package uk.gov.hmcts.reform.civil.service;

import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import uk.gov.hmcts.reform.civil.launchdarkly.FeatureToggleService;
import uk.gov.hmcts.reform.civil.model.CaseData;
Expand All @@ -13,6 +15,7 @@
@Service
public class GaForLipService {

private static final Logger log = LoggerFactory.getLogger(GaForLipService.class);
private final FeatureToggleService featureToggleService;

public boolean isGaForLip(CaseData caseData) {
Expand All @@ -32,6 +35,12 @@ public boolean isLipApp(CaseData caseData) {
}

public boolean isLipResp(CaseData caseData) {

log.info(" ****************************************************************** ");
log.info("-----feature Toggle caseData: {}", featureToggleService.isGaForLipsEnabled());
log.info("---------isGaRespondentOneLip nonnull: {}", Objects.nonNull(caseData.getIsGaRespondentOneLip()));
log.info("-------isGaRespondentOneLip: {}", caseData.getIsGaRespondentOneLip());
log.info(" ****************************************************************** ");
return featureToggleService.isGaForLipsEnabled()
&& Objects.nonNull(caseData.getIsGaRespondentOneLip())
&& caseData.getIsGaRespondentOneLip().equals(YES);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package uk.gov.hmcts.reform.civil.service;

import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import uk.gov.hmcts.reform.civil.config.properties.notification.NotificationsProperties;
import uk.gov.hmcts.reform.civil.enums.CaseState;
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.BusinessProcess;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.genapplication.GAJudicialRequestMoreInfo;

Expand Down Expand Up @@ -35,6 +38,7 @@ public class JudicialNotificationService implements NotificationData {

private static final String RESPONDENT = "respondent";
private static final String APPLICANT = "applicant";
private static final Logger log = LoggerFactory.getLogger(JudicialNotificationService.class);

private final NotificationsProperties notificationProperties;
private final NotificationService notificationService;
Expand Down Expand Up @@ -107,16 +111,31 @@ public Map<String, String> addProperties(CaseData caseData) {
GA_APPLICATION_TYPE,
Objects.requireNonNull(requiredGAType(caseData))
);

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

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

String isLipRespondentName = caseData
.getGeneralAppRespondentSolicitors().get(0).getValue().getForename()
+ " " + caseData
.getGeneralAppRespondentSolicitors().get(0).getValue().getSurname().orElse("");
customProps.put(
CASE_TITLE,
Objects.requireNonNull(caseTitle)
GA_LIP_RESP_NAME,
Objects.requireNonNull(isLipRespondentName)
);
} else {
customProps.remove(GA_LIP_RESP_NAME);
Expand All @@ -128,6 +147,8 @@ public Map<String, String> addProperties(CaseData caseData) {
private void sendNotificationForJudicialDecision(CaseData caseData, String recipient, String template)
throws NotificationException {
try {
log.info("JudicialNotificationService.class::sendNotificationForJudicialDecision::templateId: {}",
template);
notificationService.sendMail(recipient, template, addProperties(caseData),
String.format(REFERENCE_TEMPLATE,
caseData.getGeneralAppParentCaseLink().getCaseReference()));
Expand Down Expand Up @@ -222,9 +243,13 @@ private CaseData applicationRequestForInformation(CaseData caseData, String soli
.formatLocalDateTime(requestForInformationDeadline, DATE) : null);

if (areRespondentSolicitorsPresent(caseData)) {
String template = notificationProperties.getGeneralApplicationRespondentEmailTemplate();
if (gaForLipService.isLipResp(caseData)) {
template = notificationProperties.getLipGeneralAppRespondentEmailTemplate();
}
sendEmailToRespondent(
caseData,
notificationProperties.getGeneralApplicationRespondentEmailTemplate()
template
);
}
customProps.remove(GA_NOTIFICATION_DEADLINE);
Expand Down Expand Up @@ -309,6 +334,11 @@ private void applicationApprovedNotification(CaseData caseData, String solicitor
caseData,
notificationProperties.getJudgeApproveOrderToStrikeOutOCMC()
);
} else if (useGaForLipTemplate(caseData)) {
sendEmailToRespondent(
caseData,
notificationProperties.getLipGeneralAppRespondentEmailTemplate()
);
} else {
sendEmailToRespondent(
caseData,
Expand Down Expand Up @@ -376,9 +406,13 @@ private void applicationDismissedByJudge(CaseData caseData, String solicitorType

if (solicitorType.equals(RESPONDENT)
&& isSendEmailToDefendant(caseData)) {
String template = notificationProperties.getJudgeDismissesOrderRespondentEmailTemplate();
if (gaForLipService.isLipResp(caseData)) {
template = notificationProperties.getLipGeneralAppRespondentEmailTemplate();
}
sendEmailToRespondent(
caseData,
notificationProperties.getJudgeDismissesOrderRespondentEmailTemplate()
template
);
}

Expand All @@ -396,9 +430,13 @@ && isSendEmailToDefendant(caseData)) {
private void applicationDirectionOrder(CaseData caseData, String solicitorType) {
if (solicitorType.equals(RESPONDENT)
&& isSendEmailToDefendant(caseData)) {
String template = notificationProperties.getJudgeForDirectionOrderRespondentEmailTemplate();
if (gaForLipService.isLipResp(caseData)) {
template = notificationProperties.getLipGeneralAppRespondentEmailTemplate();
}
sendEmailToRespondent(
caseData,
notificationProperties.getJudgeForDirectionOrderRespondentEmailTemplate()
template
);
}

Expand Down Expand Up @@ -515,4 +553,20 @@ public static boolean useOcmcTemplate(CaseData caseData) {
&& caseData.getGeneralAppSuperClaimType().equals("SPEC_CLAIM");
}

public boolean useGaForLipTemplate(CaseData caseData) {
return gaForLipService.isLipResp(caseData);
}

private static boolean isRespondentNotificationMakeDecisionEvent(CaseData caseData) {
var judicialDecision = Optional.ofNullable(caseData.getBusinessProcess())
.map(BusinessProcess::getCamundaEvent).orElse(null);
// Case Event should be START_RESPONDENT_NOTIFICATION_PROCESS_MAKE_DECISION
return
Objects.nonNull(judicialDecision)
&& caseData.getBusinessProcess().getCamundaEvent()
.equals("MAKE_DECISION")
&& caseData.getBusinessProcess().getActivityId()
.equals("StartRespondentNotificationProcessMakeDecision");
}

}
Loading
Loading