Skip to content

Commit

Permalink
chore: [IOBP-489] Removal of BPD references around the app (#5421)
Browse files Browse the repository at this point in the history
  • Loading branch information
forrest57 authored Jan 26, 2024
1 parent 660d955 commit 1dfe18c
Show file tree
Hide file tree
Showing 53 changed files with 335 additions and 3,626 deletions.
5 changes: 0 additions & 5 deletions .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@ ZENDESK_PRIVACY_URL='https://www.pagopa.it/it/privacy-policy-assistenza/'
MIXPANEL_TOKEN='0cb505dace6f4b3ceb9e17c7fcd7c66f'
# Test overlay caption, if the string is nonempty will be displayed in the TestOverlay
# TEST_OVERLAY_CAPTION='Functionality name here!'
BONUS_VACANZE_ENABLED=YES
MYPORTAL_ENABLED=NO
# enable playgrounds inside developer section
PLAYGROUNDS_ENABLED=YES
# BPD configuration
BPD_ENABLED=YES
# endpoint BPD API
BPD_API_URL_PREFIX='http://127.0.0.1:3000/bonus'
BPD_API_SIT='https://api-io.dev.cstar.pagopa.it'
Expand All @@ -53,8 +50,6 @@ SICILIAVOLA_ENABLED=NO
ZENDESK_ENABLED=YES
# CGN new merchants features
CGN_MERCHANTS_V2_ENABLED=NO
# Opt-in payments method
BPD_OPT_IN_PAYMENT_METHODS = YES
# Ukraine donation
UA_DONATIONS_ENABLED=YES
# FIMS (Federated Identity Management System) feature
Expand Down
5 changes: 0 additions & 5 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@ ZENDESK_PRIVACY_URL='https://www.pagopa.it/it/privacy-policy-assistenza/'
MIXPANEL_TOKEN='0cb505dace6f4b3ceb9e17c7fcd7c66f'
# Test overlay caption, if the string is nonempty will be displayed in the TestOverlay
# TEST_OVERLAY_CAPTION='Functionality name here!'
BONUS_VACANZE_ENABLED=YES
MYPORTAL_ENABLED=NO
# enable playgrounds inside developer section
PLAYGROUNDS_ENABLED=YES
# BPD configuration
BPD_ENABLED=YES
# endpoint BPD API
BPD_API_URL_PREFIX=https://api-io.cstar.pagopa.it
BPD_API_SIT='https://api-io.dev.cstar.pagopa.it'
Expand All @@ -53,8 +50,6 @@ SICILIAVOLA_ENABLED=NO
ZENDESK_ENABLED=YES
# CGN new merchants features
CGN_MERCHANTS_V2_ENABLED=NO
# Opt-in payments method
BPD_OPT_IN_PAYMENT_METHODS = YES
# Ukraine donation
UA_DONATIONS_ENABLED=YES
# FIMS (Federated Identity Management System) feature
Expand Down
9 changes: 9 additions & 0 deletions jestGlobalExtendExpectImport.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// for TSC to correctly read the type definition
// exported by this lib, it is necessary to import it
// in a `.ts` file, otherwise it will be ignored

// this file is strictly for TS to recognize the type definition,
// avoiding the malpractice of having to import it in a test,
// since the import is already done in the jest config files

import "@testing-library/jest-native/extend-expect";
6 changes: 0 additions & 6 deletions ts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ export const isDebugBiometricIdentificationEnabled =

export const myPortalEnabled: boolean = Config.MYPORTAL_ENABLED === "YES";

export const bpdEnabled: boolean = Config.BPD_ENABLED === "YES";

export const bpdApiUrlPrefix: string = Config.BPD_API_URL_PREFIX;

export const bpdApiSitUrlPrefix: string = Config.BPD_API_SIT;
Expand All @@ -77,10 +75,6 @@ export const zendeskEnabled: boolean = Config.ZENDESK_ENABLED === "YES";
// CGN new merchants features
export const cgnMerchantsV2Enabled = Config.CGN_MERCHANTS_V2_ENABLED === "YES";

// Opt-in payments method
export const bpdOptInPaymentMethodsEnabled =
Config.BPD_OPT_IN_PAYMENT_METHODS === "YES";

// Ukraine donation
export const uaDonationsEnabled = Config.UA_DONATIONS_ENABLED === "YES";

Expand Down
39 changes: 2 additions & 37 deletions ts/features/bonus/__mock__/availableBonuses.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { BonusAvailable } from "../../../../definitions/content/BonusAvailable";
import { BonusesAvailable } from "../../../../definitions/content/BonusesAvailable";
import { ID_BPD_TYPE, ID_CGN_TYPE } from "../common/utils";
import { BonusVisibilityEnum } from "../../../../definitions/content/BonusVisibility";
import { BonusesAvailable } from "../../../../definitions/content/BonusesAvailable";
import { ID_CGN_TYPE } from "../common/utils";

export const contentBonusVacanzeIT = `#### Chi può richiederlo?
Expand Down Expand Up @@ -68,42 +67,8 @@ This is the process in app:
- if you confirm the request, IO generates your Bonus Vacanze;
- once activated, your bonus will be visible in the Payments section of the app.
`;
export const bpdBonus: BonusAvailable = {
id_type: ID_BPD_TYPE,
it: {
name: "Cashback",
description:
"Fino a 500€ a nucleo familiare per andare in vacanza in Italia",
subtitle:
"L'incentivo per supportare il settore del turismo dopo il lockdown richiesto dal COVID-19",
title: "Richiesta Bonus Vacanze",
content: contentBonusVacanzeIT,
tos_url: "https://io.italia.it/app-content/bonus_vacanze_tos.html"
},
en: {
name: "Cashback",
description: "Up to € 500 per family to go on holiday in Italy",
subtitle:
"The incentive established to support tourism after the lockdown due to the Coronavirus emergency.",
title: "Bonus Vacanze Request",
content: contentBonusVacanzeEN,
tos_url: "https://io.italia.it/app-content/bonus_vacanze_tos.html"
},
service_id: "01EB8AXKNV6NMSP2R25KSGF743",
is_active: false,
hidden: true,
visibility: BonusVisibilityEnum.visible,
valid_from: new Date("2020-07-01T00:00:00.000Z"),
valid_to: new Date("2020-12-31T00:00:00.000Z"),
cover:
"https://raw.githubusercontent.com/pagopa/io-services-metadata/master/bonus/vacanze/logo/logo_BonusVacanze.png",
sponsorship_description: "Agenzia delle Entrate",
sponsorship_cover:
"https://raw.githubusercontent.com/pagopa/io-services-metadata/master/bonus/vacanze/logo/logo_AgenziaEntrate.png"
};

export const availableBonuses: BonusesAvailable = [
bpdBonus,
{
id_type: ID_CGN_TYPE,
it: {
Expand Down
137 changes: 0 additions & 137 deletions ts/features/bonus/bpd/analytics/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ import { useNavigation } from "@react-navigation/native";
import * as React from "react";
import { useContext, useEffect, useState } from "react";
import { useDispatch } from "react-redux";
import { isError, isReady } from "../../../../../common/model/RemoteValue";
import LoadingSpinnerOverlay from "../../../../../components/LoadingSpinnerOverlay";
import { LightModalContext } from "../../../../../components/ui/LightModal";
import { bpdOptInPaymentMethodsEnabled } from "../../../../../config";
import I18n from "../../../../../i18n";
import ROUTES from "../../../../../navigation/routes";
import { useIOSelector } from "../../../../../store/hooks";
import { bpdRemoteConfigSelector } from "../../../../../store/reducers/backendStatus";
import { isError, isReady } from "../../../../../common/model/RemoteValue";
import BPD_ROUTES from "../../navigation/routes";
import { optInPaymentMethodsShowChoice } from "../../store/actions/optInPaymentMethods";
import { showOptInChoiceSelector } from "../../store/reducers/details/activation/ui";
import { bpdLastUpdateSelector } from "../../store/reducers/details/lastUpdate";
Expand All @@ -20,18 +16,11 @@ const BpdOptInPaymentMethodsContainer = () => {
const navigation = useNavigation();
const { showModal, hideModal } = useContext(LightModalContext);
const [showOptInChecked, setShowOptInChecked] = useState<boolean>(false);
const bpdRemoteConfig = useIOSelector(bpdRemoteConfigSelector);
const showOptInChoice = useIOSelector(showOptInChoiceSelector);
const bpdLastUpdate = useIOSelector(bpdLastUpdateSelector);
const isOptInPaymentMethodsEnabled =
bpdRemoteConfig?.opt_in_payment_methods_v2 && bpdOptInPaymentMethodsEnabled;

useEffect(() => {
if (
isOptInPaymentMethodsEnabled &&
!showOptInChecked &&
!isReady(showOptInChoice)
) {
if (!showOptInChecked && !isReady(showOptInChoice)) {
setShowOptInChecked(true);
// Starts the optInShouldShowChoiceHandler saga
dispatch(optInPaymentMethodsShowChoice.request());
Expand All @@ -43,31 +32,13 @@ const BpdOptInPaymentMethodsContainer = () => {
/>
);
}
}, [
isOptInPaymentMethodsEnabled,
dispatch,
showOptInChecked,
bpdLastUpdate,
showModal,
showOptInChoice
]);
}, [dispatch, showOptInChecked, bpdLastUpdate, showModal, showOptInChoice]);

useEffect(() => {
if (
isOptInPaymentMethodsEnabled &&
(isReady(showOptInChoice) || isError(showOptInChoice))
) {
if (isReady(showOptInChoice) || isError(showOptInChoice)) {
hideModal();
if (isReady(showOptInChoice) && showOptInChoice.value) {
navigation.navigate(ROUTES.WALLET_NAVIGATOR, {
screen: BPD_ROUTES.OPT_IN_PAYMENT_METHODS.MAIN,
params: {
screen: BPD_ROUTES.OPT_IN_PAYMENT_METHODS.CASHBACK_UPDATE
}
});
}
}
}, [isOptInPaymentMethodsEnabled, hideModal, showOptInChoice, navigation]);
}, [hideModal, showOptInChoice, navigation]);

return <></>;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as React from "react";
import { connect } from "react-redux";
import { Dispatch } from "redux";
import { GlobalState } from "../../../../../store/reducers/types";
import { navigateToBpdDetails } from "../../navigation/actions";
import { bpdSelectPeriod } from "../../store/actions/selectedPeriod";
import { bpdPeriodsAmountWalletVisibleSelector } from "../../store/reducers/details/combiner";
import { BpdPeriodWithInfo } from "../../store/reducers/details/periods";
Expand Down Expand Up @@ -51,7 +50,6 @@ const BpdCardsInWalletContainer = (props: Props) => (
const mapDispatchToProps = (dispatch: Dispatch) => ({
navigateToCashbackDetails: (period: BpdPeriodWithInfo) => {
dispatch(bpdSelectPeriod(period));
navigateToBpdDetails(period);
}
});

Expand Down
Loading

0 comments on commit 1dfe18c

Please sign in to comment.