-
-
Notifications
You must be signed in to change notification settings - Fork 207
Description
Describe the problem
When generating CrossIndustryInvoice (CII) XML with ZUGFeRD2PullProvider, the element:
/rsm:CrossIndustryInvoice/rsm:ExchangedDocumentContext/ram:BusinessProcessSpecifiedDocumentContextParameter/ram:ID (EN16931 BT-23)
cannot be set by the user.
Currently Mustang only writes BusinessProcessSpecifiedDocumentContextParameter for the XRechnung profile (with a fixed/implicit value), and omits it for other profiles such as Factur-X EXTENDED / EN16931.
This makes it impossible to satisfy ecosystems/validators where BT-23 is required or expected.
Expected behavior
Users should be able to set a custom BT-23 value (string / URN) when generating CII XML, independently of the selected profile.
Actual behavior
In profile XRechnung: BT-23 is generated with a fixed value (hardcoded), but cannot be customized.
In profile EXTENDED/EN16931/Factur-X: BT-23 is not generated at all.
Why this matters / use cases
Some customers require a local business process code (e.g. “B1”, “B8”) for routing/workflow, and currently we must post-process the XML output (fragile).
Proposed solution (API)
Option A (preferred): add an optional field to Invoice:
Invoice#setBusinessProcessId(String id)
Invoice#getBusinessProcessId()
Then in ZUGFeRD2PullProvider:
if invoice.getBusinessProcessId() is not null/blank → always write ram:BusinessProcessSpecifiedDocumentContextParameterram:ID...</ram:ID></ram:BusinessProcessSpecifiedDocumentContextParameter>
else keep current behavior (XRechnung default value or omitted for other profiles)
Option B: add a setter on the provider:
ZUGFeRD2PullProvider#setBusinessProcessId(String id)
Backward compatibility
No breaking changes: default output remains unchanged unless the new property is set.
For XRechnung: keep the existing default value if user does not set anything; allow overriding when explicitly provided.
Minimal patch hint
BusinessProcessSpecifiedDocumentContextParameter is written in ZUGFeRD2PullProvider only under XRechnung conditions; the patch would move this logic to:
“if custom id present → write it; else if profile==XRechnung → write current default; else omit”.
Additional context
BT-24 (GuidelineSpecifiedDocumentContextParameter/ID) is already correctly written based on profile. The missing part is making BT-23 configurable.