Skip to content

Commit 8d657be

Browse files
mikebrownccdhmcts-jenkins-d-to-i[bot]rajeshthuraiyur
authored
DIAC-1078 Request respondent review of appellant case 7 day complianc… (#2580)
* DIAC-1078 Request respondent review of appellant case 7 day compliance date - code logic updated, unit tests added, new constants added, functional test WIP * Bumping chart version/ fixing aliases * functional test desc corrected, functional test expectation sendDirectionExplanation added * functional test added DIAC-1078 Request respondent review when NOT detained --------- Co-authored-by: hmcts-jenkins-d-to-i <62423932+hmcts-jenkins-d-to-i[bot]@users.noreply.github.com> Co-authored-by: rajeshthuraiyur <48379561+rajeshthuraiyur@users.noreply.github.com>
1 parent 8539079 commit 8d657be

File tree

6 files changed

+154
-5
lines changed

6 files changed

+154
-5
lines changed

charts/ia-case-api/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ java:
4242
REQUEST_RESPONDENT_EVIDENCE_DETAINED_DUE_IN_DAYS: 7
4343
REQUEST_RESPONDENT_REVIEW_DUE_IN_DAYS: 14
4444
REQUEST_RESPONDENT_REVIEW_ADA_DUE_IN_DAYS: 2
45+
REQUEST_RESPONDENT_REVIEW_DETAINED_DUE_IN_DAYS: 7
4546
APPELLANT_REASONS_FOR_APPEAL_DUE_IN_DAYS: 28
4647
PAYMENT_AFTER_REMISSION_REJECTION_DUE_IN_MINUTES: 20160
4748
PAYMENT_EA_HU_NO_REMISSION_DUE_IN_MINUTES: 20160
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"description": "DIAC-1078 Request respondent review when detained - check sendDirectionDateDue ",
3+
"request": {
4+
"uri": "/asylum/ccdAboutToStart",
5+
"credentials": "CaseOfficer",
6+
"input": {
7+
"eventId": "requestRespondentReview",
8+
"state": "awaitingRespondentReview",
9+
"caseData": {
10+
"template": "minimal-appeal-submitted.json",
11+
"replacements": {
12+
"appellantInDetention": "Yes",
13+
"homeOfficeSearchStatus": "SUCCESS",
14+
"sendDirectionExplanation": null,
15+
"sendDirectionParties": null,
16+
"sendDirectionDateDue": null
17+
}
18+
}
19+
}
20+
},
21+
"expectation": {
22+
"status": 200,
23+
"errors": [],
24+
"caseData": {
25+
"template": "minimal-appeal-submitted.json",
26+
"replacements": {
27+
"sendDirectionExplanation": "By the date below you must review the appellant’s ASA and bundle.\nThe review must comply with (i) Rule 24A (3) of the Tribunal Procedure Rules 2014 and (ii) Practice Direction (1.11.2024) Part 2, section 2.1 (e), Part 3, sections 7.11 – 7.12. Specifically, the review must:\n\n- be meaningful.\n- explain whether you agree that the schedule of disputed issues is correct. If not, the review must set out the correct list of disputed issues, including whether there are any further issues that the respondent wishes to raise.\n- state whether you oppose or accept the appellant’s position on each issue and why.\n- cross-reference your submissions to paragraphs in the decision under appeal, pages in the respondent’s bundle, any country information evidence schedule, and/or any additional evidence relied upon.\n- specify which, if any, witnesses you intend to cross-examine and if you do not intend to cross-examine a witness, outline any objections to that witness’s statement being read by a judge.\n- address whether the appeal should be allowed on any ground if the appellant and/or their key witnesses are found to be credible according to the applicable standard of proof.\n- identify whether you are prepared to withdraw the decision (or part of it).\n- state whether the appeal can be resolved without a hearing.\n- not exceed 6 pages unless reasons are submitted in an accompanying application.\n- not contain standard or pro-forma paragraphs.\n- provide the name of the author of the review and the date.\n\nParties must ensure they conduct proceedings with procedural rigour. The Tribunal will not overlook breaches of the requirements of the Procedure Rules, Practice Statement or Practice Direction, nor failures to comply with directions issued by the Tribunal. Parties are reminded of the sanctions for non-compliance set out in paragraph 5.3 of the Practice Direction of 01.11.24.",
28+
"sendDirectionParties": "respondent",
29+
"sendDirectionDateDue": "{$TODAY+7}"
30+
}
31+
}
32+
}
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"description": "DIAC-1078 Request respondent review when NOT detained - check sendDirectionDateDue ",
3+
"request": {
4+
"uri": "/asylum/ccdAboutToStart",
5+
"credentials": "CaseOfficer",
6+
"input": {
7+
"eventId": "requestRespondentReview",
8+
"state": "awaitingRespondentReview",
9+
"caseData": {
10+
"template": "minimal-appeal-submitted.json",
11+
"replacements": {
12+
"appellantInDetention": "No",
13+
"homeOfficeSearchStatus": "SUCCESS",
14+
"sendDirectionExplanation": null,
15+
"sendDirectionParties": null,
16+
"sendDirectionDateDue": null
17+
}
18+
}
19+
}
20+
},
21+
"expectation": {
22+
"status": 200,
23+
"errors": [],
24+
"caseData": {
25+
"template": "minimal-appeal-submitted.json",
26+
"replacements": {
27+
"sendDirectionExplanation": "By the date below you must review the appellant’s ASA and bundle.\nThe review must comply with (i) Rule 24A (3) of the Tribunal Procedure Rules 2014 and (ii) Practice Direction (1.11.2024) Part 2, section 2.1 (e), Part 3, sections 7.11 – 7.12. Specifically, the review must:\n\n- be meaningful.\n- explain whether you agree that the schedule of disputed issues is correct. If not, the review must set out the correct list of disputed issues, including whether there are any further issues that the respondent wishes to raise.\n- state whether you oppose or accept the appellant’s position on each issue and why.\n- cross-reference your submissions to paragraphs in the decision under appeal, pages in the respondent’s bundle, any country information evidence schedule, and/or any additional evidence relied upon.\n- specify which, if any, witnesses you intend to cross-examine and if you do not intend to cross-examine a witness, outline any objections to that witness’s statement being read by a judge.\n- address whether the appeal should be allowed on any ground if the appellant and/or their key witnesses are found to be credible according to the applicable standard of proof.\n- identify whether you are prepared to withdraw the decision (or part of it).\n- state whether the appeal can be resolved without a hearing.\n- not exceed 6 pages unless reasons are submitted in an accompanying application.\n- not contain standard or pro-forma paragraphs.\n- provide the name of the author of the review and the date.\n\nParties must ensure they conduct proceedings with procedural rigour. The Tribunal will not overlook breaches of the requirements of the Procedure Rules, Practice Statement or Practice Direction, nor failures to comply with directions issued by the Tribunal. Parties are reminded of the sanctions for non-compliance set out in paragraph 5.3 of the Practice Direction of 01.11.24.",
28+
"sendDirectionParties": "respondent",
29+
"sendDirectionDateDue": "{$TODAY+14}"
30+
}
31+
}
32+
}
33+
}

