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

feat: add further directions to order flow (FPLA-1105) #760

Merged
merged 32 commits into from
Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6974848
feat: add directions to order generation flow (FPLA-1105)
Dec 30, 2019
12cee1a
added assertion for removing orderFurtherDirections
Dec 30, 2019
497f7e1
merge with master branch
Jan 3, 2020
c9954c0
judiciary permissions for furtherDirections
Jan 3, 2020
d88ee8a
Merge branch 'master' into FPLA-1105-add-further-directions-to-order-…
swalker125 Jan 3, 2020
cd869f0
Initial pass of show hide logic
lewisbirks Jan 6, 2020
3830790
Logic to only generate document once
lewisbirks Jan 6, 2020
9286c17
Reset callback-request.json
lewisbirks Jan 6, 2020
bb47ea6
Updated template, moved furtherDirections output to be within the con…
lewisbirks Jan 6, 2020
c1a515c
Update integration tests to fully test the mid event
lewisbirks Jan 6, 2020
20c36ef
Fix NPE when caseData.getOrderFurtherDirections is null
lewisbirks Jan 6, 2020
cf7415d
Updated e2e tests to reflect show conditions based on orders
lewisbirks Jan 6, 2020
f2e76e8
Test clean up
lewisbirks Jan 6, 2020
00141fa
Merge branch 'master' of github.com:hmcts/fpl-ccd-configuration into …
lewisbirks Jan 6, 2020
ef27d73
Removed exception that isn't thrown
lewisbirks Jan 6, 2020
5059b07
Merge branch 'master' into FPLA-1105-add-further-directions-to-order-…
lewisbirks Jan 6, 2020
758d184
Updated template to ensure that warning block always appears at the b…
lewisbirks Jan 7, 2020
07e62a2
Merge branch 'FPLA-1105-add-further-directions-to-order-flow' of gith…
lewisbirks Jan 7, 2020
78e453f
Merge branch 'master' of github.com:hmcts/fpl-ccd-configuration into …
lewisbirks Jan 7, 2020
6762b3f
Moved GeneratedOrderService.getFurtherDirections to CaseData.getFurth…
lewisbirks Jan 7, 2020
2bdb314
Merge branch 'master' of github.com:hmcts/fpl-ccd-configuration into …
lewisbirks Jan 7, 2020
86e1c2f
Merge branch 'master' into FPLA-1105-add-further-directions-to-order-…
lewisbirks Jan 7, 2020
e3ce857
Merge branch 'master' into FPLA-1105-add-further-directions-to-order-…
lewisbirks Jan 7, 2020
a62bed4
Code review comments
lewisbirks Jan 7, 2020
fad8225
Merge remote-tracking branch 'origin/FPLA-1105-add-further-directions…
lewisbirks Jan 7, 2020
309f322
Made further directions mandatory
lewisbirks Jan 8, 2020
c2e5595
Merge branch 'master' into FPLA-1105-add-further-directions-to-order-…
lewisbirks Jan 9, 2020
f30d635
Merge branch 'master' of github.com:hmcts/fpl-ccd-configuration into …
lewisbirks Jan 9, 2020
e51bb9a
Merge branch 'master' into FPLA-1105-add-further-directions-to-order-…
lewisbirks Jan 10, 2020
125742d
Merge branch 'master' into FPLA-1105-add-further-directions-to-order-…
lewisbirks Jan 10, 2020
256715c
Merge branch 'master' into FPLA-1105-add-further-directions-to-order-…
lewisbirks Jan 13, 2020
d593576
Merge branch 'master' into FPLA-1105-add-further-directions-to-order-…
lewisbirks Jan 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions ccd-definition/AuthorisationCaseField/court-admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,13 @@
"UserRole": "caseworker-publiclaw-courtadmin",
"CRUD": "CRUD"
},
{
"LiveFrom": "01/01/2017",
"CaseTypeID": "CARE_SUPERVISION_EPO",
"CaseFieldID": "orderFurtherDirections",
"UserRole": "caseworker-publiclaw-courtadmin",
joez-f marked this conversation as resolved.
Show resolved Hide resolved
"CRUD": "CRUD"
},
{
"LiveFrom": "01/01/2017",
"CaseTypeID": "CARE_SUPERVISION_EPO",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@
"PageLabel": " ",
"PageDisplayOrder": 3,
"PageColumnNumber": 1,
"ShowSummaryChangeOption": "Y"
},
{
"LiveFrom": "01/01/2017",
"CaseTypeID": "CARE_SUPERVISION_EPO",
"CaseEventID": "createOrder-PREPARE_FOR_HEARING",
joez-f marked this conversation as resolved.
Show resolved Hide resolved
"CaseFieldID": "orderFurtherDirections",
"PageFieldDisplayOrder": 1,
"DisplayContext": "OPTIONAL",
"PageID": "FurtherDirections",
"PageLabel": " ",
"PageDisplayOrder": 4,
"PageColumnNumber": 1,
"ShowSummaryChangeOption": "Y",
"CallBackURLMidEvent": "${CCD_DEF_CASE_SERVICE_BASE_URL}/callback/create-order/mid-event"
}
Expand Down
13 changes: 13 additions & 0 deletions ccd-definition/CaseEventToFields/createOrder.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@
"PageLabel": " ",
"PageDisplayOrder": 3,
"PageColumnNumber": 1,
"ShowSummaryChangeOption": "Y"
},
{
"LiveFrom": "01/01/2017",
"CaseTypeID": "CARE_SUPERVISION_EPO",
"CaseEventID": "createOrder",
"CaseFieldID": "orderFurtherDirections",
"PageFieldDisplayOrder": 1,
"DisplayContext": "OPTIONAL",
"PageID": "FurtherDirections",
"PageLabel": " ",
"PageDisplayOrder": 4,
"PageColumnNumber": 1,
joez-f marked this conversation as resolved.
Show resolved Hide resolved
"ShowSummaryChangeOption": "Y",
"CallBackURLMidEvent": "${CCD_DEF_CASE_SERVICE_BASE_URL}/callback/create-order/mid-event"
}
Expand Down
8 changes: 8 additions & 0 deletions ccd-definition/CaseField.json
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,14 @@
"FieldType": "OrderTypeAndDocument",
"SecurityClassification": "Public"
},
{
"LiveFrom": "01/01/2017",
"CaseTypeID": "CARE_SUPERVISION_EPO",
"ID": "orderFurtherDirections",
"Label": "Further directions",
"FieldType": "FurtherDirections",
"SecurityClassification": "Public"
},
{
"LiveFrom": "01/01/2017",
"CaseTypeID": "CARE_SUPERVISION_EPO",
Expand Down
19 changes: 19 additions & 0 deletions ccd-definition/ComplexTypes/1_furtherDirections.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
{
"LiveFrom": "01/01/2017",
"ID": "FurtherDirections",
"ListElementCode": "directionsNeeded",
"FieldType": "YesOrNo",
"ElementLabel": "Do you want to add further directions to the order?",
"SecurityClassification": "Public"
},
{
"LiveFrom": "01/01/2017",
"ID": "FurtherDirections",
"ListElementCode": "directions",
"FieldType": "TextArea",
"ElementLabel": "Give details",
"SecurityClassification": "Public",
"FieldShowCondition": "directionsNeeded = \"Yes\""
}
]
8 changes: 8 additions & 0 deletions ccd-definition/ComplexTypes/GeneratedOrder.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,13 @@
"FieldType": "JudgeAndLegalAdvisor",
"ElementLabel": "Judge and legal advisor",
"SecurityClassification": "Public"
},
{
"LiveFrom": "01/01/2017",
"ID": "GeneratedOrder",
"ListElementCode": "furtherDirections",
"FieldType": "FurtherDirections",
"ElementLabel": "Directions",
"SecurityClassification": "Public"
}
]
Binary file modified docker/docmosis/templates/FL-PLW-GOR-ENG-00218.docx
Binary file not shown.
10 changes: 10 additions & 0 deletions e2e/pages/events/createOrderEvent.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ module.exports = {
title: '#order_title',
details: '#order_details',
orderTypeList: '#orderTypeAndDocument_type',
directionsNeeded: {
yes: '#orderFurtherDirections_directionsNeeded-Yes',
no: '#orderFurtherDirections_directionsNeeded-No',
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have directionsNeeded.no if we don’t use it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the idea of the page objects being a bit like an API for the page. i.e this is everything you can do... But sure it's not used. You think I should remove?

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, maybe that is a good idea then actually. i think leave in :)

},
directions: '#orderFurtherDirections_directions',
},

