diff --git a/src/ROUTES.js b/src/ROUTES.js
index 6872398c20f1..3ae1dcc48022 100644
--- a/src/ROUTES.js
+++ b/src/ROUTES.js
@@ -107,7 +107,6 @@ export default {
WORKSPACE_INVOICES: 'workspace/:policyID/invoices',
WORKSPACE_TRAVEL: 'workspace/:policyID/travel',
WORKSPACE_MEMBERS: 'workspace/:policyID/members',
- WORKSPACE_BANK_ACCOUNT: 'workspace/:policyID/bank-account',
WORKSPACE_NEW_ROOM: 'workspace/new-room',
getWorkspaceInitialRoute: policyID => `workspace/${policyID}`,
getWorkspaceInviteRoute: policyID => `workspace/${policyID}/invite`,
@@ -118,7 +117,6 @@ export default {
getWorkspaceInvoicesRoute: policyID => `workspace/${policyID}/invoices`,
getWorkspaceTravelRoute: policyID => `workspace/${policyID}/travel`,
getWorkspaceMembersRoute: policyID => `workspace/${policyID}/members`,
- getWorkspaceBankAccountRoute: policyID => `workspace/${policyID}/bank-account`,
getRequestCallRoute: taskID => `request-call/${taskID}`,
REQUEST_CALL: 'request-call/:taskID',
diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js
index 788e6b49e541..d37b2229d977 100644
--- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js
+++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js
@@ -378,13 +378,6 @@ const SettingsModalStackNavigator = createModalStackNavigator([
},
name: 'Workspace_Members',
},
- {
- getComponent: () => {
- const WorkspaceBankAccountPage = require('../../../pages/workspace/WorkspaceBankAccountPage').default;
- return WorkspaceBankAccountPage;
- },
- name: 'Workspace_BankAccount',
- },
{
getComponent: () => {
const WorkspaceInvitePage = require('../../../pages/workspace/WorkspaceInvitePage').default;
diff --git a/src/libs/Navigation/linkingConfig.js b/src/libs/Navigation/linkingConfig.js
index dafe15789e54..d3ba9fdb96ca 100644
--- a/src/libs/Navigation/linkingConfig.js
+++ b/src/libs/Navigation/linkingConfig.js
@@ -127,10 +127,6 @@ export default {
Workspace_Members: {
path: ROUTES.WORKSPACE_MEMBERS,
},
- Workspace_BankAccount: {
- path: ROUTES.WORKSPACE_BANK_ACCOUNT,
- exact: true,
- },
Workspace_Invite: {
path: ROUTES.WORKSPACE_INVITE,
},
diff --git a/src/libs/actions/ReimbursementAccount/navigation.js b/src/libs/actions/ReimbursementAccount/navigation.js
index 28cfbea88a9f..f695137764fa 100644
--- a/src/libs/actions/ReimbursementAccount/navigation.js
+++ b/src/libs/actions/ReimbursementAccount/navigation.js
@@ -6,7 +6,6 @@ import CONST from '../../../CONST';
import ONYXKEYS from '../../../ONYXKEYS';
import ROUTES from '../../../ROUTES';
import Navigation from '../../Navigation/Navigation';
-import BankAccount from '../../models/BankAccount';
const WITHDRAWAL_ACCOUNT_STEPS = [
{
@@ -95,18 +94,9 @@ function goToWithdrawalAccountSetupStep(stepID, achData) {
/**
* Navigate to the correct bank account route based on the bank account state and type
- *
- * @param {String} policyID
*/
-function navigateToBankAccountRoute(policyID) {
- const achData = store.getReimbursementAccountInSetup();
- const state = lodashGet(achData, 'state');
- const isShowPage = lodashGet(achData, 'bankAccountID') && state !== BankAccount.STATE.OPEN;
- if (isShowPage) {
- Navigation.navigate(ROUTES.getWorkspaceBankAccountRoute(policyID));
- } else {
- Navigation.navigate(ROUTES.getBankAccountRoute());
- }
+function navigateToBankAccountRoute() {
+ Navigation.navigate(ROUTES.getBankAccountRoute());
}
export {
diff --git a/src/libs/actions/ReimbursementAccount/resetFreePlanBankAccount.js b/src/libs/actions/ReimbursementAccount/resetFreePlanBankAccount.js
index 021623a51aa9..24a7919fe824 100644
--- a/src/libs/actions/ReimbursementAccount/resetFreePlanBankAccount.js
+++ b/src/libs/actions/ReimbursementAccount/resetFreePlanBankAccount.js
@@ -1,11 +1,7 @@
import lodashGet from 'lodash/get';
import ONYXKEYS from '../../../ONYXKEYS';
-import CONST from '../../../CONST';
import * as store from './store';
-import Navigation from '../../Navigation/Navigation';
-import ROUTES from '../../../ROUTES';
import * as API from '../../API';
-import BankAccount from '../../models/BankAccount';
/**
* Reset user's reimbursement account. This will delete the bank account.
@@ -19,34 +15,43 @@ function resetFreePlanBankAccount() {
throw new Error('Missing credentials when attempting to reset free plan bank account');
}
- const achData = {
- useOnfido: true,
- policyID: '',
- isInSetup: true,
- domainLimit: 0,
- currentStep: CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT,
- state: BankAccount.STATE.DELETED,
- };
-
API.write('RestartBankAccountSetup',
{
bankAccountID,
ownerEmail: store.getCredentials().login,
},
{
- optimisticData: [{
- onyxMethod: 'merge',
- key: ONYXKEYS.REIMBURSEMENT_ACCOUNT,
- value: {achData, shouldShowResetModal: false},
- },
- {
- onyxMethod: 'set',
- key: ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT,
- value: null,
- }],
+ optimisticData: [
+ {
+ onyxMethod: 'set',
+ key: ONYXKEYS.ONFIDO_TOKEN,
+ value: '',
+ },
+ {
+ onyxMethod: 'set',
+ key: ONYXKEYS.PLAID_DATA,
+ value: {},
+ },
+ {
+ onyxMethod: 'set',
+ key: ONYXKEYS.PLAID_LINK_TOKEN,
+ value: '',
+ },
+ {
+ onyxMethod: 'set',
+ key: ONYXKEYS.REIMBURSEMENT_ACCOUNT,
+ value: {
+ achData: {},
+ shouldShowResetModal: false,
+ },
+ },
+ {
+ onyxMethod: 'set',
+ key: ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT,
+ value: null,
+ },
+ ],
});
-
- Navigation.navigate(ROUTES.getBankAccountRoute());
}
export default resetFreePlanBankAccount;
diff --git a/src/pages/ReimbursementAccount/ContinueBankAccountSetup.js b/src/pages/ReimbursementAccount/ContinueBankAccountSetup.js
new file mode 100644
index 000000000000..feeab0ec1fee
--- /dev/null
+++ b/src/pages/ReimbursementAccount/ContinueBankAccountSetup.js
@@ -0,0 +1,84 @@
+import lodashGet from 'lodash/get';
+import PropTypes from 'prop-types';
+import React from 'react';
+import {ScrollView} from 'react-native';
+import _ from 'underscore';
+import * as BankAccounts from '../../libs/actions/BankAccounts';
+import * as Expensicons from '../../components/Icon/Expensicons';
+import * as Illustrations from '../../components/Icon/Illustrations';
+import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
+import Button from '../../components/Button';
+import compose from '../../libs/compose';
+import CONST from '../../CONST';
+import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView';
+import HeaderWithCloseButton from '../../components/HeaderWithCloseButton';
+import MenuItem from '../../components/MenuItem';
+import Navigation from '../../libs/Navigation/Navigation';
+import styles from '../../styles/styles';
+import ScreenWrapper from '../../components/ScreenWrapper';
+import Section from '../../components/Section';
+import Text from '../../components/Text';
+import withPolicy from '../workspace/withPolicy';
+import WorkspaceResetBankAccountModal from '../workspace/WorkspaceResetBankAccountModal';
+
+const propTypes = {
+ continue: PropTypes.func.isRequired,
+
+ /** Policy values needed in the component */
+ policy: PropTypes.shape({
+ name: PropTypes.string,
+ }).isRequired,
+
+ ...withLocalizePropTypes,
+};
+
+const ContinueBankAccountSetup = props => (
+
+
+
+
+
+
+ {props.translate('workspace.bankAccount.youreAlmostDone')}
+
+
+
+
+
+
+
+
+);
+
+ContinueBankAccountSetup.propTypes = propTypes;
+ContinueBankAccountSetup.displayName = 'ContinueBankAccountSetup';
+
+export default compose(
+ withPolicy,
+ withLocalize,
+)(ContinueBankAccountSetup);
diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js
index 4b532a8daf6c..1e671e3bb5aa 100644
--- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js
+++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js
@@ -11,6 +11,7 @@ import ONYXKEYS from '../../ONYXKEYS';
import ReimbursementAccountLoadingIndicator from '../../components/ReimbursementAccountLoadingIndicator';
import Navigation from '../../libs/Navigation/Navigation';
import CONST from '../../CONST';
+import BankAccount from '../../libs/models/BankAccount';
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
import compose from '../../libs/compose';
import styles from '../../styles/styles';
@@ -22,6 +23,7 @@ import networkPropTypes from '../../components/networkPropTypes';
// Steps
import BankAccountStep from './BankAccountStep';
import CompanyStep from './CompanyStep';
+import ContinueBankAccountSetup from './ContinueBankAccountSetup';
import RequestorStep from './RequestorStep';
import ValidationStep from './ValidationStep';
import ACHContractStep from './ACHContractStep';
@@ -72,6 +74,17 @@ const defaultProps = {
};
class ReimbursementAccountPage extends React.Component {
+ constructor(props) {
+ super(props);
+ this.continue = this.continue.bind(this);
+
+ const achData = lodashGet(this.props, 'reimbursementAccount.achData', {});
+ const hasInProgressVBBA = achData.bankAccountID && achData.state !== BankAccount.STATE.OPEN;
+ this.state = {
+ shouldShowContinueSetupButton: hasInProgressVBBA,
+ };
+ }
+
componentDidMount() {
this.fetchData();
}
@@ -155,6 +168,12 @@ class ReimbursementAccountPage extends React.Component {
BankAccounts.fetchFreePlanVerifiedBankAccount(stepToOpen !== CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT ? stepToOpen : '');
}
+ continue() {
+ this.setState({
+ shouldShowContinueSetupButton: false,
+ });
+ }
+
render() {
// The SetupWithdrawalAccount flow allows us to continue the flow from various points depending on where the
// user left off. This view will refer to the achData as the single source of truth to determine which route to
@@ -176,6 +195,15 @@ class ReimbursementAccountPage extends React.Component {
);
}
+ const hasInProgressVBBA = achData.bankAccountID && achData.state !== BankAccount.STATE.OPEN;
+ if (hasInProgressVBBA && this.state.shouldShowContinueSetupButton) {
+ return (
+
+ );
+ }
+
let errorComponent;
const userHasPhonePrimaryEmail = Str.endsWith(this.props.session.email, CONST.SMS.DOMAIN);
diff --git a/src/pages/workspace/WorkspaceBankAccountPage.js b/src/pages/workspace/WorkspaceBankAccountPage.js
deleted file mode 100644
index 844ccc67bfa9..000000000000
--- a/src/pages/workspace/WorkspaceBankAccountPage.js
+++ /dev/null
@@ -1,135 +0,0 @@
-import lodashGet from 'lodash/get';
-import PropTypes from 'prop-types';
-import React from 'react';
-import {ScrollView} from 'react-native';
-import {withOnyx} from 'react-native-onyx';
-import _ from 'underscore';
-import HeaderWithCloseButton from '../../components/HeaderWithCloseButton';
-import * as Expensicons from '../../components/Icon/Expensicons';
-import * as Illustrations from '../../components/Icon/Illustrations';
-import ScreenWrapper from '../../components/ScreenWrapper';
-import Text from '../../components/Text';
-import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
-import * as BankAccounts from '../../libs/actions/BankAccounts';
-import compose from '../../libs/compose';
-import BankAccount from '../../libs/models/BankAccount';
-import Navigation from '../../libs/Navigation/Navigation';
-import ONYXKEYS from '../../ONYXKEYS';
-import ROUTES from '../../ROUTES';
-import reimbursementAccountPropTypes from '../ReimbursementAccount/reimbursementAccountPropTypes';
-import Section from '../../components/Section';
-import WorkspaceResetBankAccountModal from './WorkspaceResetBankAccountModal';
-import styles from '../../styles/styles';
-import CONST from '../../CONST';
-import withPolicy from './withPolicy';
-import Button from '../../components/Button';
-import MenuItem from '../../components/MenuItem';
-import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView';
-
-const propTypes = {
- /** ACH data for the withdrawal account actively being set up */
- reimbursementAccount: reimbursementAccountPropTypes,
-
- /** Policy values needed in the component */
- policy: PropTypes.shape({
- name: PropTypes.string,
- }).isRequired,
-
- ...withLocalizePropTypes,
-};
-
-const defaultProps = {
- reimbursementAccount: {
- isLoading: true,
- },
-};
-
-class WorkspaceBankAccountPage extends React.Component {
- constructor(props) {
- super(props);
- this.getShouldShowPage = this.getShouldShowPage.bind(this);
- this.navigateToBankAccountRoute = this.navigateToBankAccountRoute.bind(this);
- }
-
- componentDidMount() {
- if (this.getShouldShowPage()) {
- return;
- }
- this.navigateToBankAccountRoute();
- }
-
- /**
- * If we have an open bank account or no bank account at all then we will immediately redirect the user to /bank-account to display the next step
- *
- * @returns {Boolean}
- */
- getShouldShowPage() {
- const state = lodashGet(this.props.reimbursementAccount, 'achData.state');
- return lodashGet(this.props.reimbursementAccount, 'achData.bankAccountID') && state !== BankAccount.STATE.OPEN;
- }
-
- /**
- * Navigate to the bank account route
- */
- navigateToBankAccountRoute() {
- Navigation.navigate(ROUTES.getBankAccountRoute());
- }
-
- render() {
- return (
-
-
- Navigation.navigate(ROUTES.getWorkspaceInitialRoute(this.props.route.params.policyID))}
- shouldShowGetAssistanceButton
- guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT}
- shouldShowBackButton
- />
-
-
-
- {this.props.translate('workspace.bankAccount.youreAlmostDone')}
-
-
-
-
-
-
-
-
- );
- }
-}
-
-WorkspaceBankAccountPage.propTypes = propTypes;
-WorkspaceBankAccountPage.defaultProps = defaultProps;
-
-export default compose(
- withLocalize,
- withOnyx({
- reimbursementAccount: {
- key: ONYXKEYS.REIMBURSEMENT_ACCOUNT,
- },
- }),
- withPolicy,
-)(WorkspaceBankAccountPage);