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

fix regex for debit card name #21880

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,6 @@ const CONST = {
REGEX: {
SPECIAL_CHARS_WITHOUT_NEWLINE: /((?!\n)[()-\s\t])/g,
DIGITS_AND_PLUS: /^\+?[0-9]*$/,
ALPHABETIC_CHARS: /[a-zA-Z]+/,
ALPHABETIC_CHARS_WITH_NUMBER: /^[a-zA-ZÀ-ÿ0-9 ]*$/,
POSITIVE_INTEGER: /^\d+$/,
PO_BOX: /\b[P|p]?(OST|ost)?\.?\s*[O|o|0]?(ffice|FFICE)?\.?\s*[B|b][O|o|0]?[X|x]?\.?\s+[#]?(\d+)\b/,
Expand Down
2 changes: 1 addition & 1 deletion src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ export default {
growlMessageOnSave: 'Your debit card was successfully added',
expensifyPassword: 'Expensify password',
error: {
invalidName: 'Please enter a valid name',
invalidName: 'Name can only include latin letters and numbers.',
addressZipCode: 'Please enter a valid zip code',
debitCardNumber: 'Please enter a valid debit card number',
expirationDate: 'Please select a valid expiration date',
Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ export default {
growlMessageOnSave: 'Su tarteja de débito se agregó correctamente',
expensifyPassword: 'Contraseña de Expensify',
error: {
invalidName: 'Por favor, introduce un nombre válido',
invalidName: 'El nombre solo puede contener números y caracteres latinos.',
addressZipCode: 'Por favor, introduce un código postal válido',
debitCardNumber: 'Por favor, introduce un número de tarjeta de débito válido',
expirationDate: 'Por favor, selecciona una fecha de vencimiento válida',
Expand Down
14 changes: 0 additions & 14 deletions src/libs/ValidationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,6 @@ function isValidDebitCard(string) {
return validateCardNumber(string);
}

/**
*
* @param {String} nameOnCard
* @returns {Boolean}
*/
function isValidCardName(nameOnCard) {
if (!CONST.REGEX.ALPHABETIC_CHARS.test(nameOnCard)) {
return false;
}

return !_.isEmpty(nameOnCard.trim());
}

/**
* @param {String} code
* @returns {Boolean}
Expand Down Expand Up @@ -464,7 +451,6 @@ export {
getAgeRequirementError,
isValidAddress,
isValidDate,
isValidCardName,
isValidPastDate,
isValidSecurityCode,
isValidExpirationDate,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/Payments/AddDebitCardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class DebitCardPage extends Component {
validate(values) {
const errors = {};

if (!values.nameOnCard || !ValidationUtils.isValidCardName(values.nameOnCard)) {
if (!values.nameOnCard || !ValidationUtils.isValidLegalName(values.nameOnCard)) {
errors.nameOnCard = 'addDebitCardPage.error.invalidName';
}

Expand Down