Skip to content

Commit

Permalink
Merge pull request #42589 from koko57/refactor/36648-wallet-enablemen…
Browse files Browse the repository at this point in the history
…t-flow-connect-steps

Refactor/36648 wallet enablement flow connect steps
  • Loading branch information
mountiny authored Jun 12, 2024
2 parents edec897 + a327b9b commit 69dfe2a
Show file tree
Hide file tree
Showing 26 changed files with 300 additions and 166 deletions.
3 changes: 3 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ const CONST = {
LICENSES_URL: `${USE_EXPENSIFY_URL}/licenses`,
ACH_TERMS_URL: `${USE_EXPENSIFY_URL}/achterms`,
WALLET_AGREEMENT_URL: `${USE_EXPENSIFY_URL}/walletagreement`,
BANCORP_WALLET_AGREEMENT_URL: `${USE_EXPENSIFY_URL}/bancorp-bank-wallet-terms-of-service`,
HELP_LINK_URL: `${USE_EXPENSIFY_URL}/usa-patriot-act`,
ELECTRONIC_DISCLOSURES_URL: `${USE_EXPENSIFY_URL}/esignagreement`,
GITHUB_RELEASE_URL: 'https://api.github.com/repos/expensify/app/releases/latest',
Expand Down Expand Up @@ -1428,6 +1429,7 @@ const CONST = {
},
STEP: {
// In the order they appear in the Wallet flow
ADD_BANK_ACCOUNT: 'AddBankAccountStep',
ADDITIONAL_DETAILS: 'AdditionalDetailsStep',
ADDITIONAL_DETAILS_KBA: 'AdditionalDetailsKBAStep',
ONFIDO: 'OnfidoStep',
Expand Down Expand Up @@ -1464,6 +1466,7 @@ const CONST = {
CONCIERGE: 'CONCIERGE_NAVIGATE',
},
MTL_WALLET_PROGRAM_ID: '760',
BANCORP_WALLET_PROGRAM_ID: '660',
PROGRAM_ISSUERS: {
EXPENSIFY_PAYMENTS: 'Expensify Payments LLC',
BANCORP_BANK: 'The Bancorp Bank',
Expand Down
5 changes: 0 additions & 5 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,7 @@ const ROUTES = {
},
SETTINGS_ADD_DEBIT_CARD: 'settings/wallet/add-debit-card',
SETTINGS_ADD_BANK_ACCOUNT: 'settings/wallet/add-bank-account',
SETTINGS_ADD_BANK_ACCOUNT_REFACTOR: 'settings/wallet/add-bank-account-refactor',
SETTINGS_ENABLE_PAYMENTS: 'settings/wallet/enable-payments',
// TODO: Added temporarily for testing purposes, remove after refactor - https://github.com/Expensify/App/issues/36648
SETTINGS_ENABLE_PAYMENTS_REFACTOR: 'settings/wallet/enable-payments-refactor',
// TODO: Added temporarily for testing purposes, remove after refactor - https://github.com/Expensify/App/issues/36648
SETTINGS_ENABLE_PAYMENTS_TEMPORARY_TERMS: 'settings/wallet/enable-payments-temporary-terms',
SETTINGS_WALLET_CARD_DIGITAL_DETAILS_UPDATE_ADDRESS: {
route: 'settings/wallet/card/:domain/digital-details/update-address',
getRoute: (domain: string) => `settings/wallet/card/${domain}/digital-details/update-address` as const,
Expand Down
5 changes: 0 additions & 5 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const SCREENS = {
APP_DOWNLOAD_LINKS: 'Settings_App_Download_Links',
ADD_DEBIT_CARD: 'Settings_Add_Debit_Card',
ADD_BANK_ACCOUNT: 'Settings_Add_Bank_Account',
ADD_BANK_ACCOUNT_REFACTOR: 'Settings_Add_Bank_Account_Refactor',
CLOSE: 'Settings_Close',
TWO_FACTOR_AUTH: 'Settings_TwoFactorAuth',
REPORT_CARD_LOST_OR_DAMAGED: 'Settings_ReportCardLostOrDamaged',
Expand Down Expand Up @@ -89,10 +88,6 @@ const SCREENS = {
TRANSFER_BALANCE: 'Settings_Wallet_Transfer_Balance',
CHOOSE_TRANSFER_ACCOUNT: 'Settings_Wallet_Choose_Transfer_Account',
ENABLE_PAYMENTS: 'Settings_Wallet_EnablePayments',
// TODO: Added temporarily for testing purposes, remove after refactor - https://github.com/Expensify/App/issues/36648
ENABLE_PAYMENTS_REFACTOR: 'Settings_Wallet_EnablePayments_Refactor',
// TODO: Added temporarily for testing purposes, remove after refactor - https://github.com/Expensify/App/issues/36648
ENABLE_PAYMENTS_TEMPORARY_TERMS: 'Settings_Wallet_EnablePayments_Temporary_Terms',
CARD_ACTIVATE: 'Settings_Wallet_Card_Activate',
REPORT_VIRTUAL_CARD_FRAUD: 'Settings_Wallet_ReportVirtualCardFraud',
CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS: 'Settings_Wallet_Cards_Digital_Details_Update_Address',
Expand Down
69 changes: 17 additions & 52 deletions src/components/AddPlaidBankAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import FullPageOfflineBlockingView from './BlockingViews/FullPageOfflineBlocking
import FormHelpMessage from './FormHelpMessage';
import Icon from './Icon';
import getBankIcon from './Icon/BankIcons';
import Picker from './Picker';
import PlaidLink from './PlaidLink';
import RadioButtons from './RadioButtons';
import Text from './Text';
Expand Down Expand Up @@ -59,9 +58,6 @@ type AddPlaidBankAccountProps = AddPlaidBankAccountOnyxProps & {
/** Are we adding a withdrawal account? */
allowDebit?: boolean;

/** Is displayed in new VBBA */
isDisplayedInNewVBBA?: boolean;

/** Is displayed in new enable wallet flow */
isDisplayedInWalletFlow?: boolean;

Expand All @@ -84,7 +80,6 @@ function AddPlaidBankAccount({
bankAccountID = 0,
allowDebit = false,
isPlaidDisabled,
isDisplayedInNewVBBA = false,
errorText = '',
onInputChange = () => {},
isDisplayedInWalletFlow = false,
Expand Down Expand Up @@ -259,62 +254,32 @@ function AddPlaidBankAccount({
return <FullPageOfflineBlockingView>{renderPlaidLink()}</FullPageOfflineBlockingView>;
}

if (isDisplayedInNewVBBA || isDisplayedInWalletFlow) {
return (
<FullPageOfflineBlockingView>
<Text style={[styles.mb3, styles.textHeadlineLineHeightXXL]}>{translate(isDisplayedInWalletFlow ? 'walletPage.chooseYourBankAccount' : 'bankAccount.chooseAnAccount')}</Text>
{!!text && <Text style={[styles.mb6, styles.textSupporting]}>{text}</Text>}
<View style={[styles.flexRow, styles.alignItemsCenter, styles.mb6]}>
<Icon
src={icon}
height={iconSize}
width={iconSize}
additionalStyles={iconStyles}
/>
<View>
<Text style={[styles.ml3, styles.textStrong]}>{bankName}</Text>
{selectedPlaidAccountMask.length > 0 && (
<Text style={[styles.ml3, styles.textLabelSupporting]}>{`${translate('bankAccount.accountEnding')} ${selectedPlaidAccountMask}`}</Text>
)}
</View>
</View>
<Text style={[styles.textLabelSupporting]}>{`${translate('bankAccount.chooseAnAccountBelow')}:`}</Text>
<RadioButtons
items={options}
defaultCheckedValue={defaultSelectedPlaidAccountID}
onPress={handleSelectingPlaidAccount}
radioButtonStyle={[styles.mb6]}
/>
<FormHelpMessage message={errorText} />
</FullPageOfflineBlockingView>
);
}

// Plaid bank accounts view
return (
<FullPageOfflineBlockingView>
{!!text && <Text style={[styles.mb5]}>{text}</Text>}
<View style={[styles.flexRow, styles.alignItemsCenter, styles.mb5]}>
<Text style={[styles.mb3, styles.textHeadlineLineHeightXXL]}>{translate(isDisplayedInWalletFlow ? 'walletPage.chooseYourBankAccount' : 'bankAccount.chooseAnAccount')}</Text>
{!!text && <Text style={[styles.mb6, styles.textSupporting]}>{text}</Text>}
<View style={[styles.flexRow, styles.alignItemsCenter, styles.mb6]}>
<Icon
src={icon}
height={iconSize}
width={iconSize}
additionalStyles={iconStyles}
/>
<Text style={[styles.ml3, styles.textStrong]}>{bankName}</Text>
</View>
<View>
<Picker
label={translate('addPersonalBankAccountPage.chooseAccountLabel')}
onInputChange={onSelect}
items={options}
placeholder={{
value: '',
label: translate('bankAccount.chooseAnAccount'),
}}
value={selectedPlaidAccountID}
/>
<View>
<Text style={[styles.ml3, styles.textStrong]}>{bankName}</Text>
{selectedPlaidAccountMask.length > 0 && (
<Text style={[styles.ml3, styles.textLabelSupporting]}>{`${translate('bankAccount.accountEnding')} ${selectedPlaidAccountMask}`}</Text>
)}
</View>
</View>
<Text style={[styles.textLabelSupporting]}>{`${translate('bankAccount.chooseAnAccountBelow')}:`}</Text>
<RadioButtons
items={options}
defaultCheckedValue={defaultSelectedPlaidAccountID}
onPress={handleSelectingPlaidAccount}
radioButtonStyle={[styles.mb6]}
/>
<FormHelpMessage message={errorText} />
</FullPageOfflineBlockingView>
);
}
Expand Down
6 changes: 4 additions & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,8 @@ export default {
facialScan: 'Onfido’s Facial Scan Policy and Release',
tryAgain: 'Try again',
verifyIdentity: 'Verify identity',
letsVerifyIdentity: "Let's verify your identity.",
butFirst: `But first, the boring stuff. Read up on the legalese in the next step and click "Accept" when you're ready.`,
genericError: 'There was an error while processing this step. Please try again.',
cameraPermissionsNotGranted: 'Enable camera access',
cameraRequestMessage: 'We need access to your camera to complete bank account verification. Please enable via Settings > New Expensify.',
Expand Down Expand Up @@ -1662,8 +1664,8 @@ export default {
noOverdraftOrCredit: 'No overdraft/credit feature.',
electronicFundsWithdrawal: 'Electronic funds withdrawal',
standard: 'Standard',
takeALookAtSomeFees: 'Take a look at some fees.',
checkPlease: 'Check please.',
reviewTheFees: 'Please review the fees below.',
checkTheBoxes: 'Please check the boxes below.',
agreeToTerms: 'Agree to the terms and you’ll be good to go!',
shortTermsForm: {
expensifyPaymentsAccount: ({walletProgram}: WalletProgramParams) => `The Expensify Wallet is issued by ${walletProgram}.`,
Expand Down
6 changes: 4 additions & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1641,6 +1641,8 @@ export default {
facialScan: 'Política y lanzamiento de la exploración facial de Onfido',
tryAgain: 'Intentar otra vez',
verifyIdentity: 'Verificar identidad',
letsVerifyIdentity: '¡Vamos a verificar tu identidad!',
butFirst: 'Pero primero, lo aburrido. Lee la jerga legal en el siguiente paso y haz clic en "Aceptar" cuando estés listo.',
genericError: 'Hubo un error al procesar este paso. Inténtalo de nuevo.',
cameraPermissionsNotGranted: 'Permiso para acceder a la cámara',
cameraRequestMessage: 'Necesitamos acceso a tu cámara para completar la verificación de tu cuenta de banco. Por favor habilita los permisos en Configuración > Nuevo Expensify.',
Expand Down Expand Up @@ -1684,8 +1686,8 @@ export default {
noOverdraftOrCredit: 'Sin función de sobregiro/crédito',
electronicFundsWithdrawal: 'Retiro electrónico de fondos',
standard: 'Estándar',
takeALookAtSomeFees: 'Echa un vistazo a algunas tarifas.',
checkPlease: 'Por favor, revisa.',
reviewTheFees: 'Por favor, revisa las siguientes tarifas.',
checkTheBoxes: 'Por favor, marca las siguientes casillas.',
agreeToTerms: 'Debes aceptar los términos y condiciones para continuar.',
shortTermsForm: {
expensifyPaymentsAccount: ({walletProgram}: WalletProgramParams) => `La billetera Expensify es emitida por ${walletProgram}.`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,9 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.CONFIRM]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardConfirm').default as React.ComponentType,
[SCREENS.SETTINGS.WALLET.TRANSFER_BALANCE]: () => require('../../../../pages/settings/Wallet/TransferBalancePage').default as React.ComponentType,
[SCREENS.SETTINGS.WALLET.CHOOSE_TRANSFER_ACCOUNT]: () => require('../../../../pages/settings/Wallet/ChooseTransferAccountPage').default as React.ComponentType,
[SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default as React.ComponentType,
// TODO: Added temporarily for testing purposes, remove after refactor - https://github.com/Expensify/App/issues/36648
[SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS_REFACTOR]: () => require('../../../../pages/EnablePayments/PersonalInfo/PersonalInfo').default as React.ComponentType,
// TODO: Added temporarily for testing purposes, remove after refactor - https://github.com/Expensify/App/issues/36648
[SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS_TEMPORARY_TERMS]: () => require('../../../../pages/EnablePayments/FeesAndTerms/FeesAndTerms').default as React.ComponentType,
[SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePayments').default as React.ComponentType,
[SCREENS.SETTINGS.ADD_DEBIT_CARD]: () => require('../../../../pages/settings/Wallet/AddDebitCardPage').default as React.ComponentType,
[SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: () => require('../../../../pages/AddPersonalBankAccountPage').default as React.ComponentType,
[SCREENS.SETTINGS.ADD_BANK_ACCOUNT_REFACTOR]: () => require('../../../../pages/EnablePayments/AddBankAccount/AddBankAccount').default as React.ComponentType,
[SCREENS.SETTINGS.PROFILE.STATUS]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusPage').default as React.ComponentType,
[SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusClearAfterPage').default as React.ComponentType,
[SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_DATE]: () => require('../../../../pages/settings/Profile/CustomStatus/SetDatePage').default as React.ComponentType,
Expand Down
14 changes: 0 additions & 14 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,6 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
path: ROUTES.SETTINGS_ENABLE_PAYMENTS,
exact: true,
},
// TODO: Added temporarily for testing purposes, remove after refactor - https://github.com/Expensify/App/issues/36648
[SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS_REFACTOR]: {
path: ROUTES.SETTINGS_ENABLE_PAYMENTS_REFACTOR,
exact: true,
},
// TODO: Added temporarily for testing purposes, remove after refactor - https://github.com/Expensify/App/issues/36648
[SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS_TEMPORARY_TERMS]: {
path: ROUTES.SETTINGS_ENABLE_PAYMENTS_TEMPORARY_TERMS,
exact: true,
},
[SCREENS.SETTINGS.WALLET.TRANSFER_BALANCE]: {
path: ROUTES.SETTINGS_WALLET_TRANSFER_BALANCE,
exact: true,
Expand Down Expand Up @@ -204,10 +194,6 @@ const config: LinkingOptions<RootStackParamList>['config'] = {
path: ROUTES.SETTINGS_ADD_BANK_ACCOUNT,
exact: true,
},
[SCREENS.SETTINGS.ADD_BANK_ACCOUNT_REFACTOR]: {
path: ROUTES.SETTINGS_ADD_BANK_ACCOUNT_REFACTOR,
exact: true,
},
[SCREENS.SETTINGS.PROFILE.PRONOUNS]: {
path: ROUTES.SETTINGS_PRONOUNS,
exact: true,
Expand Down
14 changes: 10 additions & 4 deletions src/libs/actions/BankAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ function openPersonalBankAccountSetupView(exitReportID?: string) {
}

/**
* TODO: remove the previous function and rename this function to openPersonalBankAccountSetupView after migrating to the new flow
* Open the personal bank account setup flow, with an optional exitReportID to redirect to once the flow is finished.
* Open the personal bank account setup flow using Plaid, with an optional exitReportID to redirect to once the flow is finished.
*/
function openPersonalBankAccountSetupViewRefactor(exitReportID?: string) {
function openPersonalBankAccountSetupWithPlaid(exitReportID?: string) {
clearPlaid().then(() => {
if (exitReportID) {
Onyx.merge(ONYXKEYS.PERSONAL_BANK_ACCOUNT, {exitReportID});
Expand Down Expand Up @@ -232,6 +231,13 @@ function addPersonalBankAccount(account: PlaidBankAccount) {
shouldShowSuccess: true,
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.USER_WALLET,
value: {
currentStep: CONST.WALLET.STEP.ADDITIONAL_DETAILS,
},
},
],
failureData: [
{
Expand Down Expand Up @@ -562,7 +568,7 @@ export {
validateBankAccount,
verifyIdentityForBankAccount,
setReimbursementAccountLoading,
openPersonalBankAccountSetupViewRefactor,
openPersonalBankAccountSetupWithPlaid,
updateAddPersonalBankAccountDraft,
clearPersonalBankAccountSetupType,
validatePlaidSelection,
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/Wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function openEnablePaymentsPage() {
API.read(READ_COMMANDS.OPEN_ENABLE_PAYMENTS_PAGE, {});
}

function updateCurrentStep(currentStep: ValueOf<typeof CONST.WALLET.STEP>) {
function updateCurrentStep(currentStep: ValueOf<typeof CONST.WALLET.STEP> | null) {
Onyx.merge(ONYXKEYS.USER_WALLET, {currentStep});
}

Expand Down
2 changes: 2 additions & 0 deletions src/pages/AddPersonalBankAccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ function AddPersonalBankAccountPage({personalBankAccount, plaidData}: AddPersona
>
<AddPlaidBankAccount
onSelect={setSelectedPlaidAccountId}
text={translate('walletPage.chooseAccountBody')}
plaidData={plaidData}
isDisplayedInWalletFlow
onExitPlaid={() => Navigation.goBack()}
receivedRedirectURI={getPlaidOAuthReceivedRedirectURI()}
selectedPlaidAccountID={selectedPlaidAccountId}
Expand Down
10 changes: 5 additions & 5 deletions src/pages/EnablePayments/AddBankAccount/AddBankAccount.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useCallback, useEffect} from 'react';
import React, {useCallback} from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
Expand All @@ -12,6 +12,7 @@ import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@navigation/Navigation';
import * as BankAccounts from '@userActions/BankAccounts';
import * as PaymentMethods from '@userActions/PaymentMethods';
import * as Wallet from '@userActions/Wallet';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
Expand Down Expand Up @@ -44,7 +45,6 @@ function AddBankAccount({personalBankAccount, plaidData, personalBankAccountDraf

if (selectedPlaidBankAccount) {
BankAccounts.addPersonalBankAccount(selectedPlaidBankAccount);
Navigation.navigate(ROUTES.SETTINGS_ENABLE_PAYMENTS);
}
}, [personalBankAccountDraft?.plaidAccountID, plaidData?.bankAccounts]);

Expand All @@ -54,7 +54,6 @@ function AddBankAccount({personalBankAccount, plaidData, personalBankAccountDraf

const exitFlow = (shouldContinue = false) => {
const exitReportID = personalBankAccount?.exitReportID;
// TODO: https://github.com/Expensify/App/issues/36648 This should be updated to the correct route once the refactor is complete
const onSuccessFallbackRoute = personalBankAccount?.onSuccessFallbackRoute ?? '';

if (exitReportID) {
Expand All @@ -75,18 +74,19 @@ function AddBankAccount({personalBankAccount, plaidData, personalBankAccountDraf
}
if (screenIndex === 0) {
BankAccounts.clearPersonalBankAccount();
Wallet.updateCurrentStep(null);
Navigation.goBack(ROUTES.SETTINGS_WALLET);
return;
}
prevScreen();
};

useEffect(() => BankAccounts.clearPersonalBankAccount, []);

return (
<ScreenWrapper
testID={AddBankAccount.displayName}
includeSafeAreaPaddingBottom={false}
shouldEnablePickerAvoiding={false}
shouldShowOfflineIndicator
>
<HeaderWithBackButton
shouldShowBackButton
Expand Down
Loading

0 comments on commit 69dfe2a

Please sign in to comment.