-
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-10336 SDO EA email notification (#3450)
* CIV-10336 SDO EA email notification * CIV-10336 SDO EA email notification * update tests --------- Co-authored-by: Gareth Lancaster <[email protected]> Co-authored-by: Hemanth Potipati <[email protected]> Co-authored-by: AhsanZX97 <[email protected]>
- Loading branch information
1 parent
07edf6f
commit e67b77c
Showing
14 changed files
with
197 additions
and
17 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
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
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
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
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 |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
import uk.gov.hmcts.reform.civil.sampledata.CallbackParamsBuilder; | ||
import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; | ||
import uk.gov.hmcts.reform.civil.notify.NotificationService; | ||
import uk.gov.hmcts.reform.civil.service.FeatureToggleService; | ||
import uk.gov.hmcts.reform.civil.service.OrganisationService; | ||
import uk.gov.hmcts.reform.civil.prd.model.Organisation; | ||
|
||
|
@@ -45,6 +46,8 @@ public class CreateSDOApplicantsNotificationHandlerTest extends BaseCallbackHand | |
private NotificationsProperties notificationsProperties; | ||
@MockBean | ||
private OrganisationService organisationService; | ||
@MockBean | ||
private FeatureToggleService featureToggleService; | ||
@Autowired | ||
private CreateSDOApplicantsNotificationHandler handler; | ||
|
||
|
@@ -82,6 +85,58 @@ private Map<String, String> getNotificationDataMap(CaseData caseData) { | |
} | ||
} | ||
|
||
@Nested | ||
class AboutToSubmitCallbackEA { | ||
|
||
@BeforeEach | ||
void setup() { | ||
when(notificationsProperties.getSdoOrderedEA()).thenReturn("template-id-EA"); | ||
when(notificationsProperties.getSdoOrderedSpecEA()).thenReturn("template-id-spec-EA"); | ||
when(featureToggleService.isEarlyAdoptersEnabled()).thenReturn(true); | ||
when(organisationService.findOrganisationById(anyString())) | ||
.thenReturn(Optional.of(Organisation.builder().name("Signer Name").build())); | ||
} | ||
|
||
@Test | ||
void shouldNotifyApplicantSolicitor_whenInvoked() { | ||
CaseData caseData = CaseDataBuilder.builder().atStateClaimDetailsNotified().build(); | ||
CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).build(); | ||
|
||
handler.handle(params); | ||
|
||
verify(notificationService).sendMail( | ||
"[email protected]", | ||
"template-id-EA", | ||
getNotificationDataMap(caseData), | ||
"create-sdo-applicants-notification-000DC001" | ||
); | ||
} | ||
|
||
@Test | ||
void shouldNotifyApplicantSolicitorSpec_whenInvoked() { | ||
CaseData caseData = CaseDataBuilder.builder().atStateClaimDetailsNotified() | ||
.setClaimTypeToSpecClaim().build(); | ||
CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).build(); | ||
|
||
handler.handle(params); | ||
|
||
verify(notificationService).sendMail( | ||
"[email protected]", | ||
"template-id-spec-EA", | ||
getNotificationDataMap(caseData), | ||
"create-sdo-applicants-notification-000DC001" | ||
); | ||
} | ||
|
||
@NotNull | ||
private Map<String, String> getNotificationDataMap(CaseData caseData) { | ||
return Map.of( | ||
CLAIM_REFERENCE_NUMBER, LEGACY_CASE_REFERENCE, | ||
CLAIM_LEGAL_ORG_NAME_SPEC, "Signer Name" | ||
); | ||
} | ||
} | ||
|
||
@Test | ||
void shouldReturnCorrectCamundaActivityId_whenInvoked() { | ||
assertThat(handler.camundaActivityId(CallbackParamsBuilder.builder().request(CallbackRequest.builder().eventId( | ||
|
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 |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
import uk.gov.hmcts.reform.civil.sampledata.CallbackParamsBuilder; | ||
import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder; | ||
import uk.gov.hmcts.reform.civil.sampledata.PartyBuilder; | ||
import uk.gov.hmcts.reform.civil.service.FeatureToggleService; | ||
import uk.gov.hmcts.reform.civil.service.OrganisationService; | ||
|
||
import java.util.Map; | ||
|
@@ -54,12 +55,15 @@ public class CreateSDORespondent1NotificationHandlerTest extends BaseCallbackHan | |
private NotificationsProperties notificationsProperties; | ||
@MockBean | ||
private OrganisationService organisationService; | ||
@MockBean | ||
private FeatureToggleService featureToggleService; | ||
@Autowired | ||
private CreateSDORespondent1NotificationHandler handler; | ||
private static final String DEFENDANT_EMAIL = "[email protected]"; | ||
private static final String LEGACY_REFERENCE = "create-sdo-respondent-1-notification-000DC001"; | ||
private static final String DEFENDANT_NAME = "respondent"; | ||
private static final String TEMPLATE_ID = "template-id"; | ||
private static final String TEMPLATE_ID_EA = "template-id-EA"; | ||
private static final String ORG_NAME = "Signer Name"; | ||
|
||
@Nested | ||
|
@@ -68,8 +72,10 @@ class AboutToSubmitCallback { | |
@BeforeEach | ||
void setup() { | ||
when(notificationsProperties.getSdoOrdered()).thenReturn(TEMPLATE_ID); | ||
when(notificationsProperties.getSdoOrderedEA()).thenReturn(TEMPLATE_ID_EA); | ||
when(notificationsProperties.getSdoOrderedSpecBilingual()).thenReturn(TEMPLATE_ID); | ||
when(notificationsProperties.getSdoOrderedSpec()).thenReturn(TEMPLATE_ID); | ||
when(notificationsProperties.getSdoOrderedSpecEA()).thenReturn(TEMPLATE_ID_EA); | ||
when(organisationService.findOrganisationById(anyString())) | ||
.thenReturn(Optional.of(Organisation.builder().name(ORG_NAME).build())); | ||
} | ||
|
@@ -95,6 +101,28 @@ void shouldNotifyRespondentSolicitor_whenInvoked() { | |
); | ||
} | ||
|
||
@Test | ||
void shouldNotifyRespondentSolicitor_whenInvokedEA() { | ||
when(featureToggleService.isEarlyAdoptersEnabled()).thenReturn(true); | ||
CaseData caseData = CaseDataBuilder.builder().atStateClaimDetailsNotified().build(); | ||
CallbackParams params = CallbackParams.builder() | ||
.caseData(caseData) | ||
.type(ABOUT_TO_SUBMIT) | ||
.request(CallbackRequest.builder() | ||
.eventId(CaseEvent.NOTIFY_RESPONDENT_SOLICITOR1_SDO_TRIGGERED.name()) | ||
.build()) | ||
.build(); | ||
|
||
handler.handle(params); | ||
|
||
verify(notificationService).sendMail( | ||
caseData.getRespondentSolicitor1EmailAddress(), | ||
TEMPLATE_ID_EA, | ||
getNotificationDataMap(caseData), | ||
LEGACY_REFERENCE | ||
); | ||
} | ||
|
||
@Test | ||
void shouldNotifyRespondentLiP_whenInvoked() { | ||
CaseData caseData = CaseDataBuilder.builder().atStateClaimDetailsNotified().build() | ||
|
@@ -120,6 +148,32 @@ void shouldNotifyRespondentLiP_whenInvoked() { | |
); | ||
} | ||
|
||
@Test | ||
void shouldNotifyRespondentLiP_whenInvokedEA() { | ||
when(featureToggleService.isEarlyAdoptersEnabled()).thenReturn(true); | ||
CaseData caseData = CaseDataBuilder.builder().atStateClaimDetailsNotified().build() | ||
.toBuilder() | ||
.respondent1Represented(YesOrNo.NO) | ||
.caseAccessCategory(CaseCategory.SPEC_CLAIM) | ||
.build(); | ||
CallbackParams params = CallbackParams.builder() | ||
.caseData(caseData) | ||
.type(ABOUT_TO_SUBMIT) | ||
.request(CallbackRequest.builder() | ||
.eventId(CaseEvent.NOTIFY_RESPONDENT_SOLICITOR1_SDO_TRIGGERED.name()) | ||
.build()) | ||
.build(); | ||
|
||
handler.handle(params); | ||
|
||
verify(notificationService).sendMail( | ||
caseData.getRespondent1().getPartyEmail(), | ||
TEMPLATE_ID_EA, | ||
getNotificationDataLipMap1(caseData), | ||
LEGACY_REFERENCE | ||
); | ||
} | ||
|
||
@Test | ||
void shouldNotifyRespondentLiPWithBilingual_whenDefendantResponseIsBilingual() { | ||
Party party = PartyBuilder.builder() | ||
|
Oops, something went wrong.