Skip to content

Identify Verve cards before the broader Discover prefix - #429

Merged
yezz123 merged 1 commit into
pydantic:mainfrom
charan-rathore:fix-verve-before-discover
Oct 1, 2026
Merged

yezz123 merged 1 commit into
pydantic:mainfrom
charan-rathore:fix-verve-before-discover

Conversation

@charan-rathore

Copy link
Copy Markdown
Contributor

PaymentCardNumber currently identifies every card starting with 65 as Discover before it reaches the existing Verve range of 650002 through 650027. For example, the Luhn-valid number 6500020000000000 validates successfully but reports Discover. This also accepts 17-digit cards in that range even though the existing Verve rule permits only 16, 18 and 19 digits.

Check the existing Verve ranges before the broader Discover prefix. Add regression tests for both range boundaries at all three supported lengths, rejection of a Luhn-valid 17-digit number, and Discover prefixes immediately outside the Verve range.

Validation on Python 3.12.12:

  • The new tests fail on unchanged main: 7 failed, 3 passed.
  • The payment suite and new tests pass: 86 passed.
  • The full test suite passes: 13613 passed.
  • Ruff lint and format checks pass for both changed files.
  • Mypy passes for payment.py.

This is a locally discovered bug. No live payment processing was tested. Other Python versions and the full repository typecheck were not run. The repository's frozen lockfile omits pandas, so pandas 3.0.6 and numpy 2.5.3 were installed separately to run the full suite.

@yezz123
yezz123 merged commit 271ce8c into pydantic:main Oct 1, 2026
11 checks passed
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.

2 participants