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')} + +
+