src/main/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/RequestRespondentReviewPreparer.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,20 @@ public class RequestRespondentReviewPreparer implements PreSubmitCallbackHandler
2424

2525
private final int requestRespondentReviewDueInDays;
2626
private final int requestRespondentReviewDueInDaysForAda;
27+
private final int requestRespondentReviewDueInDaysForDetained;
2728
private final DateProvider dateProvider;
2829
private final DueDateService dueDateService;
2930

3031
public RequestRespondentReviewPreparer(
3132
@Value("${requestRespondentReview.dueInDays}") int requestRespondentReviewDueInDays,
3233
@Value("${requestRespondentReviewAda.dueInDays}") int requestRespondentReviewDueInDaysForAda,
34+
@Value("${requestRespondentReviewDetained.dueInDays}") int requestRespondentReviewDueInDaysForDetained,
3335
DateProvider dateProvider,
3436
DueDateService dueDateService
3537
) {
3638
this.requestRespondentReviewDueInDays = requestRespondentReviewDueInDays;
3739
this.requestRespondentReviewDueInDaysForAda = requestRespondentReviewDueInDaysForAda;
40+
this.requestRespondentReviewDueInDaysForDetained = requestRespondentReviewDueInDaysForDetained;
3841
this.dateProvider = dateProvider;
3942
this.dueDateService = dueDateService;
4043
}
@@ -82,14 +85,27 @@ public PreSubmitCallbackResponse<AsylumCase> handle(
8285
);
8386

8487
asylumCase.write(SEND_DIRECTION_PARTIES, Parties.RESPONDENT);
85-
86-
LocalDate dueDate = HandlerUtils.isAcceleratedDetainedAppeal(asylumCase)
87-
? dueDateService.calculateDueDate(dateProvider.now().atStartOfDay(ZoneOffset.UTC), requestRespondentReviewDueInDaysForAda).toLocalDate()
88-
: dateProvider.now().plusDays(requestRespondentReviewDueInDays);
88+
89+
LocalDate dueDate = getDueDate(asylumCase);
90+
8991
asylumCase.write(SEND_DIRECTION_DATE_DUE, dueDate.toString());
9092

