Skip to content

fix(isVAT): validate the TR (VKN) check digit - #2960

Open
bahriy-dev wants to merge 1 commit into
validatorjs:masterfrom
bahriy-dev:feat/is-vat-tr-checksum
Open

bahriy-dev wants to merge 1 commit into
validatorjs:masterfrom
bahriy-dev:feat/is-vat-tr-checksum

Conversation

@bahriy-dev

Copy link
Copy Markdown

isVAT(str, 'TR') currently accepts any 10-digit string. The Turkish tax number (Vergi Kimlik Numarası, VKN) has a check digit, so numbers such as 1234567891 or 9876543210 should be rejected.

This keeps the existing format (optional TR prefix + 10 digits) and adds the check digit calculation. The existing valid test values still pass; new invalid cases fail on master and pass with this change.

I also ran the implementation against the 200 VKNs in python-stdnum's test file; all of them validate.

References:

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (9ff3424) to head (b7f46f6).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2960   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          114       114           
  Lines         2599      2609   +10     
  Branches       658       661    +3     
=========================================
+ Hits          2599      2609   +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant