Add Türkiye (TR) tax regime#743
Conversation
2e617c2 to
381afec
Compare
There was a problem hiding this comment.
Pull request overview
This pull request adds a comprehensive tax regime implementation for Türkiye (TR) to the GOBL tax library. The implementation includes tax identity validation for both company (VKN) and individual (TCKN) tax numbers with checksum verification, VAT (KDV) rate definitions with historical rates dating back to 1999, and support for corrective invoices in compliance with Turkish tax law.
Changes:
- Added complete Türkiye tax regime with VKN (10-digit) and TCKN (11-digit) tax identity validation using checksum algorithms
- Defined KDV (VAT) rates: standard 20%, reduced 10%, super-reduced 1%, with historical rate changes since 1999
- Implemented corrective invoice type as the only valid correction method per Tax Procedure Law Article 227
Reviewed changes
Copilot reviewed 14 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| regimes/tr/tr.go | Main regime definition with corrections configuration and validation/normalization hooks |
| regimes/tr/tax_identity.go | VKN and TCKN validation logic with checksum verification algorithms |
| regimes/tr/tax_identity_test.go | Comprehensive tests for tax identity normalization and validation |
| regimes/tr/tax_categories.go | KDV rate definitions with historical rates and source documentation |
| regimes/tr/invoices.go | Invoice validation requiring supplier tax ID |
| regimes/tr/invoices_test.go | Invoice validation tests |
| regimes/regimes.go | Registration of TR regime |
| examples/tr/*.yaml | Four example invoices demonstrating standard, reduced, exempt, and corrective scenarios |
| examples/tr/out/*.json | Generated JSON outputs for example invoices |
| data/regimes/tr.json | Generated regime data file |
| data/schemas/tax/regime-code.json | Added TR regime code to schema |
| CHANGELOG.md | Documented new TR regime addition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
samlown
left a comment
There was a problem hiding this comment.
Thanks for providing this! A few changes are required around the tax identity handling and the use of non-public or official sources. Some good stuff here though!
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #743 +/- ##
==========================================
+ Coverage 93.05% 93.07% +0.02%
==========================================
Files 333 337 +4
Lines 17785 17971 +186
==========================================
+ Hits 16549 16727 +178
- Misses 870 874 +4
- Partials 366 370 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks for the review Sam. You were right, TCKN is a national identity number used domestically by individuals and sole traders and not a valid tax ID for international trade. Only VKN serves that purpose. I've moved TCKN to org.Identity and updated supplier validation to require either a VKN (via TaxID) or a TCKN (via Identities). Also replaced sources with official publications, added a regime description, fixed lint issues, and added a TCKN example invoice. |
a7933ef to
5956730
Compare
5956730 to
26f1e03
Compare
Pre-Review Checklist
go generate .to ensure that the Schemas and Regime data are up to date.And if you are part of the org: