diff --git a/android/app/build.gradle b/android/app/build.gradle index e48845c9ebbf..d402d773d186 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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()) { diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index f35803fe8682..f4b923e5c017 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -30,7 +30,7 @@ CFBundleVersion - 1.2.12.2 + 1.2.12.3 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index a766da190a7f..09a61bc3a213 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.2.12.2 + 1.2.12.3 diff --git a/package-lock.json b/package-lock.json index 6d1d8edb7076..7b83dba06525 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.2.12-2", + "version": "1.2.12-3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.2.12-2", + "version": "1.2.12-3", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index e9a6c18b1231..de750e476d1c 100644 --- a/package.json +++ b/package.json @@ -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.", diff --git a/src/libs/actions/BankAccounts.js b/src/libs/actions/BankAccounts.js index a9b6083c0adb..97193ee5ad5a 100644 --- a/src/libs/actions/BankAccounts.js +++ b/src/libs/actions/BankAccounts.js @@ -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, @@ -313,7 +300,6 @@ export { clearOnfidoToken, updatePersonalInformationForBankAccount, validateBankAccount, - verifyIdentityForBankAccount, updateCompanyInformationForBankAccount, connectBankAccountWithPlaid, updatePlaidData, diff --git a/src/pages/ReimbursementAccount/RequestorOnfidoStep.js b/src/pages/ReimbursementAccount/RequestorOnfidoStep.js deleted file mode 100644 index 82b17d641d35..000000000000 --- a/src/pages/ReimbursementAccount/RequestorOnfidoStep.js +++ /dev/null @@ -1,82 +0,0 @@ -import React from 'react'; -import {ScrollView} from 'react-native'; -import {withOnyx} from 'react-native-onyx'; -import PropTypes from 'prop-types'; -import styles from '../../styles/styles'; -import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; -import * as BankAccounts from '../../libs/actions/BankAccounts'; -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 CONST from '../../CONST'; - -const propTypes = { - /** Bank account currently in setup */ - /* eslint-disable-next-line react/no-unused-prop-types */ - reimbursementAccount: reimbursementAccountPropTypes.isRequired, - onfidoToken: PropTypes.string, - onComplete: PropTypes.func.isRequired, - ...withLocalizePropTypes, -}; - -const defaultProps = { - onfidoToken: '', -}; - -class RequestorOnfidoStep extends React.Component { - constructor(props) { - super(props); - this.submit = this.submit.bind(this); - } - - submit(onfidoData) { - BankAccounts.verifyIdentityForBankAccount( - ReimbursementAccountUtils.getDefaultStateForField(this.props, 'bankAccountID', 0), - onfidoData, - ); - this.props.onComplete(); - } - - render() { - return ( - - { - // 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.submit(onfidoData); - }} - /> - - ); - } -} - -RequestorOnfidoStep.propTypes = propTypes; -RequestorOnfidoStep.defaultProps = defaultProps; - -export default compose( - withLocalize, - withOnyx({ - reimbursementAccount: { - key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, - }, - onfidoToken: { - key: ONYXKEYS.ONFIDO_TOKEN, - }, - reimbursementAccountDraft: { - key: ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT, - }, - }), -)(RequestorOnfidoStep); diff --git a/src/pages/ReimbursementAccount/RequestorStep.js b/src/pages/ReimbursementAccount/RequestorStep.js index bba0dba6b06d..6be190673464 100644 --- a/src/pages/ReimbursementAccount/RequestorStep.js +++ b/src/pages/ReimbursementAccount/RequestorStep.js @@ -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'; @@ -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 */ @@ -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'), @@ -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), }; @@ -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. * @@ -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; @@ -175,9 +183,26 @@ class RequestorStep extends React.Component { onCloseButtonPress={Navigation.dismissModal} /> {shouldShowOnfido ? ( - + + { + // 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); + }} + /> + ) : (