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

CIV-10568 Transfer WA task for GA #3470

Merged
merged 27 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
38ffdaf
CIV-10568 initial commit
bhagyashreesharma90 Oct 23, 2023
f6cfc6e
CIV-10568 temp commit
bhagyashreesharma90 Oct 24, 2023
abeb1f7
CIV-10568 delete unwanted changes
bhagyashreesharma90 Oct 25, 2023
04a8481
CIV-10568 fix sonar
bhagyashreesharma90 Oct 25, 2023
a3b16ea
CIV-10568 fix sonar
bhagyashreesharma90 Oct 25, 2023
7f7a9ee
CIV-10568 added camunda event
bhagyashreesharma90 Oct 25, 2023
162c558
Merge branch 'master' into feat/CIV-10568
bhagyashreesharma90 Oct 25, 2023
eac6bc7
Merge branch 'master' into feat/CIV-10568
bhagyashreesharma90 Oct 26, 2023
7af06e9
Merge branch 'master' into feat/CIV-10568
bhagyashreesharma90 Oct 31, 2023
07c73f2
Update TransferOnlineCaseCallbackHandler.java
bhagyashreesharma90 Oct 31, 2023
c832d11
Update FlowStateAllowedEventService.java
bhagyashreesharma90 Oct 31, 2023
ff6f200
Update FlowStateAllowedEventServiceTest.java
bhagyashreesharma90 Oct 31, 2023
f26beb4
Merge branch 'master' into feat/CIV-10568
Azam-Hmcts Oct 31, 2023
4f2cc62
Merge branch 'master' into feat/CIV-10568
bhagyashreesharma90 Nov 2, 2023
083a3ba
Merge branch 'master' into feat/CIV-10568
bhagyashreesharma90 Nov 3, 2023
1eb449f
Merge branch 'master' into feat/CIV-10568
bhagyashreesharma90 Nov 7, 2023
9476d21
Merge branch 'master' into feat/CIV-10568
ShwetaTandel-hmcts Nov 13, 2023
606b34d
Merge branch 'master' into feat/CIV-10568
bhagyashreesharma90 Nov 14, 2023
e88e203
Update TriggerGenAppLocationUpdateCallbackHandlerTest.java
bhagyashreesharma90 Nov 14, 2023
0dbff8b
CIV-10568 add jenkins file to point ccd and camunda PR
bhagyashreesharma90 Nov 14, 2023
7c9a519
Merge branch 'master' into feat/CIV-10568
bhagyashreesharma90 Nov 15, 2023
f05fb86
Merge branch 'master' into feat/CIV-10568
bhagyashreesharma90 Nov 21, 2023
42b7415
Update Jenkinsfile_CNP
bhagyashreesharma90 Nov 21, 2023
0cc66df
Update CaseEvent.java
bhagyashreesharma90 Nov 21, 2023
fedfc2d
Merge branch 'master' into feat/CIV-10568
Azam-Hmcts Nov 23, 2023
228aadc
Merge branch 'master' into feat/CIV-10568
bhagyashreesharma90 Nov 23, 2023
ca0533c
Merge branch 'master' into feat/CIV-10568
Azam-Hmcts Nov 23, 2023
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
4 changes: 2 additions & 2 deletions Jenkinsfile_CNP
bhagyashreesharma90 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import uk.gov.hmcts.contino.GithubAPI
def type = "java"
def product = "civil"
def component = "service"
def ccdBranch = "master"
def camundaBranch = "master"
def ccdBranch = "feat/CIV-10568"
def camundaBranch = "feat/CIV-10568"
def yarnBuilder = new uk.gov.hmcts.contino.YarnBuilder(this)

