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

🍒 Cherry pick PR #11702 to staging 🍒 #11705

Merged
merged 2 commits into from
Oct 10, 2022
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
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001021202
versionName "1.2.12-2"
versionCode 1001021203
versionName "1.2.12-3"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.2.12.2</string>
<string>1.2.12.3</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2.12.2</string>
<string>1.2.12.3</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.2.12-2",
"version": "1.2.12-3",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
14 changes: 0 additions & 14 deletions src/libs/actions/BankAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,19 +291,6 @@ function connectBankAccountManually(bankAccountID, accountNumber, routingNumber,
}, getVBBADataForOnyx());
}

/**
* Verify the user's identity via Onfido
*
* @param {Number} bankAccountID
* @param {Object} onfidoData
*/
function verifyIdentityForBankAccount(bankAccountID, onfidoData) {
API.write('VerifyIdentityForBankAccount', {
bankAccountID,
onfidoData: JSON.stringify(onfidoData),
}, getVBBADataForOnyx());
}

export {
addPersonalBankAccount,
connectBankAccountManually,
Expand All @@ -313,7 +300,6 @@ export {
clearOnfidoToken,
updatePersonalInformationForBankAccount,
validateBankAccount,
verifyIdentityForBankAccount,
updateCompanyInformationForBankAccount,
connectBankAccountWithPlaid,
updatePlaidData,
Expand Down
82 changes: 0 additions & 82 deletions src/pages/ReimbursementAccount/RequestorOnfidoStep.js

This file was deleted.

51 changes: 38 additions & 13 deletions src/pages/ReimbursementAccount/RequestorStep.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import lodashGet from 'lodash/get';
import {View} from 'react-native';
import {ScrollView, View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import moment from 'moment';
Expand All @@ -16,13 +16,14 @@ import Text from '../../components/Text';
import * as BankAccounts from '../../libs/actions/BankAccounts';
import IdentityForm from './IdentityForm';
import * as ValidationUtils from '../../libs/ValidationUtils';
import Onfido from '../../components/Onfido';
import compose from '../../libs/compose';
import ONYXKEYS from '../../ONYXKEYS';
import * as ReimbursementAccountUtils from '../../libs/ReimbursementAccountUtils';
import Growl from '../../libs/Growl';
import reimbursementAccountPropTypes from './reimbursementAccountPropTypes';
import ReimbursementAccountForm from './ReimbursementAccountForm';
import * as Link from '../../libs/actions/Link';
import RequestorOnfidoStep from './RequestorOnfidoStep';

const propTypes = {
/** Bank account currently in setup */
Expand All @@ -41,7 +42,6 @@ class RequestorStep extends React.Component {

this.submit = this.submit.bind(this);
this.clearErrorsAndSetValues = this.clearErrorsAndSetValues.bind(this);
this.setOnfidoAsComplete = this.setOnfidoAsComplete.bind(this);

this.state = {
firstName: ReimbursementAccountUtils.getDefaultStateForField(props, 'firstName'),
Expand All @@ -53,6 +53,7 @@ class RequestorStep extends React.Component {
dob: ReimbursementAccountUtils.getDefaultStateForField(props, 'dob'),
ssnLast4: ReimbursementAccountUtils.getDefaultStateForField(props, 'ssnLast4'),
isControllingOfficer: ReimbursementAccountUtils.getDefaultStateForField(props, 'isControllingOfficer', false),
onfidoData: lodashGet(props, ['reimbursementAccount', 'achData', 'onfidoData'], ''),
isOnfidoSetupComplete: lodashGet(props, ['achData', 'isOnfidoSetupComplete'], false),
};

Expand All @@ -73,13 +74,6 @@ class RequestorStep extends React.Component {
this.getErrors = () => ReimbursementAccountUtils.getErrors(this.props);
}

/**
* Update state to indicate that the user has completed the Onfido verification process
*/
setOnfidoAsComplete() {
this.setState({isOnfidoSetupComplete: true});
}

/**
* Clear the errors associated to keys in values if found and store the new values in the state.
*
Expand Down Expand Up @@ -153,6 +147,20 @@ class RequestorStep extends React.Component {
BankAccounts.updatePersonalInformationForBankAccount(payload);
}

submitOnfidoVerification() {
if (!this.validate()) {
return;
}

const payload = {
bankAccountID: ReimbursementAccountUtils.getDefaultStateForField(this.props, 'bankAccountID', 0),
...this.state,
dob: moment(this.state.dob).format(CONST.DATE.MOMENT_FORMAT_STRING),
};

BankAccounts.setupWithdrawalAccount(payload);
}

render() {
const achData = this.props.reimbursementAccount.achData;
const shouldShowOnfido = achData.useOnfido && this.props.onfidoToken && !this.state.isOnfidoSetupComplete;
Expand All @@ -175,9 +183,26 @@ class RequestorStep extends React.Component {
onCloseButtonPress={Navigation.dismissModal}
/>
{shouldShowOnfido ? (
<RequestorOnfidoStep
onComplete={this.setOnfidoAsComplete}
/>
<ScrollView contentContainerStyle={styles.flex1}>
<Onfido
sdkToken={this.props.onfidoToken}
onUserExit={() => {
// We're taking the user back to the company step. They will need to come back to the requestor step to make the Onfido flow appear again.
BankAccounts.goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.COMPANY);
}}
onError={() => {
// In case of any unexpected error we log it to the server, show a growl, and return the user back to the company step so they can try again.
Growl.error(this.props.translate('onfidoStep.genericError'), 10000);
BankAccounts.goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.COMPANY);
}}
onSuccess={(onfidoData) => {
this.setState({
onfidoData,
isOnfidoSetupComplete: true,
}, this.submitOnfidoVerification);
}}
/>
</ScrollView>
) : (
<ReimbursementAccountForm
onSubmit={this.submit}
Expand Down