From 33fc4d38cf1591c1e545e6e05e24cc318b0e659d Mon Sep 17 00:00:00 2001 From: Kosuke Tseng Date: Wed, 9 Nov 2022 20:55:21 -0800 Subject: [PATCH 1/5] add command --- src/libs/actions/BankAccounts.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libs/actions/BankAccounts.js b/src/libs/actions/BankAccounts.js index e81e2b863190..e83ff7f2bf8d 100644 --- a/src/libs/actions/BankAccounts.js +++ b/src/libs/actions/BankAccounts.js @@ -321,6 +321,10 @@ function verifyIdentityForBankAccount(bankAccountID, onfidoData) { }, getVBBADataForOnyx()); } +function openWorkspaceView() { + API.read('OpenWorkspaceView'); +} + export { addPersonalBankAccount, connectBankAccountManually, @@ -333,6 +337,7 @@ export { updateCompanyInformationForBankAccount, updatePersonalInformationForBankAccount, updatePlaidData, + openWorkspaceView, validateBankAccount, verifyIdentityForBankAccount, }; From 003b7d0b5dcdefbbbd8a61c845331ac3bae6365a Mon Sep 17 00:00:00 2001 From: Kosuke Tseng Date: Wed, 9 Nov 2022 20:55:41 -0800 Subject: [PATCH 2/5] use command --- src/pages/workspace/WorkspacePageWithSections.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/WorkspacePageWithSections.js b/src/pages/workspace/WorkspacePageWithSections.js index 706ff3c5bc64..c50ba8170bff 100644 --- a/src/pages/workspace/WorkspacePageWithSections.js +++ b/src/pages/workspace/WorkspacePageWithSections.js @@ -22,6 +22,8 @@ import networkPropTypes from '../../components/networkPropTypes'; import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView'; const propTypes = { + shouldSkipVBBACall: PropTypes.bool, + /** Information about the network from Onyx */ network: networkPropTypes.isRequired, @@ -71,6 +73,7 @@ const defaultProps = { footer: null, guidesCallTaskID: '', shouldUseScrollView: false, + shouldSkipVBBACall: false, }; class WorkspacePageWithSections extends React.Component { @@ -87,8 +90,10 @@ class WorkspacePageWithSections extends React.Component { } fetchData() { - const achState = lodashGet(this.props.reimbursementAccount, 'achData.state', ''); - BankAccounts.fetchFreePlanVerifiedBankAccount('', achState); + if (this.props.shouldSkipVBBACall) { + const achState = lodashGet(this.props.reimbursementAccount, 'achData.state', ''); + BankAccounts.openWorkspaceView(); + } } render() { From 5cc6c9acd650fd86a95e424294421ed3fac8b562 Mon Sep 17 00:00:00 2001 From: Kosuke Tseng Date: Wed, 9 Nov 2022 21:39:17 -0800 Subject: [PATCH 3/5] update reimbursepage --- .../reimburse/WorkspaceReimbursePage.js | 5 ++-- .../reimburse/WorkspaceReimburseView.js | 23 ++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/pages/workspace/reimburse/WorkspaceReimbursePage.js b/src/pages/workspace/reimburse/WorkspaceReimbursePage.js index 3a208fcfa9eb..c1a735defa9b 100644 --- a/src/pages/workspace/reimburse/WorkspaceReimbursePage.js +++ b/src/pages/workspace/reimburse/WorkspaceReimbursePage.js @@ -27,9 +27,10 @@ const WorkspaceReimbursePage = props => ( headerText={props.translate('workspace.common.reimburse')} route={props.route} guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_REIMBURSE} + shouldSkipVBBACall={true} > - {hasVBA => ( - + {() => ( + )} ); diff --git a/src/pages/workspace/reimburse/WorkspaceReimburseView.js b/src/pages/workspace/reimburse/WorkspaceReimburseView.js index f077583faa01..105652055ad6 100644 --- a/src/pages/workspace/reimburse/WorkspaceReimburseView.js +++ b/src/pages/workspace/reimburse/WorkspaceReimburseView.js @@ -1,5 +1,6 @@ import React from 'react'; import {View} from 'react-native'; +import {withOnyx} from 'react-native-onyx'; import PropTypes from 'prop-types'; import lodashGet from 'lodash/get'; import _ from 'underscore'; @@ -17,6 +18,10 @@ import compose from '../../../libs/compose'; import * as Policy from '../../../libs/actions/Policy'; import CONST from '../../../CONST'; import Button from '../../../components/Button'; +import ONYXKEYS from '../../../ONYXKEYS'; +import * as BankAccounts from '../../../libs/actions/BankAccounts'; +import BankAccount from '../../../libs/models/BankAccount'; +import reimbursementAccountPropTypes from '../../ReimbursementAccount/reimbursementAccountPropTypes'; import getPermittedDecimalSeparator from '../../../libs/getPermittedDecimalSeparator'; import {withNetwork} from '../../../components/OnyxProvider'; import OfflineWithFeedback from '../../../components/OfflineWithFeedback'; @@ -49,12 +54,20 @@ const propTypes = { lastModified: PropTypes.number, }).isRequired, + /** From Onyx */ + /** Bank account attached to free plan */ + reimbursementAccount: reimbursementAccountPropTypes, + /** Information about the network */ network: networkPropTypes.isRequired, ...withLocalizePropTypes, }; +const defaultProps = { + reimbursementAccount: {}, +}; + class WorkspaceReimburseView extends React.Component { constructor(props) { super(props); @@ -199,6 +212,8 @@ class WorkspaceReimburseView extends React.Component { } render() { + const achState = lodashGet(this.props.reimbursementAccount, 'achData.state', ''); + const hasVBA = achState === BankAccount.STATE.OPEN; return ( <>
- {this.props.hasVBA ? ( + {hasVBA ? (
Date: Wed, 9 Nov 2022 21:42:13 -0800 Subject: [PATCH 4/5] fix condition logic --- src/pages/workspace/WorkspacePageWithSections.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/workspace/WorkspacePageWithSections.js b/src/pages/workspace/WorkspacePageWithSections.js index c50ba8170bff..b19e395cee95 100644 --- a/src/pages/workspace/WorkspacePageWithSections.js +++ b/src/pages/workspace/WorkspacePageWithSections.js @@ -40,7 +40,7 @@ const propTypes = { }).isRequired, /** From Onyx */ - /** Bank account currently in setup */ + /** Bank account attached to free plan */ reimbursementAccount: reimbursementAccountPropTypes, /** User Data from Onyx */ @@ -90,7 +90,7 @@ class WorkspacePageWithSections extends React.Component { } fetchData() { - if (this.props.shouldSkipVBBACall) { + if (!this.props.shouldSkipVBBACall) { const achState = lodashGet(this.props.reimbursementAccount, 'achData.state', ''); BankAccounts.openWorkspaceView(); } From d694d97fc527a1ed9320c4c615c20dcf50942865 Mon Sep 17 00:00:00 2001 From: Kosuke Tseng Date: Wed, 9 Nov 2022 21:58:46 -0800 Subject: [PATCH 5/5] lint --- src/pages/workspace/WorkspacePageWithSections.js | 7 ++++--- src/pages/workspace/reimburse/WorkspaceReimbursePage.js | 2 +- src/pages/workspace/reimburse/WorkspaceReimburseView.js | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/workspace/WorkspacePageWithSections.js b/src/pages/workspace/WorkspacePageWithSections.js index b19e395cee95..7c0783aed5c0 100644 --- a/src/pages/workspace/WorkspacePageWithSections.js +++ b/src/pages/workspace/WorkspacePageWithSections.js @@ -90,10 +90,11 @@ class WorkspacePageWithSections extends React.Component { } fetchData() { - if (!this.props.shouldSkipVBBACall) { - const achState = lodashGet(this.props.reimbursementAccount, 'achData.state', ''); - BankAccounts.openWorkspaceView(); + if (this.props.shouldSkipVBBACall) { + return; } + + BankAccounts.openWorkspaceView(); } render() { diff --git a/src/pages/workspace/reimburse/WorkspaceReimbursePage.js b/src/pages/workspace/reimburse/WorkspaceReimbursePage.js index c1a735defa9b..35b3f8666e27 100644 --- a/src/pages/workspace/reimburse/WorkspaceReimbursePage.js +++ b/src/pages/workspace/reimburse/WorkspaceReimbursePage.js @@ -27,7 +27,7 @@ const WorkspaceReimbursePage = props => ( headerText={props.translate('workspace.common.reimburse')} route={props.route} guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_REIMBURSE} - shouldSkipVBBACall={true} + shouldSkipVBBACall > {() => ( diff --git a/src/pages/workspace/reimburse/WorkspaceReimburseView.js b/src/pages/workspace/reimburse/WorkspaceReimburseView.js index 105652055ad6..5aed733351de 100644 --- a/src/pages/workspace/reimburse/WorkspaceReimburseView.js +++ b/src/pages/workspace/reimburse/WorkspaceReimburseView.js @@ -19,7 +19,6 @@ import * as Policy from '../../../libs/actions/Policy'; import CONST from '../../../CONST'; import Button from '../../../components/Button'; import ONYXKEYS from '../../../ONYXKEYS'; -import * as BankAccounts from '../../../libs/actions/BankAccounts'; import BankAccount from '../../../libs/models/BankAccount'; import reimbursementAccountPropTypes from '../../ReimbursementAccount/reimbursementAccountPropTypes'; import getPermittedDecimalSeparator from '../../../libs/getPermittedDecimalSeparator';