Skip to content

Commit 5188a16

Browse files
authored
Merge pull request Expensify#71898 from callstack-internal/fix/71773-dont-show-continue-for-pending-accounts
fix: Skip Continue step for USD pending accounts
2 parents d5fabcc + 9246c3a commit 5188a16

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,15 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}:
190190
return;
191191
}
192192

193+
// If USD bank account is in pending state, we should navigate straight to the validation step and skip Continue step
194+
if (policyCurrency === CONST.CURRENCY.USD && achData?.state === CONST.BANK_ACCOUNT.STATE.PENDING) {
195+
setUSDBankAccountStep(CONST.BANK_ACCOUNT.STEP.VALIDATION);
196+
return;
197+
}
198+
193199
setShouldShowConnectedVerifiedBankAccount(isNonUSDWorkspace ? achData?.state === CONST.BANK_ACCOUNT.STATE.OPEN : achData?.currentStep === CONST.BANK_ACCOUNT.STEP.ENABLE);
194200
setShouldShowContinueSetupButton(shouldShowContinueSetupButtonValue);
195-
}, [achData?.currentStep, shouldShowContinueSetupButtonValue, isNonUSDWorkspace, isPreviousPolicy, achData?.state]);
201+
}, [achData?.currentStep, shouldShowContinueSetupButtonValue, isNonUSDWorkspace, isPreviousPolicy, achData?.state, policyCurrency]);
196202

197203
useEffect(
198204
() => {
@@ -354,9 +360,6 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}:
354360
case CONST.BANK_ACCOUNT.STEP.VALIDATION:
355361
if ([CONST.BANK_ACCOUNT.STATE.VERIFYING, CONST.BANK_ACCOUNT.STATE.SETUP].some((value) => value === achData?.state)) {
356362
goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT);
357-
} else if (!isOffline && achData?.state === CONST.BANK_ACCOUNT.STATE.PENDING) {
358-
setShouldShowContinueSetupButton(true);
359-
setUSDBankAccountStep(null);
360363
} else {
361364
Navigation.goBack();
362365
}
@@ -365,7 +368,7 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy, navigation}:
365368
default:
366369
Navigation.dismissModal();
367370
}
368-
}, [achData, currentStep, isOffline, onfidoToken]);
371+
}, [achData, currentStep, onfidoToken]);
369372

370373
const isLoading =
371374
(isLoadingApp || (reimbursementAccount?.isLoading && !reimbursementAccount?.isCreateCorpayBankAccount)) &&

src/pages/ReimbursementAccount/USD/ConnectBankAccount/ConnectBankAccount.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function ConnectBankAccount({onBackButtonPress, setShouldShowConnectedVerifiedBa
3030
const {translate} = useLocalize();
3131

3232
const [reimbursementAccount] = useOnyx(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {canBeMissing: true});
33-
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${reimbursementAccount?.achData?.policyID}}`, {canBeMissing: true});
33+
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${reimbursementAccount?.achData?.policyID}`, {canBeMissing: true});
3434
const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true});
3535

3636
const handleNavigateToConciergeChat = () => navigateToConciergeChat(true);

0 commit comments

Comments
 (0)