Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[InternalQA] Update Onyx after validating bank account #4474

Merged
merged 4 commits into from
Aug 9, 2021
Merged
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
15 changes: 14 additions & 1 deletion src/libs/actions/BankAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import BankAccount from '../models/BankAccount';
import promiseAllSettled from '../promiseAllSettled';
import Growl from '../Growl';
import {translateLocal} from '../translate';
import Navigation from '../Navigation/Navigation';

/**
* List of bank accounts. This data should not be stored in Onyx since it contains unmasked PANs.
Expand Down Expand Up @@ -553,8 +554,20 @@ function validateBankAccount(bankAccountID, validateCode) {
Growl.show('Bank Account successfully validated!', CONST.GROWL.SUCCESS, 3000);
API.User_IsUsingExpensifyCard()
.then(({isUsingExpensifyCard}) => {
const reimbursementAccount = {
loading: false,
error: '',
achData: {state: BankAccount.STATE.OPEN},
};

if (isUsingExpensifyCard) {
Navigation.dismissModal();
} else {
reimbursementAccount.achData.currentStep = CONST.BANK_ACCOUNT.STEP.ENABLE;
}

Onyx.merge(ONYXKEYS.USER, {isUsingExpensifyCard});
Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {loading: false, error: ''});
Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, reimbursementAccount);
});
return;
}
Expand Down