Add Cl regime - #891
Add Cl regime#891pacots wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds initial core GOBL regime support for Chile (CL), including regime registration, IVA/VAT tax category metadata, RUT tax identity normalization/validation, correction types, and a minimal example invoice with regenerated outputs.
Changes:
- Register the new
CLregime and add generated schema/rules/regime artifacts. - Implement Chile RUT normalization + modulo-11 validation rules and tests.
- Add IVA (VAT) 19% category definition and a minimal CL invoice example (source + generated output), plus a CHANGELOG entry.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| regimes/regimes.go | Registers the new cl regime via blank import. |
| regimes/cl/cl.go | Defines and registers the Chile regime metadata, normalization, rules, and correction types. |
| regimes/cl/cl_test.go | Verifies Chile regime definition wiring (country/currency/timezone/tax scheme/corrections). |
| regimes/cl/tax_categories.go | Adds IVA/VAT category definition (general 19% rate effective 2003-10-01) with sources. |
| regimes/cl/tax_identity.go | Implements RUT normalization hook + checksum/format validation for Chile tax identity codes. |
| regimes/cl/tax_identity_test.go | Tests normalization behavior and RUT validity/invalidity cases (including edge cases). |
| examples/cl/invoice-cl-cl.yaml | Adds a minimal Chile invoice input example using RUTs. |
| examples/cl/out/invoice-cl-cl.json | Adds the generated output envelope for the CL invoice example. |
| data/schemas/tax/regime-code.json | Adds CL to the regime code schema enumeration. |
| data/rules/cl.json | Adds generated rules output for CL tax identity validation. |
| data/regimes/cl.json | Adds generated regime definition output for CL. |
| CHANGELOG.md | Documents the addition of the Chile regime in Unreleased. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #891 +/- ##
=======================================
Coverage 94.73% 94.73%
=======================================
Files 316 318 +2
Lines 17198 17296 +98
=======================================
+ Hits 16292 16386 +94
- Misses 560 562 +2
- Partials 346 348 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
samlown
left a comment
There was a problem hiding this comment.
Thanks for this! Looks good. I'd suggest refactoring the assertions to provide more detailed fault messages.
Summary
Adds the initial Chile (
CL) tax regime.This PR focuses on core GOBL regime support for Chile: country metadata, IVA/VAT, RUT tax identity normalization and validation, invoice correction types, generated data, and a minimal example invoice.
Chile-specific SII/DTE behavior is deliberately left out of scope and would be better handled in a future addon.
What's included
regimes/cl: initial Chile regime package.regimes/regimes.go.CLcountry codeCLPcurrencyAmerica/SantiagotimezoneVAT) tax category:CLprefixkis normalized toKexamples/cl/.Tests
Adds tests for:
Kcheck digits.Focused checks run locally:
go test ./regimes/cl/... -coverprofile=coverage go tool cover -func=coverage golangci-lint run ./regimes/cl/...go test ./regimes/cl/...reports 94.7% coverage.Generated data and example outputs were updated with:
Deliberately deferred to a future SII/DTE addon
These are real Chilean e-invoicing concerns, but they are format/platform-specific and do not belong in this initial regime layer:
No Chile-specific scenario mappings are added in this initial PR.
Sources
Official Chilean sources:
BCN - Decreto Ley 825, Ley sobre Impuesto a las Ventas y Servicios
https://www.bcn.cl/leychile/navegar?idNorma=6369
SII - Formato Documentos Tributarios Electronicos
https://www.sii.cl/factura_electronica/formato_dte.pdf
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: