SwiftLuhn icon indicating copy to clipboard operation
SwiftLuhn copied to clipboard

JCB cards incorrectly validated

Open ssathy2 opened this issue 7 years ago • 1 comments

A few resources (https://www.cybersource.com/developers/getting_started/test_and_manage/best_practices/card_type_id/, https://www.freeformatter.com/credit-card-number-generator-validator.html, https://en.wikipedia.org/wiki/Payment_card_number) on credit card validation mention that JCB cards have IIN ranges of 3528–3589. Currently, the regex that the library to validate JCB cards is "^(?:2131|1800|35[0-9]{3})[0-9]{3,}$". This means that a card starting with 3510 will get validated as a JCB card.

ssathy2 avatar Jan 18 '18 17:01 ssathy2

@ssathy2 thanks for the issue, sorry it's taken this long to get to it. Do you have a regex that would fulfil this condition? ^35[0-9]{2}([0-9]{12}|[0-9]{15})$ would come close

maxkramer avatar Sep 01 '18 17:09 maxkramer