fix: accept endpoint-only parties in Flow 2 invoice inbox rules - #14
Open
alvarolivie wants to merge 1 commit into
Open
fix: accept endpoint-only parties in Flow 2 invoice inbox rules#14alvarolivie wants to merge 1 commit into
alvarolivie wants to merge 1 commit into
Conversation
French B2B invoice validation (BR-FR-13/21/22) requires each party to carry a Peppol inbox. Documents parsed from UBL/CII now express the party electronic address as an endpoint (iso6523-actorid-upis::<scheme>:<code>) instead of the deprecated inbox, so those invoices failed GOBL-FR-CTC-FLOW2-BILL-INVOICE-11/13/14 on validation. normalizeParty now back-fills the Peppol inbox from the endpoint when a party carries the endpoint but no inbox — the inverse of the eu/en16931 addon's inbox->endpoint migration — so the existing inbox rules are satisfied without changing them. Parties that already carry an inbox are left untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14 +/- ##
==========================================
- Coverage 96.96% 96.80% -0.16%
==========================================
Files 13 13
Lines 2141 2161 +20
==========================================
+ Hits 2076 2092 +16
- Misses 44 46 +2
- Partials 21 23 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates Flow 2 (invoice) party normalization so that parties expressed only with a Peppol participant endpoint (and no legacy inbox) still satisfy the existing Flow 2 inbox validation rules, unblocking endpoint-mapping changes in upstream UBL/CII converters.
Changes:
- Add Flow 2 party normalization logic to back-fill a Peppol inbox from an
iso6523-actorid-upis::…endpoint when no inbox is present. - Add unit tests covering inbox back-fill behavior (back-fill, no-op when inbox exists, ignore non-Peppol endpoints).
- Add an end-to-end Flow 2 invoice test ensuring endpoint-only supplier/customer parties pass
Calculate+Validate.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| addon/flow2/org.go | Adds endpoint→inbox back-fill during party normalization for Flow 2 invoices. |
| addon/flow2/org_test.go | Adds unit tests for endpoint-only party normalization behavior. |
| addon/flow2/flow2_test.go | Adds an end-to-end invoice test for endpoint-only parties passing validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Blocks the
gobl.ubl/gobl.ciiendpoint-mapping release. Thoseconverters are switching the party electronic address to GOBL's
org.Endpoint(iso6523-actorid-upis::<scheme>:<code>) instead of thedeprecated
org.Inbox(invopop/gobl.ubl#111, invopop/gobl.cii#68). As aresult, a French B2B invoice parsed from UBL/CII now carries an
endpoint and no inbox — and fails Flow 2 validation, which requires an
inbox:
What
normalizePartynow back-fills the Peppol inbox from the party'sendpoint when the party carries an
iso6523-actorid-upis::<scheme>:<code>endpoint but no inbox. This is the inverse of the
eu/en16931addon'sinbox→endpoint migration, so the existing BR-FR-13/21/22 rules are
satisfied without touching the rules themselves. Parties that already
carry an inbox are left untouched, and non-Peppol endpoints (e.g.
mailto:) are ignored.After normalization a party ends up with both representations (inbox +
endpoint), matching how en16931-normalized documents already look — so
every consumer works regardless of which field it reads.
Scope
Flow 2 (invoice) only — the path the converters exercise. Flow 6 (CDAR
status) keeps its own inbox handling; the converters' CDAR path is
unchanged, so it isn't affected here.
Verification
normalizePartyback-fills from a Peppol endpoint,skips when an inbox already exists, and ignores
mailto:endpoints.TestInvoiceB2BEndpointOnlyParties: a full FrenchB2B invoice with endpoint-only parties now passes
Calculate+Validate.gobl.ublvia a localreplace: parsing the Frenchb2b-reg.xmland validating no longer emits INVOICE-11/13/14 (onlyunrelated pre-existing sample-data errors remain).
Release
Cut a new tag after merge;
gobl.ublandgobl.ciibump to it in theirrespective PRs before their own merge.
🤖 Generated with Claude Code