-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Refactor Terms step of Wallet_Activate into AcceptWalletTerms
#10443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
f1fa95c
45c9f65
cb9b03b
447e84a
5fc434d
9c52ece
1ddf7b9
482f75a
559dcae
86bf03a
c82cfee
1676919
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -434,6 +434,47 @@ function verifyIdentity(parameters) { | |
}); | ||
} | ||
|
||
/** | ||
* Complete the "Accept Terms" step of the wallet activation flow. | ||
* | ||
* @param {Object} parameters | ||
* @param {Boolean} parameters.hasAcceptedTerms | ||
*/ | ||
function acceptWalletTerms(parameters) { | ||
const optimisticData = [ | ||
{ | ||
onyxMethod: CONST.ONYX.METHOD.MERGE, | ||
key: ONYXKEYS.USER_WALLET, | ||
value: { | ||
shouldShowWalletActivationSuccess: true, | ||
}, | ||
}, | ||
]; | ||
|
||
const successData = [ | ||
{ | ||
onyxMethod: CONST.ONYX.METHOD.MERGE, | ||
key: ONYXKEYS.WALLET_TERMS, | ||
value: { | ||
errors: null, | ||
}, | ||
}, | ||
]; | ||
|
||
const failureData = [ | ||
{ | ||
onyxMethod: CONST.ONYX.METHOD.MERGE, | ||
key: ONYXKEYS.USER_WALLET, | ||
value: { | ||
shouldShowWalletActivationSuccess: null, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed this to |
||
shouldShowFailedKYC: true, | ||
}, | ||
}, | ||
]; | ||
|
||
API.write('AcceptWalletTerms', {hasAcceptedTerms: parameters.hasAcceptedTerms}, {optimisticData, successData, failureData}); | ||
} | ||
|
||
/** | ||
* Fetches information about a user's Expensify Wallet | ||
* | ||
|
@@ -481,4 +522,5 @@ export { | |
updateCurrentStep, | ||
updatePersonalDetails, | ||
verifyIdentity, | ||
acceptWalletTerms, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,12 @@ import styles from '../../styles/styles'; | |
import userWalletPropTypes from './userWalletPropTypes'; | ||
import CONST from '../../CONST'; | ||
import Text from '../../components/Text'; | ||
import Icon from '../../components/Icon'; | ||
import * as Illustrations from '../../components/Icon/Illustrations'; | ||
import defaultTheme from '../../styles/themes/default'; | ||
import FixedFooter from '../../components/FixedFooter'; | ||
import Button from '../../components/Button'; | ||
import * as PaymentMethods from '../../libs/actions/PaymentMethods'; | ||
|
||
const propTypes = { | ||
...withLocalizePropTypes, | ||
|
@@ -21,24 +27,64 @@ const defaultProps = { | |
userWallet: {}, | ||
}; | ||
|
||
const ActivateStep = props => ( | ||
<ScreenWrapper> | ||
<HeaderWithCloseButton | ||
title={props.translate('activateStep.headerTitle')} | ||
onCloseButtonPress={() => Navigation.dismissModal()} | ||
shouldShowBackButton | ||
onBackButtonPress={() => Navigation.goBack()} | ||
/> | ||
<View style={[styles.mh5, styles.flex1]}> | ||
{props.userWallet.tierName === CONST.WALLET.TIER_NAME.GOLD && ( | ||
<Text>{props.translate('activateStep.activated')}</Text> | ||
)} | ||
{props.userWallet.tierName === CONST.WALLET.TIER_NAME.SILVER && ( | ||
<Text>{props.translate('activateStep.checkBackLater')}</Text> | ||
)} | ||
</View> | ||
</ScreenWrapper> | ||
); | ||
class ActivateStep extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.renderGoldWalletActivationStep = this.renderGoldWalletActivationStep.bind(this); | ||
} | ||
|
||
renderGoldWalletActivationStep() { | ||
return ( | ||
<> | ||
<View style={[styles.pageWrapper, styles.flex1, styles.flexColumn, styles.alignItemsCenter, styles.justifyContentCenter]}> | ||
<Icon | ||
src={Illustrations.TadaBlue} | ||
height={100} | ||
width={100} | ||
fill={defaultTheme.iconSuccessFill} | ||
/> | ||
<View style={[styles.ph5]}> | ||
<Text style={[styles.mt5, styles.h1, styles.textAlignCenter]}> | ||
{this.props.translate('activateStep.activatedTitle')} | ||
</Text> | ||
<Text style={[styles.mt3, styles.textAlignCenter]}> | ||
{this.props.translate('activateStep.activatedMessage')} | ||
</Text> | ||
</View> | ||
</View> | ||
<FixedFooter> | ||
<Button | ||
text={this.props.translate('common.continue')} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a big deal but we can probably adjust this now or in a follow up PR.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah at the moment I don't see how we would do that so I don't mind if we do this in a follow-up PR. |
||
onPress={PaymentMethods.continueSetup} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haven't tested but just wanted to confirm if clicking this will lead the user back to the action they were previously taking i.e. paying via the wallet or transferring their wallet balance? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a huge pain to test on dev for some reason, but yes. It calls this function, which at the bottom ends up calling the Screen.Recording.2022-08-22.at.3.38.56.PM.mov |
||
style={[styles.mt4]} | ||
iconStyles={[styles.mr5]} | ||
success | ||
/> | ||
</FixedFooter> | ||
</> | ||
); | ||
} | ||
|
||
render() { | ||
return ( | ||
<ScreenWrapper> | ||
<HeaderWithCloseButton | ||
title={this.props.translate('activateStep.headerTitle')} | ||
onCloseButtonPress={() => Navigation.dismissModal()} | ||
shouldShowBackButton | ||
onBackButtonPress={() => Navigation.goBack()} | ||
/> | ||
<View style={[styles.mh5, styles.flex1]}> | ||
francoisl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{this.props.userWallet.tierName === CONST.WALLET.TIER_NAME.GOLD && this.renderGoldWalletActivationStep()} | ||
{this.props.userWallet.tierName === CONST.WALLET.TIER_NAME.SILVER && ( | ||
<Text>{this.props.translate('activateStep.checkBackLater')}</Text> | ||
)} | ||
Comment on lines
+80
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created an issue for a mockup for the Doesn't have to be part of this PR, can be a follow up improvement. |
||
</View> | ||
</ScreenWrapper> | ||
); | ||
} | ||
} | ||
|
||
ActivateStep.propTypes = propTypes; | ||
ActivateStep.defaultProps = defaultProps; | ||
|
Uh oh!
There was an error while loading. Please reload this page.