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
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ function ReimbursementAccountPage({route, policy, isLoadingPolicy}: Reimbursemen

return (
<VerifiedBankAccountFlowEntryPoint
setShouldShowContinueSetupButton={setShouldShowContinueSetupButton}
reimbursementAccount={reimbursementAccount}
onContinuePress={isNonUSDWorkspace ? continueNonUSDVBBASetup : continueUSDVBBASetup}
policyName={policyName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ type VerifiedBankAccountFlowEntryPointProps = {

/** Set step for USD flow */
setUSDBankAccountStep: (shouldShowContinueSetupButton: string | null) => void;

/** Method to set the state of shouldShowContinueSetupButton */
setShouldShowContinueSetupButton?: (shouldShowContinueSetupButton: boolean) => void;
};

const bankInfoStepKeys = INPUT_IDS.BANK_INFO_STEP;
Expand All @@ -85,6 +88,7 @@ function VerifiedBankAccountFlowEntryPoint({
toggleValidateCodeActionModal,
setNonUSDBankAccountStep,
setUSDBankAccountStep,
setShouldShowContinueSetupButton,
}: VerifiedBankAccountFlowEntryPointProps) {
const theme = useTheme();
const styles = useThemeStyles();
Expand Down Expand Up @@ -307,6 +311,7 @@ function VerifiedBankAccountFlowEntryPoint({
isNonUSDWorkspace={isNonUSDWorkspace}
setUSDBankAccountStep={setUSDBankAccountStep}
setNonUSDBankAccountStep={setNonUSDBankAccountStep}
setShouldShowContinueSetupButton={setShouldShowContinueSetupButton}
/>
)}

Expand Down
14 changes: 13 additions & 1 deletion src/pages/workspace/WorkspaceResetBankAccountModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ type WorkspaceResetBankAccountModalProps = {
/** Method to set the state of shouldShowConnectedVerifiedBankAccount */
setShouldShowConnectedVerifiedBankAccount?: (shouldShowConnectedVerifiedBankAccount: boolean) => void;

/** Method to set the state of shouldShowContinueSetupButton */
setShouldShowContinueSetupButton?: (shouldShowContinueSetupButton: boolean) => void;

/** Method to set the state of setUSDBankAccountStep */
setUSDBankAccountStep?: (step: string | null) => void;

Expand All @@ -33,10 +36,11 @@ function WorkspaceResetBankAccountModal({
setUSDBankAccountStep,
setNonUSDBankAccountStep,
isNonUSDWorkspace,
setShouldShowContinueSetupButton,
}: WorkspaceResetBankAccountModalProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const [session] = useOnyx(ONYXKEYS.SESSION);
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
const policyID = reimbursementAccount?.achData?.policyID;
const achData = reimbursementAccount?.achData;
const isInOpenState = achData?.state === BankAccount.STATE.OPEN;
Expand All @@ -51,12 +55,20 @@ function WorkspaceResetBankAccountModal({
setShouldShowConnectedVerifiedBankAccount(false);
}

if (setShouldShowContinueSetupButton) {
setShouldShowContinueSetupButton(false);
}

if (setNonUSDBankAccountStep) {
setNonUSDBankAccountStep(null);
}
} else {
resetUSDBankAccount(bankAccountID, session, policyID);

if (setShouldShowContinueSetupButton) {
setShouldShowContinueSetupButton(false);
}

if (setShouldShowConnectedVerifiedBankAccount) {
setShouldShowConnectedVerifiedBankAccount(false);
}
Expand Down