Skip to content

Commit

Permalink
Merge pull request #4474 from Expensify/cmartins-manage-card
Browse files Browse the repository at this point in the history
[InternalQA] Update Onyx after validating bank account
  • Loading branch information
luacmartins authored Aug 9, 2021
2 parents 6808fd1 + e6ee1fe commit c8bc3ec
Showing 1 changed file with 14 additions and 1 deletion.
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

0 comments on commit c8bc3ec

Please sign in to comment.