Skip to content

Commit

Permalink
CIV-0000 Remove dashboard toggle (#1658)
Browse files Browse the repository at this point in the history
* CIV-0000 Remove dashboard toggle

* CIV-0000 Remove unused import

* CIV-0000 Remove unused imports
  • Loading branch information
paul-pearson authored Jan 29, 2025
1 parent 9e2cf8f commit 3ff6576
Show file tree
Hide file tree
Showing 22 changed files with 5 additions and 224 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public abstract class DashboardCallbackHandler extends CallbackHandler {

@Override
protected Map<String, Callback> callbacks() {
return featureToggleService.isDashboardServiceEnabled() && featureToggleService.isGaForLipsEnabled()
return featureToggleService.isGaForLipsEnabled()
? Map.of(callbackKey(ABOUT_TO_SUBMIT), this::configureDashboardScenario)
: Map.of(callbackKey(ABOUT_TO_SUBMIT), this::emptyCallbackResponse);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ApplicationSubmittedDashboardNotificationHandler extends CallbackHa

@Override
protected Map<String, Callback> callbacks() {
return featureToggleService.isDashboardServiceEnabled() && featureToggleService.isGaForLipsEnabled()
return featureToggleService.isGaForLipsEnabled()
? Map.of(callbackKey(ABOUT_TO_SUBMIT), this::configureDashboardScenario)
: Map.of(callbackKey(ABOUT_TO_SUBMIT), this::emptyCallbackResponse);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void updateDashboardTaskListAndNotification(CallbackParams callbackParam
String caseReference) {
String authToken = callbackParams.getParams().get(BEARER_TOKEN).toString();
CaseData caseData = callbackParams.getCaseData();
if (featureToggleService.isDashboardServiceEnabled() && gaForLipService.isGaForLip(caseData)) {
if (gaForLipService.isGaForLip(caseData)) {
ScenarioRequestParams scenarioParams = ScenarioRequestParams.builder().params(mapper.mapCaseDataToParams(
caseData)).build();
if (scenarios != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ public boolean isCaseFileViewEnabled() {
return internalClient.boolVariation("case-file-view", createLDUser().build(), false);
}

public boolean isDashboardServiceEnabled() {
return internalClient.boolVariation("dashboard-service", createLDUser().build(), false);
}

public boolean isCoSCEnabled() {
return internalClient.boolVariation("isCoSCEnabled", createLDUser().build(), false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.springframework.stereotype.Service;
import uk.gov.hmcts.reform.civil.client.DashboardApiClient;
import uk.gov.hmcts.reform.civil.enums.YesOrNo;
import uk.gov.hmcts.reform.civil.launchdarkly.FeatureToggleService;
import uk.gov.hmcts.reform.civil.model.CaseData;
import uk.gov.hmcts.reform.civil.utils.DocUploadUtils;
import uk.gov.hmcts.reform.civil.utils.JudicialDecisionNotificationUtil;
Expand All @@ -25,13 +24,12 @@
public class DocUploadDashboardNotificationService {

private final DashboardApiClient dashboardApiClient;
private final FeatureToggleService featureToggleService;
private final GaForLipService gaForLipService;
private final DashboardNotificationsParamsMapper mapper;

public void createDashboardNotification(CaseData caseData, String role, String authToken, boolean itsUploadAddlDocEvent) {

if (isWithNoticeOrConsent(caseData) && featureToggleService.isDashboardServiceEnabled()) {
if (isWithNoticeOrConsent(caseData)) {
log.info("Case {} is with notice or consent and the dashboard service is enabled", caseData.getCcdCaseReference());
List<String> scenarios = getDashboardScenario(role, caseData, itsUploadAddlDocEvent);
ScenarioRequestParams scenarioParams = ScenarioRequestParams.builder().params(mapper.mapCaseDataToParams(
Expand All @@ -50,8 +48,7 @@ public void createDashboardNotification(CaseData caseData, String role, String a
public void createResponseDashboardNotification(CaseData caseData, String role, String authToken) {

if ((role.equalsIgnoreCase("APPLICANT")
|| (isWithNoticeOrConsent(caseData) && role.equalsIgnoreCase("RESPONDENT")))
&& featureToggleService.isDashboardServiceEnabled()) {
|| (isWithNoticeOrConsent(caseData) && role.equalsIgnoreCase("RESPONDENT")))) {
String scenario = getResponseDashboardScenario(role, caseData);
ScenarioRequestParams scenarioParams = ScenarioRequestParams.builder().params(mapper.mapCaseDataToParams(
caseData)).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ void shouldRecordApplicationIssueFeeRequiredScenarioWhenInvoked() {

HashMap<String, Object> scenarioParams = new HashMap<>();
when(featureToggleService.isGaForLipsEnabled()).thenReturn(true);
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);

CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
Expand Down Expand Up @@ -120,7 +119,6 @@ void shouldRecordApplicationSubmittedScenarioWhenInvokedForFreeApplication() {

HashMap<String, Object> scenarioParams = new HashMap<>();
when(featureToggleService.isGaForLipsEnabled()).thenReturn(true);
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);
when(generalAppFeesService.isFreeApplication(any())).thenReturn(true);

Expand Down Expand Up @@ -151,7 +149,6 @@ void shouldNotRecordApplicationIssueFeeRequiredScenarioWhenGaFlagIsDisable() {
.build())
.build())
.build();
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(featureToggleService.isGaForLipsEnabled()).thenReturn(false);

CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
Expand All @@ -163,30 +160,5 @@ void shouldNotRecordApplicationIssueFeeRequiredScenarioWhenGaFlagIsDisable() {
verifyNoInteractions(dashboardApiClient);
}

@Test
void shouldNotRecordApplicationIssueFeeRequiredScenarioWhenDashboardFlagIsDisable() {
CaseData caseData = CaseDataBuilder.builder().atStateClaimDraft().withNoticeCaseData();
caseData = caseData.toBuilder()
.parentCaseReference(caseData.getCcdCaseReference().toString())
.isGaApplicantLip(YesOrNo.YES)
.parentClaimantIsApplicant(YesOrNo.YES)
.generalAppPBADetails(GAPbaDetails.builder()
.fee(Fee.builder()
.calculatedAmountInPence(new BigDecimal(100000))
.build())
.build())
.build();

when(featureToggleService.isDashboardServiceEnabled()).thenReturn(false);

CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
CallbackRequest.builder().eventId(CREATE_DASHBOARD_NOTIFICATION_FOR_GA_APPLICANT.name())
.build()
).build();

handler.handle(params);
verifyNoInteractions(dashboardApiClient);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ void shouldRecordApplicationSubmittedScenarioWhenFreeApplication() {

HashMap<String, Object> scenarioParams = new HashMap<>();
when(featureToggleService.isGaForLipsEnabled()).thenReturn(true);
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(generalAppFeesService.isFreeApplication(caseData)).thenReturn(true);
when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);

Expand Down Expand Up @@ -98,7 +97,6 @@ void shouldNotRecordApplicationSubmittedScenarioWhenNotFreeApplication() {

HashMap<String, Object> scenarioParams = new HashMap<>();
when(featureToggleService.isGaForLipsEnabled()).thenReturn(true);
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(generalAppFeesService.isFreeApplication(caseData)).thenReturn(false);
when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -56,10 +55,6 @@ void handleEventsReturnsTheExpectedCallbackEvent() {

@Nested
class AboutToSubmitCallback {
@BeforeEach
void setup() {
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
}

@Test
void shouldRecordApplicationSubmittedScenario_whenInvoked() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_GENERAL_APPS_TRANSLATED_DOCUMENT_UPLOADED_APPLICANT;

import java.util.HashMap;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -53,10 +52,6 @@ void shouldReturnCorrectCamundaActivityId_whenInvoked() {

@Nested
class AboutToSubmitCallback {
@BeforeEach
void setup() {
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
}

@Test
void shouldRecordTranslatedDocUploadedScenario_whenInvoked() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import static uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications.DashboardScenarios.SCENARIO_AAA6_GENERAL_APPS_TRANSLATED_DOCUMENT_UPLOADED_RESPONDENT;

import java.util.HashMap;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -53,10 +52,6 @@ void shouldReturnCorrectCamundaActivityId_whenInvoked() {

@Nested
class AboutToSubmitCallback {
@BeforeEach
void setup() {
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
}

@Test
void shouldRecordTranslatedDocUploadedScenario_whenInvoked() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -54,10 +53,6 @@ void shouldReturnCorrectCamundaActivityId_whenInvoked() {

@Nested
class AboutToSubmitCallback {
@BeforeEach
void setup() {
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
}

@Test
void shouldRecordApplicationSubmittedScenario_whenInvoked() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package uk.gov.hmcts.reform.civil.handler.callback.camunda.dashboardnotifications;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -55,10 +54,6 @@ void shouldReturnCorrectCamundaActivityId_whenInvoked() {

@Nested
class AboutToSubmitCallback {
@BeforeEach
void setup() {
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
}

@Test
void shouldRecordApplicationSubmittedScenario_whenInvoked() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ void shouldRecordMoreInfoRequiredApplicantScenarioWhenInvoked() {

HashMap<String, Object> scenarioParams = new HashMap<>();
when(featureToggleService.isGaForLipsEnabled()).thenReturn(true);
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);

CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
Expand All @@ -121,7 +120,6 @@ void shouldNotRecordMoreInfoRequiredApplicantScenarioWhenInvoked() {
.judicialDecisionRequestMoreInfo(GAJudicialRequestMoreInfo.builder().requestMoreInfoOption(
GAJudgeRequestMoreInfoOption.REQUEST_MORE_INFORMATION).deadlineForMoreInfoSubmission(
LocalDateTime.now().plusDays(5)).build()).build();
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(featureToggleService.isGaForLipsEnabled()).thenReturn(false);

CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
Expand All @@ -148,7 +146,6 @@ void shouldRecordPayAdditionalPaymentApplicantScenarioWhenInvoked(CaseState case

HashMap<String, Object> scenarioParams = new HashMap<>();
when(featureToggleService.isGaForLipsEnabled()).thenReturn(true);
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(judicialDecisionHelper.isApplicationUncloakedWithAdditionalFee(any())).thenReturn(true);
when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);

Expand Down Expand Up @@ -188,7 +185,6 @@ void shouldRecordOrderMadeApplicantScenarioWhenInvoked_isWIthNoticeApplication(G

HashMap<String, Object> scenarioParams = new HashMap<>();
when(featureToggleService.isGaForLipsEnabled()).thenReturn(true);
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);

CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
Expand Down Expand Up @@ -220,7 +216,6 @@ void shouldRecordOrderMadeApplicantScenarioWhenInvoked_isWIthOutNoticeApplicatio

HashMap<String, Object> scenarioParams = new HashMap<>();
when(featureToggleService.isGaForLipsEnabled()).thenReturn(true);
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);

CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
Expand Down Expand Up @@ -252,7 +247,6 @@ void shouldNotRecordOrderMadeApplicantScenarioWhenInvoked_isWIthNoticeApplicatio

HashMap<String, Object> scenarioParams = new HashMap<>();
when(featureToggleService.isGaForLipsEnabled()).thenReturn(true);
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);

CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
Expand Down Expand Up @@ -283,7 +277,6 @@ void shouldNotRecordOrderMadeApplicantScenarioWhenInvoked_isWIthNoticeApplicatio

HashMap<String, Object> scenarioParams = new HashMap<>();
when(featureToggleService.isGaForLipsEnabled()).thenReturn(true);
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);

CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
Expand Down Expand Up @@ -325,7 +318,6 @@ void shouldRecordHearingScheduledApplicantScenarioWhenInvoked() {

HashMap<String, Object> scenarioParams = new HashMap<>();
when(featureToggleService.isGaForLipsEnabled()).thenReturn(true);
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);

CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
Expand Down Expand Up @@ -355,7 +347,6 @@ void shouldNotRecordHearingScheduledApplicantScenarioWhenInvoked() {
.gaHearingNoticeDetail(GAHearingNoticeDetail.builder().build())
.build();

when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(featureToggleService.isGaForLipsEnabled()).thenReturn(false);

CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
Expand All @@ -380,7 +371,6 @@ void shouldRecordRequestWrittenRepresentationsApplicantScenarioWhenInvoked() {

HashMap<String, Object> scenarioParams = new HashMap<>();
when(featureToggleService.isGaForLipsEnabled()).thenReturn(true);
when(featureToggleService.isDashboardServiceEnabled()).thenReturn(true);
when(mapper.mapCaseDataToParams(any())).thenReturn(scenarioParams);

CallbackParams params = CallbackParamsBuilder.builder().of(ABOUT_TO_SUBMIT, caseData).request(
Expand Down
Loading

0 comments on commit 3ff6576

Please sign in to comment.