Skip to content

Conversation

@adlrocha
Copy link

@adlrocha adlrocha commented Dec 18, 2025

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

  • I've read the CONTRIBUTING.md guide.
  • I have performed a self-review of my code.
  • I have added thorough tests with at least 90% code coverage.
  • I've modified or created example GOBL documents to show my changes in use, if appropriate.
  • When adding or modifying a tax regime or addon, I've added links to the source of the changes, either structured or in the comments.
  • I've run go generate . to ensure that the Schemas and Regime data are up to date.
  • All linter warnings have been reviewed and fixed.
  • I've been obsessive with pointer nil checks to avoid panics.
  • The CHANGELOG.md has been updated with an overview of my changes.
  • Requested a review from @samlown.

@adlrocha adlrocha marked this pull request as draft December 18, 2025 17:39
@adlrocha adlrocha changed the title Adlrocha/ro Add ro regime Dec 19, 2025
@adlrocha adlrocha changed the title Add ro regime Add the Romania (ro) regime Dec 19, 2025
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 94.02985% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.72%. Comparing base (bf0c5f8) to head (5c30013).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
regimes/ro/bill_invoice.go 94.87% 2 Missing and 2 partials ⚠️
regimes/ro/org_identities.go 92.30% 2 Missing and 2 partials ⚠️
regimes/ro/tax_identities.go 87.09% 2 Missing and 2 partials ⚠️
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.
📢 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.

@adlrocha adlrocha marked this pull request as ready for review December 19, 2025 09:53
@samlown samlown requested a review from Copilot December 23, 2025 08:42
Copy link
Contributor

Copilot AI left a 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.

Copy link
Collaborator

@samlown samlown left a 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 {
Copy link
Collaborator

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.

Copy link
Author

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.

var InvoiceCorrectionTypes = []cbc.Key{
bill.InvoiceTypeCreditNote, // "Factură de stornare" (Negative amounts)
bill.InvoiceTypeDebitNote, // "Factură de ajustare" (Positive amounts)
bill.InvoiceTypeCorrective, // Generic correction
Copy link
Collaborator

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.

Copy link
Author

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.

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.

2 participants