Skip to content

Accept 19-digit Visa card numbers - #558

Open
Sarbajit-Sengupta wants to merge 1 commit into
python-validators:masterfrom
Sarbajit-Sengupta:fix/visa-nineteen-digit-pan
Open

Sarbajit-Sengupta wants to merge 1 commit into
python-validators:masterfrom
Sarbajit-Sengupta:fix/visa-nineteen-digit-pan

Conversation

@Sarbajit-Sengupta

Copy link
Copy Markdown

Fixes #556.

visa() rejects a checksum-correct 19-digit Visa-format number solely because it requires 16 digits. Accept 19 digits alongside 16 while retaining the existing prefix and Luhn checks. Visa's Transaction Acceptance Device Guide, section 2.1 describes support for PANs up to 19 digits.

Add a synthetic 19-digit example to the shared Visa fixtures, so generic validation and every other card-brand validator exercise it too. Negative cases cover checksum-correct unsupported lengths and incorrect 19-digit checksums.

Validation on Windows / Python 3.13.5: the new positive case fails on the original code; tox -e lint,type,format,sast,py313 passes, including 1,589 tests. Other Python versions were not run locally.

This branch has not been deployed

No deployments
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.

visa() hardcodes 16 digits although Visa supports 19-digit PANs

1 participant