DiUS / java-faker

Brings the popular ruby faker gem to Java

Home Page:http://dius.github.io/java-faker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong credit card numbers

MRezaNasirloo opened this issue · comments

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

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.

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

@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

@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

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!