Skip to content

Add Romanian tax regime support#732

Open
hassek wants to merge 4 commits intoinvopop:mainfrom
hassek:ro-tax-regime
Open

Add Romanian tax regime support#732
hassek wants to merge 4 commits intoinvopop:mainfrom
hassek:ro-tax-regime

Conversation

@hassek
Copy link
Copy Markdown

@hassek hassek commented Feb 24, 2026

Add Romanian (RO) tax regime support

  • Register new ro regime with RON currency, Europe/Bucharest timezone, and VAT tax scheme
  • VAT rates: standard (19% → 21% from Aug 2025), reduced (9% → 11%), and super-reduced (5% → 11%), with historical rates back to 2010
  • Tax identity validation: CUI/CIF format check (2-10 digits) with weighted checksum verification
  • Invoice validation: supplier tax ID required; customer required for standard invoices, forbidden for simplified invoices
  • Scenarios: reverse charge and simplified invoice legal notes (bilingual EN/RO)
  • Corrections: credit note and debit note support
  • Examples: standard RO-to-RO invoice, simplified invoice, and credit note with generated JSON output

Pre-Review Checklist

  • Opened this PR as a draft
  • Read the CONTRIBUTING.md guide.
  • Performed a self-review of my code.
  • Added thorough tests with at least 90% code coverage.
  • Modified or created example GOBL documents to show my changes in use, if appropriate.
  • Added links to the source of the changes in tax regimes or addons, either structured or in the comments.
  • Run go generate . to ensure that the Schemas and Regime data are up to date.
  • Reviewed and fixed all linter warnings.
  • Been obsessive with pointer nil checks to avoid panics.
  • Updated the CHANGELOG.md with an overview of my changes.
  • Requested a review from Copilot and fixed or dismissed (with a reason) all the feedback raised.

Only after checking off all the previous items:

  • Marked this PR as ready for review and requested one from @samlown.

@hassek hassek marked this pull request as draft February 24, 2026 11:58
@hassek hassek force-pushed the ro-tax-regime branch 2 times, most recently from 36587e1 to ff05217 Compare February 24, 2026 12:12
@hassek hassek marked this pull request as ready for review February 24, 2026 12:17
@hassek
Copy link
Copy Markdown
Author

hassek commented Feb 24, 2026

Thinking process mind travel

I 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 day

Apply modernize or the shiny go fix new tool, it's such a life changer!

Copy link
Copy Markdown
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

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/ro with 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.

Comment thread regimes/ro/README.md Outdated
Comment thread regimes/ro/README.md Outdated
Comment thread regimes/ro/scenarios.go
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 25, 2026

Codecov Report

❌ Patch coverage is 98.09524% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.89%. Comparing base (8ca0f6c) to head (54e39f4).
⚠️ Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
regimes/ro/invoices.go 91.30% 1 Missing and 1 partial ⚠️
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.
📢 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.

@hassek
Copy link
Copy Markdown
Author

hassek commented Feb 25, 2026

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

Copy link
Copy Markdown
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.

A few considerations, but outside of that, looks good! Thanks.

Comment thread regimes/ro/ro.go
Comment thread regimes/ro/README.md Outdated
Comment thread regimes/ro/invoices.go Outdated
Comment thread regimes/ro/invoices.go
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.

3 participants