Add Romanian tax regime support#732
Conversation
36587e1 to
ff05217
Compare
Thinking process mind travelI started investigating the Bulgarian implementation, decided it was not the best option because they just moved to EUR recently and don't have an official technology yet to validate invoices. Moved to two good options, Hungary and Romania which both have these validation tools. Decided for Romania as I seem to recall it been mentioned by Juan when we talked. I have this personal rule to answer: Would I bet my house this code works without issues? The answer for this PR is a hard no, the reason is I can't test this end to end and I am not able to catch all the necessary context around the project in just one day, although, I would bet less life changing objects that this is an accurate implementation ;) What I need to make that bet? a full end to end flow, with at the least two real company invoice history to run through the system and getting a 100% acceptance rate at https://www.anaf.ro/uploadxm (I do lack much context but hey! you don't bet your house easily) Tip of the dayApply |
There was a problem hiding this comment.
Pull request overview
Adds a new Romanian (RO) tax regime to GOBL, including VAT rate history, tax identity (CUI/CIF) validation/normalization, invoice validation rules, and example documents/output so the regime can be exercised through the standard calculate/validate pipeline.
Changes:
- Introduces
regimes/rowith VAT category/rates, invoice scenarios, corrections support, and CUI/CIF checksum validation + normalization. - Registers the new regime and updates generated regime/schema data (
data/regimes/ro.json,data/schemas/.../regime-code.json). - Adds RO examples (YAML inputs + expected JSON envelopes) and changelog entry.
Reviewed changes
Copilot reviewed 15 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| regimes/ro/ro.go | Registers RO regime definition (currency, timezone, validator/normalizer, scenarios, categories, corrections). |
| regimes/ro/tax_categories.go | Defines Romanian VAT category and rate history (general/reduced/super-reduced with 2025-08 changeover). |
| regimes/ro/tax_identity.go | Adds RO tax identity validation (2–10 digits + weighted checksum). |
| regimes/ro/tax_identity_test.go | Tests RO tax identity validation and normalization behavior (prefix/whitespace/separators). |
| regimes/ro/invoices.go | Adds RO-specific invoice validation rules (supplier tax ID required; simplified vs standard customer rules). |
| regimes/ro/invoices_test.go | Tests RO invoice validation rules for supplier/customer presence depending on simplified tag. |
| regimes/ro/scenarios.go | Adds scenario notes for reverse-charge and simplified tags. |
| regimes/ro/README.md | Documents RO regime sources, VAT rates, tax identity rules, and RO-specific requirements. |
| regimes/regimes.go | Adds blank import to include the RO regime in the compiled registry. |
| data/schemas/tax/regime-code.json | Adds "RO" to the regime code enum schema. |
| data/regimes/ro.json | Generated serialized RO regime definition (categories/rates/scenarios/corrections). |
| examples/ro/invoice-ro-ro.yaml | Adds RO standard invoice example input. |
| examples/ro/invoice-simplified.yaml | Adds RO simplified invoice example input. |
| examples/ro/credit-note.yaml | Adds RO credit note example input. |
| examples/ro/out/invoice-ro-ro.json | Expected generated envelope JSON for RO standard invoice example. |
| examples/ro/out/invoice-simplified.json | Expected generated envelope JSON for RO simplified invoice example. |
| examples/ro/out/credit-note.json | Expected generated envelope JSON for RO credit note example. |
| CHANGELOG.md | Notes addition of the RO regime under 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 #732 +/- ##
==========================================
+ Coverage 92.86% 92.89% +0.03%
==========================================
Files 331 334 +3
Lines 17260 17365 +105
==========================================
+ Hits 16029 16132 +103
- Misses 867 868 +1
- Partials 364 365 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Added exhaustive testing over scenarios, covered the 2 lines of code missing and fixed a few inaccurate tests where we applied a given VAT tier to a topic that was not right. @samlown this should be ready to review |
samlown
left a comment
There was a problem hiding this comment.
A few considerations, but outside of that, looks good! Thanks.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
dbaae88 to
54e39f4
Compare
Add Romanian (RO) tax regime support
Pre-Review Checklist
go generate .to ensure that the Schemas and Regime data are up to date.Only after checking off all the previous items: