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

Show verification modal instead of redirecting to concierge #4246

Merged
merged 4 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions src/libs/actions/BankAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as API from '../API';
import BankAccount from '../models/BankAccount';
import promiseAllSettled from '../promiseAllSettled';
import Growl from '../Growl';
import Navigation from '../Navigation/Navigation';
import {translateLocal} from '../translate';

/**
Expand Down Expand Up @@ -552,8 +551,11 @@ function validateBankAccount(bankAccountID, validateCode) {
.then((response) => {
if (response.jsonCode === 200) {
Growl.show('Bank Account successfully validated!', CONST.GROWL.SUCCESS, 3000);
Navigation.dismissModal();
Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {loading: false, error: ''});
API.User_IsUsingExpensifyCard()
.then(({isUsingExpensifyCard}) => {
Onyx.merge(ONYXKEYS.USER, {isUsingExpensifyCard});
Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {loading: false, error: ''});
});
return;
}

Expand Down
56 changes: 56 additions & 0 deletions src/pages/ReimbursementAccount/EnableStep.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from 'react';
import {Image, View} from 'react-native';
import styles from '../../styles/styles';
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
import {navigateToConciergeChat} from '../../libs/actions/Report';
import HeaderWithCloseButton from '../../components/HeaderWithCloseButton';
import Navigation from '../../libs/Navigation/Navigation';
import Text from '../../components/Text';
import CONST from '../../CONST';
import TextLink from '../../components/TextLink';
import compose from '../../libs/compose';

const propTypes = {
...withLocalizePropTypes,
};

const EnableStep = ({translate}) => {
const verifyingUrl = `${CONST.CLOUDFRONT_URL}/images/icons/emptystates/emptystate_reviewing.gif`;
return (
<View style={[styles.flex1, styles.justifyContentBetween]}>
<HeaderWithCloseButton
title={translate('validationStep.headerTitle')}
onCloseButtonPress={Navigation.dismissModal}
/>
<View style={[styles.flex1]}>
<Image
source={{uri: verifyingUrl}}
style={[styles.workspaceInviteWelcome]}
resizeMode="center"
/>
<Text style={[styles.mh5, styles.mb5]}>
{translate('validationStep.reviewingInfo')}
<TextLink
onPress={() => {
// There are two modals that must be dismissed before we can reveal the Concierge
// chat underneath these screens
Navigation.dismissModal();
Navigation.dismissModal();
navigateToConciergeChat();
}}
>
{translate('common.here')}
</TextLink>
{translate('validationStep.forNextSteps')}
</Text>
</View>
</View>
);
};

EnableStep.propTypes = propTypes;
EnableStep.displayName = 'EnableStep';

export default compose(
withLocalize,
)(EnableStep);
6 changes: 6 additions & 0 deletions src/pages/ReimbursementAccount/ReimbursementAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import CompanyStep from './CompanyStep';
import RequestorStep from './RequestorStep';
import ValidationStep from './ValidationStep';
import BeneficialOwnersStep from './BeneficialOwnersStep';
import EnableStep from './EnableStep';
import ROUTES from '../../ROUTES';
import HeaderWithCloseButton from '../../components/HeaderWithCloseButton';

Expand Down Expand Up @@ -232,6 +233,11 @@ class ReimbursementAccountPage extends React.Component {
error={error}
/>
)}
{currentStep === CONST.BANK_ACCOUNT.STEP.ENABLE && (
<EnableStep
achData={this.props.reimbursementAccount.achData}
/>
)}
</KeyboardAvoidingView>
</ScreenWrapper>
);
Expand Down
7 changes: 5 additions & 2 deletions src/pages/workspace/WorkspaceCardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import CONST from '../../CONST';
import Permissions from '../../libs/Permissions';
import HeroCardWebImage from '../../../assets/images/cascading-cards-web.svg';
import HeroCardMobileImage from '../../../assets/images/cascading-cards-mobile.svg';
import BankAccount from '../../libs/models/BankAccount';
import {openSignedInLink} from '../../libs/actions/App';

const propTypes = {
Expand Down Expand Up @@ -72,13 +73,15 @@ const WorkspaceCardPage = ({
isSmallScreenWidth,
reimbursementAccount,
}) => {
const isVerifying = lodashGet(reimbursementAccount, 'achData.state', '') === CONST.BANK_ACCOUNT.STATE.VERIFYING;
const isVerifying = lodashGet(reimbursementAccount, 'achData.state', '') === BankAccount.STATE.VERIFYING;
const isNotAutoProvisioned = !user.isUsingExpensifyCard
&& lodashGet(reimbursementAccount, 'achData.state', '') === BankAccount.STATE.OPEN;
let buttonText;
if (user.isFromPublicDomain) {
buttonText = translate('workspace.card.addEmail');
} else if (user.isUsingExpensifyCard) {
buttonText = translate('workspace.card.manageCards');
} else if (isVerifying) {
} else if (isVerifying || isNotAutoProvisioned) {
buttonText = translate('workspace.card.finishSetup');
} else {
buttonText = translate('workspace.card.getStarted');
Expand Down