Skip to content
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

Refactor/36648 wallet enablement flow connect steps #42589

Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
1e0e916
feat: verify identity step setup
koko57 Apr 17, 2024
bd97f55
Merge branch 'main' into refactor/36648-wallet-enablement-flow-verify…
koko57 Apr 18, 2024
d0d6b66
Merge branch 'main' into refactor/36648-wallet-enablement-flow-verify…
koko57 Apr 26, 2024
37072ac
Merge branch 'refactor/36648-wallet-enablement-flow-terms' into refac…
koko57 May 7, 2024
ca6201f
refactor: wip - connect all the steps
koko57 May 7, 2024
7a7c56e
Merge branch 'main' into refactor/36648-wallet-enablement-flow-verify…
koko57 May 8, 2024
1db17ab
Merge branch 'main' into refactor/36648-wallet-enablement-flow-verify…
koko57 May 10, 2024
eeb89be
Merge branch 'main' into refactor/36648-wallet-enablement-flow-verify…
koko57 May 14, 2024
5c427c1
feat: add verify identity intro page
koko57 May 15, 2024
f31778a
Merge branch 'main' into refactor/36648-wallet-enablement-flow-verify…
koko57 May 16, 2024
2ec3411
fix: get token and applicantID from walletOnfidoData
koko57 May 16, 2024
3c3e875
Merge branch 'main' into refactor/36648-wallet-enablement-flow-verify…
koko57 May 20, 2024
4706357
feat: change wallet agreement url for bancorp
koko57 May 20, 2024
c6028f7
refactor: cleanup
koko57 May 22, 2024
b3627ae
Merge branch 'main' into refactor/36648-wallet-enablement-flow-verify…
koko57 May 23, 2024
9764c60
chore: clean wallet draft after finishing the flow
koko57 May 23, 2024
aa7d744
fix: remove old add plaid bank account layout
koko57 May 23, 2024
f189a8c
fix: include add bank acount to the flow
koko57 May 23, 2024
034b82d
fix: show loading when confirming personal info, fetch userWallet onl…
koko57 May 24, 2024
75a219f
Merge branch 'main' into refactor/36648-wallet-enablement-flow-connec…
koko57 May 24, 2024
c5291d7
fix: proper submit/go back handling for the terms step
koko57 May 24, 2024
3538c69
fix: properly show the first step
koko57 May 24, 2024
c1bea82
fix: remove unnecessary comment
koko57 May 24, 2024
f3287b8
feat: routes cleanup
koko57 May 24, 2024
8e268c4
fix: minor fixes, lint
koko57 May 24, 2024
ac5dc1e
Merge branch 'main' into refactor/36648-wallet-enablement-flow-connec…
koko57 May 27, 2024
9178916
fix: minor fixes
koko57 May 27, 2024
0a5ce01
fix: minor fix
koko57 May 27, 2024
49e11c0
Merge branch 'main' into refactor/36648-wallet-enablement-flow-connec…
koko57 May 28, 2024
a069d7f
Merge branch 'main' into refactor/36648-wallet-enablement-flow-connec…
koko57 May 29, 2024
7f8b5cd
Merge branch 'main' into refactor/36648-wallet-enablement-flow-connec…
koko57 Jun 3, 2024
3f24c16
fix: apply requested changes
koko57 Jun 3, 2024
0ed7ab8
Merge branch 'main' into refactor/36648-wallet-enablement-flow-connec…
koko57 Jun 4, 2024
c94ac32
fix: navigate back to the Wallet page from the 1st step
koko57 Jun 4, 2024
e157244
Merge branch 'main' into refactor/36648-wallet-enablement-flow-connec…
koko57 Jun 5, 2024
c60889c
Merge branch 'main' into refactor/36648-wallet-enablement-flow-connec…
koko57 Jun 6, 2024
8a8539b
fix: add missing case
koko57 Jun 6, 2024
266a115
fix: minor fix
koko57 Jun 6, 2024
988b220
Merge branch 'main' into refactor/36648-wallet-enablement-flow-connec…
koko57 Jun 10, 2024
e586ae2
fix: remove fill from the Icon
koko57 Jun 10, 2024
10da723
fix: change deprecated withOnyx for useOnyx
koko57 Jun 10, 2024
f94279f
fix: lint
koko57 Jun 10, 2024
441e298
fix: change deprecated withOnyx for useOnyx
koko57 Jun 10, 2024
7c6e7f0
Merge branch 'main' into refactor/36648-wallet-enablement-flow-connec…
koko57 Jun 11, 2024
a327b9b
fix: replace translations
koko57 Jun 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1429,6 +1430,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 @@ -1465,6 +1467,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 @@ -139,12 +139,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
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1615,6 +1615,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
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,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
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 @@ -222,7 +222,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
6 changes: 3 additions & 3 deletions src/pages/EnablePayments/AddBankAccount/SetupMethod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type SetupMethodOnyxProps = {
type SetupMethodProps = SetupMethodOnyxProps;

const plaidDesktopMessage = getPlaidDesktopMessage();
const bankAccountRoute = `${CONFIG.EXPENSIFY.NEW_EXPENSIFY_URL}${ROUTES.SETTINGS_ADD_BANK_ACCOUNT_REFACTOR}`;
const enablePayments = `${CONFIG.EXPENSIFY.NEW_EXPENSIFY_URL}${ROUTES.SETTINGS_ENABLE_PAYMENTS}`;

function SetupMethod({isPlaidDisabled, user}: SetupMethodProps) {
const styles = useThemeStyles();
Expand All @@ -46,13 +46,13 @@ function SetupMethod({isPlaidDisabled, user}: SetupMethodProps) {
</View>
{!!plaidDesktopMessage && (
<View style={[styles.mv3, styles.flexRow, styles.justifyContentBetween]}>
<TextLink href={bankAccountRoute}>{translate(plaidDesktopMessage)}</TextLink>
<TextLink href={enablePayments}>{translate(plaidDesktopMessage)}</TextLink>
</View>
)}
<Button
icon={Expensicons.Bank}
text={translate('bankAccount.addBankAccount')}
onPress={() => BankAccounts.openPersonalBankAccountSetupViewRefactor()}
onPress={() => BankAccounts.openPersonalBankAccountSetupWithPlaid()}
isDisabled={isPlaidDisabled ?? !user?.validated}
style={[styles.mt4, styles.mb2]}
iconStyles={styles.buttonCTAIcon}
Expand Down
Loading
Loading