Skip to content

Commit

Permalink
Merge branch 'master' into SSCS-12139_send_to_interloc_work_types
Browse files Browse the repository at this point in the history
  • Loading branch information
nickhill111 committed Nov 30, 2023
2 parents 97928db + 973babc commit 7944ecd
Show file tree
Hide file tree
Showing 25 changed files with 151 additions and 126 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ dependencies {
implementation group: 'com.github.hmcts', name: 'document-management-client', version: '7.0.0'
implementation group: 'com.github.hmcts', name: 'cmc-pdf-service-client', version: '7.0.1'

implementation group: 'com.github.hmcts', name: 'sscs-common', version: '777aeb427c'
implementation group: 'com.github.hmcts', name: 'sscs-common', version: '27cdde3'
implementation group: 'com.github.hmcts', name: 'sscs-pdf-email-common', version: '1.8.10'

implementation group: 'com.azure', name: 'azure-core', version: '1.42.0'
Expand Down
2 changes: 1 addition & 1 deletion charts/sscs-tribunals-api/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: sscs-tribunals-api
home: https://github.com/hmcts/sscs-tribunals-case-api
version: 0.0.119
version: 0.0.120
description: SSCS Tribunals Case API
maintainers:
- name: HMCTS SSCS Team
Expand Down
3 changes: 2 additions & 1 deletion charts/sscs-tribunals-api/values.ccd.preview.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ sscs-tribunals-frontend:
FT_WELSH: true
PCQ_ENABLED: true
MULTIPLE_DRAFTS_ENABLED: true
ALLOW_CONFIG_MUTATIONS: true
TRIBUNALS_CASE_API_URL: http://${SERVICE_NAME}-java
UPLOAD_EVIDENCE_URL: http://${SERVICE_NAME}/evidence/upload
SERVICES_IDAM_LOGIN_URL: https://idam-web-public.aat.platform.hmcts.net/login
Expand Down Expand Up @@ -775,4 +776,4 @@ servicebus:
- name: main-topic
subscriptionNeeded: yes
queues:
- name: sscs-orchestrator-queue-preview
- name: sscs-orchestrator-queue-preview
1 change: 1 addition & 0 deletions charts/sscs-tribunals-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ java:
WORK_ALLOCATION_FEATURE: false
HEARINGS_EVENT_QUEUE_NAME: tribunals-to-hearing-api-{{ .Values.global.environment }}
CASE_ACCESS_MANAGEMENT_FEATURE: false
ELINKS_V2_FEATURE_ENABLED: false

idam-pr:
enabled: false
Expand Down
1 change: 1 addition & 0 deletions config/owasp/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<cve>CVE-2023-45648</cve>
<cve>CVE-2023-35116</cve>
<cve>CVE-2023-4586</cve>
<cve>CVE-2023-36052</cve>
<cve>CVE-2023-46604</cve>
</suppress>
</suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ pdf.api.url=${PDF_API_URL:http://rpe-pdf-service-aat.service.core-compute-aat.in

document_management.url=${TEST_DOCUMENT_MANAGEMENT_URL:http://dm-store:5005}
feature.case-access-management.enabled=true
feature.elinksV2.enabled: ${ELINKS_V2_FEATURE_ENABLED:false}
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,14 @@ protected boolean isBenefitTypeValidToHideNino(Optional<Benefit> benefitType) {
|| SscsType.SSCS5.equals(benefit.getSscsType())).isPresent();
}

protected PreSubmitCallbackResponse<SscsCaseData> issueDocument(Callback<SscsCaseData> callback, DocumentType documentType, String templateId, GenerateFile generateFile, String userAuthorisation) {
protected PreSubmitCallbackResponse<SscsCaseData> issueDocument(Callback<SscsCaseData> callback, DocumentType documentType,
String templateId, GenerateFile generateFile, String userAuthorisation) {
return issueDocument(callback, documentType, templateId, generateFile, userAuthorisation, false, false);
}

protected PreSubmitCallbackResponse<SscsCaseData> issueDocument(Callback<SscsCaseData> callback, DocumentType documentType, String templateId, GenerateFile generateFile, String userAuthorisation, boolean isPostHearingsEnabled, boolean isPostHearingsBEnabled) {
protected PreSubmitCallbackResponse<SscsCaseData> issueDocument(Callback<SscsCaseData> callback, DocumentType documentType,
String templateId, GenerateFile generateFile, String userAuthorisation,
boolean isPostHearingsEnabled, boolean isPostHearingsBEnabled) {
SscsCaseData caseData = callback.getCaseDetails().getCaseData();

if ((ADJOURNMENT_NOTICE.equals(documentType) || DRAFT_ADJOURNMENT_NOTICE.equals(documentType))
Expand All @@ -136,16 +139,12 @@ protected PreSubmitCallbackResponse<SscsCaseData> issueDocument(Callback<SscsCas
}

String documentUrl = Optional.ofNullable(getDocumentFromCaseData(caseData)).map(DocumentLink::getDocumentUrl).orElse(null);

LocalDate dateAdded = Optional.ofNullable(caseData.getDocumentStaging().getDateAdded()).orElse(LocalDate.now());

String documentTypeLabel = getDocumentTypeLabel(caseData, documentType, isPostHearingsEnabled);

String embeddedDocumentTypeLabel = getEmbeddedDocumentTypeLabel(caseData, documentType, documentTypeLabel, isPostHearingsEnabled);
boolean isScottish = Optional.ofNullable(caseData.getRegionalProcessingCenter()).map(f -> equalsIgnoreCase(f.getName(), GLASGOW)).orElse(false);

PreSubmitCallbackResponse<SscsCaseData> response = new PreSubmitCallbackResponse<>(caseData);

FormPayload formPayload = createPayload(response, caseData, embeddedDocumentTypeLabel, dateAdded, LocalDate.now(), isScottish, isPostHearingsEnabled, isPostHearingsBEnabled, userAuthorisation);

if (!response.getErrors().isEmpty()) {
Expand All @@ -160,11 +159,8 @@ protected PreSubmitCallbackResponse<SscsCaseData> issueDocument(Callback<SscsCas
.build();

log.info(String.format("Generating %s document isScottish = %s", documentTypeLabel, isScottish));

final String generatedFileUrl = generateFile.assemble(params);

documentTypeLabel = documentTypeLabel + ((DRAFT_CORRECTED_NOTICE.equals(documentType) || DRAFT_DECISION_NOTICE.equals(documentType) || DRAFT_ADJOURNMENT_NOTICE.equals(documentType)) ? " generated" : " issued");

final String filename = String.format("%s on %s.pdf", documentTypeLabel, dateAdded.format(DateTimeFormatter.ofPattern("dd-MM-yyyy")));

DocumentLink previewFile = DocumentLink.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@ public PreSubmitCallbackResponse<SscsCaseData> preview(Callback<SscsCaseData> ca
return preview(callback, documentType, userAuthorisation, showIssueDate, false, false);
}

public PreSubmitCallbackResponse<SscsCaseData> preview(Callback<SscsCaseData> callback, DocumentType documentType, String userAuthorisation, boolean showIssueDate, boolean isPostHearingsEnabled, boolean isPostHearingsBEnabled) {

public PreSubmitCallbackResponse<SscsCaseData> preview(Callback<SscsCaseData> callback, DocumentType documentType,
String userAuthorisation, boolean showIssueDate,
boolean isPostHearingsEnabled, boolean isPostHearingsBEnabled) {
this.showIssueDate = showIssueDate;

SscsCaseData sscsCaseData = callback.getCaseDetails().getCaseData();

PreSubmitCallbackResponse<SscsCaseData> preSubmitCallbackResponse = new PreSubmitCallbackResponse<>(sscsCaseData);

setGeneratedDateIfRequired(sscsCaseData, callback.getEvent());

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ public PreSubmitCallbackResponse<SscsCaseData> handle(CallbackType callbackType,

if (!StringUtils.isEmpty(existingLanguage)) {
Language language = verbalLanguagesService.getVerbalLanguage(existingLanguage);
DynamicListItem dynamicListItem = utils.getLanguageDynamicListItem(language);
interpreterLanguages.setValue(dynamicListItem);
if (null != language) {
DynamicListItem dynamicListItem = utils.getLanguageDynamicListItem(language);
interpreterLanguages.setValue(dynamicListItem);
}
}

hearingOptions.setLanguagesList(interpreterLanguages);
log.info("Populated {} Languages in DynamicList for caseId {} for update to case data event",
interpreterLanguages.getListItems().size(), caseId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public PreSubmitCallbackResponse<SscsCaseData> handle(CallbackType callbackType,
validateBenefitIssueCode(sscsCaseData, preSubmitCallbackResponse);
}
setCaseCode(preSubmitCallbackResponse, callback, hasSuperUserRole);
updateHearingOptionLanguageFromSelectedList(sscsCaseData);
validateBenefitForCase(preSubmitCallbackResponse, callback, hasSuperUserRole);

if (!preSubmitCallbackResponse.getErrors().isEmpty()) {
Expand Down Expand Up @@ -497,11 +496,4 @@ private static String resolvePostCode(SscsCaseData sscsCaseData) {
return sscsCaseData.getAppeal().getAppellant().getAddress().getPostcode();
}

private void updateHearingOptionLanguageFromSelectedList(SscsCaseData sscsCaseData) {
HearingOptions hearingOptions = sscsCaseData.getAppeal().getHearingOptions();
if (hearingOptions != null) {
DynamicList languagesList = hearingOptions.getLanguagesList();
hearingOptions.setLanguages(isNull(languagesList) ? "" : languagesList.getValue().getLabel());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,14 @@ public PreSubmitCallbackResponse<SscsCaseData> handle(CallbackType callbackType,
// Given the user selects No to generate notice option and has uploaded their custom adjournment notice document.
// Then don't generate the system default adjournment notice document.
if (YesNo.isYes(sscsCaseData.getAdjournment().getGenerateNotice())) {

if (sscsCaseData.getAdjournment().getGeneratedDate() == null) {
response.addError("Adjourn case generated date not found. Please use 'Adjourn case' event or upload your adjourn case document.");
} else {
previewService.preview(callback, DocumentType.ADJOURNMENT_NOTICE, userAuthorisation, true);
}

} else if (sscsCaseData.getAdjournment().getPreviewDocument() == null) {
response.addError("No draft adjournment notice found on case. Please use 'Adjourn case' event or upload your adjourn case document.");
}

return response;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import uk.gov.hmcts.reform.sscs.ccd.domain.DocumentLink;
import uk.gov.hmcts.reform.sscs.ccd.domain.EventType;
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsCaseData;
import uk.gov.hmcts.reform.sscs.ccd.domain.YesNo;
import uk.gov.hmcts.reform.sscs.ccd.presubmit.PreSubmitCallbackHandler;
import uk.gov.hmcts.reform.sscs.ccd.presubmit.writefinaldecision.WriteFinalDecisionBenefitTypeHelper;
import uk.gov.hmcts.reform.sscs.ccd.presubmit.writefinaldecision.WriteFinalDecisionPreviewDecisionServiceBase;
Expand Down Expand Up @@ -62,7 +63,10 @@ public PreSubmitCallbackResponse<SscsCaseData> handle(CallbackType callbackType,
DocumentType docType = SscsUtil.getIssueFinalDecisionDocumentType(sscsCaseData, isPostHearingsEnabled);

WriteFinalDecisionPreviewDecisionServiceBase previewDecisionService = decisionNoticeService.getPreviewService(benefitType);
previewDecisionService.preview(callback, docType, userAuthorisation, true, isPostHearingsEnabled, isPostHearingsBEnabled);

if (YesNo.isYes(sscsCaseData.getSscsFinalDecisionCaseData().getWriteFinalDecisionGenerateNotice())) {
previewDecisionService.preview(callback, docType, userAuthorisation, true, isPostHearingsEnabled, isPostHearingsBEnabled);
}
} else {
response.addError("No draft final decision notice found on case. Please use 'Write final decision' event before trying to issue.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import uk.gov.hmcts.reform.sscs.ccd.presubmit.PreSubmitCallbackHandler;
import uk.gov.hmcts.reform.sscs.service.FooterService;
import uk.gov.hmcts.reform.sscs.service.PostponementRequestService;
import uk.gov.hmcts.reform.sscs.util.SscsUtil;

@Service
public class PostponementRequestAboutToSubmitHandler implements PreSubmitCallbackHandler<SscsCaseData> {
Expand Down Expand Up @@ -49,7 +48,7 @@ public PreSubmitCallbackResponse<SscsCaseData> handle(CallbackType callbackType,
if (response.getErrors().isEmpty()) {
postponementRequestService.processPostponementRequest(sscsCaseData, UploadParty.DWP);
List<SscsDocument> documents = sscsCaseData.getSscsDocument();
SscsUtil.addDocumentToBundle(footerService, sscsCaseData, documents.get(documents.size() - 1));
documents.get(documents.size() - 1).getValue().setBundleAddition(footerService.getNextBundleAddition(documents));
}

return response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public PreSubmitCallbackResponse<SscsCaseData> handle(CallbackType callbackType,

if (userRoles.contains(UserRole.JUDGE.getValue())
&& !userRoles.contains(UserRole.SALARIED_JUDGE.getValue())) {
preSubmitCallbackResponse.addError("You do not have access to proceed");
preSubmitCallbackResponse.addError("You have already issued a final decision, only a salaried Judge can correct it");

return preSubmitCallbackResponse;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ public PreSubmitCallbackResponse<SscsCaseData> handle(CallbackType callbackType,

outcomeService.validate(preSubmitCallbackResponse, sscsCaseData);

if (!(State.READY_TO_LIST.equals(state)
|| State.WITH_DWP.equals(sscsCaseData.getState()))) {
if (!(State.READY_TO_LIST.equals(state) || State.WITH_DWP.equals(sscsCaseData.getState()))) {
sscsCaseData.setPreviousState(state);
}

Expand Down
7 changes: 0 additions & 7 deletions src/main/java/uk/gov/hmcts/reform/sscs/util/SscsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,6 @@ public static void addDocumentToCaseDataDocuments(SscsCaseData caseData, SscsDoc
caseData.setSscsDocument(documents);
}

public static void addDocumentToBundle(FooterService footerService, SscsCaseData sscsCaseData, SscsDocument sscsDocument) {
DocumentLink url = sscsDocument.getValue().getDocumentLink();
DocumentType documentType = DocumentType.fromValue(sscsDocument.getValue().getDocumentType());
String dateIssued = LocalDate.now().format(DateTimeFormatter.ofPattern("dd-MM-yyyy"));
footerService.createFooterAndAddDocToCase(url, sscsCaseData, documentType, dateIssued, null, null, null);
}

public static DocumentType getPostHearingReviewDocumentType(PostHearing postHearing, boolean isPostHearingsEnabled) {
if (isPostHearingsEnabled && nonNull(postHearing.getReviewType())) {
return getPostHearingReviewDocumentType(postHearing);
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/config/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ feature.gaps-switchover.enabled: ${GAPS_SWITCHOVER_FEATURE:false}
feature.snl.enabled: ${SCHEDULE_LISTING_FEATURE:true}
feature.snl.adjournment.enabled: ${ADJOURNMENT_FEATURE:true}
feature.case-access-management.enabled: ${CASE_ACCESS_MANAGEMENT_FEATURE:false}
feature.postHearings.enabled: ${POST_HEARINGS_FEATURE:true}
feature.postHearingsB.enabled: ${POST_HEARINGS_B_FEATURE:true}
feature.postHearings.enabled: ${POST_HEARINGS_FEATURE:false}
feature.postHearingsB.enabled: ${POST_HEARINGS_B_FEATURE:false}
feature.elinksV2.enabled: ${ELINKS_V2_FEATURE_ENABLED:false}

case_document_am.url=${CASE_DOCUMENT_AM_URL:http://localhost:4455}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,25 @@ public void givenThatOriginalLanguageFieldIsNonEmpty_thenSetDynamicListInitialVa
Assertions.assertNotNull(hearingOptions.getLanguagesList());
Assertions.assertEquals("Welsh", hearingOptions.getLanguagesList().getValue().getLabel());
}

@Test
public void givenThatOriginalLanguageFieldIsNonEmptyandInvalid_thenSetDynamicListInitialValue() {
sscsCaseData = CaseDataUtils.buildCaseData();
sscsCaseData.getAppeal().getHearingOptions().setLanguages("Wales");

DynamicListItem item = new DynamicListItem("Wales", "Wales");
DynamicList list = new DynamicList(null, List.of(item));

given(caseDetails.getCaseData()).willReturn(sscsCaseData);
given(dynamicListLanguageUtil.generateInterpreterLanguageFields(any())).willReturn(list);
given(dynamicListLanguageUtil.getLanguageDynamicListItem(any())).willReturn(item);
given(verbalLanguagesService.getVerbalLanguage(any())).willReturn(null);

PreSubmitCallbackResponse<SscsCaseData> response = handler.handle(ABOUT_TO_START, callback, USER_AUTHORISATION);
HearingOptions hearingOptions = sscsCaseData.getAppeal().getHearingOptions();

Assertions.assertEquals(0, response.getErrors().size());
Assertions.assertNotNull(hearingOptions.getLanguagesList());
Assertions.assertNull(hearingOptions.getLanguagesList().getValue());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1662,30 +1662,30 @@ void givenSscs5CaseBenefitCodeAndDescriptionSuperUser_thenErrorIsShownForInvalid
}

@Test
public void givenAnyCaseAndLanguageIsNotSelectedFromList_thenSetTheOriginalLanguageFieldToEmpty() {
public void givenAnyCaseAndLanguageIsNotSet_thenSetTheLanguageFieldToEmpty() {
Appeal appeal = callback.getCaseDetails().getCaseData().getAppeal();
appeal.getBenefitType().setCode("PIP");
appeal.setHearingType("paper");
appeal.setHearingOptions(HearingOptions.builder().wantsToAttend("Yes").languagesList(null).build());
appeal.setHearingOptions(HearingOptions.builder().wantsToAttend("Yes").languages(null).build());

PreSubmitCallbackResponse<SscsCaseData> response = handler.handle(ABOUT_TO_SUBMIT, callback, USER_AUTHORISATION);

assertEquals(0, response.getWarnings().size());
assertEquals("", appeal.getHearingOptions().getLanguages());
assertNull(appeal.getHearingOptions().getLanguages());
}

@ParameterizedTest
@CsvSource({
"Spanish", "Chittagonain", "Czech", "Danish", "Dinka", "Maldivian", "Toura", "Douala", "Dutch", "Dioula",
"Efik", "Estonian", "Ewe", "Ewondo", "Farsi", "Fanti", "Fijian", "French"
})
public void givenAnyCaseAndLanguageIsSelectedFromList_thenSetTheOriginalLanguageFieldToValue(String language) {
public void givenAnyCaseAndLanguageIsSet_thenSetTheLanguageValue(String language) {
Appeal appeal = callback.getCaseDetails().getCaseData().getAppeal();
appeal.getBenefitType().setCode("PIP");
appeal.setHearingType("paper");
HearingOptions hearingOptions = HearingOptions.builder()
.wantsToAttend("Yes")
.languagesList(new DynamicList(language))
.languages(language)
.build();
appeal.setHearingOptions(hearingOptions);

Expand Down
Loading

0 comments on commit 7944ecd

Please sign in to comment.