Skip to content

Commit

Permalink
Merge pull request #23045 from Expensify/cmartins-passPolicyIDParam
Browse files Browse the repository at this point in the history
Pass policyID when adding a bank account
  • Loading branch information
AndrewGable authored Jul 18, 2023
2 parents 8c952e1 + bbf339c commit 4eb2423
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/libs/actions/BankAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,10 @@ function openReimbursementAccountPage(stepToOpen, subStep, localCurrentStep) {
* @param {String} [bankAccount.incorporationState]
* @param {String} [bankAccount.incorporationDate]
* @param {Boolean} [bankAccount.hasNoConnectionToCannabis]
* @param {String} policyID
*/
function updateCompanyInformationForBankAccount(bankAccount) {
API.write('UpdateCompanyInformationForBankAccount', bankAccount, getVBBADataForOnyx());
function updateCompanyInformationForBankAccount(bankAccount, policyID) {
API.write('UpdateCompanyInformationForBankAccount', {...bankAccount, policyID}, getVBBADataForOnyx());
}

/**
Expand Down
6 changes: 5 additions & 1 deletion src/pages/ReimbursementAccount/CompanyStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ const propTypes = {
/** Whether or not the user is on a public domain email account or not */
isFromPublicDomain: PropTypes.bool,
}),

/* The workspace policyID */
policyID: PropTypes.string,
};

const defaultProps = {
session: {
email: null,
},
user: {},
policyID: '',
};

class CompanyStep extends React.Component {
Expand Down Expand Up @@ -148,7 +152,7 @@ class CompanyStep extends React.Component {
companyPhone: parsePhoneNumber(values.companyPhone, {regionCode: CONST.COUNTRY.US}).number.significant,
};

BankAccounts.updateCompanyInformationForBankAccount(bankAccount);
BankAccounts.updateCompanyInformationForBankAccount(bankAccount, this.props.policyID);
}

render() {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/ReimbursementAccount/ReimbursementAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ class ReimbursementAccountPage extends React.Component {
const achData = lodashGet(this.props.reimbursementAccount, 'achData', {});
const currentStep = achData.currentStep || CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT;
const policyName = lodashGet(this.props.policy, 'name');
const policyID = lodashGet(this.props.route.params, 'policyID');

if (_.isEmpty(this.props.policy) || !Policy.isPolicyOwner(this.props.policy)) {
return (
Expand Down Expand Up @@ -423,6 +424,7 @@ class ReimbursementAccountPage extends React.Component {
reimbursementAccountDraft={this.props.reimbursementAccountDraft}
onBackButtonPress={this.goBack}
getDefaultStateForField={this.getDefaultStateForField}
policyID={policyID}
/>
);
}
Expand Down

0 comments on commit 4eb2423

Please sign in to comment.