Skip to content

Commit

Permalink
Merge pull request #6882 from Expensify/cmartins-debitCardPassword
Browse files Browse the repository at this point in the history
Add password to AddDebitCardPage in NewDot
  • Loading branch information
luacmartins authored Jan 17, 2022
2 parents 73cc4ab + a60c827 commit c224cfe
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ export default {
billingAddress: 'Billing address',
expensifyTermsOfService: 'Expensify Terms of Service',
growlMessageOnSave: 'Your debit card was successfully added',
expensifyPassword: 'Expensify password',
error: {
invalidName: 'Please enter a valid name',
addressZipCode: 'Please enter a valid zip code',
Expand All @@ -347,6 +348,7 @@ export default {
addressCity: 'Please enter a city',
acceptedTerms: 'You must accept the Terms of Service to continue',
genericFailureMessage: 'An error occurred while adding your card, please try again',
password: 'Please enter your Expensify password',
},
},
paymentsPage: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ export default {
billingAddress: 'Dirección de envio',
expensifyTermsOfService: 'Expensify Términos de servicio',
growlMessageOnSave: 'Su tarteja de débito se agregó correctamente',
expensifyPassword: 'Contraseña de Expensify',
error: {
invalidName: 'Por favor ingrese un nombre válido',
addressZipCode: 'Por favor ingrese un código postal válido',
Expand All @@ -347,6 +348,7 @@ export default {
addressCity: 'Por favor ingrese una ciudad',
acceptedTerms: 'Debes aceptar los Términos de servicio para continuar',
genericFailureMessage: 'Se produjo un error al agregar su tarjeta. Vuelva a intentarlo',
password: 'Por favor ingrese tu contraseña de Expensify',
},
},
paymentsPage: {
Expand Down
2 changes: 2 additions & 0 deletions src/libs/actions/PaymentMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ function addBillingCard(params) {
addressName: params.nameOnCard,
addressZip: params.addressZipCode,
currency: CONST.CURRENCY.USD,
isP2PDebitCard: true,
password: params.password,
}).then(((response) => {
let errorMessage = '';
if (response.jsonCode === 200) {
Expand Down
19 changes: 19 additions & 0 deletions src/pages/settings/Payments/AddDebitCardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import FormAlertWithSubmitButton from '../../../components/FormAlertWithSubmitBu
import ONYXKEYS from '../../../ONYXKEYS';
import compose from '../../../libs/compose';
import AddressSearch from '../../../components/AddressSearch';
import * as ComponentUtils from '../../../libs/ComponentUtils';
import FormScrollView from '../../../components/FormScrollView';

const propTypes = {
Expand Down Expand Up @@ -57,6 +58,7 @@ class DebitCardPage extends Component {
addressState: '',
addressZipCode: '',
acceptedTerms: false,
password: '',
errors: {},
shouldShowAlertPrompt: false,
};
Expand All @@ -69,6 +71,7 @@ class DebitCardPage extends Component {
'addressStreet',
'addressState',
'addressZipCode',
'password',
'acceptedTerms',
];

Expand All @@ -82,6 +85,7 @@ class DebitCardPage extends Component {
addressState: 'addDebitCardPage.error.addressState',
addressZipCode: 'addDebitCardPage.error.addressZipCode',
acceptedTerms: 'addDebitCardPage.error.acceptedTerms',
password: 'addDebitCardPage.error.password',
};

this.submit = this.submit.bind(this);
Expand Down Expand Up @@ -141,6 +145,10 @@ class DebitCardPage extends Component {
errors.addressState = true;
}

if (_.isEmpty(this.state.password.trim())) {
errors.password = true;
}

if (!this.state.acceptedTerms) {
errors.acceptedTerms = true;
}
Expand Down Expand Up @@ -266,6 +274,17 @@ class DebitCardPage extends Component {
/>
</View>
</View>
<View style={[styles.mt4]}>
<TextInput
label={this.props.translate('addDebitCardPage.expensifyPassword')}
onChangeText={password => this.clearErrorAndSetValue('password', password)}
value={this.state.password}
errorText={this.getErrorText('password')}
textContentType="password"
autoCompleteType={ComponentUtils.PASSWORD_AUTOCOMPLETE_TYPE}
secureTextEntry
/>
</View>
<CheckboxWithLabel
isChecked={this.state.acceptedTerms}
onPress={() => {
Expand Down

0 comments on commit c224cfe

Please sign in to comment.