Validate advances are non-negative pt-saft-v1#830
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a Portugal SAF-T (pt-saft-v1) validation rule to ensure invoice advance payment amounts are non-negative, aligning invoice validation behavior with the SAF-T specification.
Changes:
- Added a pt-saft invoice rule to validate that each advance payment
amountis>= 0. - Updated the generated rules data (
data/rules/pt-saft.json) to include the new assertion. - Added a unit test covering the negative-advance validation failure case.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| data/rules/pt-saft.json | Adds rule metadata for validating non-negative advance amounts on invoices. |
| addons/pt/saft/invoices.go | Enforces num.ZeroOrPositive on payment.advances[].amount. |
| addons/pt/saft/invoices_test.go | Adds test ensuring negative advance amounts fail validation. |
| CHANGELOG.md | Documents the new pt-saft-v1 validation rule in Unreleased. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #830 +/- ##
=======================================
Coverage 93.39% 93.39%
=======================================
Files 369 369
Lines 20121 20124 +3
=======================================
+ Hits 18792 18795 +3
Misses 888 888
Partials 441 441 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Docs PR opened: invopop/gobl.docs#49 Added a validation rule entry documenting that advance payment amounts on Portuguese SAF-T invoices must not be negative. |
|
Docs PR opened: invopop/docs.invopop.com#385 Added a Portugal entry to the May 12, 2026 changelog noting the new SAF-T validation rejecting negative advance payment amounts. |
Pre-Review Checklist
go generate .to ensure that the Schemas and Regime data are up to date.And if you are part of the org: