Skip to content

Commit

Permalink
Merge pull request Expensify#10954 from Expensify/maria-vbba-refactor…
Browse files Browse the repository at this point in the history
…-common-code

[No QA][Refactor] Add helper method to build Onyx data for VBBA setup
  • Loading branch information
arosiclair authored Sep 13, 2022
2 parents 85a1e57 + 663cfd8 commit ca08fb0
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/libs/actions/BankAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import CONST from '../../CONST';
import * as API from '../API';
import ONYXKEYS from '../../ONYXKEYS';
import * as Localize from '../Localize';
import DateUtils from '../DateUtils';

export {
setupWithdrawalAccount,
Expand Down Expand Up @@ -41,6 +42,50 @@ function clearPlaid() {
Onyx.set(ONYXKEYS.PLAID_LINK_TOKEN, '');
}

/**
* Helper method to build the Onyx data required during setup of a Verified Business Bank Account
*
* @returns {Object}
*/
// We'll remove the below once this function is used by the VBBA commands that are yet to be implemented
/* eslint-disable no-unused-vars */
function getVBBADataForOnyx() {
return {
optimisticData: [
{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.REIMBURSEMENT_ACCOUNT,
value: {
isLoading: true,
errors: null,
},
},
],
successData: [
{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.REIMBURSEMENT_ACCOUNT,
value: {
isLoading: false,
errors: null,
},
},
],
failureData: [
{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.REIMBURSEMENT_ACCOUNT,
value: {
isLoading: false,
errors: {
[DateUtils.getMicroseconds()]: Localize.translateLocal('paymentsPage.addBankAccountFailure'),
},
},
},
],
};
}

/**
* Adds a bank account via Plaid
*
Expand Down

0 comments on commit ca08fb0

Please sign in to comment.