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-11150 flight delay screen #3483

Merged
merged 19 commits into from
Nov 15, 2023
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d213fed
CIV-11150 Add new handler
hmcts-version1-ignacio Oct 27, 2023
ddf72aa
CIV-11150 Add new handler
hmcts-version1-ignacio Oct 30, 2023
6acff96
Merge branch 'master' into feat/CIV-11150-flight-delay-screen
hmcts-version1-ignacio Oct 30, 2023
c560e13
CIV-11150 Fix sonar issues
hmcts-version1-ignacio Oct 30, 2023
6b752a3
CIV-11150 Add new test and new changes
hmcts-version1-ignacio Oct 30, 2023
e353349
CIV-11150 Add new test and new changes
hmcts-version1-ignacio Oct 30, 2023
baa080f
CIV-11150 Fix sonar issue
hmcts-version1-ignacio Oct 31, 2023
6dcaa6e
Merge branch 'master' into feat/CIV-11150-flight-delay-screen
hmcts-version1-ignacio Oct 31, 2023
40b6821
Merge branch 'master' into feat/CIV-11150-flight-delay-screen
Azam-Hmcts Oct 31, 2023
7bc06d7
CIV-11150 Add claimType modifyer
hmcts-version1-ignacio Oct 31, 2023
ad02d7b
Merge remote-tracking branch 'origin/feat/CIV-11150-flight-delay-scre…
hmcts-version1-ignacio Oct 31, 2023
ccc87a7
Merge branch 'master' into feat/CIV-11150-flight-delay-screen
hmcts-version1-ignacio Nov 2, 2023
c07f81f
Merge branch 'master' into feat/CIV-11150-flight-delay-screen
krishnanuthalapati Nov 8, 2023
ae58a1a
Merge branch 'master' into feat/CIV-11150-flight-delay-screen
hmcts-version1-ignacio Nov 10, 2023
51e9eaf
Merge branch 'master' into feat/CIV-11150-flight-delay-screen
krishnanuthalapati Nov 13, 2023
22d7325
Merge branch 'master' into feat/CIV-11150-flight-delay-screen
hmcts-version1-ignacio Nov 14, 2023
49afe53
Merge branch 'master' into feat/CIV-11150-flight-delay-screen
hmcts-version1-ignacio Nov 14, 2023
78f614a
Merge branch 'master' into feat/CIV-11150-flight-delay-screen
hmcts-version1-ignacio Nov 14, 2023
5089c55
Merge branch 'master' into feat/CIV-11150-flight-delay-screen
hmcts-version1-ignacio Nov 14, 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
Prev Previous commit
Next Next commit
CIV-11150 Add new handler
  • Loading branch information
hmcts-version1-ignacio committed Oct 30, 2023
commit ddf72aa69491fe910ad4282e7f1d6703f9233781
Original file line number Diff line number Diff line change
@@ -12,7 +12,8 @@ public enum ClaimType {
BREACH_OF_CONTRACT(FeeType.HIGHER),
CONSUMER(FeeType.HIGHER),
CONSUMER_CREDIT(FeeType.HIGHER),
OTHER(FeeType.HIGHER);
OTHER(FeeType.HIGHER),
FLIGHT_DELAY(FeeType.LOWER); //TODO is feeType lower or higher???

private final FeeType feeType;

Original file line number Diff line number Diff line change
@@ -230,6 +230,7 @@ protected Map<String, Callback> callbacks() {
)
.put(callbackKey(MID, "validate-spec-defendant-legal-rep-email"), this::validateSpecRespondentRepEmail)
.put(callbackKey(MID, "validate-spec-defendant2-legal-rep-email"), this::validateSpecRespondent2RepEmail)
.put(callbackKey(MID, "is-flight-delay-claim"), this::isFlightDelayClaim)
.build();
}

@@ -900,6 +901,18 @@ private CallbackResponse validateSpecRespondent2RepEmail(CallbackParams callback
.build();
}

private CallbackResponse isFlightDelayClaim(CallbackParams callbackParams) {
CaseData.CaseDataBuilder caseDataBuilder = callbackParams.getCaseData().toBuilder();

if (toggleService.isSdoR2Enabled()) {
caseDataBuilder.isFlightDelayClaim(callbackParams.getCaseData().getIsFlightDelayClaim());
}

return AboutToStartOrSubmitCallbackResponse.builder()
.data(caseDataBuilder.build().toMap(objectMapper))
.build();
}

private CallbackResponse setRespondent2SameLegalRepToNo(CallbackParams callbackParams) {
CaseData.CaseDataBuilder caseDataBuilder = callbackParams.getCaseData().toBuilder();

This file was deleted.

Original file line number Diff line number Diff line change
@@ -84,4 +84,8 @@ public boolean isTransferOnlineCaseEnabled() {
public boolean isCaseProgressionEnabled() {
return featureToggleApi.isFeatureEnabled("cui-case-progression");
}

public boolean isSdoR2Enabled() {
return featureToggleApi.isFeatureEnabled("isSdoR2Enabled");
}
}
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -1620,6 +1622,23 @@ void shouldReturnErrors_whenRequiredAddressIsYesAndNotValid() {
}
}

@ParameterizedTest
@ValueSource(booleans = {true, false})
void shouldSetIsFlightDelayClaim_whenPopulated(Boolean toggleStat) {
// Given
YesOrNo yesOrNo = toggleStat?YES:NO;
CaseData caseData = CaseData.builder().isFlightDelayClaim(yesOrNo)
.build();

CallbackParams params = callbackParamsOf(caseData, MID, "is-flight-delay-claim");
// When
when(toggleService.isSdoR2Enabled()).thenReturn(true);
var response = (AboutToStartOrSubmitCallbackResponse) handler.handle(params);

// Then
assertThat(response.getData()).containsEntry("isFlightDelayClaim", toggleStat?"Yes":"No");
}

@Nested
class AboutToSubmitCallbackV1 {

Original file line number Diff line number Diff line change
@@ -170,6 +170,15 @@ void shouldReturnCorrectValue_whenCaseProgressionEnabled(Boolean toggleStat) {
assertThat(featureToggleService.isCaseProgressionEnabled()).isEqualTo(toggleStat);
}

@ParameterizedTest
@ValueSource(booleans = {true, false})
void shouldReturnCorrectValue_whenIsSdoR2Enabled(Boolean toggleStat) {
var sdoR2Key = "isSdoR2Enabled";
givenToggle(sdoR2Key, toggleStat);

assertThat(featureToggleService.isSdoR2Enabled()).isEqualTo(toggleStat);
}

private void givenToggle(String feature, boolean state) {
when(featureToggleApi.isFeatureEnabled(eq(feature)))
.thenReturn(state);
Loading