From df26563db82f5d637a9cbc7263129e4f0fce399b Mon Sep 17 00:00:00 2001 From: Kosuke Tseng Date: Wed, 2 Nov 2022 22:00:54 -0700 Subject: [PATCH 01/11] add continue step --- src/libs/actions/BankAccounts.js | 10 ++ .../ReimbursementAccount/navigation.js | 9 +- .../ContinueBankAccountSetup.js | 114 ++++++++++++++++++ .../ReimbursementAccountPage.js | 9 ++ 4 files changed, 134 insertions(+), 8 deletions(-) create mode 100644 src/pages/ReimbursementAccount/ContinueBankAccountSetup.js diff --git a/src/libs/actions/BankAccounts.js b/src/libs/actions/BankAccounts.js index e81e2b863190..3bd32163c948 100644 --- a/src/libs/actions/BankAccounts.js +++ b/src/libs/actions/BankAccounts.js @@ -48,6 +48,14 @@ function clearOnfidoToken() { Onyx.merge(ONYXKEYS.ONFIDO_TOKEN, ''); } +function setReadyToContinue() { + Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {isReadyToContinue: true}); +} + +function clearReadyToContinue() { + Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {isReadyToContinue: null}); +} + /** * Helper method to build the Onyx data required during setup of a Verified Business Bank Account * @@ -327,8 +335,10 @@ export { clearPersonalBankAccount, clearPlaid, clearOnfidoToken, + clearReadyToContinue, connectBankAccountWithPlaid, deletePaymentBankAccount, + setReadyToContinue, updateBeneficialOwnersForBankAccount, updateCompanyInformationForBankAccount, updatePersonalInformationForBankAccount, diff --git a/src/libs/actions/ReimbursementAccount/navigation.js b/src/libs/actions/ReimbursementAccount/navigation.js index 28cfbea88a9f..a505b2bf99ed 100644 --- a/src/libs/actions/ReimbursementAccount/navigation.js +++ b/src/libs/actions/ReimbursementAccount/navigation.js @@ -99,14 +99,7 @@ function goToWithdrawalAccountSetupStep(stepID, achData) { * @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()); - } + Navigation.navigate(ROUTES.getBankAccountRoute()); } export { diff --git a/src/pages/ReimbursementAccount/ContinueBankAccountSetup.js b/src/pages/ReimbursementAccount/ContinueBankAccountSetup.js new file mode 100644 index 000000000000..96fd9d8cd96b --- /dev/null +++ b/src/pages/ReimbursementAccount/ContinueBankAccountSetup.js @@ -0,0 +1,114 @@ +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 '../workspace/WorkspaceResetBankAccountModal'; +import styles from '../../styles/styles'; +import CONST from '../../CONST'; +import withPolicy from '../workspace/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 ContinueBankAccountSetup extends React.Component { + constructor(props) { + super(props); + this.setReadyToContinue = this.setReadyToContinue.bind(this); + } + + setReadyToContinue() { + BankAccounts.setReadyToContinue(); + } + + render() { + return ( + + + + +
+ + {this.props.translate('workspace.bankAccount.youreAlmostDone')} + +
+