-
Notifications
You must be signed in to change notification settings - Fork 23
Add the Romania (ro) regime
#669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #669 +/- ##
==========================================
+ Coverage 92.71% 92.72% +0.01%
==========================================
Files 318 323 +5
Lines 15793 15994 +201
==========================================
+ Hits 14642 14831 +189
- Misses 826 832 +6
- Partials 325 331 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces the Romania (ro) tax regime to GOBL, implementing comprehensive support for Romanian fiscal requirements including the 2025 VAT rate changes mandated by Law 141/2025. The implementation covers VAT management, identity validation (CUI/CIF for businesses and CNP for individuals), invoice validation, and correction document types (credit notes, debit notes, corrective invoices).
Key changes:
- VAT rates: 21% standard and 11% reduced (effective August 1, 2025), with historical rates (19%/9%/5% for 2017-2025, 20% for 2016, 24% for 2010-2015)
- Identity validation: CUI/CIF with modulo 11 checksum algorithm and CNP with 13-digit validation
- E-invoicing compliance: Support for B2B, B2C, and simplified invoice mandates per Law 296/2023, OUG 69/2024, and OUG 138/2024
Reviewed changes
Copilot reviewed 25 out of 34 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
regimes/ro/ro.go |
Main regime definition and entry point with validator and normalizer functions |
regimes/ro/tax_categories.go |
VAT rate definitions (standard, reduced, super-reduced) with historical values |
regimes/ro/tax_identities.go |
CUI/CIF validation with modulo 11 checksum algorithm |
regimes/ro/org_identities.go |
Organization identity types (CUI, CNP) with validation and normalization |
regimes/ro/bill_invoice.go |
Invoice validation rules for B2B, B2C, and simplified invoices |
regimes/ro/corrections.go |
Correction document types (credit-note, debit-note, corrective) |
regimes/ro/ro_test.go |
Comprehensive tests for regime registration and configuration |
regimes/ro/tax_identities_test.go |
Tests for CUI/CIF validation including edge cases |
regimes/ro/org_identities_test.go |
Tests for CUI and CNP validation and normalization |
regimes/ro/bill_invoice_test.go |
Invoice validation tests covering all invoice types and scenarios |
regimes/ro/corrections_test.go |
Tests for credit and debit note validation |
regimes/ro/README.md |
Comprehensive documentation of Romanian tax regime requirements |
regimes/regimes.go |
Registration of RO regime in global regime list |
data/regimes/ro.json |
Regime data in JSON schema format |
data/schemas/tax/regime-code.json |
Added RO to regime codes schema |
examples/ro/*.yaml |
Example invoices demonstrating various scenarios |
examples/ro/out/*.json |
Generated JSON output from example invoices |
CHANGELOG.md |
Changelog entry documenting the new regime |
💡 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great submission! Thanks! There is a little too much validation on the basic structure of the invoice which should be offloaded to an addon in the future, we've found its best to keep the regime as flexible as possible, and add more restrictions through addons.
The Org and Tax identity approach is great. We've not done that for other countries, but it is useful to be able to re-use and validate IDs that may or may not be used for taxes, depending on the context.
| // - Reporting deadline is 5 calendar days from issuance. | ||
|
|
||
| // validateBillInvoice validates Romanian invoices according to local requirements. | ||
| func validateBillInvoice(inv *bill.Invoice) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very complete, but we don't normally add this level of validation at the Regime level and instead define an "addon" for a local format or tax agency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't go in depth into how addons worked as I was implementing the regime. I can look into it and move some of the validation logic to an addon if that's useful.
regimes/ro/corrections.go
Outdated
| var InvoiceCorrectionTypes = []cbc.Key{ | ||
| bill.InvoiceTypeCreditNote, // "Factură de stornare" (Negative amounts) | ||
| bill.InvoiceTypeDebitNote, // "Factură de ajustare" (Positive amounts) | ||
| bill.InvoiceTypeCorrective, // Generic correction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are corrective invoices supported in RO? Not all countries have support for this, the lack of a translation suggests not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, good catch! Corrections are indeed not supported, you need to issue a credit or debit note referencing the original invoice. I got inspiration from the implementation of other regimes and completely forgot to remove the unsupported correction. Pushed the fix.
This PR adds the Romania (
ro) tax regime to comply with the latest fiscal measures taking effect in 2025, including the increase in VAT rates and the extension of the RO e-Factura system to B2C and simplified invoices.Pre-Review Checklist
go generate .to ensure that the Schemas and Regime data are up to date.