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

[Refactor] Use new API Command: UpdateBeneficialOwnersForBankAccount #10994

Merged
merged 20 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
039522c
add updateBeneficialOwnersForBankAccount command
NikkiWines Sep 14, 2022
b5b7441
Merge branch 'main' of github.com:Expensify/App into nikki-refactor-b…
NikkiWines Sep 20, 2022
0d68169
modify params to match web-e requirements
NikkiWines Sep 21, 2022
1426b37
modify how we pass params to updateBeneificialOwnersForBankAccount
NikkiWines Sep 21, 2022
001f4f6
Merge branch 'main' of github.com:Expensify/App into nikki-refactor-b…
NikkiWines Sep 26, 2022
9112524
Merge branch 'main' of github.com:Expensify/App into nikki-refactor-b…
NikkiWines Sep 28, 2022
41210fc
Merge branch 'main' of github.com:Expensify/App into nikki-refactor-b…
NikkiWines Sep 28, 2022
e62c5e8
Merge branch 'cmartins-UpdateCompanyInformationForBankAccount' of git…
NikkiWines Sep 30, 2022
3a13751
Revert "Merge branch 'cmartins-UpdateCompanyInformationForBankAccount…
NikkiWines Sep 30, 2022
fcefcf2
Fix erroneous merge and revert commits
NikkiWines Sep 30, 2022
430fbfa
reintroduced changes
NikkiWines Sep 30, 2022
15ba5f3
add bankAccount to updateBeneficialOwnersForBankAccount params
NikkiWines Sep 30, 2022
a64b228
Merge branch 'main' of github.com:Expensify/App into nikki-refactor-b…
NikkiWines Oct 5, 2022
12082b0
Merge branch 'main' of github.com:Expensify/App into nikki-refactor-b…
NikkiWines Oct 6, 2022
1faeac5
Merge branch 'main' of github.com:Expensify/App into nikki-refactor-b…
NikkiWines Oct 10, 2022
195bbd5
update errorFields prop type
NikkiWines Oct 10, 2022
f6f72a3
Merge branch 'main' of github.com:Expensify/App into nikki-refactor-b…
NikkiWines Oct 10, 2022
c1bfb8b
Merge branch 'main' of github.com:Expensify/App into nikki-refactor-b…
NikkiWines Oct 11, 2022
7e3426e
Merge branch 'main' of github.com:Expensify/App into nikki-refactor-b…
NikkiWines Oct 11, 2022
6b765e7
Merge branch 'main' of github.com:Expensify/App into nikki-refactor-b…
NikkiWines Oct 13, 2022
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
17 changes: 17 additions & 0 deletions src/libs/actions/BankAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,22 @@ function updateCompanyInformationForBankAccount(bankAccount) {
API.write('UpdateCompanyInformationForBankAccount', bankAccount, getVBBADataForOnyx());
}

/**
* Add beneficial owners for the bank account, accept the ACH terms and conditions and verify the accuracy of the information provided
*
* @param {Object} params
*
* // ACH Contract Step
* @param {Boolean} [params.ownsMoreThan25Percent]
* @param {Boolean} [params.hasOtherBeneficialOwners]
* @param {Boolean} [params.acceptTermsAndConditions]
* @param {Boolean} [params.certifyTrueInformation]
* @param {String} [params.beneficialOwners]
*/
function updateBeneficialOwnersForBankAccount(params) {
API.write('UpdateBeneficialOwnersForBankAccount', {...params}, getVBBADataForOnyx());
}

/**
* Create the bank account with manually entered data.
*
Expand Down Expand Up @@ -304,6 +320,7 @@ export {
updatePersonalInformationForBankAccount,
validateBankAccount,
updateCompanyInformationForBankAccount,
updateBeneficialOwnersForBankAccount,
connectBankAccountWithPlaid,
updatePlaidData,
};
5 changes: 4 additions & 1 deletion src/pages/ReimbursementAccount/ACHContractStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import * as store from '../../libs/actions/ReimbursementAccount/store';
import Text from '../../components/Text';
import HeaderWithCloseButton from '../../components/HeaderWithCloseButton';
import styles from '../../styles/styles';
Expand Down Expand Up @@ -142,14 +143,16 @@ class ACHContractStep extends React.Component {
return;
}

const bankAccountID = lodashGet(store.getReimbursementAccountInSetup(), 'bankAccountID');

// If they did not select that there are other beneficial owners, then we need to clear out the array here. The
// reason we do it here is that if they filled out several beneficial owners, but then toggled the checkbox, we
// want the data to remain in the form so we don't lose the user input until they submit the form. This will
// prevent the data from being sent to the API
this.setState(prevState => ({
beneficialOwners: !prevState.hasOtherBeneficialOwners ? [] : prevState.beneficialOwners,
}),
() => BankAccounts.setupWithdrawalAccount({...this.state}));
() => BankAccounts.updateBeneficialOwnersForBankAccount({...this.state, beneficialOwners: JSON.stringify(this.state.beneficialOwners), bankAccountID}));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default PropTypes.shape({
error: PropTypes.string,

/** Which field needs attention? */
errorFields: PropTypes.objectOf(PropTypes.bool),
errorFields: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.bool, PropTypes.array])),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed that error types show up correctly for both types:

Boolean
Screen Shot 2022-10-10 at 17 00 31

Array

Screen Shot 2022-10-10 at 16 43 32


/** Any additional error message to show */
errors: PropTypes.objectOf(PropTypes.string),
Expand Down