braintree / credit-card-type

A library for determining credit card type
MIT License
980 stars 154 forks source link

Added new lengths for JCB #54

Closed zeh closed 6 years ago

zeh commented 7 years ago

JCB cards were marked as having a length of 16 digits, but they can also be 15 and and 19 digits long. This is not well documented, so it might be a new thing. JCB is a strange credit card.

15 and 16: http://www.regular-expressions.info/creditcard.html 15 and 16: http://developer.ean.com/general-info/valid-card-types/ 16-19: https://en.wikipedia.org/wiki/Payment_card_number#Issuer_identification_number_.28IIN.29 16 and 19: https://www.freeformatter.com/credit-card-number-generator-validator.html

crookedneighbor commented 7 years ago

Thanks for opening this PR.

I believe the 15 length JCB cards only refer to obsolete cards that are no longer in circulation.

Can you provide more official documentation for this? We'll do some research on our side as well.

zeh commented 7 years ago

@crookedneighbor I've tried, but it's hard to find. I've found a lot of second-hand info, always mentioning either 15-16 or 16-19, so you might be right on the 15-digit being outdated.

~Now, coming to think of it, I'm not 100% positive it can have a length of 19 digits. The two links above seem to be the only ones mentioning it. Other card validation sources seem to always use 15 or 16 digit lengths. This may be part of a recent move to 19-digit credit cards for some big networks, but I see no mention of JCB among them.~

Edit: ok, Wikipedia to the rescue. They did have a source for their claim of 19 digits. It's a recent change as of Feb 2017. You can read the announcement in this PDF.

JCBs can definitely have 19 digits. Every library out there is outdated.

zeh commented 7 years ago

@crookedneighbor Do you want me to remove the 15-digit definition? I think you're right in that regard, but haven't been able to find any real info.

(Discover itself only accepts 16-19 digit ones, but they're only one of the companies that seem to carry JCB cards over their network.)

crookedneighbor commented 7 years ago

Thanks for the documentation (we don't get notifications for comment edits, so I didn't see it till this morning).

Yes, please remove the 15 digit definition.

As for the 19 digit version, it's possible that it only applies to non-credit card tokenization (such as Apple Pay, Android Pay, etc). We're reviewing it and will get back to you.

zeh commented 7 years ago

@crookedneighbor Updated, thanks for double checking.

zeh commented 7 years ago

@crookedneighbor Updated, thanks for triple-checking.

crookedneighbor commented 7 years ago

We need to do some work on the Braintree backend to allow for this change before we can merge it in. I'll keep you updated, but I expect it to take another week or two before we can merge this in.

zeh commented 7 years ago

Fair enough, thanks for the heads up.

crookedneighbor commented 6 years ago

Released in v6.1.0. Thanks!

zeh commented 6 years ago

Thanks!