Repository navigation
line[].tradeSettlement.allowances is missing ChargeIndicator #116
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
To Reproduce
- Create a EN16931 invoice with discounts on line items in the form of allowances
- Check the xml output
Current vs. Expected behavior
A Charge indicator set to false should be present at the top but nothing is set, i also tried adding chargeIndicator: false to the object but it does nothing.
Here is what is generated :
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>2</ram:LineID>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:Name>Billets - Billet 2</ram:Name>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:GrossPriceProductTradePrice>
<ram:ChargeAmount>65</ram:ChargeAmount>
<ram:BasisQuantity unitCode="C62">1</ram:BasisQuantity>
</ram:GrossPriceProductTradePrice>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>52.5</ram:ChargeAmount>
<ram:BasisQuantity unitCode="C62">1</ram:BasisQuantity>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="C62">1</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>20</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeAllowanceCharge>
<ram:ActualAmount>12.5</ram:ActualAmount>
<ram:Reason>BILLETPASCHER applied on Billets - Billet 2</ram:Reason>
</ram:SpecifiedTradeAllowanceCharge>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>52.5</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>Notice SpecifiedTradeAllowanceCharge is missing ChargeIndicator.
Here is the error report from Mustang:
schema validation fails:org.xml.sax.SAXParseException; lineNumber: 93; columnNumber: 29; cvc-complex-type.2.4.a: Invalid content was found starting with element ‘{“urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100”:ActualAmount}’. One of ‘{“urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100”:ChargeIndicator}’ is expected.
[CII-SR-463]-Each Specified Trade Allowance Charge (BG-20)(BG-21) shall contain a Charge Indicator. [ID FX-SCH-A-000348] from /xslt/ZF_240/FACTUR-X_EN16931.xslt)
[CII-SR-463]-Each Specified Trade Allowance Charge (BG-20)(BG-21) shall contain a Charge Indicator. [ID FX-SCH-A-000348] from /xslt/ZF_240/FACTUR-X_EN16931.xslt)
What version of node-zugferd are you using?
0.1.1-beta.1
Provide environment information
Node v24.14.1Which area(s) are affected? (Select all that apply)
Package
Config (if applicable)
import { zugferd } from 'node-zugferd';
import { EN16931, type ProfileEN16931 } from 'node-zugferd/profile/en16931';
const invoicer = zugferd({
profile: EN16931,
strict: false,
});Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
kobima6813 commentedon Oct 26, 2026
Additional repro for this, on node-zugferd 0.1.1-beta.1 (Node 20.19.2, EN16931 profile).
Any invoice line with
tradeSettlement.allowancesfails the library's own XSD check, sotoXML()rejects it:Inside
ram:SpecifiedTradeAllowanceCharge, the CII XSD requiresram:ChargeIndicatorbeforeram:ActualAmount.The schema declares
chargeIndicator(BG-27-0) asadditionalXmlofactualAmount(BT-136), but it is not emittedbefore
ActualAmount. PassingchargeIndicator: falseexplicitly makes no difference, as #116 also says.Minimal repro (
node repro.mjs):allowancesline: the call throws the error above.Expected: inside each
ram:SpecifiedTradeAllowanceCharge,<ram:ChargeIndicator><udt:Indicator>false</udt:Indicator></ram:ChargeIndicator>is written first, followed by
ram:ActualAmount,ram:ReasonCodeandram:Reason.Impact in a larger test: we generated 600 synthetic shop carts (EN 16931, 19 %/7 % VAT) with node-zugferd.
#85 (closed) covered the same element-order problem for document-level allowances; the line-level path still shows it.