8000 FPL-35: Send notifications to CAFCASS on case submission by swalker125 · Pull Request #144 · hmcts/fpl-ccd-configuration · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

FPL-35: Send notifications to CAFCASS on case submission #144

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

Merged
merged 10 commits into from
Dec 12, 2018

Conversation

swalker125
Copy link
Contributor

JIRA link (if applicable)

https://tools.hmcts.net/jira/browse/FPL-35

Change description

Added mappings between LA code and Cafcass. Added template id for Cafcass

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[x] No

Added mappings between LA code and Cafcass. Added template id for Cafcass
@swalker125
Copy link
Contributor Author
swalker125 commented Dec 11, 2018

EMPTY
screenshot_2018-12-11 new public law application made by hillingdon local authority - familypubliclaw gmail com - gmail 1

POPULATED
screenshot_2018-12-11 new public law application made by hillingdon local authority - familypubliclaw gmail com - gmail

@@ -17,4 +17,6 @@ fpl.local_authority_user.mapping=example=>1,2,3

fpl.local_authority_code_to_hmcts_court.mapping=example=>Family Court:admin@family-court.com

fpl.local_authority_code_to_cafcass.mapping=example=>example:cafcass@cafcass.com
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change CAFCASS name so that it does not look like LA code.

import static com.google.common.base.Strings.emptyToNull;

@Configuration
public class CafcassEmailLookupConfiguration {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename as it is not about looking up for email anymore.


private Map<String, String> buildHmctsSubmissionNotification(CaseDetails caseDetails, String localAuthorityCode) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should extract this to separate classes that are well unit tested taking all options into consideration. Let's do that next sprint as tech debt.

Class itself could be called EmailContentProvider ;)


List orderType = (List) Optional.ofNullable(orders.get("orderType")).orElse(ImmutableList.builder().build());
logger.debug(
8000 Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we extract couple of lines (starting with debug, ending with exception handling) into separate method and reuse across both notification method. Logging logic is same.

@@ -87,6 +109,8 @@ public void sendNotificationToHmctsAdmin(SubmittedCaseEvent event) {
return ImmutableMap.<String, String>builder()
.put("court", hmctsCourtLookupConfiguration.getCourt(localAuthorityCode).getName())
.put("localAuthority", localAuthorityNameLookupConfiguration.getLocalAuthorityName(localAuthorityCode))
.put("dataPresent", (orderType.isEmpty()) ? ("No") : ("Yes"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove these curly brackets , that add no value.

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

class CafcassEmailLookupConfigurationTest {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test rename should follow proposed class rename as well.


@Test
void shouldReturnCafcassEmailWhenLocalAuthorityCodeExists() {
CafcassEmailLookupConfiguration.Cafcass cafcass = configuration.getCafcass(LOCAL_AUTHORITY_CODE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do static import so we see Cafcass cafcass.

@jenkins-reform-hmcts2 jenkins-reform-hmcts2 temporarily deployed to preview December 11, 2018 16:22 Inactive
@jenkins-reform-hmcts2 jenkins-reform-hmcts2 temporarily deployed to preview December 11, 2018 16:37 Inactive
@jenkins-reform-hmcts2 jenkins-reform-hmcts2 temporarily deployed to preview December 11, 2018 16:51 Inactive
@@ -6,5 +6,6 @@ private NotifyTemplates() {
//NO-OP
}

public static final String HMCTS_COURT_SUBMISSION_TEMPLATE = "1b1be684-9b0a-4e58-8e51-f0c3c2dba37c";
public static final String HMCTS_COURT_SUBMISSION_TEMPLATE = "c76d4fb2-d2b0-4ac5-9c3a-fb1fb964a257";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@jenkins-reform-hmcts2 jenkins-reform-hmcts2 temporarily deployed to preview December 11, 2018 16:59 Inactive
.put("timeFrameValue", Optional.ofNullable((String) hearing.get("timeFrame")).orElse(""))
.put("reference", String.valueOf(caseDetails.getId()))
.put("caseUrl", uiBaseUrl + "/case/" + JURISDICTION + "/" + CASE_TYPE + "/" + caseDetails.getId())
.build();
}

private Map<String, String> buildCafcassSubmissionNotification(CaseDetails caseDetails, String localAuthorityCode) {
final String name = cafcassLookupConfiguration.getCafcass(localAuthorityCode).getName();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove final before we merge.

}

@Test
void shouldReturnCafcassEmailWhenLocalAuthorityCodeExists() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename as now whole Cafcass object is returned, not only an email.

.build();

given(cafcassLookupConfiguration.getCafcass(LOCAL_AUTHORITY_CODE))
.willReturn(new CafcassLookupConfiguration.Cafcass(CAFCASS_NAME, CAFCASS_EMAIL_ADDRESS));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please static import CafcassLookupConfiguration.Cafcass so that we do not see CafcassLookupConfiguration part.

@jenkins-reform-hmcts2 jenkins-reform-hmcts2 temporarily deployed to preview December 11, 2018 17:16 Inactive
swalker125 added 2 commits December 11, 2018 17:21
@jenkins-reform-hmcts2 jenkins-reform-hmcts2 temporarily deployed to preview December 11, 2018 17:34 Inactive
@jenkins-reform-hmcts2 jenkins-reform-hmcts2 temporarily deployed to preview December 11, 2018 18:16 Inactive
@jenkins-reform-hmcts2 jenkins-reform-hmcts2 temporarily deployed to preview December 12, 2018 10:17 Inactive
@jenkins-reform-hmcts2 jenkins-reform-hmcts2 temporarily deployed to preview December 12, 2018 10:44 Inactive
@DamianDunajski DamianDunajski changed the title FPL-35: Added handler for cafcass notification FPL-35: Send notifications to CAFCASS on case submission Dec 12, 2018
@DamianDunajski DamianDunajski merged commit d380aaa into master Dec 12, 2018
@DamianDunajski DamianDunajski deleted the FPL-35-notify-cafcass-after-submission branch December 12, 2018 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0