Merge pull request #1005 from burak-inan/zugferd-importer-ubl-creditnote-fix-998

fix: Add UBL CreditNote support in ZUGFeRDInvoiceImporter
This commit is contained in:
Jochen Staerk
2026-02-04 13:17:53 +01:00
committed by GitHub
3 changed files with 8 additions and 9 deletions

View File

@@ -110,7 +110,7 @@ public class Item implements IZUGFeRDExportableItem {
icnm.getAsBigDecimal("BaseQuantity").ifPresent(this::setBasisQuantity);
});
itemMap.getNode("InvoicedQuantity").ifPresent(icn -> {
itemMap.getNode(new String[]{"InvoicedQuantity", "CreditedQuantity"}).ifPresent(icn -> {
// ubl
setQuantity(new BigDecimal(icn.getTextContent().trim()));
product.setUnit(icn.getAttributes().getNamedItem("unitCode").getNodeValue());

View File

@@ -762,10 +762,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
}
}
}
if (trans.getDocumentCode() != null
&& Arrays.asList(DocumentCodeTypeConstants.CORRECTEDINVOICE, DocumentCodeTypeConstants.CREDITNOTE).contains(trans.getDocumentCode())) {
hasDueDate = false;
}
final List<VATAmount> vatAmounts = calc.getVATAmountList();
for (final VATAmount amount : vatAmounts) {
@@ -1068,7 +1064,10 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
throw new IllegalStateException(
"if paymentTerms.dueDate is specified, paymentTerms.discountTerms.baseDate has not to be specified");
}
paymentTermsXml += "<ram:Description>" + pt.getDescription() + "</ram:Description>";
if(pt.getDescription() != null) {
paymentTermsXml += "<ram:Description>" + pt.getDescription() + "</ram:Description>";
}
if (dueDate != null)
{

View File

@@ -616,7 +616,7 @@ public class ZUGFeRDInvoiceImporter {
// //*[local-name()="Invoice" or local-name()="CreditNote"]
number = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"ID\"]").trim();
potentialCashDiscountTerms = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"PaymentTerms\"]/*[local-name()=\"Note\"]").trim();
typeCode = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"InvoiceTypeCode\"]").trim();
typeCode = extractString("/*[local-name()=\"Invoice\"]/*[local-name()=\"InvoiceTypeCode\"] | /*[local-name()=\"CreditNote\"]/*[local-name()=\"CreditNoteTypeCode\"]").trim();
String issueDateStr = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"IssueDate\"]").trim();
if (!issueDateStr.isEmpty()) {
issueDate = parseDate(issueDateStr, "yyyy-MM-dd");
@@ -633,7 +633,7 @@ public class ZUGFeRDInvoiceImporter {
}
String dueDt = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"DueDate\"]").trim();
String dueDt = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"DueDate\"] | /*[local-name()=\"CreditNote\"]/*[local-name()=\"PaymentMeans\"]/*[local-name()=\"PaymentDueDate\"]").trim();
if (!dueDt.isEmpty()) {
dueDate = parseDate(dueDt, "yyyy-MM-dd");
}
@@ -1097,7 +1097,7 @@ public class ZUGFeRDInvoiceImporter {
zpp.setReferenceNumber(buyerReference);
}
xpr = xpath.compile("//*[local-name()=\"IncludedSupplyChainTradeLineItem\"]|//*[local-name()=\"InvoiceLine\"]");
xpr = xpath.compile("//*[local-name()=\"IncludedSupplyChainTradeLineItem\"]|//*[local-name()=\"InvoiceLine\"]|//*[local-name()=\"CreditNoteLine\"]");
nodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
if (nodes.getLength() != 0) {