-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/CIV-10568
- Loading branch information
Showing
37 changed files
with
903 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...unda/notification/ClaimantLipRequestJudgementByAdmissionApplicantNotificationHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package uk.gov.hmcts.reform.civil.handler.callback.camunda.notification; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
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.config.PinInPostConfiguration; | ||
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 java.util.List; | ||
import java.util.Map; | ||
|
||
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT; | ||
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.NOTIFY_APPLICANT1_FOR_REQUEST_JUDGEMENT_BY_ADMISSION_LIP_CLAIMANT; | ||
import static uk.gov.hmcts.reform.civil.utils.PartyUtils.getPartyNameBasedOnType; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ClaimantLipRequestJudgementByAdmissionApplicantNotificationHandler extends CallbackHandler implements NotificationData { | ||
|
||
private static final List<CaseEvent> EVENTS = List.of( | ||
NOTIFY_APPLICANT1_FOR_REQUEST_JUDGEMENT_BY_ADMISSION_LIP_CLAIMANT); | ||
public static final String TASK_ID = "RequestJudgementByAdmissionLipClaimantNotifyRespondent1"; | ||
private static final String REFERENCE_TEMPLATE = "request-judgement-by-admission-applicant-notification-%s"; | ||
|
||
private final NotificationService notificationService; | ||
private final NotificationsProperties notificationsProperties; | ||
private final PinInPostConfiguration pipInPostConfiguration; | ||
|
||
@Override | ||
protected Map<String, Callback> callbacks() { | ||
return Map.of( | ||
callbackKey(ABOUT_TO_SUBMIT), | ||
this::notifyApplicant1ForRequestJudgementByAdmission | ||
); | ||
} | ||
|
||
@Override | ||
public String camundaActivityId(CallbackParams callbackParams) { | ||
return TASK_ID; | ||
} | ||
|
||
@Override | ||
public List<CaseEvent> handledEvents() { | ||
return EVENTS; | ||
} | ||
|
||
private CallbackResponse notifyApplicant1ForRequestJudgementByAdmission(CallbackParams callbackParams) { | ||
CaseData caseData = callbackParams.getCaseData(); | ||
|
||
if (!caseData.isLipvLipOneVOne() || caseData.getApplicant1Email() == null) { | ||
return AboutToStartOrSubmitCallbackResponse.builder().build(); | ||
} | ||
|
||
notificationService.sendMail( | ||
addEmail(caseData), | ||
notificationsProperties.getNotifyApplicantLipRequestJudgementByAdmissionNotificationTemplate(), | ||
addProperties(caseData), | ||
String.format(REFERENCE_TEMPLATE, caseData.getLegacyCaseReference()) | ||
); | ||
return AboutToStartOrSubmitCallbackResponse.builder().build(); | ||
} | ||
|
||
@Override | ||
public Map<String, String> addProperties(CaseData caseData) { | ||
return Map.of( | ||
CLAIMANT_NAME, getPartyNameBasedOnType(caseData.getApplicant1()), | ||
RESPONDENT_NAME, getPartyNameBasedOnType(caseData.getRespondent1()), | ||
CLAIM_REFERENCE_NUMBER, caseData.getLegacyCaseReference(), | ||
FRONTEND_URL, pipInPostConfiguration.getCuiFrontEndUrl() | ||
); | ||
} | ||
|
||
private String addEmail(CaseData caseData) { | ||
return caseData.getApplicant1Email(); | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
...nda/notification/ClaimantLipRequestJudgementByAdmissionRespondentNotificationHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package uk.gov.hmcts.reform.civil.handler.callback.camunda.notification; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
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.config.PinInPostConfiguration; | ||
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 java.util.List; | ||
import java.util.Map; | ||
|
||
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT; | ||
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.NOTIFY_RESPONDENT1_FOR_REQUEST_JUDGEMENT_BY_ADMISSION_LIP_CLAIMANT; | ||
import static uk.gov.hmcts.reform.civil.utils.PartyUtils.getPartyNameBasedOnType; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ClaimantLipRequestJudgementByAdmissionRespondentNotificationHandler extends CallbackHandler implements NotificationData { | ||
|
||
private static final List<CaseEvent> EVENTS = List.of( | ||
NOTIFY_RESPONDENT1_FOR_REQUEST_JUDGEMENT_BY_ADMISSION_LIP_CLAIMANT); | ||
public static final String TASK_ID = "RequestJudgementByAdmissionLipClaimantNotifyRespondent1"; | ||
private static final String REFERENCE_TEMPLATE = "request-judgement-by-admission-respondent-notification-%s"; | ||
|
||
private final NotificationService notificationService; | ||
private final NotificationsProperties notificationsProperties; | ||
private final PinInPostConfiguration pipInPostConfiguration; | ||
|
||
@Override | ||
protected Map<String, Callback> callbacks() { | ||
return Map.of( | ||
callbackKey(ABOUT_TO_SUBMIT), | ||
this::notifyRespondent1ForRequestJudgementByAdmission | ||
); | ||
} | ||
|
||
@Override | ||
public String camundaActivityId(CallbackParams callbackParams) { | ||
return TASK_ID; | ||
} | ||
|
||
@Override | ||
public List<CaseEvent> handledEvents() { | ||
return EVENTS; | ||
} | ||
|
||
private CallbackResponse notifyRespondent1ForRequestJudgementByAdmission(CallbackParams callbackParams) { | ||
CaseData caseData = callbackParams.getCaseData(); | ||
|
||
if (!caseData.isLipvLipOneVOne() || caseData.getRespondent1().getPartyEmail() == null) { | ||
return AboutToStartOrSubmitCallbackResponse.builder().build(); | ||
} | ||
|
||
notificationService.sendMail( | ||
addEmail(caseData), | ||
notificationsProperties.getNotifyRespondentLipRequestJudgementByAdmissionNotificationTemplate(), | ||
addProperties(caseData), | ||
String.format(REFERENCE_TEMPLATE, caseData.getLegacyCaseReference()) | ||
); | ||
return AboutToStartOrSubmitCallbackResponse.builder().build(); | ||
} | ||
|
||
@Override | ||
public Map<String, String> addProperties(CaseData caseData) { | ||
return Map.of( | ||
CLAIMANT_NAME, getPartyNameBasedOnType(caseData.getApplicant1()), | ||
RESPONDENT_NAME, getPartyNameBasedOnType(caseData.getRespondent1()), | ||
CLAIM_REFERENCE_NUMBER, caseData.getLegacyCaseReference(), | ||
FRONTEND_URL, pipInPostConfiguration.getCuiFrontEndUrl() | ||
); | ||
} | ||
|
||
private String addEmail(CaseData caseData) { | ||
return caseData.getRespondent1().getPartyEmail(); | ||
} | ||
} |
Oops, something went wrong.