Skip to content

Commit

Permalink
Merge pull request #21880 from Nikhil-Vats/21255_fix_regex_for_debit_…
Browse files Browse the repository at this point in the history
…card_name

fix regex for debit card name
  • Loading branch information
PauloGasparSv authored Jun 30, 2023
2 parents f71a1f7 + c20fd4a commit 5a713dd
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 18 deletions.
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 @@ -595,7 +595,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 @@ -596,7 +596,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

0 comments on commit 5a713dd

Please sign in to comment.