Skip to content
Open
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
7 changes: 5 additions & 2 deletions src/libs/actions/BankAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,10 @@ function getOnyxDataForConnectingVBBAAndLastPaymentMethod(policyID?: string, las

/**
* Submit Bank Account step with Plaid data so php can perform some checks.
*
* @returns true when redirected to the manual flow (Chase Plaid dummy numbers).
*/
function connectBankAccountWithPlaid(bankAccountID: number, selectedPlaidBankAccount: PlaidBankAccount, policyID: string | undefined) {
function connectBankAccountWithPlaid(bankAccountID: number, selectedPlaidBankAccount: PlaidBankAccount, policyID: string | undefined): boolean {
const isChaseBank = selectedPlaidBankAccount.bankName?.toLowerCase() === CONST.BANK_NAMES.CHASE;
if (bankAccountID === CONST.DEFAULT_NUMBER_ID && isChaseBank) {
Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {
Expand All @@ -457,7 +459,7 @@ function connectBankAccountWithPlaid(bankAccountID: number, selectedPlaidBankAcc
accountNumber: '',
routingNumber: '',
});
return;
return true;
}

const parameters: ConnectBankAccountParams = {
Expand All @@ -473,6 +475,7 @@ function connectBankAccountWithPlaid(bankAccountID: number, selectedPlaidBankAcc
};

API.write(WRITE_COMMANDS.CONNECT_BANK_ACCOUNT_WITH_PLAID, parameters, getVBBADataForOnyx());
return false;
}

/**
Expand Down
7 changes: 6 additions & 1 deletion src/pages/ReimbursementAccount/USD/BankInfo/BankInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function BankInfo({onBackButtonPress, onSubmit, policyID}: BankInfoProps) {
if (plaidAccountIDChanged) {
deletePaymentBankAccount(bankAccountID, undefined);
}
connectBankAccountWithPlaid(
const redirectedToManual = connectBankAccountWithPlaid(
plaidAccountIDChanged ? CONST.DEFAULT_NUMBER_ID : bankAccountID,
{
[BANK_INFO_STEP_KEYS.ROUTING_NUMBER]: data[BANK_INFO_STEP_KEYS.ROUTING_NUMBER] ?? '',
Expand All @@ -93,6 +93,11 @@ function BankInfo({onBackButtonPress, onSubmit, policyID}: BankInfoProps) {
},
policyID,
);

// No bank account was created. Stay on this step so the manual form can create it before advancing.
if (redirectedToManual) {
return;
}
}
markSubmitting();
};
Expand Down
Loading