9193
asylumCase.write(UPLOAD_HOME_OFFICE_APPEAL_RESPONSE_ACTION_AVAILABLE, YesOrNo.YES);
9294

9395
return new PreSubmitCallbackResponse<>(asylumCase);
9496
}
97+
98+
private LocalDate getDueDate(AsylumCase asylumCase) {
99+
LocalDate dueDate;
100+
101+
if (HandlerUtils.isAcceleratedDetainedAppeal(asylumCase)) {
102+
dueDate = dueDateService.calculateDueDate(dateProvider.now().atStartOfDay(ZoneOffset.UTC), requestRespondentReviewDueInDaysForAda).toLocalDate();
103+
} else if (HandlerUtils.isAppellantInDetention(asylumCase)) {
104+
dueDate = dateProvider.now().plusDays(requestRespondentReviewDueInDaysForDetained);
105+
} else {
106+
dueDate = dateProvider.now().plusDays(requestRespondentReviewDueInDays);
107+
}
108+
109+
return dueDate;
110+
}
95111
}

src/main/resources/application.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ requestRespondentEvidence.dueInDaysAda: ${REQUEST_RESPONDENT_EVIDENCE_ADA_DUE_IN
134134
requestRespondentEvidence.dueInDaysDetained: ${REQUEST_RESPONDENT_EVIDENCE_DETAINED_DUE_IN_DAYS:7}
135135
requestRespondentReview.dueInDays: ${REQUEST_RESPONDENT_REVIEW_DUE_IN_DAYS:14}
136136
requestRespondentReviewAda.dueInDays: ${REQUEST_RESPONDENT_REVIEW_ADA_DUE_IN_DAYS:2}
137+
requestRespondentReviewDetained.dueInDays: ${REQUEST_RESPONDENT_REVIEW_DETAINED_DUE_IN_DAYS:7}
137138
appellantReasonsForAppeal.dueInDays: ${APPELLANT_REASONS_FOR_APPEAL_DUE_IN_DAYS:28}
138139
paymentAfterRemissionRejection.dueInMinutes: ${PAYMENT_AFTER_REMISSION_REJECTION_DUE_IN_MINUTES:20160}
139140
legalRepresentativeRemissionReminder.dueInMinutes: ${LEGAL_REP_REMISSION_REMINDER_DUE_IN_MINUTES:10080}

src/test/java/uk/gov/hmcts/reform/iacaseapi/domain/handlers/presubmit/RequestRespondentReviewPreparerTest.java

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@
77
import static org.junit.jupiter.api.Assertions.assertNotNull;
88
import static org.junit.jupiter.api.Assertions.assertTrue;
99
import static org.mockito.ArgumentMatchers.any;
10+
import static org.mockito.ArgumentMatchers.anyInt;
1011
import static org.mockito.ArgumentMatchers.eq;
1112
import static org.mockito.Mockito.reset;
1213
import static org.mockito.Mockito.times;
1314
import static org.mockito.Mockito.verify;
1415
import static org.mockito.Mockito.when;
16+
import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AppealType.PA;
1517
import static uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition.*;
1618

1719
import java.time.LocalDate;
1820
import java.time.ZoneOffset;
21+
import java.time.ZonedDateTime;
1922
import java.util.List;
2023
import java.util.Optional;
2124
import org.junit.jupiter.api.BeforeEach;
@@ -30,6 +33,7 @@
3033
import org.mockito.junit.jupiter.MockitoSettings;
3134
import org.mockito.quality.Strictness;
3235
import uk.gov.hmcts.reform.iacaseapi.domain.DateProvider;
36+
import uk.gov.hmcts.reform.iacaseapi.domain.entities.AppealType;
3337
import uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCase;
3438
import uk.gov.hmcts.reform.iacaseapi.domain.entities.AsylumCaseFieldDefinition;
3539
import uk.gov.hmcts.reform.iacaseapi.domain.entities.Parties;
@@ -49,6 +53,7 @@ class RequestRespondentReviewPreparerTest {
4953

5054
private static final int DUE_IN_DAYS = 14;
5155
private static final int ADA_DUE_IN_DAYS = 2;
56+
private static final int DETAINED_DUE_IN_DAYS = 7;
5257
@Mock
5358
private DateProvider dateProvider;
5459
@Mock
@@ -73,7 +78,7 @@ class RequestRespondentReviewPreparerTest {
7378
@BeforeEach
7479
public void setUp() {
7580
requestRespondentReviewPreparer =
76-
new RequestRespondentReviewPreparer(DUE_IN_DAYS, ADA_DUE_IN_DAYS, dateProvider, dueDateService);
81+
new RequestRespondentReviewPreparer(DUE_IN_DAYS, ADA_DUE_IN_DAYS, DETAINED_DUE_IN_DAYS, dateProvider, dueDateService);
7782
}
7883

7984
@ParameterizedTest
@@ -186,4 +191,64 @@ void should_not_allow_null_arguments() {
186191
.hasMessage("callback must not be null")
187192
.isExactlyInstanceOf(NullPointerException.class);
188193
}
194+
195+
@Test
196+
void should_return_due_date_for_accelerated_detained_appeal() {
197+
LocalDate today = LocalDate.of(2025, 5,5);
198+
ZonedDateTime adaDueDate = today.plusDays(ADA_DUE_IN_DAYS).atStartOfDay(ZoneOffset.UTC);
199+
String expectedDueDate = "2025-05-07";
200+
201+
when(callback.getCaseDetails()).thenReturn(caseDetails);
202+
when(callback.getEvent()).thenReturn(Event.REQUEST_RESPONDENT_REVIEW);
203+
when(caseDetails.getCaseData()).thenReturn(asylumCase);
204+
when(asylumCase.read(IS_ACCELERATED_DETAINED_APPEAL, YesOrNo.class)).thenReturn(Optional.of(YesOrNo.YES));
205+
when(dateProvider.now()).thenReturn(today);
206+
when(asylumCase.read(APPEAL_TYPE, AppealType.class)).thenReturn(Optional.of(PA));
207+
when(dueDateService.calculateDueDate(
208+
any(), anyInt()))
209+
.thenReturn(adaDueDate);
210+
211+
PreSubmitCallbackResponse<AsylumCase> response =
212+
requestRespondentReviewPreparer.handle(PreSubmitCallbackStage.ABOUT_TO_START, callback);
213+
214+
verify(asylumCase).write(SEND_DIRECTION_DATE_DUE, expectedDueDate);
215+
}
216+
217+
@Test
218+
void should_return_due_date_for_standard_case() {
219+
LocalDate today = LocalDate.of(2025, 5,5);
220+
String expectedDueDate = "2025-05-19";
221+
222+
when(callback.getCaseDetails()).thenReturn(caseDetails);
223+
when(callback.getEvent()).thenReturn(Event.REQUEST_RESPONDENT_REVIEW);
224+
when(caseDetails.getCaseData()).thenReturn(asylumCase);
225+
when(asylumCase.read(IS_ACCELERATED_DETAINED_APPEAL, YesOrNo.class)).thenReturn(Optional.of(YesOrNo.NO));
226+
when(dateProvider.now()).thenReturn(today);
227+
when(asylumCase.read(APPEAL_TYPE, AppealType.class)).thenReturn(Optional.of(PA));
228+
229+
PreSubmitCallbackResponse<AsylumCase> response =
230+
requestRespondentReviewPreparer.handle(PreSubmitCallbackStage.ABOUT_TO_START, callback);
231+
232+
verify(asylumCase).write(SEND_DIRECTION_DATE_DUE, expectedDueDate);
233+
}
234+
235+
@Test
236+
void should_return_due_date_for_detained_case() {
237+
LocalDate today = LocalDate.of(2025, 5,5);
238+
String expectedDueDate = "2025-05-12";
239+
240+
when(callback.getCaseDetails()).thenReturn(caseDetails);
241+
when(callback.getEvent()).thenReturn(Event.REQUEST_RESPONDENT_REVIEW);
242+
when(caseDetails.getCaseData()).thenReturn(asylumCase);
243+
when(asylumCase.read(IS_ACCELERATED_DETAINED_APPEAL, YesOrNo.class)).thenReturn(Optional.of(YesOrNo.NO));
244+
when(asylumCase.read(APPELLANT_IN_DETENTION, YesOrNo.class)).thenReturn(Optional.of(YesOrNo.YES));
245+
when(dateProvider.now()).thenReturn(today);
246+
when(asylumCase.read(APPEAL_TYPE, AppealType.class)).thenReturn(Optional.of(PA));
247+
248+
PreSubmitCallbackResponse<AsylumCase> response =
249+
requestRespondentReviewPreparer.handle(PreSubmitCallbackStage.ABOUT_TO_START, callback);
250+
251+
verify(asylumCase).write(SEND_DIRECTION_DATE_DUE, expectedDueDate);
252+
}
253+
189254
}

0 commit comments

Comments
 (0)