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

RIA-7911 Update hearing adjustments #739

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
{
"description": "RIA-7322 Internal hearing requirements updated letter - ADA",
"request": {
"uri": "/asylum/ccdAboutToSubmit",
"credentials": "CaseOfficer",
"input": {
"id": 7322,
"eventId": "updateHearingRequirements",
"state": "awaitingRespondentEvidence",
"caseData": {
"template": "minimal-internal-appeal-submitted.json",
"replacements": {
"appellantInDetention": "Yes",
"isAcceleratedDetainedAppeal": "Yes"
}
}
}
},
"expectation": {
"status": 200,
"errors": [],
"caseData": {
"template": "minimal-internal-appeal-submitted.json",
"replacements": {
"appellantInDetention": "Yes",
"isAcceleratedDetainedAppeal": "Yes",
"notificationAttachmentDocuments": [
{
"id": "1",
"value": {
"tag": "internalHearingRequirementsUpdatedLetter",
"document": {
"document_url": "$/http.+\/documents/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/",
"document_filename": "PA 12345 2019-Awan-hearing-requirements-updated-letter.PDF",
"document_binary_url": "$/http.+\/documents/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\/binary/"
},
"suppliedBy": "",
"description": "",
"dateUploaded": "{$TODAY}"
}
}
]
}
}
}
}
{
"description": "RIA-7911 Internal hearing adjustments updated letter - ADA",
"request": {
"uri": "/asylum/ccdAboutToSubmit",
"credentials": "CaseOfficer",
"input": {
"id": 7911,
"eventId": "updateHearingAdjustments",
"state": "awaitingRespondentEvidence",
"caseData": {
"template": "minimal-internal-appeal-submitted.json",
"replacements": {
"appellantInDetention": "Yes",
"isAcceleratedDetainedAppeal": "Yes"
}
}
}
},
"expectation": {
"status": 200,
"errors": [],
"caseData": {
"template": "minimal-internal-appeal-submitted.json",
"replacements": {
"appellantInDetention": "Yes",
"isAcceleratedDetainedAppeal": "Yes",
"notificationAttachmentDocuments": [
{
"id": "1",
"value": {
"tag": "internalHearingAdjustmentsUpdatedLetter",
"document": {
"document_url": "$/http.+\/documents/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/",
"document_filename": "PA 12345 2019-Awan-hearing-adjustments-updated-letter.PDF",
"document_binary_url": "$/http.+\/documents/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\/binary/"
},
"suppliedBy": "",
"description": "",
"dateUploaded": "{$TODAY}"
}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
{
"description": "RIA-7322 Internal hearing requirements updated letter - ADA",
"request": {
"uri": "/asylum/ccdAboutToSubmit",
"credentials": "CaseOfficer",
"input": {
"id": 7322,
"eventId": "updateHearingRequirements",
"state": "awaitingRespondentEvidence",
"caseData": {
"template": "minimal-internal-appeal-submitted.json",
"replacements": {
"appellantInDetention": "Yes",
"isAcceleratedDetainedAppeal": "No"
}
}
}
},
"expectation": {
"status": 200,
"errors": [],
"caseData": {
"template": "minimal-internal-appeal-submitted.json",
"replacements": {
"appellantInDetention": "Yes",
"isAcceleratedDetainedAppeal": "No",
"notificationAttachmentDocuments": [
{
"id": "1",
"value": {
"tag": "internalHearingRequirementsUpdatedLetter",
"document": {
"document_url": "$/http.+\/documents/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/",
"document_filename": "PA 12345 2019-Awan-hearing-requirements-updated-letter.PDF",
"document_binary_url": "$/http.+\/documents/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\/binary/"
},
"suppliedBy": "",
"description": "",
"dateUploaded": "{$TODAY}"
}
}
]
}
}
}
}
{
"description": "RIA-7911 Internal hearing adjustments updated letter - ADA",
"request": {
"uri": "/asylum/ccdAboutToSubmit",
"credentials": "CaseOfficer",
"input": {
"id": 7911,
"eventId": "updateHearingAdjustments",
"state": "awaitingRespondentEvidence",
"caseData": {
"template": "minimal-internal-appeal-submitted.json",
"replacements": {
"appellantInDetention": "Yes",
"isAcceleratedDetainedAppeal": "No"
}
}
}
},
"expectation": {
"status": 200,
"errors": [],
"caseData": {
"template": "minimal-internal-appeal-submitted.json",
"replacements": {
"appellantInDetention": "Yes",
"isAcceleratedDetainedAppeal": "No",
"notificationAttachmentDocuments": [
{
"id": "1",
"value": {
"tag": "internalHearingAdjustmentsUpdatedLetter",
"document": {
"document_url": "$/http.+\/documents/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/",
"document_filename": "PA 12345 2019-Awan-hearing-adjustments-updated-letter.PDF",
"document_binary_url": "$/http.+\/documents/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\/binary/"
},
"suppliedBy": "",
"description": "",
"dateUploaded": "{$TODAY}"
}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public enum DocumentTag {
INTERNAL_FTPA_SUBMITTED_APPELLANT_LETTER("internalFtpaSubmittedAppellantLetter", CaseType.ASYLUM),
INTERNAL_APPELLANT_FTPA_DECIDED_LETTER("internalAppellantFtpaDecidedLetter", CaseType.ASYLUM),
INTERNAL_HO_FTPA_DECIDED_LETTER("internalHoFtpaDecidedLetter", CaseType.ASYLUM),
INTERNAL_HEARING_REQUIREMENTS_UPDATED_LETTER("internalHearingRequirementsUpdatedLetter", CaseType.ASYLUM),
INTERNAL_HEARING_ADJUSTMENTS_UPDATED_LETTER("internalHearingAdjustmentsUpdatedLetter", CaseType.ASYLUM),
MAINTAIN_CASE_UNLINK_APPEAL_LETTER("maintainCaseUnlinkAppealLetter", CaseType.ASYLUM),
MAINTAIN_CASE_LINK_APPEAL_LETTER("maintainCaseLinkAppealLetter", CaseType.ASYLUM),
INTERNAL_UPLOAD_ADDITIONAL_EVIDENCE_LETTER("internalUploadAdditionalEvidenceLetter", CaseType.ASYLUM),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public enum Event {
ADD_APPEAL_RESPONSE("addAppealResponse", CaseType.ASYLUM),
REQUEST_HEARING_REQUIREMENTS("requestHearingRequirements", CaseType.ASYLUM),
DRAFT_HEARING_REQUIREMENTS("draftHearingRequirements", CaseType.ASYLUM),
UPDATE_HEARING_REQUIREMENTS("updateHearingRequirements", CaseType.ASYLUM),
CHANGE_DIRECTION_DUE_DATE("changeDirectionDueDate", CaseType.ASYLUM),
UPLOAD_ADDITIONAL_EVIDENCE("uploadAdditionalEvidence", CaseType.ASYLUM),
LIST_CASE("listCase", CaseType.ASYLUM),
Expand Down Expand Up @@ -70,6 +69,10 @@ public enum Event {
MAKE_NEW_APPLICATION("makeNewApplication", CaseType.BAIL),
EDIT_BAIL_APPLICATION_AFTER_SUBMIT("editBailApplicationAfterSubmit", CaseType.BAIL),
UPLOAD_SIGNED_DECISION_NOTICE("uploadSignedDecisionNotice", CaseType.BAIL),

UPDATE_HEARING_REQUIREMENTS("updateHearingRequirements", CaseType.ASYLUM),
UPDATE_HEARING_ADJUSTMENTS("updateHearingAdjustments", CaseType.ASYLUM),

@JsonEnumDefaultValue
UNKNOWN("unknown", CaseType.UNKNOWN);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
package uk.gov.hmcts.reform.iacasedocumentsapi.domain.handlers.presubmit.letter;
import static java.util.Objects.requireNonNull;
import static uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.AsylumCaseDefinition.NOTIFICATION_ATTACHMENT_DOCUMENTS;
import static uk.gov.hmcts.reform.iacasedocumentsapi.domain.utils.AsylumCaseUtils.isAppellantInDetention;
import static uk.gov.hmcts.reform.iacasedocumentsapi.domain.utils.AsylumCaseUtils.isInternalCase;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.AsylumCase;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.DocumentTag;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.ccd.CaseDetails;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.ccd.Event;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.ccd.callback.Callback;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.ccd.callback.PreSubmitCallbackResponse;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.ccd.callback.PreSubmitCallbackStage;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.ccd.field.Document;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.handlers.PreSubmitCallbackHandler;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.service.DocumentCreator;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.service.DocumentHandler;
@Component
public class InternalHearingRequirementsUpdatedLetterGenerator implements PreSubmitCallbackHandler<AsylumCase> {
private final DocumentCreator<AsylumCase> internalHearingRequirementsUpdatedLetter;
private final DocumentHandler documentHandler;
public InternalHearingRequirementsUpdatedLetterGenerator(
@Qualifier("internalHearingRequirementsUpdatedLetter") DocumentCreator<AsylumCase> internalHearingRequirementsUpdatedLetter,
DocumentHandler documentHandler
) {
this.internalHearingRequirementsUpdatedLetter = internalHearingRequirementsUpdatedLetter;
this.documentHandler = documentHandler;
}
public boolean canHandle(
PreSubmitCallbackStage callbackStage,
Callback<AsylumCase> callback
) {
requireNonNull(callbackStage, "callbackStage must not be null");
requireNonNull(callback, "callback must not be null");
AsylumCase asylumCase = callback.getCaseDetails().getCaseData();
return callbackStage == PreSubmitCallbackStage.ABOUT_TO_SUBMIT
&& callback.getEvent() == Event.UPDATE_HEARING_REQUIREMENTS
&& isInternalCase(asylumCase)
&& isAppellantInDetention(asylumCase);
}
public PreSubmitCallbackResponse<AsylumCase> handle(
PreSubmitCallbackStage callbackStage,
Callback<AsylumCase> callback
) {
if (!canHandle(callbackStage, callback)) {
throw new IllegalStateException("Cannot handle callback");
}
final CaseDetails<AsylumCase> caseDetails = callback.getCaseDetails();
final AsylumCase asylumCase = caseDetails.getCaseData();
Document documentForUpload = internalHearingRequirementsUpdatedLetter.create(caseDetails);
documentHandler.addWithMetadata(
asylumCase,
documentForUpload,
NOTIFICATION_ATTACHMENT_DOCUMENTS,
DocumentTag.INTERNAL_HEARING_REQUIREMENTS_UPDATED_LETTER
);
return new PreSubmitCallbackResponse<>(asylumCase);
}
}
package uk.gov.hmcts.reform.iacasedocumentsapi.domain.handlers.presubmit.letter;

import static java.util.Objects.requireNonNull;
import static uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.AsylumCaseDefinition.NOTIFICATION_ATTACHMENT_DOCUMENTS;
import static uk.gov.hmcts.reform.iacasedocumentsapi.domain.utils.AsylumCaseUtils.isAppellantInDetention;
import static uk.gov.hmcts.reform.iacasedocumentsapi.domain.utils.AsylumCaseUtils.isInternalCase;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.AsylumCase;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.DocumentTag;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.ccd.CaseDetails;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.ccd.Event;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.ccd.callback.Callback;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.ccd.callback.PreSubmitCallbackResponse;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.ccd.callback.PreSubmitCallbackStage;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.entities.ccd.field.Document;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.handlers.PreSubmitCallbackHandler;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.service.DocumentCreator;
import uk.gov.hmcts.reform.iacasedocumentsapi.domain.service.DocumentHandler;

@Component
public class InternalHearingAdjustmentsUpdatedLetterGenerator implements PreSubmitCallbackHandler<AsylumCase> {

private final DocumentCreator<AsylumCase> internalHearingAdjustmentsUpdatedLetter;
private final DocumentHandler documentHandler;

public InternalHearingAdjustmentsUpdatedLetterGenerator(
@Qualifier("internalHearingAdjustmentsUpdatedLetter") DocumentCreator<AsylumCase> internalHearingAdjustmentsUpdatedLetter,
DocumentHandler documentHandler
) {
this.internalHearingAdjustmentsUpdatedLetter = internalHearingAdjustmentsUpdatedLetter;
this.documentHandler = documentHandler;
}

public boolean canHandle(
PreSubmitCallbackStage callbackStage,
Callback<AsylumCase> callback
) {
requireNonNull(callbackStage, "callbackStage must not be null");
requireNonNull(callback, "callback must not be null");
AsylumCase asylumCase = callback.getCaseDetails().getCaseData();

return callbackStage == PreSubmitCallbackStage.ABOUT_TO_SUBMIT
&& callback.getEvent() == Event.UPDATE_HEARING_ADJUSTMENTS
&& isInternalCase(asylumCase)
&& isAppellantInDetention(asylumCase);
}

public PreSubmitCallbackResponse<AsylumCase> handle(
PreSubmitCallbackStage callbackStage,
Callback<AsylumCase> callback
) {
if (!canHandle(callbackStage, callback)) {
throw new IllegalStateException("Cannot handle callback");
}

final CaseDetails<AsylumCase> caseDetails = callback.getCaseDetails();
final AsylumCase asylumCase = caseDetails.getCaseData();

Document documentForUpload = internalHearingAdjustmentsUpdatedLetter.create(caseDetails);

documentHandler.addWithMetadata(
asylumCase,
documentForUpload,
NOTIFICATION_ATTACHMENT_DOCUMENTS,
DocumentTag.INTERNAL_HEARING_ADJUSTMENTS_UPDATED_LETTER
);

return new PreSubmitCallbackResponse<>(asylumCase);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ private int bundlePositionIndex(DocumentWithMetadata document) {
case INTERNAL_HO_FTPA_DECIDED_LETTER:
log.warn("INTERNAL_HO_FTPA_DECIDED_LETTER tag should not be checked for bundle ordering, document desc: {}", document.getDescription());
return 54;
case INTERNAL_HEARING_REQUIREMENTS_UPDATED_LETTER:
log.warn("INTERNAL_HEARING_REQUIREMENTS_UPDATED_LETTER tag should not be checked for bundle ordering, document desc: {}", document.getDescription());
case INTERNAL_HEARING_ADJUSTMENTS_UPDATED_LETTER:
log.warn("INTERNAL_HEARING_ADJUSTMENTS_UPDATED_LETTER tag should not be checked for bundle ordering, document desc: {}", document.getDescription());
return 55;
case INTERNAL_DECIDE_HOME_OFFICE_APPLICATION_LETTER:
log.warn("INTERNAL_DECIDE_HOME_OFFICE_APPLICATION_LETTER tag should not be checked for bundle ordering, document desc: {}", document.getDescription());
Expand Down
Loading
Loading