Skip to content

Commit

Permalink
feat(Bonus Pagamenti Digitali): [#174863094] No payment methods avail…
Browse files Browse the repository at this point in the history
…able screen (#2262)

* add screens

* add comments

* Add navigation stack

* add screen events layout

* wip

* wip

* wip

* rework ibaninsertion

* clean code

* file mssing

* cleaning

* reorder store

* clean code

* add comments

* comments

* add locales and validation iban

* revert wallet

* fix

* [#174847335] add IbanKOWrong

* create common body

* .

* cannot verify string

* iban not owned

* refactoring

* fix basetypography test

* Update ts/features/bonus/bpd/saga/orchestration/onboarding/enrollToBpd.ts

Co-authored-by: Matteo Boschi <[email protected]>

* Update ts/features/bonus/bpd/screens/iban/IbanLoadingUpsert.tsx

Co-authored-by: Matteo Boschi <[email protected]>

* [#174863094] Update NoPaymentMethodsAvailableScreen

* update locales

* update iban loading caption

* wrong caption

* Update locales/it/index.yml

* Update ts/features/bonus/bpd/screens/iban/insertion/IbanInsertionComponent.tsx

Co-authored-by: Matteo Boschi <[email protected]>

* Update ts/features/bonus/bpd/screens/iban/insertion/IbanInsertionComponent.tsx

Co-authored-by: Matteo Boschi <[email protected]>

Co-authored-by: Matteo Boschi <[email protected]>
  • Loading branch information
fabriziofff and Undermaken authored Oct 7, 2020
1 parent a180b73 commit 6fda0ec
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 16 deletions.
6 changes: 5 additions & 1 deletion locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ global:
exit: Exit
saveSelection: Save the selection
search: Search
skip: "Skip"
navigator:
messages: messages
wallet: payments
Expand Down Expand Up @@ -1553,8 +1554,11 @@ bonus:
loadingActivateBpd:
title: "We are activating the cashback"
body: "Please wait."
noPaymentMethod:
title: "Add at least one payment method"
body: "To start collecting points you have to add your favorite electronic payment methods to IO: today credit cards, prepaid, rechargeable cards, debit cards, bancomat and apps and other digital tools are supported.\n\n
In the future, cashback will support other tools: you can add new payment methods to IO whenever you want and activate the collection of points on each!"
iban:
skip: "Skip"
iban: "IBAN"
edit: "Change IBAN"
insertion:
Expand Down
6 changes: 5 additions & 1 deletion locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ global:
exit: Esci
saveSelection: Salva la selezione
search: Ricerca
skip: "Salta"
navigator:
messages: messaggi
wallet: pagamenti
Expand Down Expand Up @@ -1585,8 +1586,11 @@ bonus:
loadingActivateBpd:
title: "Stiamo attivando il cashback"
body: "Ti preghiamo di attendere."
noPaymentMethod:
title: "Aggiungi almeno un metodo di pagamento"
body: "Per inziare a raccogliere punti devi aggiungere su IO i tuoi metodi di pagamento elettronico preferiti: oggi sono supportate carte di credito, prepagate, ricaricabili, carte di debito, Bancomat e app e altri strumenti digitali.\n\n
In futuro il cashback supporterà altri strumenti: potrai aggiungere quando vuoi nuovi metodi di pagamento su IO e attivare su ciascuno la raccolta dei punti!"
iban:
skip: "Salta"
iban: "IBAN"
edit: "Modifica IBAN"
insertion:
Expand Down
2 changes: 1 addition & 1 deletion ts/features/bonus/bpd/navigation/navigator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import DeclarationScreen from "../screens/onboarding/declaration/DeclarationScre
import { EnrollPaymentMethodsScreen } from "../screens/onboarding/EnrollPaymentMethodsScreen";
import LoadActivateBpdScreen from "../screens/onboarding/LoadActivateBpdScreen";
import LoadBpdActivationStatus from "../screens/onboarding/LoadBpdActivationStatus";
import { NoPaymentMethodsAvailableScreen } from "../screens/onboarding/NoPaymentMethodsAvailableScreen";
import NoPaymentMethodsAvailableScreen from "../screens/onboarding/NoPaymentMethodsAvailableScreen";
import BPD_ROUTES from "./routes";

const BpdNavigator = createStackNavigator(
Expand Down
6 changes: 3 additions & 3 deletions ts/features/bonus/bpd/saga/orchestration/insertIban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ActionType, getType, isActionOf } from "typesafe-actions";
import { navigationHistoryPop } from "../../../../../store/actions/navigationHistory";
import { navigationCurrentRouteSelector } from "../../../../../store/reducers/navigation";
import { navigateToBpdIbanInsertion } from "../../navigation/action/iban";
import { navigateToBpdOnboardingEnrollPaymentMethod } from "../../navigation/action/onboarding";
import { navigateToBpdOnboardingNoPaymentMethods } from "../../navigation/action/onboarding";
import BPD_ROUTES from "../../navigation/routes";
import {
bpdIbanInsertionCancel,
Expand All @@ -17,7 +17,7 @@ import { isBpdOnboardingOngoing } from "../../store/reducers/onboarding/ongoing"
// which screen to display, (the user already have payment methods or not)
export const chooseContinueAction = (isOnboarding: boolean) =>
isOnboarding
? navigateToBpdOnboardingEnrollPaymentMethod
? navigateToBpdOnboardingNoPaymentMethods
: NavigationActions.back;

export const isMainScreen = (screenName: string) =>
Expand Down Expand Up @@ -51,7 +51,7 @@ export function* bpdIbanInsertionWorker() {
yield put(NavigationActions.back());
} else {
if (onboardingOngoing) {
yield put(navigateToBpdOnboardingEnrollPaymentMethod());
yield put(navigateToBpdOnboardingNoPaymentMethods());
navigationHistoryPop(1);
} else {
yield put(NavigationActions.back());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const loadLocales = () => ({
body1: I18n.t("bonus.bpd.iban.insertion.body1"),
body2: I18n.t("bonus.bpd.iban.insertion.body2"),
ibanDescription: I18n.t("bonus.bpd.iban.iban"),
skip: I18n.t("bonus.bpd.iban.skip")
skip: I18n.t("global.buttons.skip")
});

export const IbanInsertionComponent: React.FunctionComponent<Props> = props => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,57 @@
import { View } from "native-base";
import * as React from "react";
import { View } from "react-native";

/**
* This screen warns the user that he does not have any payment method already present on which it is
* possible to activate the bpd and invites him to add a new one.
*/
export const NoPaymentMethodsAvailableScreen: React.FunctionComponent = () => (
<View />
);
import { SafeAreaView } from "react-native";
import { connect } from "react-redux";
import { Dispatch } from "redux";
import { Body } from "../../../../../components/core/typography/Body";
import { H1 } from "../../../../../components/core/typography/H1";
import { IOStyles } from "../../../../../components/core/variables/IOStyles";
import BaseScreenComponent from "../../../../../components/screens/BaseScreenComponent";
import I18n from "../../../../../i18n";
import { navigateToWalletHome } from "../../../../../store/actions/navigation";
import { GlobalState } from "../../../../../store/reducers/types";
import { FooterTwoButtons } from "../../../bonusVacanze/components/markdown/FooterTwoButtons";

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

const loadLocales = () => ({
headerTitle: I18n.t("bonus.bpd.title"),
skip: I18n.t("global.buttons.skip"),
addMethod: I18n.t("wallet.newPaymentMethod.addButton"),
title: I18n.t("bonus.bpd.onboarding.noPaymentMethod.title"),
body: I18n.t("bonus.bpd.onboarding.noPaymentMethod.body")
});

const NoPaymentMethodsAvailableScreen: React.FunctionComponent<Props> = props => {
const { headerTitle, skip, addMethod, title, body } = loadLocales();
return (
<BaseScreenComponent goBack={false} headerTitle={headerTitle}>
<SafeAreaView style={IOStyles.flex}>
<View style={[IOStyles.horizontalContentPadding, IOStyles.flex]}>
<View spacer={true} large={true} />
<H1>{title}</H1>
<View spacer={true} large={true} />
<Body>{body}</Body>
</View>
<FooterTwoButtons
onRight={props.skip}
onCancel={props.skip}
rightText={addMethod}
leftText={skip}
/>
</SafeAreaView>
</BaseScreenComponent>
);
};

const mapDispatchToProps = (dispatch: Dispatch) => ({
skip: () => dispatch(navigateToWalletHome())
});

const mapStateToProps = (_: GlobalState) => ({});

export default connect(
mapStateToProps,
mapDispatchToProps
)(NoPaymentMethodsAvailableScreen);

0 comments on commit 6fda0ec

Please sign in to comment.