Skip to content

Commit

Permalink
Merge pull request #4035 from Expensify/amal-remove-default-state-pick
Browse files Browse the repository at this point in the history
Remove default state AK and require users to enter a state
  • Loading branch information
pecanoro authored Jul 15, 2021
2 parents 329dc18 + c365606 commit 0735efc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/components/StatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ const STATES = _.map(CONST.STATES, ({stateISO}) => ({
label: stateISO,
}));


// Add a blank state so users are sure to actively choose a state instead accidentally going with the default choice
STATES.unshift({
value: '',
label: '-',
});

const propTypes = {
/** A callback method that is called when the value changes and it received the selected value as an argument */
onChange: PropTypes.func.isRequired,
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ export default {
website: 'Please enter a valid website',
zipCode: 'Please enter a valid zip code',
addressStreet: 'Please enter a valid address street that is not a PO Box',
addressState: 'Please select a valid state',
incorporationDate: 'Please enter a valid incorporation date',
incorporationState: 'Please enter a valid Incorporation State',
industryCode: 'Please enter a valid industry classification code',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ export default {
website: 'Ingrese un sitio web válido',
zipCode: 'Ingrese un código postal válido',
addressStreet: 'Ingrese una calle de dirección válida que no sea un apartado postal',
addressState: 'Por favor, selecciona un estado',
incorporationDate: 'Ingrese una fecha de incorporación válida',
incorporationState: 'Ingrese un estado de incorporación válido',
industryCode: 'Ingrese un código de clasificación de industria válido',
Expand Down
5 changes: 5 additions & 0 deletions src/libs/ValidationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ function isValidIdentity(identity) {
return false;
}

if (identity.state === '') {
Growl.error(translateLocal('bankAccount.error.addressState'));
return false;
}

if (!isValidZipCode(identity.zipCode)) {
Growl.error(translateLocal('bankAccount.error.zipCode'));
return false;
Expand Down
9 changes: 7 additions & 2 deletions src/pages/ReimbursementAccount/CompanyStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class CompanyStep extends React.Component {
companyName: lodashGet(props, ['achData', 'companyName'], ''),
addressStreet: lodashGet(props, ['achData', 'addressStreet'], ''),
addressCity: lodashGet(props, ['achData', 'addressCity'], ''),
addressState: lodashGet(props, ['achData', 'addressState']) || 'AK',
addressState: lodashGet(props, ['achData', 'addressState']) || '',
addressZipCode: lodashGet(props, ['achData', 'addressZipCode'], ''),
companyPhone: lodashGet(props, ['achData', 'companyPhone'], ''),
website: lodashGet(props, ['achData', 'website'], 'https://'),
companyTaxID: lodashGet(props, ['achData', 'companyTaxID'], ''),
incorporationType: lodashGet(props, ['achData', 'incorporationType'], ''),
incorporationDate: lodashGet(props, ['achData', 'incorporationDate'], ''),
incorporationState: lodashGet(props, ['achData', 'incorporationState']) || 'AK',
incorporationState: lodashGet(props, ['achData', 'incorporationState']) || '',
industryCode: lodashGet(props, ['achData', 'industryCode'], ''),
hasNoConnectionToCannabis: lodashGet(props, ['achData', 'hasNoConnectionToCannabis'], false),
password: '',
Expand All @@ -61,6 +61,11 @@ class CompanyStep extends React.Component {
return false;
}

if (this.state.addressState === '') {
Growl.error(this.props.translate('bankAccount.error.addressState'));
return false;
}

if (!isValidZipCode(this.state.addressZipCode)) {
Growl.error(this.props.translate('bankAccount.error.zipCode'));
return false;
Expand Down
3 changes: 2 additions & 1 deletion src/pages/ReimbursementAccount/RequestorStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RequestorStep extends React.Component {
lastName: lodashGet(props, ['achData', 'lastName'], ''),
requestorAddressStreet: lodashGet(props, ['achData', 'requestorAddressStreet'], ''),
requestorAddressCity: lodashGet(props, ['achData', 'requestorAddressCity'], ''),
requestorAddressState: lodashGet(props, ['achData', 'requestorAddressState']) || 'AK',
requestorAddressState: lodashGet(props, ['achData', 'requestorAddressState']) || '',
requestorAddressZipCode: lodashGet(props, ['achData', 'requestorAddressZipCode'], ''),
dob: lodashGet(props, ['achData', 'dob'], ''),
ssnLast4: lodashGet(props, ['achData', 'ssnLast4'], ''),
Expand Down Expand Up @@ -60,6 +60,7 @@ class RequestorStep extends React.Component {

if (!isValidIdentity({
street: this.state.requestorAddressStreet,
state: this.state.requestorAddressState,
zipCode: this.state.requestorAddressZipCode,
dob: this.state.dob,
ssnLast4: this.state.ssnLast4,
Expand Down

0 comments on commit 0735efc

Please sign in to comment.