Skip to content
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
3 changes: 2 additions & 1 deletion src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, is this the error message returned by the Onfido SDK?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct

USER_CAMERA_DENINED: 'Onfido.OnfidoFlowError',
USER_CAMERA_PERMISSION: 'Encountered an error: cameraPermission',
// eslint-disable-next-line max-len
Expand Down
9 changes: 8 additions & 1 deletion src/components/Onfido/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
9 changes: 5 additions & 4 deletions src/pages/ReimbursementAccount/RequestorOnfidoStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ class RequestorOnfidoStep extends React.Component {
<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);
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);
Expand Down