diff --git a/src/CONST.js b/src/CONST.js index bb32bcef4a30..34c9666c73fd 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -603,8 +603,9 @@ const CONST = { }, SMS_NUMBER_COUNTRY_CODE: 'US', ERROR: { - USER_CANCELLED: 'User canceled flow', + USER_CANCELLED: 'User canceled flow.', USER_TAPPED_BACK: 'User exited by clicking the back button.', + USER_EXITED: 'User exited by manual action.', USER_CAMERA_DENINED: 'Onfido.OnfidoFlowError', USER_CAMERA_PERMISSION: 'Encountered an error: cameraPermission', // eslint-disable-next-line max-len diff --git a/src/components/Onfido/index.native.js b/src/components/Onfido/index.native.js index 7f3387409f6c..41d91a9e259a 100644 --- a/src/components/Onfido/index.native.js +++ b/src/components/Onfido/index.native.js @@ -41,7 +41,14 @@ class Onfido extends React.Component { // If the user cancels the Onfido flow we won't log this error as it's normal. In the React Native SDK the user exiting the flow will trigger this error which we can use as // our "user exited the flow" callback. On web, this event has it's own callback passed as a config so we don't need to bother with this there. - if (_.contains([CONST.ONFIDO.ERROR.USER_CANCELLED, CONST.ONFIDO.ERROR.USER_TAPPED_BACK], errorMessage)) { + if (_.contains( + [ + CONST.ONFIDO.ERROR.USER_CANCELLED, + CONST.ONFIDO.ERROR.USER_TAPPED_BACK, + CONST.ONFIDO.ERROR.USER_EXITED, + ], + errorMessage, + )) { this.props.onUserExit(); return; } diff --git a/src/pages/ReimbursementAccount/RequestorOnfidoStep.js b/src/pages/ReimbursementAccount/RequestorOnfidoStep.js index 656b0da5138e..60399a905aca 100644 --- a/src/pages/ReimbursementAccount/RequestorOnfidoStep.js +++ b/src/pages/ReimbursementAccount/RequestorOnfidoStep.js @@ -56,13 +56,14 @@ class RequestorOnfidoStep extends React.Component { { - // 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); + BankAccounts.clearOnfidoToken(); + BankAccounts.goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.REQUESTOR); }} 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. + // In case of any unexpected error we log it to the server, show a growl, and return the user back to the requestor step so they can try again. Growl.error(this.props.translate('onfidoStep.genericError'), 10000); - BankAccounts.goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.COMPANY); + BankAccounts.clearOnfidoToken(); + BankAccounts.goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.REQUESTOR); }} onSuccess={(onfidoData) => { this.submit(onfidoData);