Skip to content

Commit

Permalink
CIV-16322 Work allocation task for caseworker to take case offline wh…
Browse files Browse the repository at this point in the history
…en CML of GA is updated (#5991)

* CIV-16322 added code to trigger wa task when cml is not in ea court

* CIV-16322 corrected checkstyle issues

* CIV-16322 added unit test for coverage

* CIV-16322 added a new field gaEaCourtLocation

* CIV-16322 test fix

* Update Jenkinsfile_CNP

* Revert "CIV-16322 test fix"

This reverts commit aea9157.

* CIV-16322 added condition to check only for Lip cases

* Reapply "CIV-16322 test fix"

This reverts commit 3670923.

* Revert "Reapply "CIV-16322 test fix""

This reverts commit 4edf1da.

---------

Co-authored-by: Raja Mani <rajakm@gmail.com>
Co-authored-by: sankhajuria <sankhajuria@gmail.com>
  • Loading branch information
3 people authored Feb 4, 2025
1 parent 442231a commit e2b71a5
Show file tree
Hide file tree
Showing 6 changed files with 219 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import uk.gov.hmcts.reform.civil.callback.CallbackHandler;
import uk.gov.hmcts.reform.civil.callback.CallbackParams;
import uk.gov.hmcts.reform.civil.callback.CaseEvent;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.service.FeatureToggleService;
import uk.gov.hmcts.reform.civil.service.GenAppStateHelperService;

import java.util.List;
Expand All @@ -19,9 +21,9 @@
import static uk.gov.hmcts.reform.civil.callback.CallbackParams.Params.BEARER_TOKEN;
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.TRIGGER_LOCATION_UPDATE;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.TRIGGER_UPDATE_GA_LOCATION;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.TRIGGER_TASK_RECONFIG;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.TRIGGER_TASK_RECONFIG_GA;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.TRIGGER_UPDATE_GA_LOCATION;

@Slf4j
@Service
Expand All @@ -32,6 +34,7 @@ public class TriggerGenAppLocationUpdateCallbackHandler extends CallbackHandler
TRIGGER_TASK_RECONFIG_GA);

private final GenAppStateHelperService helperService;
private final FeatureToggleService featureToggleService;
private final ObjectMapper objectMapper;

@Override
Expand All @@ -48,8 +51,15 @@ public List<CaseEvent> handledEvents() {

private CallbackResponse triggerGaEvent(CallbackParams callbackParams) {
CaseData caseData = callbackParams.getCaseData();
CaseData.CaseDataBuilder<?, ?> caseDataBuilder = caseData.toBuilder();

String authToken = callbackParams.getParams().get(BEARER_TOKEN).toString();
try {
if (!(featureToggleService.isGaForLipsEnabledAndLocationWhiteListed(caseData
.getCaseManagementLocation().getBaseLocation()))
&& caseData.isLipCase()) {
caseDataBuilder.gaEaCourtLocation(YesOrNo.YES);
}
if (caseData.getGeneralApplications() != null && !caseData.getGeneralApplications().isEmpty()) {
caseData = helperService.updateApplicationLocationDetailsInClaim(caseData, authToken);
if (callbackParams.getRequest().getEventId().equals(TRIGGER_UPDATE_GA_LOCATION.name())) {
Expand All @@ -65,7 +75,7 @@ private CallbackResponse triggerGaEvent(CallbackParams callbackParams) {
return AboutToStartOrSubmitCallbackResponse.builder().errors(List.of(errorMessage)).build();
}
return AboutToStartOrSubmitCallbackResponse.builder()
.data(caseData.toBuilder().build().toMap(objectMapper))
.data(caseDataBuilder.build().toMap(objectMapper))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ public class CaseData extends CaseDataParent implements MappableObject {
private final YesOrNo parentClaimantIsApplicant;
private final GAHearingDateGAspec generalAppHearingDate;
private final Document generalAppN245FormUpload;
private final YesOrNo gaEaCourtLocation;

@Builder.Default
private final List<Element<GASolicitorDetailsGAspec>> generalAppRespondentSolicitors = new ArrayList<>();
Expand Down
Loading

0 comments on commit e2b71a5

Please sign in to comment.