From 6d6b42162ded22f2f15fbb9e51458f4428d95c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Muzyk?= Date: Mon, 6 Oct 2025 16:08:41 +0200 Subject: [PATCH 1/3] fix: Skip Continue step for USD pending accounts --- src/libs/ReimbursementAccountUtils.ts | 10 ++++++++-- .../ReimbursementAccountPage.tsx | 12 +++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/libs/ReimbursementAccountUtils.ts b/src/libs/ReimbursementAccountUtils.ts index b388c3389a04..24f32c1734fd 100644 --- a/src/libs/ReimbursementAccountUtils.ts +++ b/src/libs/ReimbursementAccountUtils.ts @@ -36,10 +36,16 @@ function getRouteForCurrentStep(currentStep: ReimbursementAccountStep): Reimburs } /** - * Returns true if a VBBA exists in any state other than OPEN or LOCKED + * Returns true if a VBBA exists in any state other than OPEN, LOCKED or PENDING */ const hasInProgressUSDVBBA = (achData?: ACHDataReimbursementAccount): boolean => { - return !!achData?.bankAccountID && !!achData?.state && achData?.state !== CONST.BANK_ACCOUNT.STATE.OPEN && achData?.state !== CONST.BANK_ACCOUNT.STATE.LOCKED; + return ( + !!achData?.bankAccountID && + !!achData?.state && + achData?.state !== CONST.BANK_ACCOUNT.STATE.OPEN && + achData?.state !== CONST.BANK_ACCOUNT.STATE.LOCKED && + achData?.state !== CONST.BANK_ACCOUNT.STATE.PENDING + ); }; /** Returns true if user passed first step of flow for non USD VBBA */ diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx index f750b574468d..002cf6ec1df9 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx @@ -192,7 +192,12 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}: setShouldShowConnectedVerifiedBankAccount(isNonUSDWorkspace ? achData?.state === CONST.BANK_ACCOUNT.STATE.OPEN : achData?.currentStep === CONST.BANK_ACCOUNT.STEP.ENABLE); setShouldShowContinueSetupButton(shouldShowContinueSetupButtonValue); - }, [achData?.currentStep, shouldShowContinueSetupButtonValue, isNonUSDWorkspace, isPreviousPolicy, achData?.state]); + + // If we shouldn't show the continue button and USD bank account is in pending state, we should navigate straight to the validation step and skip Continue step + if (!shouldShowContinueSetupButtonValue && policyCurrency === CONST.CURRENCY.USD && achData?.state === CONST.BANK_ACCOUNT.STATE.PENDING) { + setUSDBankAccountStep(CONST.BANK_ACCOUNT.STEP.VALIDATION); + } + }, [achData?.currentStep, shouldShowContinueSetupButtonValue, isNonUSDWorkspace, isPreviousPolicy, achData?.state, policyCurrency]); useEffect( () => { @@ -354,9 +359,6 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}: case CONST.BANK_ACCOUNT.STEP.VALIDATION: if ([CONST.BANK_ACCOUNT.STATE.VERIFYING, CONST.BANK_ACCOUNT.STATE.SETUP].some((value) => value === achData?.state)) { goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT); - } else if (!isOffline && achData?.state === CONST.BANK_ACCOUNT.STATE.PENDING) { - setShouldShowContinueSetupButton(true); - setUSDBankAccountStep(null); } else { Navigation.goBack(); } @@ -365,7 +367,7 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}: default: Navigation.dismissModal(); } - }, [achData, currentStep, isOffline, onfidoToken]); + }, [achData, currentStep, onfidoToken]); const isLoading = (isLoadingApp || (reimbursementAccount?.isLoading && !reimbursementAccount?.isCreateCorpayBankAccount)) && From 58a98c05df06f08efb404e73726fbd457e09b915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Muzyk?= Date: Wed, 8 Oct 2025 13:12:31 +0200 Subject: [PATCH 2/3] fix: inconsistent RHP behaviour --- src/libs/ReimbursementAccountUtils.ts | 8 +------- .../ReimbursementAccount/ReimbursementAccountPage.tsx | 11 ++++++----- .../USD/ConnectBankAccount/ConnectBankAccount.tsx | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/libs/ReimbursementAccountUtils.ts b/src/libs/ReimbursementAccountUtils.ts index 24f32c1734fd..8b0d31fe6a4c 100644 --- a/src/libs/ReimbursementAccountUtils.ts +++ b/src/libs/ReimbursementAccountUtils.ts @@ -39,13 +39,7 @@ function getRouteForCurrentStep(currentStep: ReimbursementAccountStep): Reimburs * Returns true if a VBBA exists in any state other than OPEN, LOCKED or PENDING */ const hasInProgressUSDVBBA = (achData?: ACHDataReimbursementAccount): boolean => { - return ( - !!achData?.bankAccountID && - !!achData?.state && - achData?.state !== CONST.BANK_ACCOUNT.STATE.OPEN && - achData?.state !== CONST.BANK_ACCOUNT.STATE.LOCKED && - achData?.state !== CONST.BANK_ACCOUNT.STATE.PENDING - ); + return !!achData?.bankAccountID && !!achData?.state && achData?.state !== CONST.BANK_ACCOUNT.STATE.OPEN && achData?.state !== CONST.BANK_ACCOUNT.STATE.LOCKED; }; /** Returns true if user passed first step of flow for non USD VBBA */ diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx index 002cf6ec1df9..68590c134298 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx @@ -190,13 +190,14 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}: return; } - setShouldShowConnectedVerifiedBankAccount(isNonUSDWorkspace ? achData?.state === CONST.BANK_ACCOUNT.STATE.OPEN : achData?.currentStep === CONST.BANK_ACCOUNT.STEP.ENABLE); - setShouldShowContinueSetupButton(shouldShowContinueSetupButtonValue); - - // If we shouldn't show the continue button and USD bank account is in pending state, we should navigate straight to the validation step and skip Continue step - if (!shouldShowContinueSetupButtonValue && policyCurrency === CONST.CURRENCY.USD && achData?.state === CONST.BANK_ACCOUNT.STATE.PENDING) { + // If USD bank account is in pending state, we should navigate straight to the validation step and skip Continue step + if (policyCurrency === CONST.CURRENCY.USD && achData?.state === CONST.BANK_ACCOUNT.STATE.PENDING) { setUSDBankAccountStep(CONST.BANK_ACCOUNT.STEP.VALIDATION); + return; } + + setShouldShowConnectedVerifiedBankAccount(isNonUSDWorkspace ? achData?.state === CONST.BANK_ACCOUNT.STATE.OPEN : achData?.currentStep === CONST.BANK_ACCOUNT.STEP.ENABLE); + setShouldShowContinueSetupButton(shouldShowContinueSetupButtonValue); }, [achData?.currentStep, shouldShowContinueSetupButtonValue, isNonUSDWorkspace, isPreviousPolicy, achData?.state, policyCurrency]); useEffect( diff --git a/src/pages/ReimbursementAccount/USD/ConnectBankAccount/ConnectBankAccount.tsx b/src/pages/ReimbursementAccount/USD/ConnectBankAccount/ConnectBankAccount.tsx index fa9a3658531c..4702cb7339e3 100644 --- a/src/pages/ReimbursementAccount/USD/ConnectBankAccount/ConnectBankAccount.tsx +++ b/src/pages/ReimbursementAccount/USD/ConnectBankAccount/ConnectBankAccount.tsx @@ -30,7 +30,7 @@ function ConnectBankAccount({onBackButtonPress, setShouldShowConnectedVerifiedBa const {translate} = useLocalize(); const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {canBeMissing: true}); - const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${reimbursementAccount?.achData?.policyID}}`, {canBeMissing: true}); + const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${reimbursementAccount?.achData?.policyID}`, {canBeMissing: true}); const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true}); const handleNavigateToConciergeChat = () => navigateToConciergeChat(true); From 9246c3a2887e8a32da2cc7885a23b76083ac0ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Muzyk?= Date: Wed, 8 Oct 2025 13:15:08 +0200 Subject: [PATCH 3/3] fix: js doc --- src/libs/ReimbursementAccountUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReimbursementAccountUtils.ts b/src/libs/ReimbursementAccountUtils.ts index 8b0d31fe6a4c..b388c3389a04 100644 --- a/src/libs/ReimbursementAccountUtils.ts +++ b/src/libs/ReimbursementAccountUtils.ts @@ -36,7 +36,7 @@ function getRouteForCurrentStep(currentStep: ReimbursementAccountStep): Reimburs } /** - * Returns true if a VBBA exists in any state other than OPEN, LOCKED or PENDING + * Returns true if a VBBA exists in any state other than OPEN or LOCKED */ const hasInProgressUSDVBBA = (achData?: ACHDataReimbursementAccount): boolean => { return !!achData?.bankAccountID && !!achData?.state && achData?.state !== CONST.BANK_ACCOUNT.STATE.OPEN && achData?.state !== CONST.BANK_ACCOUNT.STATE.LOCKED;