Skip to content

Adding ZUGFeRD 2.5 and Factur-X 1.09#203

Draft
andesk wants to merge 9 commits into
masterfrom
feature/zugferd-2.5-factur-x-1.09
Draft

Adding ZUGFeRD 2.5 and Factur-X 1.09#203
andesk wants to merge 9 commits into
masterfrom
feature/zugferd-2.5-factur-x-1.09

Conversation

@andesk

@andesk andesk commented Jul 7, 2026

Copy link
Copy Markdown
Member

This PR adds the latest ZUGFeRD and Factur-X versions to the lib's support.

andesk and others added 9 commits July 6, 2026 16:21
…stment, ManufacturerTradeParty, PayerSpecifiedDebtorFinancialInstitution)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Populates each new field's XSD-sequence siblings so a misordered
declaration fails schema validation (verified: moving any of the three
new properties triggers an 'element not expected' XSD error).
…ntName, ReferencedProduct ID, SequenceNumeric, BasisQuantity)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…n TradeProduct

The XSD TradeProductType sequence places IndividualTradeProductInstance
before OriginTradeCountry/ManufacturerTradeParty; the property was declared
last, so a product setting both serialized as XSD-invalid. The EXTENDED
end-to-end test now sets individualTradeProductInstance to lock in the order.
PayerPartyDebtorFinancialAccount/ApplicableTradeSettlementFinancialCard were
declared out of the TradeSettlementPaymentMeansType sequence, so invoices
placing PayerPartyDebtorFinancialAccount before PayeePartyCreditorFinancialAccount
serialized as XSD-invalid. Reordered to: TypeCode, Information,
ApplicableTradeSettlementFinancialCard, PayerPartyDebtorFinancialAccount,
PayeePartyCreditorFinancialAccount, PayerSpecifiedDebtorFinancialInstitution,
PayeeSpecifiedCreditorFinancialInstitution. Adds the 3 official X01
Dauermietrechnung 1.09 EXTENDED examples as round-trip fixtures.
AttachmentBinaryObject attribute order (mimeCode/filename) is semantically
insignificant but differs between our serializer and some official examples.
Rather than contort the model (no single order satisfies all example files),
reformatXml now sorts each element's non-namespaced attributes so both sides
of the round-trip comparison normalize identically. Adds the 2 official
XRECHNUNG 1.09 examples (Elektron, Reisekostenabrechnung) as fixtures.
@andesk andesk self-assigned this Jul 7, 2026
Comment on lines +29 to +33
// Attribute order is not significant in XML, but the official examples and our serializer
// emit some attributes (e.g. mimeCode/filename on AttachmentBinaryObject) in different orders.
// Normalise by sorting each element's non-namespaced attributes so byte comparison ignores order.
// Elements carrying prefixed attributes (e.g. xsi:*) are left untouched to preserve bindings.
private static function sortElementAttributes(\DOMElement $element): void

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we want/need to add this. cc @BolZer

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.

1 participant