Skip to content

Commit

Permalink
chore(Bonus Pagamenti Digitali): [#176039881] upgrade bancomat resear…
Browse files Browse the repository at this point in the history
…ch screen (#2551)

* [#176039881] create SearchBankInfo component

* [#176039881] refactor SearchBankComponent

* [#176039881] refactor SearchBankScreen component

* [#176039881] retry global bancomat search on continue button

* [#176039881] remove unused properties

* [#176039881] remove useless properties

* [#176039881] try a global search on continue press BancomatKoSingleBankNotFound

* [#176039881] send the user the the WALLET_ONBOARDING_BANCOMAT_CHOOSE_BANK screen when  press select bank

* [#176039881] remove re-navigation to same screen

* [#176039881] rename SearchBankScreen in SearchBankInfoScreen

* [#176039881] refactor SearchBankInfoScreen

* [#176039881] renaming

* [#176039881] renaming SearchBankInfo in SearchBankInfoComponent

* [#176039881] renaming navigation action

* [#176039881] refactor navigation to searchBank screen

* [#176039881] add navigation action to SearchBankScreen

* [#176039881] refactor BancomatKoServicesError component adding navigation to search bank screen

* [#176039881] refactor SearchBankScren

* [#176039881] clean searchBar text after select item

* [#176039881] remove unused import

* [#176039881] update comments

* [#176039881] fix typo

* [#176039881] add missing translation

* [#176039881] make the tos url const

* [#176039881] refactoring styles

* [#176039881] change prop name

* [#176039881] rename route

* [#176039881] renaming screen

* [#176039881] renaming searchStartComponent

* [#176039881] remove useless code and properties

* [#176039881] modify action name

* [#176039881] modify comment

* [#176039881] remove unused import

* [#176039881] rename route

* [#176039881] fix bug

Co-authored-by: Matteo Boschi <[email protected]>
Co-authored-by: Fabrizio <[email protected]>
  • Loading branch information
3 people authored Dec 10, 2020
1 parent fa829f8 commit 82192ee
Show file tree
Hide file tree
Showing 13 changed files with 261 additions and 142 deletions.
14 changes: 8 additions & 6 deletions locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -743,11 +743,13 @@ wallet:
detailTitle: Details
help: If you have encountered a problem entering this payment method, write for more information and details
searchAbi:
title: Add PagoBANCOMAT
header: Add PagoBANCOMAT
title: Search for your PagoBANCOMAT cards
description:
text1: If you prefer, you can indicate the bank
text2: " on which you have an active PagoBANCOMAT card. Otherwise we will look for all the cards associated with you: by continuing you accept the "
text3: privacy policy
text1: "IO will search for all PagoBANCOMAT cards associated with you.\nBy continuing you accept the"
text2: information on the processing of personal data.
text3: "If you prefer, you can choose the bank on which you have an active PagoBANCOMAT card "
text4: by searching among those available
bankName: Name of the bank
noName: Name unavailable
loading: Loading bank list...
Expand All @@ -769,8 +771,8 @@ wallet:
body: "There are no PagoBANCOMAT cards registered to you: please contact your bank for further information."
koNotFoundSingleBank:
title: "Sorry, we couldn't find any card on this bank"
body: "There are no PagoBANCOMAT cards registered to you: please contact your bank for further information."
chooseAnother: "Choose another bank"
body: "There are no PagoBANCOMAT cards registered to you.\nIf you wish, IO can search between all banks."
continue: "Continue"
koServicesError:
title: "Unable to retrieve your PagoBANCOMAT cards: please select your bank"
body: "Choose the bank which issued your card to retrieve all the PagoBANCOMAT cards registered to you."
Expand Down
14 changes: 8 additions & 6 deletions locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -763,11 +763,13 @@ wallet:
detailTitle: Dettaglio
help: Se hai riscontrato un problema durante l'inserimento di questo metodo di pagamento, scrivi per maggiori informazioni e dettagli
searchAbi:
title: Aggiungi PagoBANCOMAT
header: Aggiungi PagoBANCOMAT
title: Ricerca delle tue carte PagoBANCOMAT
description:
text1: Se vuoi, puoi indicare la banca
text2: " su cui hai un carta PagoBANCOMAT attiva. Altrimenti cercheremo tutte le carte associate a te: proseguendo accetti l’"
text3: informativa sul trattamento dei dati personali
text1: "IO cercherà tutte le carte PagoBANCOMAT associate a te.\nProseguendo accetti l'"
text2: informativa sul trattamento dei dati personali.
text3: "Se preferisci, puoi scegliere la banca su cui hai una carta PagoBANCOMAT attiva, "
text4: cercando fra quelle disponibili
bankName: Denominazione della banca
noName: Nome non disponibile
loading: Carico la lista delle banche...
Expand All @@ -789,8 +791,8 @@ wallet:
body: "Non risultano carte PagoBANCOMAT a te intestate: contatta la tua banca per maggiori informazioni."
koNotFoundSingleBank:
title: "Spiacenti, non abbiamo trovato nessuna carta su questa banca"
body: "Non risultano carte PagoBANCOMAT a te intestate: contatta la tua banca per maggiori informazioni."
chooseAnother: "Scegli un'altra banca"
body: "Non risultano carte PagoBANCOMAT a te intestate.\nSe lo desideri, IO può effettuare una ricerca tra tutte le banche."
continue: "Continua"
koServicesError:
title: "Non è stato possibile recuperare le carte: seleziona la tua banca"
body: "Indica la banca che ha emesso la tua carta per vedere le lista delle carte PagoBANCOMAT a te intestate."
Expand Down
5 changes: 5 additions & 0 deletions ts/features/wallet/onboarding/bancomat/navigation/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { InferNavigationParams } from "../../../../../types/react";
import { ActivateBpdOnNewCreditCardScreen } from "../../common/screens/bpd/ActivateBpdOnNewCreditCardScreen";
import WALLET_ONBOARDING_BANCOMAT_ROUTES from "./routes";

export const navigateToOnboardingBancomatSearchStartScreen = () =>
NavigationActions.navigate({
routeName: WALLET_ONBOARDING_BANCOMAT_ROUTES.BANCOMAT_START
});

export const navigateToOnboardingBancomatChooseBank = () =>
NavigationActions.navigate({
routeName: WALLET_ONBOARDING_BANCOMAT_ROUTES.CHOOSE_BANK
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createStackNavigator } from "react-navigation";
import SuggestBpdActivationScreen from "../../common/screens/bpd/SuggestBpdActivationScreen";
import BancomatSearchStartScreen from "../screens/search/BancomatSearchStartScreen";
import SearchBankScreen from "../screens/search/SearchBankScreen";
import SearchAvailableUserBancomatScreen from "../screens/searchBancomat/SearchAvailableUserBancomatScreen";
import { ActivateBpdOnNewCreditCardScreen } from "../../common/screens/bpd/ActivateBpdOnNewCreditCardScreen";
Expand All @@ -8,6 +9,9 @@ import WALLET_ONBOARDING_BANCOMAT_ROUTES from "./routes";

const PaymentMethodOnboardingBancomatNavigator = createStackNavigator(
{
[WALLET_ONBOARDING_BANCOMAT_ROUTES.BANCOMAT_START]: {
screen: BancomatSearchStartScreen
},
[WALLET_ONBOARDING_BANCOMAT_ROUTES.CHOOSE_BANK]: {
screen: SearchBankScreen
},
Expand Down
3 changes: 2 additions & 1 deletion ts/features/wallet/onboarding/bancomat/navigation/routes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const WALLET_ONBOARDING_BANCOMAT_ROUTES = {
MAIN: "WALLET_ONBOARDING_BANCOMAT_MAIN",

CHOOSE_BANK: "WALLET_ONBOARDING_BANCOMAT_CHOOSE_BANK",
BANCOMAT_START: "WALLET_ONBOARDING_BANCOMAT_START",
CHOOSE_BANK: "WALLET_ONBOARDING_CHOOSE_BANK_SCREEN",
SEARCH_AVAILABLE_USER_BANCOMAT:
"WALLET_ONBOARDING_BANCOMAT_SEARCH_AVAILABLE_USER_BANCOMAT",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { SagaCallReturnType } from "../../../../../../types/utils";
import { activateBpdOnNewPaymentMethods } from "../../../../../bonus/bpd/saga/orchestration/activateBpdOnNewAddedPaymentMethods";
import {
navigateToActivateBpdOnNewBancomat,
navigateToOnboardingBancomatChooseBank
navigateToOnboardingBancomatSearchStartScreen
} from "../../navigation/action";
import WALLET_ONBOARDING_BANCOMAT_ROUTES from "../../navigation/routes";
import {
Expand All @@ -30,8 +30,8 @@ import { onboardingBancomatAddedPansSelector } from "../../store/reducers/addedP
*/
function* bancomatWorkUnit() {
return yield call(executeWorkUnit, {
startScreenNavigation: navigateToOnboardingBancomatChooseBank(),
startScreenName: WALLET_ONBOARDING_BANCOMAT_ROUTES.CHOOSE_BANK,
startScreenNavigation: navigateToOnboardingBancomatSearchStartScreen(),
startScreenName: WALLET_ONBOARDING_BANCOMAT_ROUTES.BANCOMAT_START,
complete: walletAddBancomatCompleted,
back: walletAddBancomatBack,
cancel: walletAddBancomatCancel
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { View } from "native-base";
import * as React from "react";
import I18n from "../../../../../../i18n";
import { Body } from "../../../../../../components/core/typography/Body";
import { H1 } from "../../../../../../components/core/typography/H1";
import { H4 } from "../../../../../../components/core/typography/H4";
import { Link } from "../../../../../../components/core/typography/Link";

type Props = {
openTosModal: () => void;
onSearch: () => void;
};

export const BancomatSearchStartComponent: React.FunctionComponent<Props> = (
props: Props
) => (
<>
<H1>{I18n.t("wallet.searchAbi.title")}</H1>
<View spacer={true} large={true} />
<Body>
<H4 weight={"Regular"} color={"bluegreyDark"}>
{I18n.t("wallet.searchAbi.description.text1")}
</H4>
<Link onPress={props.openTosModal}>
{I18n.t("wallet.searchAbi.description.text2")}
</Link>
</Body>
<View spacer={true} large={true} />
<Body>
<H4 weight={"Regular"} color={"bluegreyDark"}>
{I18n.t("wallet.searchAbi.description.text3")}
</H4>
<Link onPress={props.onSearch}>
{I18n.t("wallet.searchAbi.description.text4")}
</Link>
</Body>
</>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import * as React from "react";
import { connect } from "react-redux";
import { Dispatch } from "redux";
import { SafeAreaView } from "react-native";
import { Content } from "native-base";
import { withLightModalContext } from "../../../../../../components/helpers/withLightModalContext";
import BaseScreenComponent from "../../../../../../components/screens/BaseScreenComponent";
import { LightModalContextInterface } from "../../../../../../components/ui/LightModal";
import I18n from "../../../../../../i18n";
import { GlobalState } from "../../../../../../store/reducers/types";
import TosBonusComponent from "../../../../../bonus/bonusVacanze/components/TosBonusComponent";
import { isError, isLoading } from "../../../../../bonus/bpd/model/RemoteValue";
import { abiSelector } from "../../../store/abi";
import {
navigateToOnboardingBancomatChooseBank,
navigateToOnboardingBancomatSearchAvailableUserBancomat
} from "../../navigation/action";
import {
loadAbi,
searchUserPans,
walletAddBancomatBack,
walletAddBancomatCancel
} from "../../store/actions";
import { emptyContextualHelp } from "../../../../../../utils/emptyContextualHelp";
import FooterWithButtons from "../../../../../../components/ui/FooterWithButtons";
import {
cancelButtonProps,
confirmButtonProps
} from "../../../../../bonus/bonusVacanze/components/buttons/ButtonConfigurations";
import { IOStyles } from "../../../../../../components/core/variables/IOStyles";
import { BancomatSearchStartComponent } from "./BancomatSearchStartComponent";

type Props = LightModalContextInterface &
ReturnType<typeof mapStateToProps> &
ReturnType<typeof mapDispatchToProps>;

const tos_url = "https://io.italia.it/app-content/privacy_bancomat.html";

const renderFooterButtons = (onCancel: () => void, onContinue: () => void) => (
<FooterWithButtons
type={"TwoButtonsInlineThird"}
leftButton={cancelButtonProps(onCancel, I18n.t("global.buttons.cancel"))}
rightButton={confirmButtonProps(
onContinue,
I18n.t("global.buttons.continue")
)}
/>
);

/**
* This screen allows the user to choose a specific bank to search for their Bancomat.
* @constructor
*/
const BancomatSearchStartScreen: React.FunctionComponent<Props> = (
props: Props
) => {
const openTosModal = () => {
props.showModal(
<TosBonusComponent tos_url={tos_url} onClose={props.hideModal} />
);
};

const onContinueHandler = () => {
props.searchPans();
};
return (
<BaseScreenComponent
goBack={true}
headerTitle={I18n.t("wallet.searchAbi.header")}
contextualHelp={emptyContextualHelp}
>
<SafeAreaView style={IOStyles.flex}>
<Content style={IOStyles.flex}>
<BancomatSearchStartComponent
openTosModal={openTosModal}
onSearch={props.navigateToSearchBankScreen}
/>
</Content>
{renderFooterButtons(props.onCancel, onContinueHandler)}
</SafeAreaView>
</BaseScreenComponent>
);
};

const mapDispatchToProps = (dispatch: Dispatch) => ({
loadAbis: () => dispatch(loadAbi.request()),
onCancel: () => dispatch(walletAddBancomatCancel()),
onBack: () => dispatch(walletAddBancomatBack()),
searchPans: (abi?: string) => {
dispatch(searchUserPans.request(abi));
dispatch(navigateToOnboardingBancomatSearchAvailableUserBancomat());
},
navigateToSearchBankScreen: () => {
dispatch(navigateToOnboardingBancomatChooseBank());
}
});

const mapStateToProps = (state: GlobalState) => ({
isLoading: isLoading(abiSelector(state)),
isError: isError(abiSelector(state))
});

export default withLightModalContext(
connect(mapStateToProps, mapDispatchToProps)(BancomatSearchStartScreen)
);
Loading

0 comments on commit 82192ee

Please sign in to comment.