From 9903a96e1c88dfe67aaa2c0b41a037266bd2a7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Mon, 3 Oct 2022 22:05:00 -0500 Subject: [PATCH 1/4] save routingNumber and accountNumber in connectBankAccountManually --- src/libs/actions/BankAccounts.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/actions/BankAccounts.js b/src/libs/actions/BankAccounts.js index 97193ee5ad5ab..9101e83064493 100644 --- a/src/libs/actions/BankAccounts.js +++ b/src/libs/actions/BankAccounts.js @@ -283,6 +283,8 @@ function updateCompanyInformationForBankAccount(bankAccount) { * */ function connectBankAccountManually(bankAccountID, accountNumber, routingNumber, plaidMask) { + // Save routingNumber and accountNumber because are required for the next step in the VBA flow + Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT, {routingNumber, accountNumber}); API.write('ConnectBankAccountManually', { bankAccountID, accountNumber, From da605d69554cbf17fa22026d3f8da5ebca4e7733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Tue, 4 Oct 2022 15:47:19 -0500 Subject: [PATCH 2/4] remove Onyx.merge --- src/libs/actions/BankAccounts.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libs/actions/BankAccounts.js b/src/libs/actions/BankAccounts.js index 9101e83064493..97193ee5ad5ab 100644 --- a/src/libs/actions/BankAccounts.js +++ b/src/libs/actions/BankAccounts.js @@ -283,8 +283,6 @@ function updateCompanyInformationForBankAccount(bankAccount) { * */ function connectBankAccountManually(bankAccountID, accountNumber, routingNumber, plaidMask) { - // Save routingNumber and accountNumber because are required for the next step in the VBA flow - Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT, {routingNumber, accountNumber}); API.write('ConnectBankAccountManually', { bankAccountID, accountNumber, From 955d337171b1692ef6e083219649926942822808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Tue, 4 Oct 2022 15:47:47 -0500 Subject: [PATCH 3/4] get reimbursementAccountDraftValues in CompanyStep --- src/libs/actions/FormActions.js | 9 +++++++++ src/pages/ReimbursementAccount/CompanyStep.js | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/src/libs/actions/FormActions.js b/src/libs/actions/FormActions.js index 188d10b759b79..0cadc9236548a 100644 --- a/src/libs/actions/FormActions.js +++ b/src/libs/actions/FormActions.js @@ -24,7 +24,16 @@ function setDraftValues(formID, draftValues) { Onyx.merge(`${formID}DraftValues`, draftValues); } +/** + * @param {String} formID + * @returns {String} + */ +function getDraftValuesKey(formID) { + return `${formID}DraftValues`; +} + export { + getDraftValuesKey, setIsLoading, setErrors, setDraftValues, diff --git a/src/pages/ReimbursementAccount/CompanyStep.js b/src/pages/ReimbursementAccount/CompanyStep.js index 29ea6bfea723e..4c806b821f7e3 100644 --- a/src/pages/ReimbursementAccount/CompanyStep.js +++ b/src/pages/ReimbursementAccount/CompanyStep.js @@ -26,6 +26,7 @@ import AddressForm from './AddressForm'; import ReimbursementAccountForm from './ReimbursementAccountForm'; import * as ReimbursementAccount from '../../libs/actions/ReimbursementAccount'; import * as ReimbursementAccountUtils from '../../libs/ReimbursementAccountUtils'; +import * as FormActions from '../../libs/actions/FormActions'; const propTypes = { ...withLocalizePropTypes, @@ -312,6 +313,9 @@ export default compose( reimbursementAccountDraft: { key: ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT, }, + reimbursementAccountDraftValues: { + key: FormActions.getDraftValuesKey(ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM), + }, session: { key: ONYXKEYS.SESSION, }, From 17a224b64702fefd94218f278db41467b914de75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Tue, 4 Oct 2022 15:54:48 -0500 Subject: [PATCH 4/4] get values from reimbursementAccountDraftValues --- src/libs/ReimbursementAccountUtils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/ReimbursementAccountUtils.js b/src/libs/ReimbursementAccountUtils.js index 4074f1e8ab6c6..2e6570880233b 100644 --- a/src/libs/ReimbursementAccountUtils.js +++ b/src/libs/ReimbursementAccountUtils.js @@ -35,6 +35,7 @@ function getDefaultStateForField(props, fieldName, defaultValue = '') { function getBankAccountFields(props, fieldNames) { return { ..._.pick(lodashGet(props, 'reimbursementAccount.achData'), ...fieldNames), + ..._.pick(lodashGet(props, 'reimbursementAccountDraftValues'), ...fieldNames), ..._.pick(props.reimbursementAccountDraft, ...fieldNames), }; }