diff --git a/src/CONST.ts b/src/CONST.ts
index 3d59770795d0..63bef2f015dc 100755
--- a/src/CONST.ts
+++ b/src/CONST.ts
@@ -277,8 +277,9 @@ const CONST = {
STEP: {
// In the order they appear in the VBA flow
BANK_ACCOUNT: 'BankAccountStep',
- COMPANY: 'CompanyStep',
REQUESTOR: 'RequestorStep',
+ COMPANY: 'CompanyStep',
+ BENEFICIAL_OWNERS: 'BeneficialOwnersStep',
ACH_CONTRACT: 'ACHContractStep',
VALIDATION: 'ValidationStep',
ENABLE: 'EnableStep',
diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts
index 53cd37e71f67..5e5230c45273 100755
--- a/src/ONYXKEYS.ts
+++ b/src/ONYXKEYS.ts
@@ -127,6 +127,7 @@ const ONYXKEYS = {
/** Token needed to initialize Onfido */
ONFIDO_TOKEN: 'onfidoToken',
+ ONFIDO_APPLICANT_ID: 'onfidoApplicantID',
/** Indicates which locale should be used */
NVP_PREFERRED_LOCALE: 'preferredLocale',
@@ -397,6 +398,7 @@ type OnyxValues = {
[ONYXKEYS.IS_PLAID_DISABLED]: boolean;
[ONYXKEYS.PLAID_LINK_TOKEN]: string;
[ONYXKEYS.ONFIDO_TOKEN]: string;
+ [ONYXKEYS.ONFIDO_APPLICANT_ID]: string;
[ONYXKEYS.NVP_PREFERRED_LOCALE]: OnyxTypes.Locale;
[ONYXKEYS.USER_WALLET]: OnyxTypes.UserWallet;
[ONYXKEYS.WALLET_ONFIDO]: OnyxTypes.WalletOnfido;
diff --git a/src/components/ReimbursementAccountLoadingIndicator.js b/src/components/ReimbursementAccountLoadingIndicator.js
index bc0e70e64419..141e056afd93 100644
--- a/src/components/ReimbursementAccountLoadingIndicator.js
+++ b/src/components/ReimbursementAccountLoadingIndicator.js
@@ -4,7 +4,6 @@ import {StyleSheet, View} from 'react-native';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import FullPageOfflineBlockingView from './BlockingViews/FullPageOfflineBlockingView';
-import FullScreenLoadingIndicator from './FullscreenLoadingIndicator';
import HeaderWithBackButton from './HeaderWithBackButton';
import Lottie from './Lottie';
import LottieAnimations from './LottieAnimations';
@@ -12,9 +11,6 @@ import ScreenWrapper from './ScreenWrapper';
import Text from './Text';
const propTypes = {
- /** Whether the user is submitting verifications data */
- isSubmittingVerificationsData: PropTypes.bool.isRequired,
-
/** Method to trigger when pressing back button of the header */
onBackButtonPress: PropTypes.func.isRequired,
};
@@ -33,22 +29,18 @@ function ReimbursementAccountLoadingIndicator(props) {
onBackButtonPress={props.onBackButtonPress}
/>
- {props.isSubmittingVerificationsData ? (
-
-
-
- {translate('reimbursementAccountLoadingAnimation.explanationLine')}
-
+
+
+
+ {translate('reimbursementAccountLoadingAnimation.explanationLine')}
- ) : (
-
- )}
+
);
diff --git a/src/hooks/useSubStep/index.ts b/src/hooks/useSubStep/index.ts
index 647b84308792..bbb1f7cabe49 100644
--- a/src/hooks/useSubStep/index.ts
+++ b/src/hooks/useSubStep/index.ts
@@ -15,7 +15,7 @@ export default function useSubStep({bodyContent, onFinished, startFrom = 0}: Use
setScreenIndex(prevScreenIndex);
}, [screenIndex]);
- const nextScreen = useCallback(() => {
+ const nextScreen = useCallback((data) => {
if (isEditing.current) {
isEditing.current = false;
@@ -27,7 +27,7 @@ export default function useSubStep({bodyContent, onFinished, startFrom = 0}: Use
const nextScreenIndex = screenIndex + 1;
if (nextScreenIndex === bodyContent.length) {
- onFinished();
+ onFinished(data);
} else {
setScreenIndex(nextScreenIndex);
}
diff --git a/src/hooks/useSubStep/types.ts b/src/hooks/useSubStep/types.ts
index a039cad3a23b..ab2d165e7ce5 100644
--- a/src/hooks/useSubStep/types.ts
+++ b/src/hooks/useSubStep/types.ts
@@ -22,7 +22,7 @@ type UseSubStep = {
bodyContent: Array>;
/** called on last sub step */
- onFinished: () => void;
+ onFinished: (data?: Record) => void;
/** index of initial sub step to display */
startFrom?: number;
diff --git a/src/libs/actions/BankAccounts.ts b/src/libs/actions/BankAccounts.ts
index 38544037396a..9d90d1c7ec9b 100644
--- a/src/libs/actions/BankAccounts.ts
+++ b/src/libs/actions/BankAccounts.ts
@@ -11,7 +11,7 @@ import type {BankAccountStep, BankAccountSubStep} from '@src/types/onyx/Reimburs
import type {
ACHContractStepProps,
BankAccountStepProps,
- BeneficialOwnersStepDraftProps,
+ BeneficialOwnersStepProps,
CompanyStepProps,
OnfidoData,
ReimbursementAccountProps,
@@ -90,6 +90,7 @@ function clearPersonalBankAccount() {
function clearOnfidoToken() {
Onyx.merge(ONYXKEYS.ONFIDO_TOKEN, '');
+ Onyx.merge(ONYXKEYS.ONFIDO_APPLICANT_ID, '');
}
/**
@@ -161,6 +162,7 @@ function connectBankAccountWithPlaid(bankAccountID: number, selectedPlaidBankAcc
bank?: string;
plaidAccountID: string;
plaidAccessToken: string;
+ canUseNewVbbaFlow: boolean;
};
const parameters: ConnectBankAccountWithPlaidParams = {
@@ -170,6 +172,7 @@ function connectBankAccountWithPlaid(bankAccountID: number, selectedPlaidBankAcc
bank: selectedPlaidBankAccount.bankName,
plaidAccountID: selectedPlaidBankAccount.plaidAccountID,
plaidAccessToken: selectedPlaidBankAccount.plaidAccessToken,
+ canUseNewVbbaFlow: true,
};
API.write(commandName, parameters, getVBBADataForOnyx());
@@ -277,7 +280,10 @@ function deletePaymentBankAccount(bankAccountID: number) {
* This action is called by the requestor step in the Verified Bank Account flow
*/
function updatePersonalInformationForBankAccount(params: RequestorStepProps) {
- API.write('UpdatePersonalInformationForBankAccount', params, getVBBADataForOnyx(CONST.BANK_ACCOUNT.STEP.REQUESTOR));
+ API.write('UpdatePersonalInformationForBankAccount', {
+ ...params,
+ canUseNewVbbaFlow: true,
+ }, getVBBADataForOnyx(CONST.BANK_ACCOUNT.STEP.REQUESTOR));
}
function validateBankAccount(bankAccountID: number, validateCode: string) {
@@ -379,25 +385,32 @@ function openReimbursementAccountPage(stepToOpen: ReimbursementAccountStep, subS
* Updates the bank account in the database with the company step data
*/
function updateCompanyInformationForBankAccount(bankAccount: BankAccountCompanyInformation, policyID: string) {
- type UpdateCompanyInformationForBankAccountParams = BankAccountCompanyInformation & {policyID: string};
+ type UpdateCompanyInformationForBankAccountParams = BankAccountCompanyInformation & {
+ policyID: string,
+ canUseNewVbbaFlow: boolean,
+ };
- const parameters: UpdateCompanyInformationForBankAccountParams = {...bankAccount, policyID};
+ const parameters: UpdateCompanyInformationForBankAccountParams = {
+ ...bankAccount,
+ policyID,
+ canUseNewVbbaFlow: true,
+ };
API.write('UpdateCompanyInformationForBankAccount', parameters, getVBBADataForOnyx(CONST.BANK_ACCOUNT.STEP.COMPANY));
}
/**
- * Add beneficial owners for the bank account to the draft
+ * Add beneficial owners for the bank account and verify the accuracy of the information provided
*/
-function updateBeneficialOwnersForBankAccountDraft(params: BeneficialOwnersStepDraftProps) {
- Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT, params);
+function updateBeneficialOwnersForBankAccount(params: BeneficialOwnersStepProps) {
+ API.write('UpdateBeneficialOwnersForBankAccount', {...params, canUseNewVbbaFlow: true}, getVBBADataForOnyx());
}
/**
- * Add beneficial owners for the bank account, accept the ACH terms and conditions and verify the accuracy of the information provided
+ * accept the ACH terms and conditions and verify the accuracy of the information provided
*/
-function updateBeneficialOwnersForBankAccount(params: ACHContractStepProps) {
- API.write('UpdateBeneficialOwnersForBankAccount', params, getVBBADataForOnyx());
+function acceptACHContractForBankAccount(params: ACHContractStepProps) {
+ API.write('AcceptACHContractForBankAccount', {...params, canUseNewVbbaFlow: true}, getVBBADataForOnyx());
}
/**
@@ -410,6 +423,7 @@ function connectBankAccountManually(bankAccountID: number, accountNumber?: strin
accountNumber?: string;
routingNumber?: string;
plaidMask?: string;
+ canUseNewVbbaFlow: boolean;
};
const parameters: ConnectBankAccountManuallyParams = {
@@ -417,6 +431,7 @@ function connectBankAccountManually(bankAccountID: number, accountNumber?: strin
accountNumber,
routingNumber,
plaidMask,
+ canUseNewVbbaFlow: true,
};
API.write('ConnectBankAccountManually', parameters, getVBBADataForOnyx(CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT));
@@ -429,11 +444,13 @@ function verifyIdentityForBankAccount(bankAccountID: number, onfidoData: OnfidoD
type VerifyIdentityForBankAccountParams = {
bankAccountID: number;
onfidoData: string;
+ canUseNewVbbaFlow: boolean;
};
const parameters: VerifyIdentityForBankAccountParams = {
bankAccountID,
onfidoData: JSON.stringify(onfidoData),
+ canUseNewVbbaFlow: true,
};
API.write('VerifyIdentityForBankAccount', parameters, getVBBADataForOnyx());
@@ -469,6 +486,7 @@ function setReimbursementAccountLoading(isLoading: boolean) {
}
export {
+ acceptACHContractForBankAccount,
addBusinessWebsiteForDraft,
addBusinessAddressForDraft,
addPersonalAddressForDraft,
@@ -487,7 +505,6 @@ export {
clearReimbursementAccount,
openReimbursementAccountPage,
updateBeneficialOwnersForBankAccount,
- updateBeneficialOwnersForBankAccountDraft,
updateCompanyInformationForBankAccount,
updatePersonalInformationForBankAccount,
openWorkspaceView,
diff --git a/src/libs/actions/ReimbursementAccount/resetFreePlanBankAccount.js b/src/libs/actions/ReimbursementAccount/resetFreePlanBankAccount.js
index 14c988033689..476f80a4af4f 100644
--- a/src/libs/actions/ReimbursementAccount/resetFreePlanBankAccount.js
+++ b/src/libs/actions/ReimbursementAccount/resetFreePlanBankAccount.js
@@ -43,6 +43,11 @@ function resetFreePlanBankAccount(bankAccountID, session) {
key: ONYXKEYS.ONFIDO_TOKEN,
value: '',
},
+ {
+ onyxMethod: Onyx.METHOD.SET,
+ key: ONYXKEYS.ONFIDO_APPLICANT_ID,
+ value: '',
+ },
{
onyxMethod: Onyx.METHOD.SET,
key: ONYXKEYS.PLAID_DATA,
diff --git a/src/pages/ReimbursementAccount/ACHContractStep.js b/src/pages/ReimbursementAccount/ACHContractStep.js
index 07f0828fe67f..5204ba7d3fc3 100644
--- a/src/pages/ReimbursementAccount/ACHContractStep.js
+++ b/src/pages/ReimbursementAccount/ACHContractStep.js
@@ -1,6 +1,5 @@
import PropTypes from 'prop-types';
-import React, {useState} from 'react';
-import BeneficialOwnerInfo from './BeneficialOwnerInfo/BeneficialOwnerInfo';
+import React from 'react';
import CompleteVerification from './CompleteVerification/CompleteVerification';
const propTypes = {
@@ -12,23 +11,10 @@ const propTypes = {
};
function ACHContractStep({onBackButtonPress, onCloseButtonPress}) {
- const [isBeneficialOwnerInfoSet, setIsBeneficialOwnerInfoSet] = useState(false);
- const handleCompleteVerificationBackButtonPress = () => setIsBeneficialOwnerInfoSet(false);
-
- if (isBeneficialOwnerInfoSet) {
- return (
-
- );
- }
-
return (
-
);
}
diff --git a/src/pages/ReimbursementAccount/BankInfo/substeps/Confirmation.tsx b/src/pages/ReimbursementAccount/BankInfo/substeps/Confirmation.tsx
index 287e18fb02d0..f3738e8a529a 100644
--- a/src/pages/ReimbursementAccount/BankInfo/substeps/Confirmation.tsx
+++ b/src/pages/ReimbursementAccount/BankInfo/substeps/Confirmation.tsx
@@ -39,10 +39,15 @@ function Confirmation({reimbursementAccount, reimbursementAccountDraft, onNext}:
const isLoading = reimbursementAccount?.isLoading ?? false;
const setupType = reimbursementAccount?.achData?.subStep ?? '';
+ const bankAccountID = Number(reimbursementAccount?.achData?.[bankInfoStepKeys.BANK_ACCOUNT_ID] ?? '0');
const values = useMemo(() => getSubstepValues(bankInfoStepKeys, reimbursementAccountDraft ?? {}, reimbursementAccount ?? {}), [reimbursementAccount, reimbursementAccountDraft]);
const error = ErrorUtils.getLatestErrorMessage(reimbursementAccount ?? {});
const handleConnectDifferentAccount = () => {
+ if (bankAccountID) {
+ ReimbursementAccount.requestResetFreePlanBankAccount();
+ return;
+ }
const bankAccountData = {
[bankInfoStepKeys.ROUTING_NUMBER]: '',
[bankInfoStepKeys.ACCOUNT_NUMBER]: '',
diff --git a/src/pages/ReimbursementAccount/BeneficialOwnerInfo/BeneficialOwnerInfo.js b/src/pages/ReimbursementAccount/BeneficialOwnerInfo/BeneficialOwnerInfo.js
index 27c07699512d..d1bf37a164f6 100644
--- a/src/pages/ReimbursementAccount/BeneficialOwnerInfo/BeneficialOwnerInfo.js
+++ b/src/pages/ReimbursementAccount/BeneficialOwnerInfo/BeneficialOwnerInfo.js
@@ -101,7 +101,7 @@ function BeneficialOwnerInfo({reimbursementAccount, reimbursementAccountDraft, o
zipCode: lodashGet(reimbursementAccountDraft, `beneficialOwner_${ownerKey}_zipCode`),
}));
- BankAccounts.updateBeneficialOwnersForBankAccountDraft({
+ BankAccounts.updateBeneficialOwnersForBankAccount({
ownsMoreThan25Percent: isUserUBO,
beneficialOwners: JSON.stringify(beneficialOwners),
beneficialOwnerKeys,
diff --git a/src/pages/ReimbursementAccount/BeneficialOwnersStep.js b/src/pages/ReimbursementAccount/BeneficialOwnersStep.js
new file mode 100644
index 000000000000..7b5538de932f
--- /dev/null
+++ b/src/pages/ReimbursementAccount/BeneficialOwnersStep.js
@@ -0,0 +1,24 @@
+import PropTypes from 'prop-types';
+import React from 'react';
+import BeneficialOwnerInfo from "@pages/ReimbursementAccount/BeneficialOwnerInfo/BeneficialOwnerInfo";
+
+const propTypes = {
+ /** Goes to the previous step */
+ onBackButtonPress: PropTypes.func.isRequired,
+
+ /** Exits flow and goes back to the workspace initial page */
+ onCloseButtonPress: PropTypes.func.isRequired,
+};
+
+function BeneficialOwnersStep({onBackButtonPress, onCloseButtonPress}) {
+ return (
+
+ );
+}
+
+BeneficialOwnersStep.propTypes = propTypes;
+BeneficialOwnersStep.displayName = 'BeneficialOwnersStep';
+export default BeneficialOwnersStep;
diff --git a/src/pages/ReimbursementAccount/BusinessInfo/BusinessInfo.tsx b/src/pages/ReimbursementAccount/BusinessInfo/BusinessInfo.tsx
index ef33c515bf76..9327f6e6a2e2 100644
--- a/src/pages/ReimbursementAccount/BusinessInfo/BusinessInfo.tsx
+++ b/src/pages/ReimbursementAccount/BusinessInfo/BusinessInfo.tsx
@@ -114,7 +114,7 @@ function BusinessInfo({reimbursementAccount, reimbursementAccountDraft, policyID
/>
diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/NameBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/NameBusiness.tsx
index 49a76155ca91..4a11d6caf9bc 100644
--- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/NameBusiness.tsx
+++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/NameBusiness.tsx
@@ -34,7 +34,7 @@ function NameBusiness({reimbursementAccount, onNext, isEditing}: NameBusinessPro
const bankAccountID = getDefaultValueForReimbursementAccountField(reimbursementAccount, 'bankAccountID', 0);
- const shouldDisableCompanyName = Boolean(bankAccountID && defaultCompanyName);
+ const shouldDisableCompanyName = Boolean(bankAccountID && defaultCompanyName && reimbursementAccount?.achData?.state !== 'SETUP');
return (
// @ts-expect-error TODO: Remove this once Form (https://github.com/Expensify/App/issues/31972) is migrated to TypeScript
diff --git a/src/pages/ReimbursementAccount/BusinessInfo/substeps/TaxIdBusiness.tsx b/src/pages/ReimbursementAccount/BusinessInfo/substeps/TaxIdBusiness.tsx
index 3b1d47d7ba31..1f3234c607df 100644
--- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/TaxIdBusiness.tsx
+++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/TaxIdBusiness.tsx
@@ -42,7 +42,7 @@ function TaxIdBusiness({reimbursementAccount, onNext, isEditing}: TaxIdBusinessP
const bankAccountID = getDefaultValueForReimbursementAccountField(reimbursementAccount, 'bankAccountID', 0);
- const shouldDisableCompanyTaxID = Boolean(bankAccountID && defaultCompanyTaxId);
+ const shouldDisableCompanyTaxID = Boolean(bankAccountID && defaultCompanyTaxId && reimbursementAccount?.achData?.state !== 'SETUP');
return (
// @ts-expect-error TODO: Remove this once Form (https://github.com/Expensify/App/issues/31972) is migrated to TypeScript
diff --git a/src/pages/ReimbursementAccount/CompleteVerification/CompleteVerification.js b/src/pages/ReimbursementAccount/CompleteVerification/CompleteVerification.js
index f43c042c6484..9e234a5686b6 100644
--- a/src/pages/ReimbursementAccount/CompleteVerification/CompleteVerification.js
+++ b/src/pages/ReimbursementAccount/CompleteVerification/CompleteVerification.js
@@ -39,7 +39,6 @@ const defaultProps = {
const BODY_CONTENT = [ConfirmAgreements];
const COMPLETE_VERIFICATION_KEYS = CONST.BANK_ACCOUNT.COMPLETE_VERIFICATION.INPUT_KEY;
-const BENEFICIAL_OWNER_INFO_STEP_KEYS = CONST.BANK_ACCOUNT.BENEFICIAL_OWNER_INFO_STEP.INPUT_KEY;
const CompleteVerification = forwardRef(({reimbursementAccount, reimbursementAccountDraft, onBackButtonPress, onCloseButtonPress}, ref) => {
const {translate} = useLocalize();
@@ -52,10 +51,8 @@ const CompleteVerification = forwardRef(({reimbursementAccount, reimbursementAcc
bankAccountID: getDefaultValueForReimbursementAccountField(reimbursementAccount, COMPLETE_VERIFICATION_KEYS.BANK_ACCOUNT_ID, 0),
...values,
};
- const beneficialOwnersStepValues = getSubstepValues(BENEFICIAL_OWNER_INFO_STEP_KEYS, reimbursementAccountDraft, reimbursementAccount);
- BankAccounts.updateBeneficialOwnersForBankAccount({
- ...beneficialOwnersStepValues,
+ BankAccounts.acceptACHContractForBankAccount({
...payload,
});
}, [reimbursementAccount, reimbursementAccountDraft, values]);
diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js
index 3c5bf46c3a93..ab18114ad414 100644
--- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js
+++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js
@@ -34,6 +34,7 @@ import EnableBankAccount from './EnableBankAccount/EnableBankAccount';
import reimbursementAccountDraftPropTypes from './ReimbursementAccountDraftPropTypes';
import * as ReimbursementAccountProps from './reimbursementAccountPropTypes';
import RequestorStep from './RequestorStep';
+import BeneficialOwnersStep from './BeneficialOwnersStep';
const propTypes = {
/** Plaid SDK token to use to initialize the widget */
@@ -105,6 +106,7 @@ const defaultProps = {
const ROUTE_NAMES = {
COMPANY: 'company',
PERSONAL_INFORMATION: 'personal-information',
+ BENEFICIAL_OWNERS: 'beneficial-owners',
CONTRACT: 'contract',
VALIDATE: 'validate',
ENABLE: 'enable',
@@ -125,6 +127,8 @@ function getStepToOpenFromRouteParams(route) {
return CONST.BANK_ACCOUNT.STEP.COMPANY;
case ROUTE_NAMES.PERSONAL_INFORMATION:
return CONST.BANK_ACCOUNT.STEP.REQUESTOR;
+ case ROUTE_NAMES.BENEFICIAL_OWNERS:
+ return CONST.BANK_ACCOUNT.STEP.BENEFICIAL_OWNERS;
case ROUTE_NAMES.CONTRACT:
return CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT;
case ROUTE_NAMES.VALIDATE:
@@ -146,6 +150,8 @@ function getRouteForCurrentStep(currentStep) {
return ROUTE_NAMES.COMPANY;
case CONST.BANK_ACCOUNT.STEP.REQUESTOR:
return ROUTE_NAMES.PERSONAL_INFORMATION;
+ case CONST.BANK_ACCOUNT.STEP.BENEFICIAL_OWNERS:
+ return ROUTE_NAMES.BENEFICIAL_OWNERS;
case CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT:
return ROUTE_NAMES.CONTRACT;
case CONST.BANK_ACCOUNT.STEP.VALIDATION:
@@ -370,20 +376,24 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol
break;
case CONST.BANK_ACCOUNT.STEP.COMPANY:
- BankAccounts.goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT);
+ BankAccounts.clearOnfidoToken();
+ BankAccounts.goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.REQUESTOR);
break;
case CONST.BANK_ACCOUNT.STEP.REQUESTOR:
if (shouldShowOnfido) {
BankAccounts.clearOnfidoToken();
} else {
- BankAccounts.goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.COMPANY);
+ BankAccounts.goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT, {subStep: CONST.BANK_ACCOUNT.SUBSTEP.MANUAL});
}
break;
+ case CONST.BANK_ACCOUNT.STEP.BENEFICIAL_OWNERS:
+ BankAccounts.goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.COMPANY);
+ break;
+
case CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT:
- BankAccounts.clearOnfidoToken();
- BankAccounts.goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.REQUESTOR);
+ BankAccounts.goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.BENEFICIAL_OWNERS);
break;
case CONST.BANK_ACCOUNT.STEP.VALIDATION:
@@ -415,17 +425,15 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol
const isLoading = (isLoadingApp || account.isLoading || reimbursementAccount.isLoading) && (!plaidCurrentEvent || plaidCurrentEvent === CONST.BANK_ACCOUNT.PLAID.EVENTS_NAME.EXIT);
const shouldShowOfflineLoader = !(
- isOffline && _.contains([CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT, CONST.BANK_ACCOUNT.STEP.COMPANY, CONST.BANK_ACCOUNT.STEP.REQUESTOR, CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT], currentStep)
+ isOffline && _.contains([CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT, CONST.BANK_ACCOUNT.STEP.COMPANY, CONST.BANK_ACCOUNT.STEP.REQUESTOR, CONST.BANK_ACCOUNT.STEP.BENEFICIAL_OWNERS, CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT], currentStep)
);
// Show loading indicator when page is first time being opened and props.reimbursementAccount yet to be loaded from the server
// or when data is being loaded. Don't show the loading indicator if we're offline and restarted the bank account setup process
// On Android, when we open the app from the background, Onfido activity gets destroyed, so we need to reopen it.
if ((!hasACHDataBeenLoaded || isLoading) && shouldShowOfflineLoader && (shouldReopenOnfido || !requestorStepRef.current)) {
- const isSubmittingVerificationsData = _.contains([CONST.BANK_ACCOUNT.STEP.COMPANY, CONST.BANK_ACCOUNT.STEP.REQUESTOR, CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT], currentStep);
return (
);
@@ -510,6 +518,15 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol
);
}
+ if (currentStep === CONST.BANK_ACCOUNT.STEP.BENEFICIAL_OWNERS) {
+ return (
+
+ );
+ }
+
if (currentStep === CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT) {
return (
{
- BankAccounts.verifyIdentityForBankAccount(lodashGet(reimbursementAccount, 'achData.bankAccountID', 0), onfidoData);
+ BankAccounts.verifyIdentityForBankAccount(lodashGet(reimbursementAccount, 'achData.bankAccountID', 0), {...onfidoData, applicantID: onfidoApplicantID});
BankAccounts.updateReimbursementAccountDraft({isOnfidoSetupComplete: true});
};
@@ -90,4 +93,7 @@ export default withOnyx({
onfidoToken: {
key: ONYXKEYS.ONFIDO_TOKEN,
},
+ onfidoApplicantID: {
+ key: ONYXKEYS.ONFIDO_APPLICANT_ID,
+ },
})(RequestorOnfidoStep);
diff --git a/src/pages/ReimbursementAccount/VerifyIdentity/VerifyIdentity.js b/src/pages/ReimbursementAccount/VerifyIdentity/VerifyIdentity.js
index 96dde089225d..4e6ab813eda2 100644
--- a/src/pages/ReimbursementAccount/VerifyIdentity/VerifyIdentity.js
+++ b/src/pages/ReimbursementAccount/VerifyIdentity/VerifyIdentity.js
@@ -25,21 +25,23 @@ const propTypes = {
/** Exits flow and goes back to the workspace initial page */
onCloseButtonPress: PropTypes.func.isRequired,
+
+ onfidoApplicantID: PropTypes.string,
};
const defaultProps = {
reimbursementAccount: ReimbursementAccountProps.reimbursementAccountDefaultProps,
+ onfidoApplicantID: null,
};
const bodyContent = [OnfidoInitialize];
-function VerifyIdentity({reimbursementAccount, onBackButtonPress, onCloseButtonPress}) {
+function VerifyIdentity({reimbursementAccount, onBackButtonPress, onCloseButtonPress, onfidoApplicantID}) {
const styles = useThemeStyles();
const {translate} = useLocalize();
-
const submit = useCallback(
(onfidoData) => {
- BankAccounts.verifyIdentityForBankAccount(getDefaultValueForReimbursementAccountField(reimbursementAccount, 'bankAccountID', 0), onfidoData);
+ BankAccounts.verifyIdentityForBankAccount(getDefaultValueForReimbursementAccountField(reimbursementAccount, 'bankAccountID', 0), {...onfidoData, applicantID: onfidoApplicantID});
BankAccounts.updateReimbursementAccountDraft({isOnfidoSetupComplete: true});
},
[reimbursementAccount],
@@ -58,7 +60,7 @@ function VerifyIdentity({reimbursementAccount, onBackButtonPress, onCloseButtonP
{}}
- startStepIndex={3}
+ startStepIndex={2}
stepNames={CONST.BANK_ACCOUNT.STEP_NAMES}
/>
@@ -79,4 +81,7 @@ export default withOnyx({
reimbursementAccount: {
key: ONYXKEYS.REIMBURSEMENT_ACCOUNT,
},
+ onfidoApplicantID: {
+ key: ONYXKEYS.ONFIDO_APPLICANT_ID,
+ },
})(VerifyIdentity);
diff --git a/src/types/onyx/ReimbursementAccountDraft.ts b/src/types/onyx/ReimbursementAccountDraft.ts
index 03b2c8f1a0f0..192146706df1 100644
--- a/src/types/onyx/ReimbursementAccountDraft.ts
+++ b/src/types/onyx/ReimbursementAccountDraft.ts
@@ -37,7 +37,7 @@ type RequestorStepProps = {
onfidoData?: OnfidoData;
};
-type BeneficialOwnersStepDraftProps = {
+type BeneficialOwnersStepProps = {
ownsMoreThan25Percent?: boolean;
hasOtherBeneficialOwners?: boolean;
beneficialOwners?: string;
@@ -45,12 +45,9 @@ type BeneficialOwnersStepDraftProps = {
};
type ACHContractStepProps = {
- ownsMoreThan25Percent?: boolean;
- hasOtherBeneficialOwners?: boolean;
acceptTermsAndConditions?: boolean;
certifyTrueInformation?: boolean;
- beneficialOwners?: string;
- beneficialOwnerKeys?: string[];
+ isAuthorizedToUseBankAccount?: boolean;
};
type ReimbursementAccountProps = {
@@ -66,7 +63,7 @@ type ReimbursementAccountProps = {
// BeneficialOwnerDraftData is saved under dynamic key which consists of prefix, beneficial owner ID and input key
type BeneficialOwnerDraftData = Record<`beneficialOwner_${string}_${string}`, string>;
-type ReimbursementAccountDraft = BankAccountStepProps & CompanyStepProps & RequestorStepProps & ACHContractStepProps & ReimbursementAccountProps & BeneficialOwnerDraftData;
+type ReimbursementAccountDraft = BankAccountStepProps & CompanyStepProps & RequestorStepProps & BeneficialOwnersStepProps & ACHContractStepProps & ReimbursementAccountProps & BeneficialOwnerDraftData;
export default ReimbursementAccountDraft;
-export type {ACHContractStepProps, BeneficialOwnersStepDraftProps, RequestorStepProps, OnfidoData, BankAccountStepProps, CompanyStepProps, ReimbursementAccountProps};
+export type {ACHContractStepProps, BeneficialOwnersStepProps, RequestorStepProps, OnfidoData, BankAccountStepProps, CompanyStepProps, ReimbursementAccountProps};