From c439682513c2d52e47ff3a7768877bb7e7d28439 Mon Sep 17 00:00:00 2001 From: fabriziofff Date: Wed, 3 Mar 2021 18:44:00 +0100 Subject: [PATCH] [#177187748] Revert "feat(Bonus Pagamenti Digitali): [#177187748] Unlock the search for SIA and ICCREA (for test only) (#2862)" This reverts commit 8f29540e987513d201c52333f31c195e45b73990. --- .env.production | 2 +- .../screens/start/CoBadgeStartScreen.tsx | 7 +++- .../__test__/CoBadgeStartScreen.test.tsx | 32 +++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/.env.production b/.env.production index 7e44cec3458..57ed9cc193d 100644 --- a/.env.production +++ b/.env.production @@ -43,7 +43,7 @@ MYPORTAL_ENABLED=NO PLAYGROUNDS_ENABLED=YES # BPD configuration BPD_ENABLED=YES -BPD_TEST_OVERLAY=YES +BPD_TEST_OVERLAY=NO PRIVATIVE_ENABLED=NO # endpoint BPD API BPD_API_URL_PREFIX=https://prod.cstar.pagopa.it diff --git a/ts/features/wallet/onboarding/cobadge/screens/start/CoBadgeStartScreen.tsx b/ts/features/wallet/onboarding/cobadge/screens/start/CoBadgeStartScreen.tsx index c7d8f18e32b..aab8de7986b 100644 --- a/ts/features/wallet/onboarding/cobadge/screens/start/CoBadgeStartScreen.tsx +++ b/ts/features/wallet/onboarding/cobadge/screens/start/CoBadgeStartScreen.tsx @@ -12,6 +12,7 @@ import { loadCoBadgeAbiConfiguration } from "../../store/actions"; import { getCoBadgeAbiConfigurationSelector } from "../../store/reducers/abiConfiguration"; import { onboardingCoBadgeAbiSelectedSelector } from "../../store/reducers/abiSelected"; import CoBadgeChosenBankScreen from "./CoBadgeChosenBankScreen"; +import CoBadgeStartKoDisabled from "./ko/CoBadgeStartKoDisabled"; import CoBadgeStartKoUnavailable from "./ko/CoBadgeStartKoUnavailable"; import LoadAbiConfiguration from "./LoadAbiConfiguration"; @@ -47,7 +48,7 @@ const CoBadgeStartComponent = (props: Props): React.ReactElement => { } switch (props.abiSelectedConfiguration.value) { case StatusEnum.enabled: - case StatusEnum.disabled: + void trackOutput("Enabled", props.maybeAbiSelected); // Single ABI (bank) screen that allow to start the search return ( { testID={"CoBadgeChosenBankScreenSingleBank"} /> ); + case StatusEnum.disabled: + void trackOutput("Disabled", props.maybeAbiSelected); + // The chosen ABI is disabled (not yet available) + return ; case StatusEnum.unavailable: void trackOutput("Unavailable", props.maybeAbiSelected); // THe chosen ABI is unavailable (technical problems) diff --git a/ts/features/wallet/onboarding/cobadge/screens/start/__test__/CoBadgeStartScreen.test.tsx b/ts/features/wallet/onboarding/cobadge/screens/start/__test__/CoBadgeStartScreen.test.tsx index 4c7e19d45d3..ecd04a673f4 100644 --- a/ts/features/wallet/onboarding/cobadge/screens/start/__test__/CoBadgeStartScreen.test.tsx +++ b/ts/features/wallet/onboarding/cobadge/screens/start/__test__/CoBadgeStartScreen.test.tsx @@ -24,6 +24,18 @@ jest.mock("react-native-share", () => jest.fn()); const configurationFailure = getGenericError(new Error("generic Error")); const abiTestId = "9876"; const abiTestId2 = "2222"; +const abiConfigurationWithoutBankMock: CoBadgeServices = { + ServiceName: { + status: StatusEnum.enabled, + issuers: [{ abi: "1", name: "bankName" }] + } +}; +const abiConfigurationDisabled: CoBadgeServices = { + ServiceName: { + status: StatusEnum.disabled, + issuers: [{ abi: abiTestId, name: "bankName" }] + } +}; const abiConfigurationUnavailable: CoBadgeServices = { ServiceName: { status: StatusEnum.unavailable, @@ -144,7 +156,24 @@ describe("Test behaviour of the CoBadgeStartScreen", () => { ).toBeTruthy(); } }); + it("When receive a configuration without the selected abi, the screen should render CoBadgeStartKoDisabled", () => { + const { store, testComponent } = getInitCoBadgeStartScreen(abiTestId); + + store.dispatch( + loadCoBadgeAbiConfiguration.success(abiConfigurationWithoutBankMock) + ); + // The user should see the disabled screen when the selected abi is not in the remote configuration + expect(isDisabledScreen(testComponent)).toBe(true); + }); + it("When receive a configuration without an abi disabled, the screen should render CoBadgeStartKoDisabled", () => { + const { store, testComponent } = getInitCoBadgeStartScreen(abiTestId); + store.dispatch( + loadCoBadgeAbiConfiguration.success(abiConfigurationDisabled) + ); + // The user should see the disabled screen + expect(isDisabledScreen(testComponent)).toBe(true); + }); it("When receive a configuration with an abi unavailable, the screen should render CoBadgeStartKoUnavailable", () => { const { store, testComponent } = getInitCoBadgeStartScreen(abiTestId); @@ -236,6 +265,9 @@ const isAllBankScreen = (component: RenderAPI) => const isLoadingScreen = (component: RenderAPI) => component.queryByTestId("LoadAbiConfiguration") !== null; +const isDisabledScreen = (component: RenderAPI) => + component.queryByTestId("CoBadgeStartKoDisabled") !== null; + const isUnavailableScreen = (component: RenderAPI) => component.queryByTestId("CoBadgeStartKoUnavailable") !== null;