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 issue #535 and add test cases #539

Merged
merged 3 commits into from
Jun 9, 2016
Merged

Conversation

dhAlcojor
Copy link
Contributor

@dhAlcojor dhAlcojor commented Jun 4, 2016

This time I edited the right file (^^U) and added some test cases for Union Pay credit cards.

This fixes #535.

@coveralls
Copy link

coveralls commented Jun 4, 2016

Coverage Status

Coverage remained the same at 99.091% when pulling 7153ce7 on dhAlcojor:master into 3c9b751 on chriso:master.

@chriso
Copy link
Collaborator

chriso commented Jun 5, 2016

/^62[0-9]{5,}$/ would allow through something like 6212345 which doesn't look valid. Where did you get this regex from?

A few other places validate as follows:

Can you fix the regex?

@dhAlcojor
Copy link
Contributor Author

In this document (https://www.six-payment-services.com/dam/downloads/datasheets/110004302_DS_SecurityFeatures_UnionPay_INT_EN_opt.pdf) it says that Union Pay credit cards start with a 62 and have 16 digits.

But it's not clear (to me, at least), what happens with Union Pay debit cards because it says that they have 13 - 19 digits and that some debit cards can start with 3, 4, 5 or 9. This sounds a little crazy, so I'll implement the regex for Union Pay credit cards.

@chriso
Copy link
Collaborator

chriso commented Jun 9, 2016

/^(62[0-9]{14})$/ should be fine for now.

@chriso
Copy link
Collaborator

chriso commented Jun 9, 2016

The test failure appears unrelated.

@chriso chriso merged commit 9bfb273 into validatorjs:master Jun 9, 2016
chriso added a commit that referenced this pull request Jun 9, 2016
@dhAlcojor
Copy link
Contributor Author

Yeah, my edit didn't seem capable of breaking anything...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Union Pay credit cards are always invalid
3 participants