-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Charges on item level #568
base: master
Are you sure you want to change the base?
Conversation
Adds support for allowances and charges on item level Fixes ZUGFeRD#561 Previously charges/allowances on item level where handled same as header level
// now handling base64 encoded attachments AttachmentBinaryObject=CII, EmbeddedDocumentBinaryObject=UBL | ||
xpr = xpath.compile("//*[local-name()=\"AttachmentBinaryObject\"]|//*[local-name()=\"EmbeddedDocumentBinaryObject\"]"); | ||
NodeList attachmentNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET); | ||
for (int i = 0; i < attachmentNodes.getLength(); i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically moved everything below to new method parseCharge() without much changes. Ignoring whitespaces should make this diff easier to parse (?w=1)
// be read, | ||
// so the invoice remains arithmetically correct | ||
// -> parse document level charges+allowances | ||
xpr = xpath.compile("//*[local-name()=\"ApplicableHeaderTradeSettlement\"]//*[local-name()=\"SpecifiedTradeAllowanceCharge\"]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added ApplicableHeaderTradeSettlement because we only want to have header level charges here
reason = XMLTools.trimOrNull(chargeNodeChilds.item(chargeChildIndex)); | ||
} else if (chargeChildName.equals("ReasonCode")) { | ||
reasonCode = XMLTools.trimOrNull(chargeNodeChilds.item(chargeChildIndex)); | ||
} else if (isHeader && chargeChildName.equals("CategoryTradeTax")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added condition isHeader
|
||
if (zpp.getZFItems() != null && zpp.getZFItems().length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was previously only done for if (nodes.getLength() != 0)
zfItems.length > 0 should basically check the same
Add missing @test Annotation
af6563c
to
34afa6a
Compare
@jstaerk Do you mind sharing why you have rejected this PR until now? What can I do to improve this? |
Adds support for allowances and charges on item level
Fixes #561
Previously charges/allowances on item level where handled same as header level