-
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.
CIV-15230 LR notification stay update requested (#5621)
* CIV-15230 Notify LR stay update requested * CIV-15230 add template * CIV-15230 add abstract classes * CIV-15230 lint * CIV-15230 lint
- Loading branch information
1 parent
ac3c669
commit f89b908
Showing
14 changed files
with
434 additions
and
68 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
32 changes: 32 additions & 0 deletions
32
.../civil/handler/callback/camunda/notification/AbstractNotifyManageStayClaimantHandler.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,32 @@ | ||
package uk.gov.hmcts.reform.civil.handler.callback.camunda.notification; | ||
|
||
import uk.gov.hmcts.reform.civil.callback.CallbackParams; | ||
import uk.gov.hmcts.reform.civil.model.CaseData; | ||
import uk.gov.hmcts.reform.civil.notify.NotificationService; | ||
import uk.gov.hmcts.reform.civil.notify.NotificationsProperties; | ||
|
||
public abstract class AbstractNotifyManageStayClaimantHandler extends AbstractNotifyManageStayHandler { | ||
|
||
public AbstractNotifyManageStayClaimantHandler(NotificationService notificationService, NotificationsProperties notificationsProperties) { | ||
super(notificationService, notificationsProperties); | ||
} | ||
|
||
@Override | ||
protected String getRecipient(CallbackParams callbackParams) { | ||
CaseData caseData = callbackParams.getCaseData(); | ||
return caseData.isApplicantLiP() | ||
? caseData.getClaimantUserDetails().getEmail() | ||
: caseData.getApplicantSolicitor1UserDetails().getEmail(); | ||
} | ||
|
||
@Override | ||
protected boolean isLiP(CaseData caseData) { | ||
return caseData.isApplicantLiP(); | ||
} | ||
|
||
@Override | ||
protected String getPartyName(CallbackParams callbackParams) { | ||
CaseData caseData = callbackParams.getCaseData(); | ||
return caseData.getApplicant1().getPartyName(); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...civil/handler/callback/camunda/notification/AbstractNotifyManageStayDefendantHandler.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,43 @@ | ||
package uk.gov.hmcts.reform.civil.handler.callback.camunda.notification; | ||
|
||
import uk.gov.hmcts.reform.civil.callback.CallbackParams; | ||
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 static java.util.Objects.nonNull; | ||
|
||
public abstract class AbstractNotifyManageStayDefendantHandler extends AbstractNotifyManageStayHandler { | ||
|
||
public AbstractNotifyManageStayDefendantHandler(NotificationService notificationService, NotificationsProperties notificationsProperties) { | ||
super(notificationService, notificationsProperties); | ||
} | ||
|
||
@Override | ||
protected String getPartyName(CallbackParams callbackParams) { | ||
CaseData caseData = callbackParams.getCaseData(); | ||
return isRespondentSolicitor2(callbackParams) | ||
? caseData.getRespondent2().getPartyName() | ||
: caseData.getRespondent1().getPartyName(); | ||
} | ||
|
||
@Override | ||
protected String getRecipient(CallbackParams callbackParams) { | ||
CaseData caseData = callbackParams.getCaseData(); | ||
if (caseData.isRespondent1LiP() && nonNull(caseData.getRespondent1().getPartyEmail())) { | ||
return caseData.getRespondent1().getPartyEmail(); | ||
} else { | ||
if (isRespondentSolicitor2(callbackParams)) { | ||
return caseData.getRespondentSolicitor2EmailAddress(); | ||
} | ||
return caseData.getRespondentSolicitor1EmailAddress(); | ||
} | ||
} | ||
|
||
@Override | ||
protected boolean isLiP(CaseData caseData) { | ||
return caseData.isRespondent1LiP(); | ||
} | ||
|
||
protected abstract boolean isRespondentSolicitor2(CallbackParams callbackParams); | ||
} |
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
50 changes: 50 additions & 0 deletions
50
...civil/handler/callback/camunda/notification/NotifyClaimantStayUpdateRequestedHandler.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,50 @@ | ||
package uk.gov.hmcts.reform.civil.handler.callback.camunda.notification; | ||
|
||
import org.springframework.stereotype.Service; | ||
import uk.gov.hmcts.reform.civil.callback.CallbackParams; | ||
import uk.gov.hmcts.reform.civil.callback.CaseEvent; | ||
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 static uk.gov.hmcts.reform.civil.callback.CaseEvent.NOTIFY_CLAIMANT_STAY_UPDATE_REQUESTED; | ||
|
||
@Service | ||
public class NotifyClaimantStayUpdateRequestedHandler extends AbstractNotifyManageStayClaimantHandler { | ||
|
||
private static final String TASK_ID = "NotifyClaimantStayUpdateRequested"; | ||
private static final String REFERENCE_TEMPLATE = "stay-update-requested-claimant-notification-%s"; | ||
private static final List<CaseEvent> EVENTS = List.of(NOTIFY_CLAIMANT_STAY_UPDATE_REQUESTED); | ||
|
||
public NotifyClaimantStayUpdateRequestedHandler(NotificationService notificationService, NotificationsProperties notificationsProperties) { | ||
super(notificationService, notificationsProperties); | ||
} | ||
|
||
@Override | ||
protected String getReferenceTemplate() { | ||
return REFERENCE_TEMPLATE; | ||
} | ||
|
||
@Override | ||
public String camundaActivityId(CallbackParams callbackParams) { | ||
return TASK_ID; | ||
} | ||
|
||
@Override | ||
protected String getNotificationTemplate(CaseData caseData) { | ||
if (isLiP(caseData)) { | ||
// TODO: add lip template | ||
return null; | ||
} else { | ||
return notificationsProperties.getNotifyLRStayUpdateRequested(); | ||
} | ||
} | ||
|
||
@Override | ||
public List<CaseEvent> handledEvents() { | ||
return EVENTS; | ||
} | ||
|
||
} |
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
62 changes: 62 additions & 0 deletions
62
...ivil/handler/callback/camunda/notification/NotifyDefendantStayUpdateRequestedHandler.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,62 @@ | ||
package uk.gov.hmcts.reform.civil.handler.callback.camunda.notification; | ||
|
||
import org.springframework.stereotype.Service; | ||
import uk.gov.hmcts.reform.civil.callback.CallbackParams; | ||
import uk.gov.hmcts.reform.civil.callback.CaseEvent; | ||
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 static uk.gov.hmcts.reform.civil.callback.CaseEvent.NOTIFY_DEFENDANT2_STAY_UPDATE_REQUESTED; | ||
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.NOTIFY_DEFENDANT_STAY_UPDATE_REQUESTED; | ||
|
||
@Service | ||
public class NotifyDefendantStayUpdateRequestedHandler extends AbstractNotifyManageStayDefendantHandler { | ||
|
||
private static final String TASK_ID = "NotifyDefendantStayUpdateRequested"; | ||
private static final String TASK_ID_DEFENDANT_2 = "NotifyDefendant2StayUpdateRequested"; | ||
private static final String REFERENCE_TEMPLATE = "stay-update-requested-defendant-notification-%s"; | ||
private static final List<CaseEvent> EVENTS = List.of(NOTIFY_DEFENDANT_STAY_UPDATE_REQUESTED, | ||
NOTIFY_DEFENDANT2_STAY_UPDATE_REQUESTED); | ||
|
||
public NotifyDefendantStayUpdateRequestedHandler(NotificationService notificationService, NotificationsProperties notificationsProperties) { | ||
super(notificationService, notificationsProperties); | ||
} | ||
|
||
@Override | ||
protected String getReferenceTemplate() { | ||
return REFERENCE_TEMPLATE; | ||
} | ||
|
||
@Override | ||
protected String getNotificationTemplate(CaseData caseData) { | ||
if (isLiP(caseData)) { | ||
// TODO: add lip template | ||
return null; | ||
} else { | ||
return notificationsProperties.getNotifyLRStayUpdateRequested(); | ||
} | ||
} | ||
|
||
@Override | ||
public List<CaseEvent> handledEvents() { | ||
return EVENTS; | ||
} | ||
|
||
@Override | ||
public String camundaActivityId(CallbackParams callbackParams) { | ||
if (isRespondentSolicitor2(callbackParams)) { | ||
return TASK_ID_DEFENDANT_2; | ||
} else { | ||
return TASK_ID; | ||
} | ||
} | ||
|
||
@Override | ||
protected boolean isRespondentSolicitor2(CallbackParams callbackParams) { | ||
CaseEvent caseEvent = CaseEvent.valueOf(callbackParams.getRequest().getEventId()); | ||
return NOTIFY_DEFENDANT2_STAY_UPDATE_REQUESTED.equals(caseEvent); | ||
} | ||
} |
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
Oops, something went wrong.