Skip to content

Support the electronic address of seller and buyer (BT-34, BT-49) - #64

Merged
halfbyte merged 2 commits into
halfbyte:mainfrom
konvenit:MP-53295-electronic-address-upstream
Oct 21, 2026
Merged

halfbyte merged 2 commits into
halfbyte:mainfrom
konvenit:MP-53295-electronic-address-upstream

Conversation

@ahmedm10

@ahmedm10 ahmedm10 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A trade party can't carry an electronic address (BT-34 for the seller, BT-49 for the buyer). These are the URIUniversalCommunication element of the party itself, which says where electronic documents for that party go. The only email the gem can write today belongs to the contact (DefinedTradeContact), which says whom to call. Peppol routing and XRechnung expect the party's address, and for a plain ZUGFeRD invoice it tells the recipient where to send replies.

Change

  • TradeParty#electronic_address and #electronic_address_scheme_id write <ram:URIUniversalCommunication><ram:URIID schemeID="…">…</ram:URIID></ram:URIUniversalCommunication> after the postal address, where the CII schema places it. Version 2 only.
  • It is written only when both are set: EN 16931 requires the scheme (BR-62, BR-63), e.g. EM for an email address or 9930 for a German VAT number from the EAS code list. This follows global_id, which is also left out without its scheme.
  • It is left out of the ShipToTradeParty. The invoice writes the buyer a second time as the ship-to party, and the Factur-X EN 16931 schematron reports URIUniversalCommunication there as "not used in the given context". It follows the existing exclude_tax flag, which already keeps the buyer ID out of the ship-to party.

Existing callers get the same XML as before.

Tests

Three new tests in test/invoice_test.rb: seller and buyer address, each written once, also validated against the schematron (based on make_eu_invoice); no element without a scheme; no element by default. The full suite passes.

Adds TradeParty#electronic_address and #electronic_address_scheme_id
(EN 16931 BT-34 / BT-49) as URIUniversalCommunication. Written only
with a scheme (BR-62, BR-63) and left out of the ShipToTradeParty,
where the profile does not use it.
@ahmedm10
ahmedm10 force-pushed the MP-53295-electronic-address-upstream branch from ab44284 to 496e369 Compare October 19, 2026 17:14
@ahmedm10
ahmedm10 marked this pull request as ready for review October 19, 2026 17:14
@halfbyte
halfbyte merged commit 02df4d4 into halfbyte:main Oct 21, 2026
4 checks passed
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.

2 participants