-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Migrate BankAccount_SetupWithdrawalAccount API #3507
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
Changes from 21 commits
c219c9e
6eac7d4
cc78e01
c810c56
4f96379
99e0f81
3319c16
ca91a0c
d61a525
e966390
a7eaefe
4bebfbb
76b67ce
c3b8007
e31e101
36e5a97
b96c297
661ee34
e01ae51
e85f587
825d108
c900d39
1b1e210
a48ddb5
635bebf
b408663
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -812,6 +812,48 @@ function BankAccount_Create(parameters) { | |
return Network.post(commandName, parameters, CONST.NETWORK.METHOD.POST, true); | ||
} | ||
|
||
/** | ||
* @param {*} parameters | ||
* @returns {Promise} | ||
*/ | ||
function BankAccount_SetupWithdrawal(parameters) { | ||
const commandName = 'BankAccount_SetupWithdrawal'; | ||
let allowedParameters = [ | ||
'currentStep', 'policyID', 'bankAccountID', 'useOnfido', 'errorAttemptsCount', | ||
|
||
// data from bankAccount step: | ||
'setupType', 'routingNumber', 'accountNumber', 'addressName', 'plaidAccountID', 'ownershipType', 'isSavings', | ||
'acceptTerms', 'bankName', 'plaidAccessToken', 'alternateRoutingNumber', | ||
|
||
// data from company step: | ||
'companyName', 'companyTaxID', 'addressStreet', 'addressCity', 'addressState', 'addressZipCode', | ||
'hasNoConnectionToCannabis', 'incorporationType', 'incorporationState', 'incorporationDate', 'industryCode', | ||
'website', 'companyPhone', 'ficticiousBusinessName', | ||
|
||
// data from requestor step: | ||
'firstName', 'lastName', 'dob', 'requestorAddressStreet', 'requestorAddressCity', 'requestorAddressState', | ||
'requestorAddressZipCode', 'isOnfidoSetupComplete', 'onfidoData', 'isControllingOfficer', 'ssnLast4', | ||
|
||
// data from ACHContract step (which became the "Beneficial Owners" step, but the key is still ACHContract as | ||
// it's used in several logic: | ||
'ownsMoreThan25Percent', 'beneficialOwners', 'acceptTermsAndConditions', 'certifyTrueInformation', | ||
]; | ||
|
||
if (!parameters.useOnfido) { | ||
allowedParameters = allowedParameters.concat(['passport', 'answers']); | ||
} | ||
|
||
// Only keep allowed parameters in the additionalData object | ||
const additionalData = _.pick(parameters, allowedParameters); | ||
|
||
requireParameters(['currentStep'], parameters, commandName); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is another thing we could create a follow-up for, but are there different sets of required parameters for each step? Might be more comprehensible to have something like: const requiredParameters = [
CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT: [
// the required parameters for this step
],
CONST.BANK_ACCOUNT.STEP.COMPANY: [
// the required parameters for this step
],
...
...
]; And that could help us do better client-side validation 🤷 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. I think something like that would clean this up maybe. They are also not used anywhere else atm. |
||
return Network.post( | ||
commandName, {additionalData: JSON.stringify(additionalData), password: parameters.password}, | ||
CONST.NETWORK.METHOD.POST, | ||
true, | ||
); | ||
} | ||
|
||
/** | ||
* @param {Object} parameters | ||
* @param {String[]} data | ||
|
@@ -850,6 +892,7 @@ export { | |
Authenticate, | ||
BankAccount_Create, | ||
BankAccount_Get, | ||
BankAccount_SetupWithdrawal, | ||
ChangePassword, | ||
CreateChatReport, | ||
CreateLogin, | ||
|
Uh oh!
There was an error while loading. Please reload this page.