Skip to content

fix: accept endpoint-only parties in Flow 2 invoice inbox rules - #14

Open
alvarolivie wants to merge 1 commit into
mainfrom
party-endpoint-mapping
Open

fix: accept endpoint-only parties in Flow 2 invoice inbox rules#14
alvarolivie wants to merge 1 commit into
mainfrom
party-endpoint-mapping

Conversation

@alvarolivie

Copy link
Copy Markdown
Contributor

Why

Blocks the gobl.ubl / gobl.cii endpoint-mapping release. Those
converters are switching the party electronic address to GOBL's
org.Endpoint (iso6523-actorid-upis::<scheme>:<code>) instead of the
deprecated org.Inbox (invopop/gobl.ubl#111, invopop/gobl.cii#68). As a
result, a French B2B invoice parsed from UBL/CII now carries an
endpoint and no inbox — and fails Flow 2 validation, which requires an
inbox:

[GOBL-FR-CTC-FLOW2-BILL-INVOICE-11] ($.doc.supplier.inboxes) ... required (BR-FR-13)
[GOBL-FR-CTC-FLOW2-BILL-INVOICE-13] ($.doc.supplier) ... inbox with scheme 0225 ... (BR-FR-21/22)
[GOBL-FR-CTC-FLOW2-BILL-INVOICE-14] ($.doc.customer.inboxes) ... required (BR-FR-13)

What

normalizeParty now back-fills the Peppol inbox from the party's
endpoint
when the party carries an iso6523-actorid-upis::<scheme>:<code>
endpoint but no inbox. This is the inverse of the eu/en16931 addon's
inbox→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

  • New unit tests: normalizeParty back-fills from a Peppol endpoint,
    skips when an inbox already exists, and ignores mailto: endpoints.
  • New end-to-end test TestInvoiceB2BEndpointOnlyParties: a full French
    B2B invoice with endpoint-only parties now passes Calculate +
    Validate.
  • Confirmed against gobl.ubl via a local replace: parsing the French
    b2b-reg.xml and validating no longer emits INVOICE-11/13/14 (only
    unrelated pre-existing sample-data errors remain).

Release

Cut a new tag after merge; gobl.ubl and gobl.cii bump to it in their
respective PRs before their own merge.

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings July 20, 2026 11:52
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.80%. Comparing base (e1cfb0b) to head (9e1ab88).

Files with missing lines Patch % Lines
addon/flow2/org.go 80.00% 2 Missing and 2 partials ⚠️
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.
📢 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.

Copilot AI left a comment

Copy link
Copy Markdown

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 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.

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