selectType(type) {
Expand All @@ -25,4 +30,9 @@ module.exports = {
judgeAndLegalAdvisor.enterJudgeLastName(judgeLastName);
judgeAndLegalAdvisor.enterLegalAdvisorName(legalAdvisorName);
},

enterDirections(directions) {
I.click(this.fields.directionsNeeded.yes);
I.fillField(this.fields.directions, directions);
},
};
4 changes: 4 additions & 0 deletions e2e/tests/hmctsAdministersCaseAfterSubmission_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ Scenario('HMCTS admin creates multiple orders for the case', async (I, caseViewP
await createOrderEventPage.enterC21OrderDetails();
await I.retryUntilExists(() => I.click('Continue'), '#judgeAndLegalAdvisor_judgeTitle');
await createOrderEventPage.enterJudgeAndLegalAdvisor(orders[0].judgeAndLegalAdvisor.judgeLastName, orders[0].judgeAndLegalAdvisor.legalAdvisorName);
await I.retryUntilExists(() => I.click('Continue'), '#orderFurtherDirections_directionsNeeded');
joez-f marked this conversation as resolved.
Show resolved Hide resolved
await createOrderEventPage.enterDirections('example directions');
await I.completeEvent('Save and continue');
let orderTime = new Date();

Expand All @@ -161,6 +163,8 @@ Scenario('HMCTS admin creates multiple orders for the case', async (I, caseViewP
await createOrderEventPage.selectType(orders[1].type);
await I.retryUntilExists(() => I.click('Continue'), '#judgeAndLegalAdvisor_judgeTitle');
await createOrderEventPage.enterJudgeAndLegalAdvisor(orders[1].judgeAndLegalAdvisor.judgeLastName, orders[1].judgeAndLegalAdvisor.legalAdvisorName);
await I.retryUntilExists(() => I.click('Continue'), '#orderFurtherDirections_directionsNeeded');
await createOrderEventPage.enterDirections('example directions');
await I.completeEvent('Save and continue');
orderTime = new Date();
I.seeEventSubmissionConfirmation(config.administrationActions.createOrder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ private GeneratedOrder buildExpectedCareOrder() {
}

private void aboutToSubmitAssertions(CaseData caseData, GeneratedOrder expectedOrder) {

List<Element<GeneratedOrder>> orders = caseData.getOrderCollection();
assertThat(caseData.getOrderTypeAndDocument()).isEqualTo(null);
assertThat(caseData.getOrder()).isEqualTo(null);
assertThat(caseData.getJudgeAndLegalAdvisor()).isEqualTo(null);
assertThat(caseData.getOrderFurtherDirections()).isEqualTo(null);
assertThat(orders.get(0).getValue()).isEqualTo(expectedOrder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public AboutToStartOrSubmitCallbackResponse handleAboutToSubmit(
caseDetails.getData().remove("orderTypeAndDocument");
caseDetails.getData().remove("order");
caseDetails.getData().remove("judgeAndLegalAdvisor");
caseDetails.getData().remove("orderFurtherDirections");

return AboutToStartOrSubmitCallbackResponse.builder()
.data(caseDetails.getData())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public List<Element<Child>> getAllChildren() {
private final C2DocumentBundle temporaryC2Document;
private final List<Element<C2DocumentBundle>> c2DocumentBundle;
private final OrderTypeAndDocument orderTypeAndDocument;
private final FurtherDirections orderFurtherDirections;
private final GeneratedOrder order;
private final List<Element<GeneratedOrder>> orderCollection;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package uk.gov.hmcts.reform.fpl.model;

import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class FurtherDirections {
private final String directionsNeeded;
private final String directions;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ public class GeneratedOrder {
private final DocumentReference document;
private final String date;
private final JudgeAndLegalAdvisor judgeAndLegalAdvisor;
private final FurtherDirections furtherDirections;
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public Map<String, Object> getOrderTemplateData(CaseData caseData) {
.put("legalAdvisorName", JudgeAndLegalAdvisorHelper.getLegalAdvisorName(
caseData.getJudgeAndLegalAdvisor()))
.put("children", getChildrenDetails(caseData))
.put("furtherDirections", defaultIfNull(caseData.getOrderFurtherDirections().getDirections(), ""))
.build();

return orderTemplateBuilder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import uk.gov.hmcts.reform.fpl.model.CaseData;
import uk.gov.hmcts.reform.fpl.model.Child;
import uk.gov.hmcts.reform.fpl.model.ChildParty;
import uk.gov.hmcts.reform.fpl.model.FurtherDirections;
import uk.gov.hmcts.reform.fpl.model.GeneratedOrder;
import uk.gov.hmcts.reform.fpl.model.OrderTypeAndDocument;
import uk.gov.hmcts.reform.fpl.model.common.DocumentReference;
Expand Down Expand Up @@ -261,6 +262,7 @@ private Map<String, Object> createExpectedOrderData(String date, GeneratedOrderT
}

expectedMap
.put("furtherDirections", "Example Directions")
Copy link
Contributor

Choose a reason for hiding this comment

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

we could probably move this expected map out to a private method - I know you are just adding one line here to existing code though so it's up to you :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's already within a private method, so I am just going to leave as is

.put("familyManCaseNumber", "123")
.put("courtName", "Example Court")
.put("todaysDate", date)
Expand Down Expand Up @@ -288,13 +290,21 @@ private CaseData createPopulatedCaseData(GeneratedOrderType type, LocalDate loca
.order(GeneratedOrder.builder()
.title("Example Title")
.details("Example details")
.build())
Copy link
Contributor

Choose a reason for hiding this comment

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

would these case builder options be nicer in private methods too or would you like to keep them in here? - getting bulky

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also already in a private method

.orderFurtherDirections(FurtherDirections.builder()
.directionsNeeded("Yes")
.directions("Example Directions")
.build());
break;
case CARE_ORDER:
caseDataBuilder
.orderTypeAndDocument(OrderTypeAndDocument.builder()
.type(CARE_ORDER)
.document(DocumentReference.builder().build())
.build())
.orderFurtherDirections(FurtherDirections.builder()
.directionsNeeded("Yes")
.directions("Example Directions")
.build());
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"childInformation": "Cousin",
"litigationIssues": "NO",
"genderIdentification": "Unknown",
"representedBy" : []
"representedBy": []
},
"additionalOthers": [
{
Expand Down Expand Up @@ -495,7 +495,11 @@
"title": "Example Order",
"details": "Example order details here - Lorem ipsum dolor sit amet, consectetur adipiscing elit"
},
"familyManCaseNumber": "12345L"
"familyManCaseNumber": "12345L",
"orderFurtherDirections": {
"directionsNeeded": "Yes",
"directions": "Example directions"
}
}
},
"case_details_before": {
Expand Down