Repository navigation
Conversation
…e-and-references # Conflicts: # test/invoice_test.rb
This was referenced Oct 19, 2026
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.
Ticket
https://miceportal.atlassian.net/browse/MP-53292
Story
Auftragsbuch writes every ZUGFeRD document as a commercial invoice: the gem hardcodes the document type (BT-3) to 380. Cancellations and refunds are credit notes (381) and corrections are corrected invoices (384), so a recipient's software books them the wrong way. A credit note or correction should also say which invoice it refers to (BG-3, the preceding invoice reference), which the gem cannot write at all.
The third change is for the seller identifier. Invoices that must not carry our VAT ID (non-taxable commission invoices, category O) still need a seller identifier, and the right field for a commercial register entry such as
HRB München 169661is the legal registration identifier (BT-30). The gem always writes a scheme ID there and defaults to "0002", the French SIRENE register, which would mislabel a German register entry. BT-30 now works without a scheme.How to review
One commit, three small changes:
lib/secretariat/invoice.rbtype_code(BT-3): written as given, 380 when not set.preceding_invoice_id(BT-25) andpreceding_invoice_issue_date(BT-26): written asInvoiceReferencedDocumentafter the totals block, where the CII schema expects it. Version 2 only, like attachments.lib/secretariat/trade_party.rb:legal_organization: { id: "...", scheme_id: nil }writes noschemeID.test/invoice_test.rb: six testsDesign Choices
InvoiceReferencedDocument. Alegal_organizationwithout ascheme_idkey still gets "0002".scheme_id: nilexplicitly used to get "0002" and now gets no scheme. An explicit nil reads as "no scheme", and the attribute is optional in EN 16931 (BT-30-1).main, as for MP-54008 Fix 1-cent VAT rounding in line totals and VAT base #7, so the same commit can go upstream: the TypeCode was an open TODO there. The library files apply cleanly on ourmain; the test file only needs its tests placed next to ours.Links
Checklist