Fix France B2G UBL: contract DocumentType and code routage scheme 0224 - #77
Open
pmenendz wants to merge 1 commit into
Open
Fix France B2G UBL: contract DocumentType and code routage scheme 0224#77pmenendz wants to merge 1 commit into
pmenendz wants to merge 1 commit into
Conversation
Serialize ordering.contracts[].type into cac:ContractDocumentReference/ cbc:DocumentType (EXT-FR-FE-01). Previously only cbc:ID (BT-12) was emitted and the contract type was dropped entirely. Resolve PartyIdentification schemeID for the "private-id" identity (France code routage / Chorus Pro Code Service), mapping it to ISO 6523 scheme 0224 when the iso-scheme-id extension is absent. The France Extended/B2G profile uses the fr/facturx placeholder addon which, unlike fr/ctc, never sets that extension, so the 0224 identity required by BR-FR-CPRO-11 was missing from the UBL output. Pylon #4850 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 #77 +/- ##
==========================================
+ Coverage 78.61% 78.65% +0.03%
==========================================
Files 26 26
Lines 1927 1935 +8
==========================================
+ Hits 1515 1522 +7
- Misses 296 297 +1
Partials 116 116 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Ref: GBL-71 · Pylon #4850
Fixes two France B2G UBL serialization bugs reported by Brevo in Pylon ticket #4850 ("UAT Bug reporting 014 — B2G specificities").
Issue 1 — Contract type dropped (
ordering.go)addOrderingemitted only the contract code (cbc:ID, BT-12) and never the contract type, socac:ContractDocumentReference/cbc:DocumentType(the France CTC/Chorus Pro extension EXT-FR-FE-01, "type de contrat") was missing from the output.Fix: serialize
contract.Typeintocbc:DocumentType.Note:
typeis a GOBLcbc.Key, so it must be lower-case — uppercase values like"MARCHE"are (correctly) rejected upstream withkey must match the required pattern. EXT-FR-FE-01 has no fixed code list in XP Z12-012 (free text complementing BT-12), so the value is passed through verbatim.Issue 3 — Code routage (scheme 0224) missing (
party.go)newPartyderivedPartyIdentification/schemeIDsolely from theiso-scheme-idextension. That extension is set during normalization only by thefr/ctcaddon (B2B/CIUS). The France Extended / B2G profile uses thefr/facturxaddon, which is a placeholder and never sets it — so theprivate-id(code routage / Chorus Pro "Code Service") identity serialized withoutschemeID="0224", violating BR-FR-CPRO-11.Fix: add an
identitySchemeID()resolver that prefers the explicitiso-scheme-idext and falls back to mapping theprivate-idkey →0224. Now the0224identity is emitted in both the CIUS and Extended profiles, alongside0009(SIRET).Not included
Issue 2 (
#ADNfootnote showing escompte text instead ofB2G) is not a code bug — those notes are hardcoded in Brevo's Chargebee workflow (confirmed by Álvaro in Pylon #4781). gobl.ubl serializes notes faithfully (#ADN#B2Gworks). It needs a workflow-config change, not a code change here.Tests
TestNewOrdering/contract type maps to cbc:DocumentTypeTestNewParty/private-id key maps to scheme 0224 without extBoth fixes are additive (DocumentType only emitted when
typeis set; the 0224 fallback only fires when the ext is absent), so no existing fixtures changed.go test ./...,gofmt, andgo vetall pass.🤖 Generated with Claude Code