From 2d2c833d46fce88b3bcf1467c8e5fb6ff30ea7ab Mon Sep 17 00:00:00 2001 From: Nathalie Kuoch Date: Tue, 2 Jan 2024 16:22:22 +0100 Subject: [PATCH] Use new vbba 111 commands and swap order of company step and requestor steps --- src/CONST.ts | 6 +- src/ONYXKEYS.ts | 2 + .../ReimbursementAccountLoadingIndicator.js | 30 +++----- src/hooks/useSubStep/index.ts | 37 +++++---- src/languages/en.ts | 3 - src/languages/es.ts | 3 - src/libs/actions/BankAccounts.ts | 77 ++++++++++++------- .../resetFreePlanBankAccount.js | 5 ++ .../ReimbursementAccount/ACHContractStep.js | 18 +---- .../BankInfo/BankInfo.tsx | 4 +- .../BankInfo/substeps/Confirmation.tsx | 5 ++ .../BankInfo/substeps/Manual.tsx | 2 +- .../BankInfo/substeps/Plaid.tsx | 2 +- ...OwnerInfo.tsx => BeneficialOwnersStep.tsx} | 32 ++++---- .../BusinessInfo/BusinessInfo.tsx | 18 ++--- .../BusinessInfo/substeps/NameBusiness.tsx | 2 +- .../BusinessInfo/substeps/TaxIdBusiness.tsx | 2 +- src/pages/ReimbursementAccount/CompanyStep.js | 11 +-- .../CompleteVerification.tsx | 12 +-- .../components/BankAccountValidationForm.tsx | 2 +- .../PersonalInfo/PersonalInfo.tsx | 10 +-- .../ReimbursementAccountDraftPropTypes.js | 1 - .../ReimbursementAccountPage.js | 48 ++++++++---- .../RequestorOnfidoStep.js | 13 +++- .../VerifyIdentity/VerifyIdentity.tsx | 15 ++-- src/types/onyx/ReimbursementAccount.ts | 4 +- src/types/onyx/ReimbursementAccountDraft.ts | 26 +++---- 27 files changed, 198 insertions(+), 192 deletions(-) rename src/pages/ReimbursementAccount/{BeneficialOwnerInfo/BeneficialOwnerInfo.tsx => BeneficialOwnersStep.tsx} (90%) diff --git a/src/CONST.ts b/src/CONST.ts index 4dd88aaac710..3150b87db19d 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -189,7 +189,6 @@ const CONST = { BANK_ACCOUNT: { BANK_INFO_STEP: { INPUT_KEY: { - BANK_ACCOUNT_ID: 'bankAccountID', ROUTING_NUMBER: 'routingNumber', ACCOUNT_NUMBER: 'accountNumber', PLAID_MASK: 'plaidMask', @@ -201,7 +200,6 @@ const CONST = { }, PERSONAL_INFO_STEP: { INPUT_KEY: { - BANK_ACCOUNT_ID: 'bankAccountID', FIRST_NAME: 'firstName', LAST_NAME: 'lastName', DOB: 'dob', @@ -266,7 +264,6 @@ const CONST = { }, COMPLETE_VERIFICATION: { INPUT_KEY: { - BANK_ACCOUNT_ID: 'bankAccountID', IS_AUTHORIZED_TO_USE_BANK_ACCOUNT: 'isAuthorizedToUseBankAccount', CERTIFY_TRUE_INFORMATION: 'certifyTrueInformation', ACCEPT_TERMS_AND_CONDITIONS: 'acceptTermsAndConditions', @@ -281,8 +278,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 98e3856f4544..5b2171af73f2 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', @@ -398,6 +399,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 f7d1ed273959..e215cea4d8de 100644 --- a/src/hooks/useSubStep/index.ts +++ b/src/hooks/useSubStep/index.ts @@ -15,23 +15,26 @@ export default function useSubStep({bodyContent, onFinished, startFrom = 0}: setScreenIndex(prevScreenIndex); }, [screenIndex]); - const nextScreen = useCallback(() => { - if (isEditing.current) { - isEditing.current = false; - - setScreenIndex(bodyContent.length - 1); - - return; - } - - const nextScreenIndex = screenIndex + 1; - - if (nextScreenIndex === bodyContent.length) { - onFinished(); - } else { - setScreenIndex(nextScreenIndex); - } - }, [screenIndex, bodyContent.length, onFinished]); + const nextScreen = useCallback( + (data?: Record) => { + if (isEditing.current) { + isEditing.current = false; + + setScreenIndex(bodyContent.length - 1); + + return; + } + + const nextScreenIndex = screenIndex + 1; + + if (nextScreenIndex === bodyContent.length) { + onFinished(data); + } else { + setScreenIndex(nextScreenIndex); + } + }, + [screenIndex, bodyContent.length, onFinished], + ); const moveTo = useCallback((step: number) => { isEditing.current = true; diff --git a/src/languages/en.ts b/src/languages/en.ts index 837ab8a3d40e..7b4027dce36b 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1464,9 +1464,6 @@ export default { headerTitle: 'Personal information', learnMore: 'Learn more', isMyDataSafe: 'Is my data safe?', - onFidoConditions: 'By continuing with the request to add this bank account, you confirm that you have read, understand and accept ', - isControllingOfficer: 'I am authorized to use my company bank account for business spend', - isControllingOfficerError: 'You must be a controlling officer with authorization to operate the business bank account.', }, personalInfoStep: { personalInfo: 'Personal info', diff --git a/src/languages/es.ts b/src/languages/es.ts index e5806a4c5b82..4a6040f899e2 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1486,9 +1486,6 @@ export default { headerTitle: 'Información personal', learnMore: 'Más información', isMyDataSafe: '¿Están seguros mis datos?', - onFidoConditions: 'Al continuar con la solicitud de añadir esta cuenta bancaria, confirma que ha leído, entiende y acepta ', - isControllingOfficer: 'Estoy autorizado a utilizar la cuenta bancaria de mi compañía para gastos de empresa', - isControllingOfficerError: 'Debe ser un oficial controlador con autorización para operar la cuenta bancaria de la compañía', }, personalInfoStep: { personalInfo: 'Información Personal', diff --git a/src/libs/actions/BankAccounts.ts b/src/libs/actions/BankAccounts.ts index c32cf0a4306e..f55991e2c48b 100644 --- a/src/libs/actions/BankAccounts.ts +++ b/src/libs/actions/BankAccounts.ts @@ -8,15 +8,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type PlaidBankAccount from '@src/types/onyx/PlaidBankAccount'; import type {BankAccountStep, BankAccountSubStep} from '@src/types/onyx/ReimbursementAccount'; -import type { - ACHContractStepProps, - BankAccountStepProps, - BeneficialOwnersStepDraftProps, - CompanyStepProps, - OnfidoData, - ReimbursementAccountProps, - RequestorStepProps, -} from '@src/types/onyx/ReimbursementAccountDraft'; +import type {ACHContractStepProps, BeneficialOwnersStepProps, CompanyStepProps, OnfidoData, RequestorStepProps} from '@src/types/onyx/ReimbursementAccountDraft'; import type {OnyxData} from '@src/types/onyx/Request'; import * as ReimbursementAccount from './ReimbursementAccount'; @@ -35,8 +27,6 @@ export { export {openPlaidBankAccountSelector, openPlaidBankLogin} from './Plaid'; export {openOnfidoFlow, answerQuestionsForWallet, verifyIdentity, acceptWalletTerms} from './Wallet'; -type BankAccountCompanyInformation = BankAccountStepProps & CompanyStepProps & ReimbursementAccountProps; - type ReimbursementAccountStep = BankAccountStep | ''; type ReimbursementAccountSubStep = BankAccountSubStep | ''; @@ -97,6 +87,7 @@ function clearPersonalBankAccount() { function clearOnfidoToken() { Onyx.merge(ONYXKEYS.ONFIDO_TOKEN, ''); + Onyx.merge(ONYXKEYS.ONFIDO_APPLICANT_ID, ''); } /** @@ -168,6 +159,7 @@ function connectBankAccountWithPlaid(bankAccountID: number, selectedPlaidBankAcc bank?: string; plaidAccountID: string; plaidAccessToken: string; + canUseNewVbbaFlow: boolean; }; const parameters: ConnectBankAccountWithPlaidParams = { @@ -177,6 +169,7 @@ function connectBankAccountWithPlaid(bankAccountID: number, selectedPlaidBankAcc bank: selectedPlaidBankAccount.bankName, plaidAccountID: selectedPlaidBankAccount.plaidAccountID, plaidAccessToken: selectedPlaidBankAccount.plaidAccessToken, + canUseNewVbbaFlow: true, }; API.write(commandName, parameters, getVBBADataForOnyx()); @@ -283,8 +276,16 @@ 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)); +function updatePersonalInformationForBankAccount(bankAccountID: number, params: RequestorStepProps) { + API.write( + 'UpdatePersonalInformationForBankAccount', + { + ...params, + bankAccountID, + canUseNewVbbaFlow: true, + }, + getVBBADataForOnyx(CONST.BANK_ACCOUNT.STEP.REQUESTOR), + ); } function validateBankAccount(bankAccountID: number, validateCode: string) { @@ -385,26 +386,46 @@ 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}; - - const parameters: UpdateCompanyInformationForBankAccountParams = {...bankAccount, policyID}; - - API.write('UpdateCompanyInformationForBankAccount', parameters, getVBBADataForOnyx(CONST.BANK_ACCOUNT.STEP.COMPANY)); +function updateCompanyInformationForBankAccount(bankAccountID: number, params: CompanyStepProps) { + API.write( + 'UpdateCompanyInformationForBankAccount', + { + ...params, + bankAccountID, + canUseNewVbbaFlow: true, + }, + 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(bankAccountID: number, params: BeneficialOwnersStepProps) { + API.write( + 'UpdateBeneficialOwnersForBankAccount', + { + ...params, + bankAccountID, + 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(bankAccountID: number, params: ACHContractStepProps) { + API.write( + 'AcceptACHContractForBankAccount', + { + ...params, + bankAccountID, + canUseNewVbbaFlow: true, + }, + getVBBADataForOnyx(), + ); } /** @@ -417,6 +438,7 @@ function connectBankAccountManually(bankAccountID: number, accountNumber?: strin accountNumber?: string; routingNumber?: string; plaidMask?: string; + canUseNewVbbaFlow: boolean; }; const parameters: ConnectBankAccountManuallyParams = { @@ -424,6 +446,7 @@ function connectBankAccountManually(bankAccountID: number, accountNumber?: strin accountNumber, routingNumber, plaidMask, + canUseNewVbbaFlow: true, }; API.write('ConnectBankAccountManually', parameters, getVBBADataForOnyx(CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT)); @@ -436,11 +459,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()); @@ -508,6 +533,7 @@ function setReimbursementAccountLoading(isLoading: boolean) { } export { + acceptACHContractForBankAccount, addBusinessWebsiteForDraft, addBusinessAddressForDraft, addPersonalAddressForDraft, @@ -526,7 +552,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/BankInfo.tsx b/src/pages/ReimbursementAccount/BankInfo/BankInfo.tsx index daaa78a5ed9a..d9b036739af2 100644 --- a/src/pages/ReimbursementAccount/BankInfo/BankInfo.tsx +++ b/src/pages/ReimbursementAccount/BankInfo/BankInfo.tsx @@ -54,13 +54,13 @@ function BankInfo({reimbursementAccount, reimbursementAccountDraft, plaidLinkTok const submit = useCallback(() => { if (setupType === CONST.BANK_ACCOUNT.SETUP_TYPE.MANUAL) { BankAccounts.connectBankAccountManually( - Number(reimbursementAccount?.achData?.[bankInfoStepKeys.BANK_ACCOUNT_ID] ?? '0'), + Number(reimbursementAccount?.achData?.bankAccountID ?? '0'), values[bankInfoStepKeys.ACCOUNT_NUMBER], values[bankInfoStepKeys.ROUTING_NUMBER], values[bankInfoStepKeys.PLAID_MASK], ); } else if (setupType === CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID) { - BankAccounts.connectBankAccountWithPlaid(Number(reimbursementAccount?.achData?.[bankInfoStepKeys.BANK_ACCOUNT_ID] ?? '0'), { + BankAccounts.connectBankAccountWithPlaid(Number(reimbursementAccount?.achData?.bankAccountID ?? '0'), { [bankInfoStepKeys.ROUTING_NUMBER]: values[bankInfoStepKeys.ROUTING_NUMBER] ?? '', [bankInfoStepKeys.ACCOUNT_NUMBER]: values[bankInfoStepKeys.ACCOUNT_NUMBER] ?? '', [bankInfoStepKeys.BANK_NAME]: values[bankInfoStepKeys.BANK_NAME] ?? '', diff --git a/src/pages/ReimbursementAccount/BankInfo/substeps/Confirmation.tsx b/src/pages/ReimbursementAccount/BankInfo/substeps/Confirmation.tsx index 0ad09825ed69..9115969b8d30 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?.bankAccountID ?? '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/BankInfo/substeps/Manual.tsx b/src/pages/ReimbursementAccount/BankInfo/substeps/Manual.tsx index dcee4756f81a..beae2f9a63f6 100644 --- a/src/pages/ReimbursementAccount/BankInfo/substeps/Manual.tsx +++ b/src/pages/ReimbursementAccount/BankInfo/substeps/Manual.tsx @@ -62,7 +62,7 @@ function Manual({reimbursementAccount, onNext}: ManualProps) { [translate], ); - const shouldDisableInputs = Boolean(reimbursementAccount?.achData?.[bankInfoStepKeys.BANK_ACCOUNT_ID] ?? ''); + const shouldDisableInputs = Boolean(reimbursementAccount?.achData?.bankAccountID ?? ''); return ( // @ts-expect-error TODO: Remove this once FormProvider (https://github.com/Expensify/App/issues/31972) is migrated to TypeScript. diff --git a/src/pages/ReimbursementAccount/BankInfo/substeps/Plaid.tsx b/src/pages/ReimbursementAccount/BankInfo/substeps/Plaid.tsx index 69350c96f3dc..a495684e9105 100644 --- a/src/pages/ReimbursementAccount/BankInfo/substeps/Plaid.tsx +++ b/src/pages/ReimbursementAccount/BankInfo/substeps/Plaid.tsx @@ -72,7 +72,7 @@ function Plaid({reimbursementAccount, reimbursementAccountDraft, onNext, plaidDa onNext(); }, [plaidData, reimbursementAccountDraft, onNext]); - const bankAccountID = Number(reimbursementAccount?.achData?.[bankInfoStepKeys.BANK_ACCOUNT_ID] ?? '0'); + const bankAccountID = Number(reimbursementAccount?.achData?.bankAccountID ?? '0'); const selectedPlaidAccountID = reimbursementAccountDraft?.[bankInfoStepKeys.PLAID_ACCOUNT_ID] ?? ''; return ( diff --git a/src/pages/ReimbursementAccount/BeneficialOwnerInfo/BeneficialOwnerInfo.tsx b/src/pages/ReimbursementAccount/BeneficialOwnersStep.tsx similarity index 90% rename from src/pages/ReimbursementAccount/BeneficialOwnerInfo/BeneficialOwnerInfo.tsx rename to src/pages/ReimbursementAccount/BeneficialOwnersStep.tsx index 8037820a55fb..76add958bfb6 100644 --- a/src/pages/ReimbursementAccount/BeneficialOwnerInfo/BeneficialOwnerInfo.tsx +++ b/src/pages/ReimbursementAccount/BeneficialOwnersStep.tsx @@ -15,13 +15,13 @@ import * as FormActions from '@userActions/FormActions'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {ReimbursementAccount, ReimbursementAccountDraft} from '@src/types/onyx'; -import BeneficialOwnerCheckUBO from './substeps/BeneficialOwnerCheckUBO'; -import AddressUBO from './substeps/BeneficialOwnerDetailsFormSubsteps/AddressUBO'; -import ConfirmationUBO from './substeps/BeneficialOwnerDetailsFormSubsteps/ConfirmationUBO'; -import DateOfBirthUBO from './substeps/BeneficialOwnerDetailsFormSubsteps/DateOfBirthUBO'; -import LegalNameUBO from './substeps/BeneficialOwnerDetailsFormSubsteps/LegalNameUBO'; -import SocialSecurityNumberUBO from './substeps/BeneficialOwnerDetailsFormSubsteps/SocialSecurityNumberUBO'; -import CompanyOwnersListUBO from './substeps/CompanyOwnersListUBO'; +import BeneficialOwnerCheckUBO from './BeneficialOwnerInfo/substeps/BeneficialOwnerCheckUBO'; +import AddressUBO from './BeneficialOwnerInfo/substeps/BeneficialOwnerDetailsFormSubsteps/AddressUBO'; +import ConfirmationUBO from './BeneficialOwnerInfo/substeps/BeneficialOwnerDetailsFormSubsteps/ConfirmationUBO'; +import DateOfBirthUBO from './BeneficialOwnerInfo/substeps/BeneficialOwnerDetailsFormSubsteps/DateOfBirthUBO'; +import LegalNameUBO from './BeneficialOwnerInfo/substeps/BeneficialOwnerDetailsFormSubsteps/LegalNameUBO'; +import SocialSecurityNumberUBO from './BeneficialOwnerInfo/substeps/BeneficialOwnerDetailsFormSubsteps/SocialSecurityNumberUBO'; +import CompanyOwnersListUBO from './BeneficialOwnerInfo/substeps/CompanyOwnersListUBO'; type BeneficialOwnerInfoOnyxProps = { /** Reimbursement account from ONYX */ @@ -31,15 +31,12 @@ type BeneficialOwnerInfoOnyxProps = { reimbursementAccountDraft: OnyxEntry; }; -type BeneficialOwnerInfoProps = { +type BeneficialOwnersStepProps = { /** Goes to the previous step */ onBackButtonPress: () => void; /** Exits flow and goes back to the workspace initial page */ onCloseButtonPress: () => void; - - /** Changes variable responsible for displaying step 4 or 5 */ - setIsBeneficialOwnerInfoSet: (newState: boolean) => void; } & BeneficialOwnerInfoOnyxProps; const BODY_CONTENT: Array void}>> = [ @@ -52,7 +49,7 @@ const BODY_CONTENT: Array { @@ -225,7 +221,7 @@ function BeneficialOwnerInfo({reimbursementAccount, reimbursementAccountDraft, o return ( ({ +export default withOnyx({ reimbursementAccount: { key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, }, reimbursementAccountDraft: { key: ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT, }, -})(BeneficialOwnerInfo); +})(BeneficialOwnersStep); diff --git a/src/pages/ReimbursementAccount/BusinessInfo/BusinessInfo.tsx b/src/pages/ReimbursementAccount/BusinessInfo/BusinessInfo.tsx index 27941ab25612..8cedabe44502 100644 --- a/src/pages/ReimbursementAccount/BusinessInfo/BusinessInfo.tsx +++ b/src/pages/ReimbursementAccount/BusinessInfo/BusinessInfo.tsx @@ -1,4 +1,3 @@ -import {parsePhoneNumber} from 'awesome-phonenumber'; import lodashPick from 'lodash/pick'; import React, {useCallback, useMemo} from 'react'; import {View} from 'react-native'; @@ -11,6 +10,7 @@ import useLocalize from '@hooks/useLocalize'; import useSubStep from '@hooks/useSubStep'; import type {SubStepProps} from '@hooks/useSubStep/types'; import useThemeStyles from '@hooks/useThemeStyles'; +import {parsePhoneNumber} from '@libs/PhoneNumber'; import getInitialSubstepForBusinessInfo from '@pages/ReimbursementAccount/utils/getInitialSubstepForBusinessInfo'; import getSubstepValues from '@pages/ReimbursementAccount/utils/getSubstepValues'; import * as BankAccounts from '@userActions/BankAccounts'; @@ -36,9 +36,6 @@ type BusinessInfoOnyxProps = { }; type BusinessInfoProps = BusinessInfoOnyxProps & { - /** The workspace policyID */ - policyID: string; - /** Goes to the previous step */ onBackButtonPress: () => void; @@ -60,7 +57,7 @@ const bodyContent: Array> = [ const businessInfoStepKeys = CONST.BANK_ACCOUNT.BUSINESS_INFO_STEP.INPUT_KEY; -function BusinessInfo({reimbursementAccount, reimbursementAccountDraft, policyID, onBackButtonPress, onCloseButtonPress}: BusinessInfoProps) { +function BusinessInfo({reimbursementAccount, reimbursementAccountDraft, onBackButtonPress, onCloseButtonPress}: BusinessInfoProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); @@ -75,16 +72,13 @@ function BusinessInfo({reimbursementAccount, reimbursementAccountDraft, policyID const values = useMemo(() => getSubstepValues(businessInfoStepKeys, reimbursementAccountDraft, reimbursementAccount), [reimbursementAccount, reimbursementAccountDraft]); const submit = useCallback(() => { - const payload = { - bankAccountID: reimbursementAccount?.achData?.bankAccountID ?? 0, + BankAccounts.updateCompanyInformationForBankAccount(Number(reimbursementAccount?.achData?.bankAccountID ?? '0'), { ...values, ...getBankAccountFields(['routingNumber', 'accountNumber', 'bankName', 'plaidAccountID', 'plaidAccessToken', 'isSavings']), companyTaxID: values.companyTaxID?.replace(CONST.REGEX.NON_NUMERIC, ''), companyPhone: parsePhoneNumber(values.companyPhone ?? '', {regionCode: CONST.COUNTRY.US}).number?.significant, - }; - - BankAccounts.updateCompanyInformationForBankAccount(payload, policyID); - }, [reimbursementAccount, values, getBankAccountFields, policyID]); + }); + }, [reimbursementAccount, values, getBankAccountFields]); const startFrom = useMemo(() => getInitialSubstepForBusinessInfo(values), [values]); @@ -119,7 +113,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 f9220a110279..9ac5776c6324 100644 --- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/NameBusiness.tsx +++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/NameBusiness.tsx @@ -33,7 +33,7 @@ function NameBusiness({reimbursementAccount, onNext, isEditing}: NameBusinessPro const defaultCompanyName = reimbursementAccount?.achData?.companyName ?? ''; const bankAccountID = reimbursementAccount?.achData?.bankAccountID ?? 0; - const shouldDisableCompanyName = Boolean(bankAccountID && defaultCompanyName); + const shouldDisableCompanyName = Boolean(bankAccountID && defaultCompanyName && reimbursementAccount?.achData?.state !== 'SETUP'); return ( // @ts-expect-error TODO: Remove this once FormProvider (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 9933eaafa504..ee99c3e53666 100644 --- a/src/pages/ReimbursementAccount/BusinessInfo/substeps/TaxIdBusiness.tsx +++ b/src/pages/ReimbursementAccount/BusinessInfo/substeps/TaxIdBusiness.tsx @@ -40,7 +40,7 @@ function TaxIdBusiness({reimbursementAccount, onNext, isEditing}: TaxIdBusinessP const defaultCompanyTaxId = reimbursementAccount?.achData?.companyTaxID ?? ''; const bankAccountID = reimbursementAccount?.achData?.bankAccountID ?? 0; - const shouldDisableCompanyTaxID = Boolean(bankAccountID && defaultCompanyTaxId); + const shouldDisableCompanyTaxID = Boolean(bankAccountID && defaultCompanyTaxId && reimbursementAccount?.achData?.state !== 'SETUP'); return ( // @ts-expect-error TODO: Remove this once FormProvider (https://github.com/Expensify/App/issues/31972) is migrated to TypeScript diff --git a/src/pages/ReimbursementAccount/CompanyStep.js b/src/pages/ReimbursementAccount/CompanyStep.js index b303897bc4c9..b9710983c880 100644 --- a/src/pages/ReimbursementAccount/CompanyStep.js +++ b/src/pages/ReimbursementAccount/CompanyStep.js @@ -3,9 +3,6 @@ import React from 'react'; import BusinessInfo from './BusinessInfo/BusinessInfo'; const propTypes = { - /* The workspace policyID */ - policyID: PropTypes.string, - /** Goes to the previous step */ onBackButtonPress: PropTypes.func.isRequired, @@ -13,14 +10,9 @@ const propTypes = { onCloseButtonPress: PropTypes.func.isRequired, }; -const defaultProps = { - policyID: '', -}; - -function CompanyStep({policyID, onBackButtonPress, onCloseButtonPress}) { +function CompanyStep({onBackButtonPress, onCloseButtonPress}) { return ( @@ -28,7 +20,6 @@ function CompanyStep({policyID, onBackButtonPress, onCloseButtonPress}) { } CompanyStep.propTypes = propTypes; -CompanyStep.defaultProps = defaultProps; CompanyStep.displayName = 'CompanyStep'; export default CompanyStep; diff --git a/src/pages/ReimbursementAccount/CompleteVerification/CompleteVerification.tsx b/src/pages/ReimbursementAccount/CompleteVerification/CompleteVerification.tsx index e8fb9b487fa8..db918931c5d1 100644 --- a/src/pages/ReimbursementAccount/CompleteVerification/CompleteVerification.tsx +++ b/src/pages/ReimbursementAccount/CompleteVerification/CompleteVerification.tsx @@ -35,7 +35,6 @@ type CompleteVerificationProps = CompleteVerificationOnyxProps & { const BODY_CONTENT: Array> = [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; function CompleteVerification({reimbursementAccount, reimbursementAccountDraft, onBackButtonPress, onCloseButtonPress}: CompleteVerificationProps) { const {translate} = useLocalize(); @@ -44,19 +43,12 @@ function CompleteVerification({reimbursementAccount, reimbursementAccountDraft, const values = useMemo(() => getSubstepValues(COMPLETE_VERIFICATION_KEYS, reimbursementAccountDraft, reimbursementAccount), [reimbursementAccount, reimbursementAccountDraft]); const submit = useCallback(() => { - const payload = { - bankAccountID: values?.bankAccountID ?? reimbursementAccount?.achData?.bankAccountID, + BankAccounts.acceptACHContractForBankAccount(Number(reimbursementAccount?.achData?.bankAccountID ?? '0'), { isAuthorizedToUseBankAccount: values.isAuthorizedToUseBankAccount, certifyTrueInformation: values.certifyTrueInformation, acceptTermsAndConditions: values.acceptTermsAndConditions, - }; - const beneficialOwnersStepValues = getSubstepValues(BENEFICIAL_OWNER_INFO_STEP_KEYS, reimbursementAccountDraft, reimbursementAccount); - - BankAccounts.updateBeneficialOwnersForBankAccount({ - ...beneficialOwnersStepValues, - ...payload, }); - }, [reimbursementAccount, reimbursementAccountDraft, values]); + }, [reimbursementAccount, values]); const {componentToRender: SubStep, isEditing, screenIndex, nextScreen, prevScreen, moveTo, goToTheLastStep} = useSubStep({bodyContent: BODY_CONTENT, startFrom: 0, onFinished: submit}); diff --git a/src/pages/ReimbursementAccount/ConnectBankAccount/components/BankAccountValidationForm.tsx b/src/pages/ReimbursementAccount/ConnectBankAccount/components/BankAccountValidationForm.tsx index f7b73679bc27..a20c1d2dd721 100644 --- a/src/pages/ReimbursementAccount/ConnectBankAccount/components/BankAccountValidationForm.tsx +++ b/src/pages/ReimbursementAccount/ConnectBankAccount/components/BankAccountValidationForm.tsx @@ -72,7 +72,7 @@ function BankAccountValidationForm({requiresTwoFactorAuth, reimbursementAccount} const validateCode = [amount1, amount2, amount3].join(','); // Send valid amounts to BankAccountAPI::validateBankAccount in Web-Expensify - const bankAccountID = reimbursementAccount?.achData?.bankAccountID; + const bankAccountID = Number(reimbursementAccount?.achData?.bankAccountID ?? '0'); if (bankAccountID) { BankAccounts.validateBankAccount(bankAccountID, validateCode); } diff --git a/src/pages/ReimbursementAccount/PersonalInfo/PersonalInfo.tsx b/src/pages/ReimbursementAccount/PersonalInfo/PersonalInfo.tsx index 038917978865..96b24f6b7939 100644 --- a/src/pages/ReimbursementAccount/PersonalInfo/PersonalInfo.tsx +++ b/src/pages/ReimbursementAccount/PersonalInfo/PersonalInfo.tsx @@ -45,14 +45,10 @@ function PersonalInfo({reimbursementAccount, reimbursementAccountDraft, onBackBu const styles = useThemeStyles(); const values = useMemo(() => getSubstepValues(personalInfoStepKeys, reimbursementAccountDraft, reimbursementAccount), [reimbursementAccount, reimbursementAccountDraft]); - + const bankAccountID = Number(reimbursementAccount?.achData?.bankAccountID ?? '0'); const submit = useCallback(() => { - const payload = { - ...values, - }; - - BankAccounts.updatePersonalInformationForBankAccount(payload); - }, [values]); + BankAccounts.updatePersonalInformationForBankAccount(bankAccountID, {...values}); + }, [values, bankAccountID]); const startFrom = useMemo(() => getInitialSubstepForPersonalInfo(values), [values]); const {componentToRender: SubStep, isEditing, screenIndex, nextScreen, prevScreen, moveTo, goToTheLastStep} = useSubStep({bodyContent, startFrom, onFinished: submit}); diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountDraftPropTypes.js b/src/pages/ReimbursementAccount/ReimbursementAccountDraftPropTypes.js index c5ebe400fa53..c46ae5a65020 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountDraftPropTypes.js +++ b/src/pages/ReimbursementAccount/ReimbursementAccountDraftPropTypes.js @@ -33,7 +33,6 @@ export default PropTypes.shape({ requestorAddressZipCode: PropTypes.string, dob: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]), ssnLast4: PropTypes.string, - isControllingOfficer: PropTypes.bool, isOnfidoSetupComplete: PropTypes.bool, /** Props needed for ACHContractStep */ diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js index 3c5bf46c3a93..65a95dadf666 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js @@ -27,6 +27,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import ACHContractStep from './ACHContractStep'; import BankAccountStep from './BankAccountStep'; +import BeneficialOwnersStep from './BeneficialOwnersStep'; import CompanyStep from './CompanyStep'; import ConnectBankAccount from './ConnectBankAccount/ConnectBankAccount'; import ContinueBankAccountSetup from './ContinueBankAccountSetup'; @@ -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,20 +425,24 @@ 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 ( - - ); + return ; } let errorText; @@ -493,7 +507,6 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol ); } @@ -510,6 +523,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 +96,7 @@ export default withOnyx({ onfidoToken: { key: ONYXKEYS.ONFIDO_TOKEN, }, + onfidoApplicantID: { + key: ONYXKEYS.ONFIDO_APPLICANT_ID, + }, })(RequestorOnfidoStep); diff --git a/src/pages/ReimbursementAccount/VerifyIdentity/VerifyIdentity.tsx b/src/pages/ReimbursementAccount/VerifyIdentity/VerifyIdentity.tsx index a1645512a5ab..40e49ceb281e 100644 --- a/src/pages/ReimbursementAccount/VerifyIdentity/VerifyIdentity.tsx +++ b/src/pages/ReimbursementAccount/VerifyIdentity/VerifyIdentity.tsx @@ -19,6 +19,9 @@ import OnfidoInitialize from './substeps/OnfidoInitialize'; type VerifyIdentityOnyxProps = { /** Reimbursement account from ONYX */ reimbursementAccount: OnyxEntry; + + /** Onfido applicant ID from ONYX */ + onfidoApplicantID: OnyxEntry; }; type VerifyIdentityProps = VerifyIdentityOnyxProps & { @@ -31,20 +34,19 @@ type VerifyIdentityProps = VerifyIdentityOnyxProps & { const bodyContent: Array> = [OnfidoInitialize]; -function VerifyIdentity({reimbursementAccount, onBackButtonPress, onCloseButtonPress}: VerifyIdentityProps) { +function VerifyIdentity({reimbursementAccount, onBackButtonPress, onCloseButtonPress, onfidoApplicantID}: VerifyIdentityProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); - const submit = useCallback( (onfidoData?: OnfidoData) => { if (!onfidoData) { return; } - BankAccounts.verifyIdentityForBankAccount(reimbursementAccount?.achData?.bankAccountID ?? 0, onfidoData); + BankAccounts.verifyIdentityForBankAccount(Number(reimbursementAccount?.achData?.bankAccountID ?? '0'), {...onfidoData, applicantID: onfidoApplicantID}); BankAccounts.updateReimbursementAccountDraft({isOnfidoSetupComplete: true}); }, - [reimbursementAccount], + [reimbursementAccount, onfidoApplicantID], ); const {componentToRender: SubStep, isEditing, moveTo, nextScreen} = useSubStep({bodyContent, startFrom: 0, onFinished: submit}); @@ -60,7 +62,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/ReimbursementAccount.ts b/src/types/onyx/ReimbursementAccount.ts index 85a39914058d..8fa5e4891540 100644 --- a/src/types/onyx/ReimbursementAccount.ts +++ b/src/types/onyx/ReimbursementAccount.ts @@ -2,7 +2,7 @@ import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; import type {BankName} from './Bank'; import type * as OnyxCommon from './OnyxCommon'; -import type {ACHContractStepProps, BeneficialOwnersStepDraftProps, CompanyStepProps, RequestorStepProps} from './ReimbursementAccountDraft'; +import type {ACHContractStepProps, BeneficialOwnersStepProps, CompanyStepProps, RequestorStepProps} from './ReimbursementAccountDraft'; type BankAccountStep = ValueOf; @@ -32,7 +32,7 @@ type ACHData = { /** Bank account owner name */ addressName?: string; -} & BeneficialOwnersStepDraftProps & +} & BeneficialOwnersStepProps & CompanyStepProps & RequestorStepProps & ACHContractStepProps; diff --git a/src/types/onyx/ReimbursementAccountDraft.ts b/src/types/onyx/ReimbursementAccountDraft.ts index dd00bdda5942..d776f2f75a1f 100644 --- a/src/types/onyx/ReimbursementAccountDraft.ts +++ b/src/types/onyx/ReimbursementAccountDraft.ts @@ -32,12 +32,11 @@ type RequestorStepProps = { requestorAddressZipCode?: string; dob?: string; ssnLast4?: string; - isControllingOfficer?: boolean; isOnfidoSetupComplete?: boolean; onfidoData?: OnfidoData; }; -type BeneficialOwnersStepDraftProps = { +type BeneficialOwnersStepProps = { ownsMoreThan25Percent?: boolean; hasOtherBeneficialOwners?: boolean; beneficialOwners?: string; @@ -45,13 +44,9 @@ type BeneficialOwnersStepDraftProps = { }; type ACHContractStepProps = { - ownsMoreThan25Percent?: boolean; - hasOtherBeneficialOwners?: boolean; acceptTermsAndConditions?: boolean; certifyTrueInformation?: boolean; isAuthorizedToUseBankAccount?: boolean; - beneficialOwners?: string; - beneficialOwnerKeys?: string[]; }; type ReimbursementAccountProps = { @@ -67,16 +62,13 @@ 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, - BeneficialOwnerDraftData, -}; +export type {ACHContractStepProps, BeneficialOwnersStepProps, RequestorStepProps, OnfidoData, BankAccountStepProps, CompanyStepProps, ReimbursementAccountProps, BeneficialOwnerDraftData};