AppPipelineConfig pipelineConf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public enum CaseEvent {
GENERATE_TRIAL_READY_DOCUMENT_RESPONDENT1(USER),
GENERATE_TRIAL_READY_DOCUMENT_RESPONDENT2(USER),
LIP_CLAIM_SETTLED(USER),
TRIGGER_TASK_RECONFIG(USER),
NOTIFY_FORMER_SOLICITOR(CAMUNDA),
NOTIFY_OTHER_SOLICITOR_1(CAMUNDA),
NOTIFY_OTHER_SOLICITOR_2(CAMUNDA),
Expand Down Expand Up @@ -297,7 +298,8 @@ public enum CaseEvent {
SEND_CVP_JOIN_LINK(USER),
SET_LIP_RESPONDENT_RESPONSE_DEADLINE(CAMUNDA),
NOTIFY_LIP_RESPONDENT_CLAIMANT_CONFIRM_TO_PROCEED(CAMUNDA),
NOTIFY_LIP_APPLICANT_CLAIMANT_CONFIRM_TO_PROCEED(CAMUNDA);
NOTIFY_LIP_APPLICANT_CLAIMANT_CONFIRM_TO_PROCEED(CAMUNDA),
TRIGGER_TASK_RECONFIG_GA(CAMUNDA);

private final UserType userType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@
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;

@Slf4j
@Service
@RequiredArgsConstructor
public class TriggerGenAppLocationUpdateCallbackHandler extends CallbackHandler {

private static final List<CaseEvent> EVENTS = List.of(TRIGGER_UPDATE_GA_LOCATION);
private static final List<CaseEvent> EVENTS = List.of(TRIGGER_UPDATE_GA_LOCATION,
TRIGGER_TASK_RECONFIG_GA);

private final GenAppStateHelperService helperService;
private final ObjectMapper objectMapper;
Expand All @@ -49,7 +52,11 @@ private CallbackResponse triggerGaEvent(CallbackParams callbackParams) {
try {
if (caseData.getGeneralApplications() != null && !caseData.getGeneralApplications().isEmpty()) {
caseData = helperService.updateApplicationLocationDetailsInClaim(caseData, authToken);
helperService.triggerEvent(caseData, TRIGGER_LOCATION_UPDATE);
if (callbackParams.getRequest().getEventId().equals(TRIGGER_UPDATE_GA_LOCATION.name())) {
helperService.triggerEvent(caseData, TRIGGER_LOCATION_UPDATE);
} else if (callbackParams.getRequest().getEventId().equals(TRIGGER_TASK_RECONFIG_GA.name())) {
helperService.triggerEvent(caseData, TRIGGER_TASK_RECONFIG);
}
}
} catch (Exception e) {
String errorMessage = "Could not trigger event to update location on application under case: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import uk.gov.hmcts.reform.civil.callback.CallbackParams;
import uk.gov.hmcts.reform.civil.callback.CaseEvent;
import uk.gov.hmcts.reform.civil.helpers.LocationHelper;
import uk.gov.hmcts.reform.civil.model.BusinessProcess;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.model.common.DynamicList;
import uk.gov.hmcts.reform.civil.referencedata.LocationRefDataService;
Expand All @@ -22,14 +23,14 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;

import static java.util.Objects.nonNull;
import static uk.gov.hmcts.reform.civil.callback.CallbackParams.Params.BEARER_TOKEN;
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_START;
import static uk.gov.hmcts.reform.civil.callback.CallbackType.ABOUT_TO_SUBMIT;
import static uk.gov.hmcts.reform.civil.callback.CallbackType.MID;
import static uk.gov.hmcts.reform.civil.callback.CallbackType.SUBMITTED;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.TRANSFER_ONLINE_CASE;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.TRIGGER_TASK_RECONFIG_GA;
import static uk.gov.hmcts.reform.civil.model.common.DynamicList.fromList;

@Service
Expand Down Expand Up @@ -110,10 +111,12 @@ private CallbackResponse saveTransferOnlineCase(CallbackParams callbackParams) {
callbackParams.getCaseData().getTransferCourtLocationList());
if (nonNull(newCourtLocation)) {
caseDataBuilder.caseManagementLocation(LocationHelper.buildCaseLocation(newCourtLocation));
caseDataBuilder.locationName(newCourtLocation.getSiteName());
}
DynamicList tempLocationList = caseData.getTransferCourtLocationList();
tempLocationList.setListItems(null);
caseDataBuilder.transferCourtLocationList(tempLocationList);
caseDataBuilder.businessProcess(BusinessProcess.ready(TRIGGER_TASK_RECONFIG_GA));
return AboutToStartOrSubmitCallbackResponse.builder()
.data(caseDataBuilder.build().toMap(objectMapper))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import uk.gov.hmcts.reform.ccd.client.model.AboutToStartOrSubmitCallbackResponse;
import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest;
import uk.gov.hmcts.reform.civil.callback.CallbackParams;
import uk.gov.hmcts.reform.civil.handler.callback.BaseCallbackHandlerTest;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.sampledata.CallbackParamsBuilder;
import uk.gov.hmcts.reform.civil.sampledata.CaseDataBuilder;
import uk.gov.hmcts.reform.civil.sampledata.GeneralApplicationDetailsBuilder;
import uk.gov.hmcts.reform.civil.service.GenAppStateHelperService;
Expand All @@ -28,8 +30,10 @@
import static org.mockito.Mockito.when;

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_GA;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.TRIGGER_LOCATION_UPDATE;
import static uk.gov.hmcts.reform.civil.callback.CaseEvent.TRIGGER_TASK_RECONFIG;

@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = {
Expand All @@ -51,6 +55,7 @@ class TriggerGenAppLocationUpdateCallbackHandlerTest extends BaseCallbackHandler
@Test
void handleEventsReturnsTheExpectedCallbackEvent() {
assertThat(handler.handledEvents()).contains(TRIGGER_UPDATE_GA_LOCATION);
assertThat(handler.handledEvents()).contains(TRIGGER_TASK_RECONFIG_GA);
}

@Test
Expand All @@ -63,7 +68,12 @@ void shouldTriggerGeneralApplicationEvent_whenCaseHasGeneralApplication() {
getOriginalStatusOfGeneralApplication()
);
when(helperService.updateApplicationLocationDetailsInClaim(any(), any())).thenReturn(caseData);
CallbackParams params = callbackParamsOf(caseData, ABOUT_TO_SUBMIT);
CallbackParams params = CallbackParamsBuilder.builder()
.of(ABOUT_TO_SUBMIT, caseData)
.request(CallbackRequest.builder()
.eventId(TRIGGER_UPDATE_GA_LOCATION.name())
.build())
.build();
var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(params);

assertThat(response.getErrors()).isNull();
Expand Down Expand Up @@ -106,6 +116,27 @@ void triggerGeneralApplicationEventThrowsException_HandleFailure() {
assertThat(response.getErrors()).contains(expectedErrorMessage);
}

@Test
void shouldTriggerReconfigureWhenCallbackEventIsReconfigGA() {
CaseData caseData = GeneralApplicationDetailsBuilder.builder()
.getTestCaseDataWithDetails(CaseData.builder().build(),
true,
true,
true, true,
getOriginalStatusOfGeneralApplication()
);
when(helperService.updateApplicationLocationDetailsInClaim(any(), any())).thenReturn(caseData);
CallbackParams callbackParams = CallbackParamsBuilder.builder()
.of(ABOUT_TO_SUBMIT, caseData)
.request(CallbackRequest.builder()
.eventId(TRIGGER_TASK_RECONFIG_GA.name())
.build())
.build();
var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(callbackParams);
assertThat(response.getErrors()).isNull();
verify(helperService, times(1)).triggerEvent(caseData, TRIGGER_TASK_RECONFIG);
}

private Map<String, String> getOriginalStatusOfGeneralApplication() {
Map<String, String> latestStatus = new HashMap<>();
latestStatus.put("1234", "Application Submitted - Awaiting Judicial Decision");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,4 @@ void shouldReturnExpectedSubmittedCallbackResponse() {
void handleEventsReturnsTheExpectedCallbackEvent() {
assertThat(handler.handledEvents()).contains(CaseEvent.TRANSFER_ONLINE_CASE);
}
}
}
Loading