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

Wrong credit card numbers #747

Open
MRezaNasirloo opened this issue Oct 4, 2022 · 5 comments
Open

Wrong credit card numbers #747

MRezaNasirloo opened this issue Oct 4, 2022 · 5 comments

Comments

@MRezaNasirloo
Copy link

Describe the bug
Some generated credit card numbers for CreditCardType.VISA and CreditCardType.DISCOVER are wrong

To Reproduce

repeat(1000) {
    val creditCard = Faker.instance().finance().creditCard(CreditCardType.DISCOVER).replace("-", "")
    if (creditCard.length == 20 || creditCard.length == 13) {
        println(creditCard)
    }
}

Expected behavior

  • Discover PAN should have a length of 16-19, not 20
  • Visa PAN should have a length of 16-19, not 13

Versions:

  • OS: OSX
  • JDK 17
  • Faker Version 1.0.2
@bodiam
Copy link

bodiam commented Oct 4, 2022

Hi @MRezaNasirloo , could you please try out Datafaker.net, an active fork of this library? We did some improvements recently on the credit card generation in 1.7.0-SNAPSHOT, which might fix this issue, and we would love to hear your feedback on this.

@MRezaNasirloo
Copy link
Author

MRezaNasirloo commented Oct 17, 2022

Hi @bodiam, Same issue, you can try the above snippet

@bodiam
Copy link

bodiam commented Oct 20, 2022

@MRezaNasirloo according to this info here: https://moneytips.com/anatomy-of-a-credit-card/, Visa cards:

Visa cards begin with a 4 and have 13 or 16 digits

The same information can be found here: https://en.wikipedia.org/wiki/Payment_card_number

@MRezaNasirloo
Copy link
Author

@bodiam You're right, however, these are not in circulation anymore, I guess.

While the vast majority of Visa's account ranges describe 16 digit card numbers there are still a few account ranges (forty as of 11 December 2013) dedicated to 13 digit PANs and several (439 as of 11 Dec. 2013) account ranges where the issuer can mix 13 and 16 digit card numbers. Visa's VPay brand can specify PAN lengths from 13 to 19 digits and so card numbers of more than 16 digits are now being seen.

What about DISCOVER? Max length should be 19 not 20

@bodiam
Copy link

bodiam commented Oct 26, 2022

Can you give the snapshot version of Datafaker a try? I believe I fixed all the credit card issues, but if you find an issue, can you please make a new issue in the Datafaker repo for this? Thanks!

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

No branches or pull requests

2 participants