-
Notifications
You must be signed in to change notification settings - Fork 21
Update Verifactu validations #654
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
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 enhances Verifactu invoice validations by adding stricter rules for simplified invoices (F2 and R5 types) and ensuring tax breakdown requirements are met. The changes align with Verifactu API requirements that reject invoices with prohibited customer information in simplified invoices and require at least one non-retained tax category.
Key changes:
- Simplified invoices (F2/R5) now explicitly prohibit customers with tax IDs or identity documents
- New validation ensures invoices contain at least one non-retained tax category
- Comprehensive test coverage for all new validation scenarios
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| addons/es/verifactu/bill.go | Refactored customer validation to use conditional logic based on document type (F2/R5 vs others), added new validateInvoiceCustomerSimplified function to enforce simplified invoice restrictions, and added validateInvoiceTotals to ensure invoices have required tax categories |
| addons/es/verifactu/bill_test.go | Added comprehensive test coverage for simplified invoice customer restrictions (with/without tax ID and identities), tax category requirements (no taxes, only retained taxes, valid combinations), and updated existing test to remove customer identifiers for R5 invoices |
💡 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 #654 +/- ##
==========================================
+ Coverage 92.48% 92.51% +0.02%
==========================================
Files 313 313
Lines 15338 15452 +114
==========================================
+ Hits 14185 14295 +110
- Misses 827 829 +2
- Partials 326 328 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Not totally convinced here. So for two things that are happening:
- If there is something the user can do with the simplified invoice, why not just do it for them?
- I wouldn't produce errors in once place while suggest the user needs to fix it somewhere else, that'll get really confusing. It could be that each line needs to have a tax combo set and the validation should be there. Special charges, like with the
keyset tooutlay, would need to be exceptions.
This PR improves validations for Verifactu invoices:
Simplified Invoices (F2 or R5)
Taxes Validation
Pre-Review Checklist
go generate .to ensure that the Schemas and Regime data are up to date.