Skip to content

Commit

Permalink
Merge branch 'master' into SSCSSI-82
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayparekh-hmcts authored Dec 9, 2024
2 parents 35bd511 + 81cd360 commit e5125b2
Show file tree
Hide file tree
Showing 21 changed files with 260 additions and 116 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,10 @@ dependencies {
implementation group: 'com.mchange', name: 'c3p0', version: '0.10.1'
implementation group: 'org.flywaydb', name: 'flyway-core', version: '9.22.3'

implementation group: 'com.github.hmcts', name: 'sscs-common', version: '5.12.21'
implementation group: 'com.github.hmcts', name: 'sscs-common', version: '5.12.22'
implementation group: 'com.github.hmcts', name: 'sscs-pdf-email-common', version: '5.2.21'


implementation group: 'com.azure', name: 'azure-core', version: '1.46.0'
implementation group: 'com.azure', name: 'azure-messaging-servicebus', version: '7.15.1'

Expand Down
2 changes: 1 addition & 1 deletion config/owasp/suppressions.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
<suppress until = "2024-12-09">
<suppress until = "2024-12-23">
<cve>CVE-2023-39017</cve>
<cve>CVE-2024-38820</cve>
<!-- Requires update of elasticsearch lib that has lucene dependency version > 9.12.0 -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package uk.gov.hmcts.reform.sscs.jms.listener;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
Expand All @@ -24,7 +25,18 @@
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.util.ReflectionTestUtils;
import uk.gov.hmcts.reform.sscs.ccd.domain.*;
import uk.gov.hmcts.reform.sscs.ccd.domain.Adjournment;
import uk.gov.hmcts.reform.sscs.ccd.domain.Appeal;
import uk.gov.hmcts.reform.sscs.ccd.domain.Appellant;
import uk.gov.hmcts.reform.sscs.ccd.domain.BenefitCode;
import uk.gov.hmcts.reform.sscs.ccd.domain.HearingOptions;
import uk.gov.hmcts.reform.sscs.ccd.domain.HearingRoute;
import uk.gov.hmcts.reform.sscs.ccd.domain.Issue;
import uk.gov.hmcts.reform.sscs.ccd.domain.Name;
import uk.gov.hmcts.reform.sscs.ccd.domain.RegionalProcessingCenter;
import uk.gov.hmcts.reform.sscs.ccd.domain.SessionCategory;
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsCaseData;
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsCaseDetails;
import uk.gov.hmcts.reform.sscs.ccd.service.UpdateCcdCaseService;
import uk.gov.hmcts.reform.sscs.exception.GetCaseException;
import uk.gov.hmcts.reform.sscs.exception.TribunalsEventProcessingException;
Expand Down Expand Up @@ -112,7 +124,7 @@ public void testHearingsUpdateCase() throws UpdateCaseException, TribunalsEventP
when(refData.getSessionCategoryMaps()).thenReturn(sessionCategoryMaps);
when(refData.getHearingDurations()).thenReturn(hearingDurationsService);
when(refData.getRegionalProcessingCenterService()).thenReturn(regionalProcessingCenterService);
when(regionalProcessingCenterService.getByPostcode(any())).thenReturn(RegionalProcessingCenter.builder().hearingRoute(
when(regionalProcessingCenterService.getByPostcode(any(), anyBoolean())).thenReturn(RegionalProcessingCenter.builder().hearingRoute(
HearingRoute.LIST_ASSIST).build());
when(refData.getVenueService()).thenReturn(venueService);
when(venueService.getActiveRegionalEpimsIdsForRpc(any())).thenReturn(List.of(VenueDetails.builder().epimsId("1").build()));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package uk.gov.hmcts.reform.sscs.jms.listener;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
Expand All @@ -24,7 +25,18 @@
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.util.ReflectionTestUtils;
import uk.gov.hmcts.reform.sscs.ccd.domain.*;
import uk.gov.hmcts.reform.sscs.ccd.domain.Adjournment;
import uk.gov.hmcts.reform.sscs.ccd.domain.Appeal;
import uk.gov.hmcts.reform.sscs.ccd.domain.Appellant;
import uk.gov.hmcts.reform.sscs.ccd.domain.BenefitCode;
import uk.gov.hmcts.reform.sscs.ccd.domain.HearingOptions;
import uk.gov.hmcts.reform.sscs.ccd.domain.HearingRoute;
import uk.gov.hmcts.reform.sscs.ccd.domain.Issue;
import uk.gov.hmcts.reform.sscs.ccd.domain.Name;
import uk.gov.hmcts.reform.sscs.ccd.domain.RegionalProcessingCenter;
import uk.gov.hmcts.reform.sscs.ccd.domain.SessionCategory;
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsCaseData;
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsCaseDetails;
import uk.gov.hmcts.reform.sscs.ccd.service.UpdateCcdCaseService;
import uk.gov.hmcts.reform.sscs.exception.GetCaseException;
import uk.gov.hmcts.reform.sscs.exception.TribunalsEventProcessingException;
Expand Down Expand Up @@ -109,7 +121,7 @@ public void testHearingsUpdateCaseV2() throws UpdateCaseException, TribunalsEven
when(refData.getSessionCategoryMaps()).thenReturn(sessionCategoryMaps);
when(refData.getHearingDurations()).thenReturn(hearingDurationsService);
when(refData.getRegionalProcessingCenterService()).thenReturn(regionalProcessingCenterService);
when(regionalProcessingCenterService.getByPostcode(any())).thenReturn(RegionalProcessingCenter.builder().hearingRoute(
when(regionalProcessingCenterService.getByPostcode(any(), anyBoolean())).thenReturn(RegionalProcessingCenter.builder().hearingRoute(
HearingRoute.LIST_ASSIST).build());
when(refData.getVenueService()).thenReturn(venueService);
when(venueService.getActiveRegionalEpimsIdsForRpc(any())).thenReturn(List.of(VenueDetails.builder().epimsId("1").build()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
import uk.gov.hmcts.reform.sscs.ccd.callback.Callback;
import uk.gov.hmcts.reform.sscs.ccd.callback.CallbackType;
import uk.gov.hmcts.reform.sscs.ccd.callback.PreSubmitCallbackResponse;
import uk.gov.hmcts.reform.sscs.ccd.domain.*;
import uk.gov.hmcts.reform.sscs.ccd.domain.Appeal;
import uk.gov.hmcts.reform.sscs.ccd.domain.BenefitType;
import uk.gov.hmcts.reform.sscs.ccd.domain.DynamicList;
import uk.gov.hmcts.reform.sscs.ccd.domain.DynamicListItem;
import uk.gov.hmcts.reform.sscs.ccd.domain.EventType;
import uk.gov.hmcts.reform.sscs.ccd.domain.HearingOptions;
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsCaseData;
import uk.gov.hmcts.reform.sscs.ccd.presubmit.PreSubmitCallbackHandler;
import uk.gov.hmcts.reform.sscs.reference.data.model.Language;
import uk.gov.hmcts.reform.sscs.reference.data.service.VerbalLanguagesService;
Expand Down Expand Up @@ -97,15 +103,18 @@ private void setupBenefitSelection(SscsCaseData sscsCaseData) {
}

private void setupUkPortsOfEntry(SscsCaseData sscsCaseData) {
final DynamicList ukPortOfEntries = SscsUtil.getPortsOfEntry();
String portOfEntryCode = sscsCaseData.getAppeal().getAppellant().getAddress().getPortOfEntry();
DynamicList portOfEntryDynamicList = sscsCaseData.getAppeal().getAppellant().getAddress().getUkPortOfEntryList();
if (portOfEntryDynamicList == null || portOfEntryDynamicList.getValue() == null) {
final DynamicList ukPortOfEntries = SscsUtil.getPortsOfEntry();
String portOfEntryCode = sscsCaseData.getAppeal().getAppellant().getAddress().getPortOfEntry();

if (isNotEmpty(portOfEntryCode)) {
DynamicListItem selectedPortOfEntry = getSelectedDynamicListItem(ukPortOfEntries.getListItems(), portOfEntryCode);
ukPortOfEntries.setValue(selectedPortOfEntry);
}

if (isNotEmpty(portOfEntryCode)) {
DynamicListItem selectedPortOfEntry = getSelectedDynamicListItem(ukPortOfEntries.getListItems(), portOfEntryCode);
ukPortOfEntries.setValue(selectedPortOfEntry);
sscsCaseData.getAppeal().getAppellant().getAddress().setUkPortOfEntryList(ukPortOfEntries);
}

sscsCaseData.getAppeal().getAppellant().getAddress().setUkPortOfEntryList(ukPortOfEntries);
}

private DynamicListItem getSelectedDynamicListItem(List<DynamicListItem> listItems, String code) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package uk.gov.hmcts.reform.sscs.ccd.presubmit.caseupdated;

import static java.util.Objects.*;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import static java.util.Objects.requireNonNull;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
Expand All @@ -10,14 +11,18 @@
import static uk.gov.hmcts.reform.sscs.ccd.domain.YesNo.YES;
import static uk.gov.hmcts.reform.sscs.ccd.domain.YesNo.isYes;
import static uk.gov.hmcts.reform.sscs.helper.SscsHelper.validateHearingOptionsAndExcludeDates;
import static uk.gov.hmcts.reform.sscs.idam.UserRole.*;
import static uk.gov.hmcts.reform.sscs.idam.UserRole.SUPER_USER;
import static uk.gov.hmcts.reform.sscs.idam.UserRole.SYSTEM_USER;
import static uk.gov.hmcts.reform.sscs.model.AppConstants.IBCA_BENEFIT_CODE;
import static uk.gov.hmcts.reform.sscs.util.OtherPartyDataUtil.isConfidential;
import static uk.gov.hmcts.reform.sscs.util.SscsUtil.handleBenefitType;
import static uk.gov.hmcts.reform.sscs.util.SscsUtil.handleIbcaCase;

import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.validation.ConstraintValidatorContext;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -27,7 +32,27 @@
import uk.gov.hmcts.reform.sscs.ccd.callback.Callback;
import uk.gov.hmcts.reform.sscs.ccd.callback.CallbackType;
import uk.gov.hmcts.reform.sscs.ccd.callback.PreSubmitCallbackResponse;
import uk.gov.hmcts.reform.sscs.ccd.domain.*;
import uk.gov.hmcts.reform.sscs.ccd.domain.Address;
import uk.gov.hmcts.reform.sscs.ccd.domain.Appeal;
import uk.gov.hmcts.reform.sscs.ccd.domain.Appellant;
import uk.gov.hmcts.reform.sscs.ccd.domain.Appointee;
import uk.gov.hmcts.reform.sscs.ccd.domain.Benefit;
import uk.gov.hmcts.reform.sscs.ccd.domain.BenefitType;
import uk.gov.hmcts.reform.sscs.ccd.domain.CaseDetails;
import uk.gov.hmcts.reform.sscs.ccd.domain.CaseManagementLocation;
import uk.gov.hmcts.reform.sscs.ccd.domain.DynamicList;
import uk.gov.hmcts.reform.sscs.ccd.domain.DynamicListItem;
import uk.gov.hmcts.reform.sscs.ccd.domain.Entity;
import uk.gov.hmcts.reform.sscs.ccd.domain.EventType;
import uk.gov.hmcts.reform.sscs.ccd.domain.HearingOptions;
import uk.gov.hmcts.reform.sscs.ccd.domain.HearingType;
import uk.gov.hmcts.reform.sscs.ccd.domain.JointParty;
import uk.gov.hmcts.reform.sscs.ccd.domain.MrnDetails;
import uk.gov.hmcts.reform.sscs.ccd.domain.RegionalProcessingCenter;
import uk.gov.hmcts.reform.sscs.ccd.domain.Representative;
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsCaseData;
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsType;
import uk.gov.hmcts.reform.sscs.ccd.domain.YesNo;
import uk.gov.hmcts.reform.sscs.ccd.presubmit.AssociatedCaseLinkHelper;
import uk.gov.hmcts.reform.sscs.ccd.presubmit.PreSubmitCallbackHandler;
import uk.gov.hmcts.reform.sscs.ccd.presubmit.ResponseEventsAboutToSubmit;
Expand Down Expand Up @@ -141,7 +166,7 @@ public PreSubmitCallbackResponse<SscsCaseData> handle(CallbackType callbackType,
|| isNotBlank(appellant.getAddress().getPortOfEntry()))) {

String postCode = resolvePostCode(sscsCaseData);
RegionalProcessingCenter newRpc = regionalProcessingCenterService.getByPostcode(postCode);
RegionalProcessingCenter newRpc = regionalProcessingCenterService.getByPostcode(postCode, sscsCaseData.isIbcCase());

maybeChangeIsScottish(sscsCaseData.getRegionalProcessingCenter(), newRpc, sscsCaseData);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package uk.gov.hmcts.reform.sscs.domain.wrapper;

import uk.gov.hmcts.reform.sscs.ccd.domain.Benefit;

public class SyaBenefitType {

private String description;
Expand Down Expand Up @@ -38,4 +40,8 @@ public String toString() {
+ ", code='" + code + '\''
+ '}';
}

public boolean isIbc() {
return code.equals(Benefit.INFECTED_BLOOD_COMPENSATION.getShortName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

import static java.util.Objects.requireNonNull;
import static org.apache.commons.lang3.StringUtils.equalsIgnoreCase;
import static uk.gov.hmcts.reform.sscs.ccd.domain.EventType.*;
import static uk.gov.hmcts.reform.sscs.ccd.domain.EventType.APPEAL_TO_PROCEED;
import static uk.gov.hmcts.reform.sscs.ccd.domain.EventType.CASE_UPDATED;
import static uk.gov.hmcts.reform.sscs.ccd.domain.EventType.DWP_RAISE_EXCEPTION;
import static uk.gov.hmcts.reform.sscs.ccd.domain.EventType.INTERLOC_VALID_APPEAL;
import static uk.gov.hmcts.reform.sscs.ccd.domain.EventType.NOT_LISTABLE;
import static uk.gov.hmcts.reform.sscs.ccd.domain.EventType.RESEND_CASE_TO_GAPS2;
import static uk.gov.hmcts.reform.sscs.ccd.domain.EventType.VALID_APPEAL_CREATED;

import java.time.LocalDate;
import java.time.LocalDateTime;
Expand All @@ -15,7 +21,11 @@
import uk.gov.hmcts.reform.sscs.ccd.callback.Callback;
import uk.gov.hmcts.reform.sscs.ccd.callback.CallbackType;
import uk.gov.hmcts.reform.sscs.ccd.callback.DispatchPriority;
import uk.gov.hmcts.reform.sscs.ccd.domain.*;
import uk.gov.hmcts.reform.sscs.ccd.domain.EventType;
import uk.gov.hmcts.reform.sscs.ccd.domain.HearingRoute;
import uk.gov.hmcts.reform.sscs.ccd.domain.RegionalProcessingCenter;
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsCaseData;
import uk.gov.hmcts.reform.sscs.ccd.domain.SscsCaseDetails;
import uk.gov.hmcts.reform.sscs.ccd.service.CcdService;
import uk.gov.hmcts.reform.sscs.ccd.service.UpdateCcdCaseService;
import uk.gov.hmcts.reform.sscs.evidenceshare.service.RoboticsService;
Expand Down Expand Up @@ -161,7 +171,7 @@ private void updateRpc(final SscsCaseData sscsCaseData) {
// Updating the RPC also done on CASE_UPDATED in tribunals-api.
// We should update the case details before sending robotics.
if (sscsCaseData.getAppeal().getAppellant() != null && sscsCaseData.getAppeal().getAppellant().getAddress() != null && sscsCaseData.getAppeal().getAppellant().getAddress().getPostcode() != null) {
RegionalProcessingCenter rpc = regionalProcessingCenterService.getByPostcode(sscsCaseData.getAppeal().getAppellant().getAddress().getPostcode());
RegionalProcessingCenter rpc = regionalProcessingCenterService.getByPostcode(sscsCaseData.getAppeal().getAppellant().getAddress().getPostcode(), sscsCaseData.isIbcCase());
sscsCaseData.setRegionalProcessingCenter(rpc);

if (rpc != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private static List<HearingLocation> getOverrideLocations(SscsCaseData caseData)
private static List<HearingLocation> getPaperCaseLocations(SscsCaseData caseData, ReferenceDataServiceHolder refData) throws ListingException {
if (HearingChannelUtil.isPaperCase(caseData)) {
RegionalProcessingCenter rpc = caseData.getRegionalProcessingCenter();
validatedRpc(rpc, refData);
validatedRpc(rpc, refData, caseData.isIbcCase());

List<VenueDetails> venueDetailsList = refData
.getVenueService()
Expand All @@ -99,11 +99,11 @@ private static List<HearingLocation> getPaperCaseLocations(SscsCaseData caseData
return Collections.emptyList();
}

private static void validatedRpc(RegionalProcessingCenter regionalProcessingCenter, ReferenceDataServiceHolder refData) throws ListingException {
private static void validatedRpc(RegionalProcessingCenter regionalProcessingCenter, ReferenceDataServiceHolder refData, boolean isIbca) throws ListingException {
if (nonNull(regionalProcessingCenter)) {
String regionalProcessingCenterPostCode = regionalProcessingCenter.getPostcode();
RegionalProcessingCenterService regionalProcessingCenterService = refData.getRegionalProcessingCenterService();
RegionalProcessingCenter processingCenterByPostCode = regionalProcessingCenterService.getByPostcode(regionalProcessingCenterPostCode);
RegionalProcessingCenter processingCenterByPostCode = regionalProcessingCenterService.getByPostcode(regionalProcessingCenterPostCode, isIbca);

log.info("rpc by postcode {}", processingCenterByPostCode);

Expand All @@ -124,7 +124,7 @@ private static List<HearingLocation> getAdjournedLocations(SscsCaseData caseData
VenueService venueService = refData.getVenueService();
if (PAPER.equals(adjournment.getTypeOfNextHearing())) {
RegionalProcessingCenter rpc = caseData.getRegionalProcessingCenter();
validatedRpc(rpc, refData);
validatedRpc(rpc, refData, caseData.isIbcCase());

List<VenueDetails> paperVenues = venueService.getActiveRegionalEpimsIdsForRpc(rpc.getEpimsId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;
import uk.gov.hmcts.reform.sscs.ccd.domain.Appeal;
import uk.gov.hmcts.reform.sscs.ccd.domain.Benefit;
import uk.gov.hmcts.reform.sscs.ccd.domain.CaseLink;
import uk.gov.hmcts.reform.sscs.ccd.domain.CaseLinkDetails;
import uk.gov.hmcts.reform.sscs.ccd.domain.CaseManagementLocation;
Expand Down Expand Up @@ -150,9 +149,9 @@ public Long submitAppeal(SyaCaseWrapper appeal, String userToken) {
}

SscsCaseData convertAppealToSscsCaseData(SyaCaseWrapper appeal) {
boolean isIba = appeal.getBenefitType().getCode().equals(Benefit.INFECTED_BLOOD_COMPENSATION.getShortName());
String postCode = resolvePostCode(appeal, isIba);
RegionalProcessingCenter rpc = regionalProcessingCenterService.getByPostcode(isIba ? postCode : getFirstHalfOfPostcode(postCode));
boolean isIbc = appeal.getBenefitType().isIbc();
String postCode = resolvePostCode(appeal, isIbc);
RegionalProcessingCenter rpc = regionalProcessingCenterService.getByPostcode(isIbc ? postCode : getFirstHalfOfPostcode(postCode), isIbc);

SscsCaseData sscsCaseData = rpc == null
? convertSyaToCcdCaseDataV1(appeal, caseAccessManagementFeature)
Expand All @@ -177,7 +176,7 @@ SscsCaseData convertAppealToSscsCaseData(SyaCaseWrapper appeal) {
}

log.info("{} - setting venue name to {}",
isIba
isIbc
? sscsCaseData.getAppeal().getAppellant().getIdentity().getIbcaReference()
: maskNino(sscsCaseData.getAppeal().getAppellant().getIdentity().getNino()),
sscsCaseData.getProcessingVenue());
Expand Down Expand Up @@ -308,9 +307,9 @@ private void associateCase(IdamTokens idamTokens,
}
}

private String resolvePostCode(SyaCaseWrapper appeal, boolean isIba) {
private String resolvePostCode(SyaCaseWrapper appeal, boolean isIbc) {
Boolean inMainlandUk = appeal.getContactDetails().getInMainlandUk();
if (isIba && inMainlandUk != null && inMainlandUk.equals(Boolean.FALSE)) {
if (isIbc && inMainlandUk != null && inMainlandUk.equals(Boolean.FALSE)) {
return appeal.getAppellant().getContactDetails().getPortOfEntry();
} else if (Boolean.TRUE.equals(appeal.getIsAppointee())) {
return Optional.ofNullable(appeal.getAppointee())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private void restoreData(SscsCaseDetails sscsCaseDetails) {

String postCode = sscsCaseData.getAppeal().getAppellant().getAddress().getPostcode();
String firstHalfOfPostcode = getFirstHalfOfPostcode(postCode);
RegionalProcessingCenter rpc = regionalProcessingCenterService.getByPostcode(firstHalfOfPostcode);
RegionalProcessingCenter rpc = regionalProcessingCenterService.getByPostcode(firstHalfOfPostcode, sscsCaseData.isIbcCase());

if (rpc != null) {
sscsCaseData.setRegion(rpc.getName());
Expand Down
Loading

0 comments on commit e5125b2

Please sign in to comment.