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

Pass policyID when adding a bank account #23045

Merged
merged 5 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
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
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
Loading