-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Form refactor bankaccountstep #10900
Changes from 1 commit
c09bf34
3f8c116
8808c9c
9bf7312
7ecc6c2
590d0df
f4134db
191739a
90057a2
2d99e38
cdb883a
2ef74ca
0e2b26f
4bdc2d7
5f08c30
df9b2c0
84011f1
e19f42f
e8c0496
58198e2
27dddb3
ebcc540
44cc59d
fbd3ca4
bd2e691
08753f3
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 |
---|---|---|
|
@@ -61,6 +61,9 @@ class BankAccountStep extends React.Component { | |
this.addPlaidAccount = this.addPlaidAccount.bind(this); | ||
this.validate = this.validate.bind(this); | ||
this.validatePlaidAccount = this.validatePlaidAccount.bind(this); | ||
this.state = { | ||
selectedPlaidBankAccount: undefined, | ||
}; | ||
} | ||
|
||
/** | ||
|
@@ -83,9 +86,10 @@ class BankAccountStep extends React.Component { | |
return errors; | ||
} | ||
|
||
validatePlaidAccount(values) { | ||
validatePlaidAccount() { | ||
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. I think we can skip validating Plaid account, as we don't allow the user to continue unless they choose an account. I don't see a way of triggering the validation error if it exists. @luacmartins what do you think? 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. Yes I think we can skip this, removed validatePlaidAccount for now 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. Makes sense since we can't display that error and the user can't continue without selecting an account. |
||
const selectedPlaidBankAccount = this.state.selectedPlaidBankAccount; | ||
const errors = {}; | ||
if (_.isUndefined(values.selectedPlaidBankAccount)) { | ||
if (_.isUndefined(selectedPlaidBankAccount)) { | ||
errors.selectedPlaidBankAccount = this.props.translate('bankAccount.error.noBankAccountSelected'); | ||
} | ||
|
||
|
@@ -110,9 +114,11 @@ class BankAccountStep extends React.Component { | |
* Add the Bank account retrieved via Plaid in db | ||
* @param {Object} values - form input values passed by the Form component | ||
*/ | ||
addPlaidAccount(values) { | ||
const selectedPlaidBankAccount = values.selectedPlaidBankAccount; | ||
|
||
addPlaidAccount() { | ||
const selectedPlaidBankAccount = this.state.selectedPlaidBankAccount; | ||
if (!this.state.selectedPlaidBankAccount) { | ||
return; | ||
} | ||
BankAccounts.setupWithdrawalAccount({ | ||
acceptTerms: true, | ||
setupType: CONST.BANK_ACCOUNT.SETUP_TYPE.PLAID, | ||
|
@@ -235,11 +241,15 @@ class BankAccountStep extends React.Component { | |
validate={this.validatePlaidAccount} | ||
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. Removing this completely will cause an error, maybe we can have it return an empty object 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. added empty object to validate in PLAID Form |
||
onSubmit={this.addPlaidAccount} | ||
submitButtonText={this.props.translate('common.saveAndContinue')} | ||
style={[styles.mh5, styles.mb5, styles.flex1]} | ||
style={[styles.mh5, styles.flexGrow1]} | ||
isSubmitButtonVisible={!_.isUndefined(this.state.selectedPlaidBankAccount)} | ||
> | ||
<AddPlaidBankAccount | ||
inputID="selectedPlaidBankAccount" | ||
text={this.props.translate('bankAccount.plaidBodyCopy')} | ||
onSelect={(params) => { | ||
this.setState({ | ||
selectedPlaidBankAccount: params.selectedPlaidBankAccount, | ||
}); | ||
}} | ||
onExitPlaid={() => BankAccounts.setBankAccountSubStep(null)} | ||
receivedRedirectURI={this.props.receivedRedirectURI} | ||
plaidLinkOAuthToken={this.props.plaidLinkOAuthToken} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be moved below
submitButtonText
, as now it sits under the/* Onyx Props */
comment but it's not an Onyx prop.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change has been done