-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Bonus Pagamenti Digitali): [#175683801] When credit card has bee…
…n added, join BPD or enroll the new method to BPD (#2399) * [#175683801] wip * [#175683801] refactoring when new credit card has been added navigate to join bpd / enroll the new method on bpd * [#175683801] add comment * [#175683801] refactoring * [#175683801] restore code * [#175683801] fix typo * [#175683801] log the AuthorizationCode * [#175683801] revert Co-authored-by: fabriziofff <[email protected]>
- Loading branch information
1 parent
114b511
commit 86fb44c
Showing
7 changed files
with
151 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 7 additions & 62 deletions
69
ts/features/wallet/onboarding/bancomat/screens/bpd/ActivateBpdOnNewBancomatScreen.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,15 @@ | ||
import { View } from "native-base"; | ||
import * as React from "react"; | ||
import { SafeAreaView, ScrollView } from "react-native"; | ||
import { NavigationActions } from "react-navigation"; | ||
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 { GlobalState } from "../../../../../../store/reducers/types"; | ||
import { FooterTwoButtons } from "../../../../../bonus/bonusVacanze/components/markdown/FooterTwoButtons"; | ||
import { PaymentMethodRawList } from "../../../../../bonus/bpd/components/paymentMethodActivationToggle/list/PaymentMethodRawList"; | ||
import { onboardingBancomatAddedPansSelector } from "../../store/reducers/addedPans"; | ||
import { GlobalState } from "../../../../../../store/reducers/types"; | ||
import ActivateBpdOnNewPaymentMethodScreen from "./ActivateBpdOnNewPaymentMethodScreen"; | ||
export type Props = ReturnType<typeof mapStateToProps>; | ||
|
||
export type Props = ReturnType<typeof mapDispatchToProps> & | ||
ReturnType<typeof mapStateToProps>; | ||
|
||
const loadLocales = () => ({ | ||
headerTitle: I18n.t("wallet.onboarding.bancomat.headerTitle"), | ||
title: I18n.t("wallet.onboarding.bancomat.bpd.activateNew.title"), | ||
body1: I18n.t("wallet.onboarding.bancomat.bpd.activateNew.body1"), | ||
body2: I18n.t("wallet.onboarding.bancomat.bpd.activateNew.body2"), | ||
skip: I18n.t("wallet.onboarding.bancomat.bpd.activateNew.skip"), | ||
continueStr: I18n.t("global.buttons.continue") | ||
}); | ||
|
||
const ActivateBpdOnNewBancomatScreen: React.FunctionComponent<Props> = props => { | ||
const { headerTitle, title, body1, body2, skip, continueStr } = loadLocales(); | ||
return ( | ||
<BaseScreenComponent headerTitle={headerTitle}> | ||
<SafeAreaView style={IOStyles.flex}> | ||
<ScrollView> | ||
<View style={IOStyles.horizontalContentPadding}> | ||
<View spacer={true} large={true} /> | ||
<H1>{title}</H1> | ||
<View spacer={true} large={true} /> | ||
<Body>{body1}</Body> | ||
<View spacer={true} large={true} /> | ||
<PaymentMethodRawList paymentList={props.newBancomat} /> | ||
<View spacer={true} large={true} /> | ||
<Body>{body2}</Body> | ||
</View> | ||
</ScrollView> | ||
|
||
<FooterTwoButtons | ||
type={"TwoButtonsInlineHalf"} | ||
onCancel={props.skip} | ||
onRight={props.skip} | ||
rightText={continueStr} | ||
leftText={skip} | ||
/> | ||
</SafeAreaView> | ||
</BaseScreenComponent> | ||
); | ||
}; | ||
|
||
const mapDispatchToProps = (dispatch: Dispatch) => ({ | ||
skip: () => dispatch(NavigationActions.back()) | ||
}); | ||
const ActivateBpdOnNewBancomatScreen: React.FC<Props> = (props: Props) => ( | ||
<ActivateBpdOnNewPaymentMethodScreen paymentMethods={props.newBancomat} /> | ||
); | ||
|
||
const mapStateToProps = (state: GlobalState) => ({ | ||
newBancomat: onboardingBancomatAddedPansSelector(state) | ||
}); | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(ActivateBpdOnNewBancomatScreen); | ||
export default connect(mapStateToProps)(ActivateBpdOnNewBancomatScreen); |
19 changes: 19 additions & 0 deletions
19
ts/features/wallet/onboarding/bancomat/screens/bpd/ActivateBpdOnNewCreditCardScreen.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as React from "react"; | ||
import { NavigationScreenProps } from "react-navigation"; | ||
import { PatchedWalletV2 } from "../../../../../../types/pagopa"; | ||
import ActivateBpdOnNewPaymentMethodScreen from "./ActivateBpdOnNewPaymentMethodScreen"; | ||
|
||
type ActivateBpdOnNewCreditCardScreenNavigationParams = { | ||
creditCards: ReadonlyArray<PatchedWalletV2>; | ||
}; | ||
type Props = NavigationScreenProps< | ||
ActivateBpdOnNewCreditCardScreenNavigationParams | ||
>; | ||
|
||
export const ActivateBpdOnNewCreditCardScreen: React.FC<Props> = ( | ||
props: Props | ||
) => ( | ||
<ActivateBpdOnNewPaymentMethodScreen | ||
paymentMethods={props.navigation.getParam("creditCards")} | ||
/> | ||
); |
68 changes: 68 additions & 0 deletions
68
ts/features/wallet/onboarding/bancomat/screens/bpd/ActivateBpdOnNewPaymentMethodScreen.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { View } from "native-base"; | ||
import * as React from "react"; | ||
import { SafeAreaView, ScrollView } from "react-native"; | ||
import { NavigationActions } from "react-navigation"; | ||
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 { FooterTwoButtons } from "../../../../../bonus/bonusVacanze/components/markdown/FooterTwoButtons"; | ||
import { PaymentMethodRawList } from "../../../../../bonus/bpd/components/paymentMethodActivationToggle/list/PaymentMethodRawList"; | ||
import { PatchedWalletV2 } from "../../../../../../types/pagopa"; | ||
|
||
type OwnProps = { | ||
paymentMethods: ReadonlyArray<PatchedWalletV2>; | ||
}; | ||
|
||
export type Props = ReturnType<typeof mapDispatchToProps> & OwnProps; | ||
|
||
const loadLocales = () => ({ | ||
headerTitle: I18n.t("wallet.onboarding.bancomat.headerTitle"), | ||
title: I18n.t("wallet.onboarding.bancomat.bpd.activateNew.title"), | ||
body1: I18n.t("wallet.onboarding.bancomat.bpd.activateNew.body1"), | ||
body2: I18n.t("wallet.onboarding.bancomat.bpd.activateNew.body2"), | ||
skip: I18n.t("wallet.onboarding.bancomat.bpd.activateNew.skip"), | ||
continueStr: I18n.t("global.buttons.continue") | ||
}); | ||
|
||
const ActivateBpdOnNewPaymentMethodScreen: React.FunctionComponent<Props> = props => { | ||
const { headerTitle, title, body1, body2, skip, continueStr } = loadLocales(); | ||
return ( | ||
<BaseScreenComponent headerTitle={headerTitle}> | ||
<SafeAreaView style={IOStyles.flex}> | ||
<ScrollView> | ||
<View style={IOStyles.horizontalContentPadding}> | ||
<View spacer={true} large={true} /> | ||
<H1>{title}</H1> | ||
<View spacer={true} large={true} /> | ||
<Body>{body1}</Body> | ||
<View spacer={true} large={true} /> | ||
<PaymentMethodRawList paymentList={props.paymentMethods} /> | ||
<View spacer={true} large={true} /> | ||
<Body>{body2}</Body> | ||
</View> | ||
</ScrollView> | ||
|
||
<FooterTwoButtons | ||
type={"TwoButtonsInlineHalf"} | ||
onCancel={props.skip} | ||
onRight={props.skip} | ||
rightText={continueStr} | ||
leftText={skip} | ||
/> | ||
</SafeAreaView> | ||
</BaseScreenComponent> | ||
); | ||
}; | ||
|
||
const mapDispatchToProps = (dispatch: Dispatch) => ({ | ||
skip: () => dispatch(NavigationActions.back()) | ||
}); | ||
|
||
export default connect( | ||
undefined, | ||
mapDispatchToProps | ||
)(ActivateBpdOnNewPaymentMethodScreen); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters