Merge branch 'master' into master

This commit is contained in:
Jochen Staerk
2024-11-17 19:49:49 +01:00
committed by GitHub
14 changed files with 482 additions and 521 deletions

View File

@@ -3,7 +3,7 @@
2024-
- 435 use invoiceimporter as common technical basis also for zugferdimporter
- also import delivery address
- 527 metrics raises errors
- 527 metrics may raise error on some pdf files
- 517 read product GlobalID
- 380 Added test for input stream validation
- 518 corrently validate more XRechnung versions
@@ -13,7 +13,9 @@
- 532 support validation warnings!
- 534 new signature
- 538 Mustang validator always claims PDF is invalid if flavour is PDF/A-3A
- 555 be able to validate ubl credit notes
- when parsing now distinguishing between the parseExceptions StructureException and ArithmetricException
- Import IncludedNotes on invoice extraction #554
2.14.2
=======

View File

@@ -0,0 +1,13 @@
package org.mustangproject.Exceptions;
import java.text.ParseException;
/***
* will be thrown if a invoice cant be reproduced numerically
*/
public class ArithmetricException extends ParseException {
public ArithmetricException() {
super(
"Could not reproduce the invoice, this could mean that it could not be read properly", 0);
}
}

View File

@@ -0,0 +1,12 @@
package org.mustangproject.Exceptions;
import java.text.ParseException;
/***
* will be thrown if a invoice cant be read
*/
public class StructureException extends ParseException {
public StructureException(String message, int line) {
super(message, line);
}
}

View File

@@ -23,7 +23,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class TradeParty implements IZUGFeRDExportableTradeParty {
protected String name, zip, street, location, country;
protected String name, zip, street, location, country, taxScheme;
protected String taxID = null, vatID = null;
protected String ID = null;
protected String description = null;
@@ -91,8 +91,46 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
}
}
// UBL only: formally it can have a name as well but BT27 party name *should* be stored in
// so overwrite if one exists
if (currentTopElementName.equals("PartyTaxScheme")) {
NodeList partyTaxScheme = party.item(partyIndex).getChildNodes();
for (int partyTaxSchemeIndex = 0; partyTaxSchemeIndex < partyTaxScheme.getLength(); partyTaxSchemeIndex++) {
if (partyTaxScheme.item(partyTaxSchemeIndex).getLocalName() != null) {
if (partyTaxScheme.item(partyTaxSchemeIndex).getLocalName().equals("CompanyID")) {
setTaxID(partyTaxScheme.item(partyTaxSchemeIndex).getTextContent());
}
}
}
}
// if (currentTopElementName.equals("PartyTaxScheme")) {
// NodeList partyTaxScheme = party.item(partyIndex).getChildNodes();
// for (int partyTaxSchemeIndex = 0; partyTaxSchemeIndex < partyTaxScheme.getLength(); partyTaxSchemeIndex++) {
// if (partyTaxScheme.item(partyTaxSchemeIndex).getLocalName() != null) {
// if (partyTaxScheme.item(partyTaxSchemeIndex).getLocalName().equals("TaxScheme")) {
// NodeList taxScheme = partyTaxScheme.item(partyTaxSchemeIndex).getChildNodes();
// for (int taxSchemeIndex = 0 ; taxSchemeIndex < taxScheme.getLength(); taxSchemeIndex++) {
// if (taxScheme.item(taxSchemeIndex).getLocalName() != null) {
// if(taxScheme.item(taxSchemeIndex).getLocalName().equals("ID")){
// if (partyTaxScheme.item(partyTaxSchemeIndex).getLocalName().equals("CompanyID")) {
// setTaxID(partyTaxScheme.item(partyTaxSchemeIndex).getTextContent());
// } else {
// setVATID(partyTaxScheme.item(partyTaxSchemeIndex).getTextContent());
// }
// }
// }
// }
// }
//
// }
// }
// }
/*
UBL only: formally it can have a name as well but BT27 party name *should* be stored in
so overwrite if one exists
*/
if (currentTopElementName.equals("PartyLegalEntity")) {
NodeList legal = party.item(partyIndex).getChildNodes();
for (int legalChildIndex = 0; legalChildIndex < legal.getLength(); legalChildIndex++) {
@@ -100,6 +138,9 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
if (legal.item(legalChildIndex).getLocalName().equals("RegistrationName")) {
setName(legal.item(legalChildIndex).getTextContent());
}
if (legal.item(legalChildIndex).getLocalName().equals("CompanyLegalForm")) {
setDescription(legal.item(legalChildIndex).getTextContent());
}
}
}
}
@@ -212,26 +253,27 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
}
if (currentUBLChild.equals("SpecifiedTaxRegistration")) {
if (currentUBLChild.equals("PartyTaxScheme")) {
NodeList taxChilds = nodes.item(nodeIndex).getChildNodes();
for (int taxChildIndex = 0; taxChildIndex < taxChilds.getLength(); taxChildIndex++) {
if (taxChilds.item(taxChildIndex).getLocalName() != null) {
if ((taxChilds.item(taxChildIndex).getLocalName().equals("ID"))) {
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("schemeID") != null) {
Node firstChild = taxChilds.item(taxChildIndex).getFirstChild();
if (firstChild != null) {
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("schemeID").getNodeValue().equals("VA")) {
setVATID(firstChild.getNodeValue());
if ((taxChilds.item(taxChildIndex).getLocalName().equals("TaxScheme"))) {
if (taxChilds.item(taxChildIndex).getLocalName().equals("CompanyID")) {
if (taxChilds.item(taxChildIndex).getLocalName().equals("ID")) {
if (taxChilds.item(taxChildIndex).getLocalName().equals("CompanyID")) {
setVATID(taxChilds.item(taxChildIndex).getTextContent());
}
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("schemeID").getNodeValue().equals("FC")) {
setTaxID(firstChild.getNodeValue());
// setTaxID(partyTaxScheme.item(partyTaxSchemeIndex).getTextContent());
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("ID").getNodeValue().equals("FC")) {
if (taxChilds.item(taxChildIndex).getLocalName().equals("CompanyID")) {
setTaxID(taxChilds.item(taxChildIndex).getTextContent());
}
}
}
}
}
}
}
}
}
}

View File

@@ -54,15 +54,6 @@ public class ZUGFeRDImporter extends ZUGFeRDInvoiceImporter {
}
/***
* Wrapper for protected method extractString
* @param xpathStr the xpath expression to be evaluated
* @return the extracted String for the specific path in the document
*/
public String wExtractString(String xpathStr) {
return extractString(xpathStr);
}
////////////////////////////////////

View File

@@ -9,6 +9,8 @@ import org.apache.pdfbox.pdmodel.common.PDNameTreeNode;
import org.apache.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification;
import org.apache.pdfbox.pdmodel.common.filespecification.PDEmbeddedFile;
import org.mustangproject.*;
import org.mustangproject.Exceptions.ArithmetricException;
import org.mustangproject.Exceptions.StructureException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
@@ -352,6 +354,34 @@ public class ZUGFeRDInvoiceImporter {
}
}
}
List<IncludedNote> includedNotes = new ArrayList<>();
if ((item.getLocalName() != null) && (item.getLocalName().equals("IncludedNote"))) {
String subjectCode = "";
String content = null;
NodeList includedNodeChilds = item.getChildNodes();
for (int issueDateChildIndex = 0; issueDateChildIndex < includedNodeChilds.getLength(); issueDateChildIndex++) {
if ((includedNodeChilds.item(issueDateChildIndex).getLocalName() != null)
&& (includedNodeChilds.item(issueDateChildIndex).getLocalName().equals("Content"))) {
content = XMLTools.trimOrNull(includedNodeChilds.item(issueDateChildIndex));
}
if ((includedNodeChilds.item(issueDateChildIndex).getLocalName() != null)
&& (includedNodeChilds.item(issueDateChildIndex).getLocalName().equals("SubjectCode"))) {
subjectCode = XMLTools.trimOrNull(includedNodeChilds.item(issueDateChildIndex));
}
}
switch (subjectCode){
case "AAI": includedNotes.add(IncludedNote.generalNote(content)); break;
case "REG": includedNotes.add(IncludedNote.regulatoryNote(content)); break;
case "ABL": includedNotes.add(IncludedNote.legalNote(content)); break;
case "CUS": includedNotes.add(IncludedNote.customsNote(content)); break;
case "SUR": includedNotes.add(IncludedNote.sellerNote(content)); break;
case "TXD": includedNotes.add(IncludedNote.taxNote(content)); break;
case "ACY": includedNotes.add(IncludedNote.introductionNote(content)); break;
case "AAK": includedNotes.add(IncludedNote.discountBonusNote(content)); break;
default: includedNotes.add(IncludedNote.unspecifiedNote(content)); break;
}
}
zpp.addNotes(includedNotes);
}
}
String rootNode = extractString("local-name(/*)");
@@ -440,7 +470,8 @@ public class ZUGFeRDInvoiceImporter {
}
String currency = extractString("//*[local-name()=\"ApplicableHeaderTradeSettlement\"]/*[local-name()=\"InvoiceCurrencyCode\"]|*[local-name()=\"DocumentCurrencyCode\"]");
String currency = extractString("//*[local-name()=\"ApplicableHeaderTradeSettlement\"]/*[local-name()=\"InvoiceCurrencyCode\"]|//*[local-name()=\"DocumentCurrencyCode\"]") ;
zpp.setCurrency(currency);
xpr = xpath.compile("//*[local-name()=\"ApplicableHeaderTradeSettlement\"]|//*[local-name()=\"ApplicableSupplyChainTradeSettlement\"]");
@@ -578,6 +609,9 @@ public class ZUGFeRDInvoiceImporter {
if (buyerOrderIssuerAssignedID != null) {
zpp.setBuyerOrderReferencedDocumentID(buyerOrderIssuerAssignedID);
}
else {
zpp.setBuyerOrderReferencedDocumentID(extractString("//*[local-name()=\"OrderReference\"]/*[local-name()=\"ID\"]"));
}
if (sellerOrderIssuerAssignedID != null) {
zpp.setSellerOrderReferencedDocumentID(sellerOrderIssuerAssignedID);
}
@@ -697,15 +731,13 @@ public class ZUGFeRDInvoiceImporter {
try {
whichType = getStandard();
} catch (Exception e) {
throw new ParseException("Could not find out if it's an invoice, order, or delivery advice", 0);
throw new StructureException("Could not find out if it's an invoice, order, or delivery advice", 0);
}
if ((whichType != EStandard.despatchadvice)
&& ((!expectedStringTotalGross.equals(XMLTools.nDigitFormat(expectedGrandTotal, 2)))
&& (!ignoreCalculationErrors))) {
throw new ParseException(
"Could not reproduce the invoice, this could mean that it could not be read properly", 0);
throw new ArithmetricException();
}
}
return zpp;

View File

@@ -249,6 +249,12 @@ public class ZUGFeRDVisualizer {
EStandard theStandard = findOutStandardFromRootNode(fis);
fis = new FileInputStream(xmlFilename);//rewind :-(
return toFOP(fis, theStandard);
}
protected String toFOP(InputStream is, EStandard theStandard)
throws FileNotFoundException, TransformerException {
try {
if (mXsltPDFTemplate == null) {
mXsltPDFTemplate = mFactory.newTemplates(
@@ -263,11 +269,11 @@ public class ZUGFeRDVisualizer {
//zf2 or fx
if (theStandard == EStandard.facturx) {
applyZF2XSLT(fis, iaos);
applyZF2XSLT(is, iaos);
} else if (theStandard == EStandard.ubl) {
applyUBL2XSLT(fis, iaos);
applyUBL2XSLT(is, iaos);
} else if (theStandard == EStandard.ubl_creditnote) {
applyUBLCreditNote2XSLT(fis, iaos);
applyUBLCreditNote2XSLT(is, iaos);
}

View File

@@ -1,431 +0,0 @@
/**
* *********************************************************************
* <p>
* Copyright 2019 Jochen Staerk
* <p>
* Use is subject to license terms.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* <p>
* See the License for the specific language governing permissions and
* limitations under the License.
* <p>
* **********************************************************************
*/
package org.mustangproject.ZUGFeRD;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.mustangproject.*;
import javax.xml.xpath.XPathExpressionException;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
/***
* Classname ZF2ZInvoiceImporterTest is alphabetical behind the tests which will create the file
* used for this import, testout-ZF2New.pdf
*/
public class ZF2ZInvoiceImporterTest extends ResourceCase {
public void testInvoiceImport() {
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("./target/testout-ZF2new.pdf");
boolean hasExceptions = false;
Invoice invoice = null;
try {
invoice = zii.extractInvoice();
} catch (XPathExpressionException | ParseException e) {
hasExceptions = true;
}
assertFalse(hasExceptions);
// Reading ZUGFeRD
assertEquals("Bei Spiel GmbH", invoice.getOwnOrganisationName());
assertEquals(3, invoice.getZFItems().length);
assertEquals("400.0000", invoice.getZFItems()[1].getQuantity().toString());
assertEquals("AB321", invoice.getReferenceNumber());
assertEquals("160.0000", invoice.getZFItems()[0].getPrice().toString());
assertEquals("Heiße Luft pro Liter", invoice.getZFItems()[2].getProduct().getName());
assertEquals("LTR", invoice.getZFItems()[2].getProduct().getUnit());
assertEquals("7.00", invoice.getZFItems()[0].getProduct().getVATPercent().toString());
assertEquals("RE-20170509/505", invoice.getNumber());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
assertEquals("2017-05-09", sdf.format(invoice.getIssueDate()));
assertEquals("2017-05-07", sdf.format(invoice.getDeliveryDate()));
assertEquals("2017-05-30", sdf.format(invoice.getDueDate()));
assertEquals("Bahnstr. 42", invoice.getRecipient().getStreet());
assertEquals("Hinterhaus", invoice.getRecipient().getAdditionalAddress());
assertEquals("Zweiter Stock", invoice.getRecipient().getAdditionalAddressExtension());
assertEquals("88802", invoice.getRecipient().getZIP());
assertEquals("DE", invoice.getRecipient().getCountry());
assertEquals("Spielkreis", invoice.getRecipient().getLocation());
assertEquals("Ecke 12", invoice.getSender().getStreet());
assertEquals("12345", invoice.getSender().getZIP());
assertEquals("DE", invoice.getSender().getCountry());
assertEquals("Stadthausen", invoice.getSender().getLocation());
TransactionCalculator tc = new TransactionCalculator(invoice);
assertEquals(new BigDecimal("571.04"), tc.getGrandTotal());
// name street location zip country, contact name phone email, total amount
}
public void testInvoiceImportUBL() {
boolean hasExceptions = false;
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter();
File expectedResult = getResourceAsFile("testout-ZF2new.ubl.xml");
Invoice invoice = null;
try {
String xml = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8).replace("\r", "").replace("\n", "");
zii.fromXML(xml);
invoice = zii.extractInvoice();
} catch (XPathExpressionException | ParseException | IOException e) {
hasExceptions = true;
}
assertFalse(hasExceptions);
// Reading ZUGFeRD
assertEquals("Bei Spiel GmbH", invoice.getOwnOrganisationName());
assertEquals(3, invoice.getZFItems().length);
assertEquals("400", invoice.getZFItems()[1].getQuantity().toString());
assertEquals("AB321", invoice.getReferenceNumber());
assertEquals("160", invoice.getZFItems()[0].getPrice().toString());
assertEquals("Heiße Luft pro Liter", invoice.getZFItems()[2].getProduct().getName());
assertEquals("LTR", invoice.getZFItems()[2].getProduct().getUnit());
assertEquals("7", invoice.getZFItems()[0].getProduct().getVATPercent().toString());
assertEquals("RE-20170509/505", invoice.getNumber());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
assertEquals("2017-05-09", sdf.format(invoice.getIssueDate()));
assertEquals("2017-05-07", sdf.format(invoice.getDeliveryDate()));
assertEquals("2017-05-30", sdf.format(invoice.getDueDate()));
assertEquals("Bahnstr. 42", invoice.getRecipient().getStreet());
assertEquals("Hinterhaus", invoice.getRecipient().getAdditionalAddress());
assertEquals("Zweiter Stock", invoice.getRecipient().getAdditionalAddressExtension());
assertEquals("88802", invoice.getRecipient().getZIP());
assertEquals("DE", invoice.getRecipient().getCountry());
assertEquals("Spielkreis", invoice.getRecipient().getLocation());
assertEquals("Ecke 12", invoice.getSender().getStreet());
assertEquals("12345", invoice.getSender().getZIP());
assertEquals("DE", invoice.getSender().getCountry());
assertEquals("Stadthausen", invoice.getSender().getLocation());
assertTrue(invoice.getPayee() != null);
assertEquals("VR Factoring GmbH", invoice.getPayee().getName());
TransactionCalculator tc = new TransactionCalculator(invoice);
assertEquals(new BigDecimal("571.04"), tc.getGrandTotal());
// name street location zip country, contact name phone email, total amount
}
public void testEdgeInvoiceImport() {
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("./target/testout-ZF2PushEdge.pdf");
boolean hasExceptions = false;
Invoice invoice = null;
try {
invoice = zii.extractInvoice();
} catch (XPathExpressionException | ParseException e) {
hasExceptions = true;
}
assertFalse(hasExceptions);
// Reading ZUGFeRD
assertEquals("4711", invoice.getZFItems()[0].getProduct().getSellerAssignedID());
assertEquals("9384", invoice.getSellerOrderReferencedDocumentID());
assertEquals("sender@test.org", invoice.getSender().getEmail());
assertEquals("recipient@test.org", invoice.getRecipient().getEmail());
assertEquals("28934", invoice.getBuyerOrderReferencedDocumentID());
}
public void testZF1Import() {
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("./target/testout-MustangGnuaccountingBeispielRE-20171118_506zf1.pdf");
boolean hasExceptions = false;
Invoice invoice = null;
try {
invoice = zii.extractInvoice();
} catch (XPathExpressionException | ParseException e) {
hasExceptions = true;
}
assertFalse(hasExceptions);
// Reading ZUGFeRD
assertEquals("Bei Spiel GmbH", invoice.getOwnOrganisationName());
assertEquals(3, invoice.getZFItems().length);
assertEquals("400.0000", invoice.getZFItems()[1].getQuantity().toString());
assertEquals("160.0000", invoice.getZFItems()[0].getPrice().toString());
assertEquals("Hot air „heiße Luft“ (litres)", invoice.getZFItems()[2].getProduct().getName());
assertEquals("LTR", invoice.getZFItems()[2].getProduct().getUnit());
assertEquals("7.00", invoice.getZFItems()[0].getProduct().getVATPercent().toString());
assertEquals("RE-20190610/507", invoice.getNumber());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
assertEquals("2019-06-10", sdf.format(invoice.getIssueDate()));
assertEquals("2019-07-01", sdf.format(invoice.getDueDate()));
assertEquals("street", invoice.getRecipient().getStreet());
assertEquals("zip", invoice.getRecipient().getZIP());
assertEquals("DE", invoice.getRecipient().getCountry());
assertEquals("city", invoice.getRecipient().getLocation());
assertEquals("street", invoice.getSender().getStreet());
assertEquals("zip", invoice.getSender().getZIP());
assertEquals("DE", invoice.getSender().getCountry());
assertEquals("city", invoice.getSender().getLocation());
TransactionCalculator tc = new TransactionCalculator(invoice);
assertEquals(new BigDecimal("571.04"), tc.getGrandTotal());
// name street location zip country, contact name phone email, total amount
}
public void testItemAllowancesChargesImport() {
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("./target/testout-ZF2PushItemChargesAllowances.pdf");
boolean hasExceptions = false;
Invoice invoice = null;
try {
invoice = zii.extractInvoice();
} catch (XPathExpressionException | ParseException e) {
hasExceptions = true;
}
assertFalse(hasExceptions);
TransactionCalculator tc = new TransactionCalculator(invoice);
assertEquals(new BigDecimal("18.33"), tc.getGrandTotal());
}
public void testBasisQuantityImport() {
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("./target/testout-ZF2newEdge.pdf");
boolean hasExceptions = false;
Invoice invoice = null;
try {
invoice = zii.extractInvoice();
} catch (XPathExpressionException | ParseException e) {
hasExceptions = true;
}
assertFalse(hasExceptions);
TransactionCalculator tc = new TransactionCalculator(invoice);
assertEquals(new BigDecimal("337.60"), tc.getGrandTotal());
}
public void testAllowancesChargesImport() {
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("./target/testout-ZF2PushChargesAllowances.pdf");
boolean hasExceptions = false;
Invoice invoice = null;
try {
invoice = zii.extractInvoice();
} catch (XPathExpressionException | ParseException e) {
hasExceptions = true;
}
assertFalse(hasExceptions);
TransactionCalculator tc = new TransactionCalculator(invoice);
assertEquals(new BigDecimal("11.07"), tc.getGrandTotal());
}
public void testXRImport() {
boolean hasExceptions = false;
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter();
try {
zii.fromXML(new String(Files.readAllBytes(Paths.get("./target/testout-XR-Edge.xml")), StandardCharsets.UTF_8));
} catch (IOException e) {
hasExceptions = true;
}
Invoice invoice = null;
try {
invoice = zii.extractInvoice();
} catch (XPathExpressionException | ParseException e) {
hasExceptions = true;
}
assertFalse(hasExceptions);
TransactionCalculator tc = new TransactionCalculator(invoice);
assertEquals(new BigDecimal("1.00"), tc.getGrandTotal());
assertTrue(invoice.getTradeSettlement().length==1);
assertTrue(invoice.getTradeSettlement()[0] instanceof IZUGFeRDTradeSettlementPayment);
IZUGFeRDTradeSettlementPayment paym=(IZUGFeRDTradeSettlementPayment)invoice.getTradeSettlement()[0];
assertEquals("DE12500105170648489890", paym.getOwnIBAN());
assertEquals("COBADEFXXX", paym.getOwnBIC());
assertTrue(invoice.getPayee() != null);
assertEquals("VR Factoring GmbH", invoice.getPayee().getName());
}
/**
* testing if other files embedded in pdf additionally to the invoice can be read correctly
* */
public void testDetach() {
boolean hasExceptions = false;
byte[] fileA=null;
byte[] fileB=null;
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("./target/testout-ZF2PushAttachments.pdf");
for (FileAttachment fa:zii.getFileAttachmentsPDF()) {
if (fa.getFilename().equals("one.pdf")) {
fileA=fa.getData();
} else if (fa.getFilename().equals("two.pdf")) {
fileB=fa.getData();
}
}
byte[] b = {12, 13}; // the sample data that was used to write the files
assertTrue(Arrays.equals(fileA, b));
assertEquals(fileA.length, 2);
assertTrue(Arrays.equals(fileB, b));
assertEquals(fileB.length, 2);
}
public void testImportDebit() {
File CIIinputFile = getResourceAsFile("cii/minimalDebit.xml");
try {
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(CIIinputFile));
Invoice i=zii.extractInvoice();
assertEquals("DE21860000000086001055", i.getSender().getBankDetails().get(0).getIBAN());
ObjectMapper mapper = new ObjectMapper();
String jsonArray = mapper.writeValueAsString(i);
// assertEquals("",jsonArray);
} catch (IOException e) {
fail("IOException not expected");
} catch (XPathExpressionException e) {
throw new RuntimeException(e);
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
public void testImportMinimum() {
File CIIinputFile = getResourceAsFile("cii/facturFrMinimum.xml");
try {
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(CIIinputFile));
CalculatedInvoice i=new CalculatedInvoice();
zii.extractInto(i);
assertEquals("671.15", i.getGrandTotal().toString());
} catch (IOException e) {
fail("IOException not expected");
} catch (XPathExpressionException e) {
throw new RuntimeException(e);
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
public void testEEISI_300_cii_Import() throws XPathExpressionException, ParseException {
boolean hasExceptions = false;
File inputCII = getResourceAsFile("not_validating_full_invoice_based_onTest_EeISI_300_CENfullmodel.cii.xml");
File inputUBL = getResourceAsFile("not_validating_full_invoice_based_onTest_EeISI_300_CENfullmodel.ubl.xml");
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter();
try {
zii.fromXML(new String(Files.readAllBytes(inputCII.toPath()), StandardCharsets.UTF_8));
} catch (IOException e) {
hasExceptions = true;
}
Invoice invoiceUBL = null;
invoiceUBL = zii.extractInvoice();
try {
zii.fromXML(new String(Files.readAllBytes(inputUBL.toPath()), StandardCharsets.UTF_8));
} catch (IOException e) {
hasExceptions = true;
}
Invoice invoiceCII = null;
try {
invoiceCII = zii.extractInvoice();
ObjectMapper mapper = new ObjectMapper();
String ubl=mapper.writeValueAsString(invoiceUBL);
String cii=mapper.writeValueAsString(invoiceCII);
assertEquals(cii,ubl);
/*
<cbc:Name>Seller contact point</cbc:Name>
<cbc:Telephone>+41 345 654455</cbc:Telephone>
<cbc:ElectronicMail>seller@contact.de);*/
} catch (XPathExpressionException | ParseException e) {
hasExceptions = true;
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
assertFalse(hasExceptions);
TransactionCalculator tc = new TransactionCalculator(invoiceCII);
assertEquals(new BigDecimal("205.00"), tc.getGrandTotal());
}
}

View File

@@ -22,9 +22,8 @@ package org.mustangproject.ZUGFeRD;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.mustangproject.CalculatedInvoice;
import org.mustangproject.FileAttachment;
import org.mustangproject.Invoice;
import org.junit.jupiter.api.Test;
import org.mustangproject.*;
import javax.xml.xpath.XPathExpressionException;
import java.io.File;
@@ -37,6 +36,10 @@ import java.nio.file.Paths;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
/***
@@ -352,8 +355,7 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
}
public void testImportMinimum() {
public void testImportMinimum() {
File CIIinputFile = getResourceAsFile("cii/facturFrMinimum.xml");
try {
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(CIIinputFile));
@@ -373,59 +375,25 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
}
/*
this would test if for all elements/attributes
*/
public void testEEISI_300_cii_Import() throws XPathExpressionException, ParseException {
boolean hasExceptions = false;
File inputCII = getResourceAsFile("not_validating_full_invoice_based_onTest_EeISI_300_CENfullmodel.cii.xml");
File inputUBL = getResourceAsFile("not_validating_full_invoice_based_onTest_EeISI_300_CENfullmodel.ubl.xml");
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter();
try {
zii.fromXML(new String(Files.readAllBytes(inputCII.toPath()), StandardCharsets.UTF_8));
} catch (IOException e) {
hasExceptions = true;
}
Invoice invoiceUBL = null;
invoiceUBL = zii.extractInvoice();
try {
zii.fromXML(new String(Files.readAllBytes(inputUBL.toPath()), StandardCharsets.UTF_8));
} catch (IOException e) {
hasExceptions = true;
}
Invoice invoiceCII = null;
try {
invoiceCII = zii.extractInvoice();
ObjectMapper mapper = new ObjectMapper();
String ubl = mapper.writeValueAsString(invoiceUBL);
String cii = mapper.writeValueAsString(invoiceCII);
//assertEquals(cii,ubl);
/*
<cbc:Name>Seller contact point</cbc:Name>
<cbc:Telephone>+41 345 654455</cbc:Telephone>
<cbc:ElectronicMail>seller@contact.de);*
} catch (XPathExpressionException | ParseException e) {
hasExceptions = true;
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
assertFalse(hasExceptions);
TransactionCalculator tc = new TransactionCalculator(invoiceCII);
assertEquals(new BigDecimal("205.00"), tc.getGrandTotal());
@Test
public void testImportIncludedNotes() throws XPathExpressionException, ParseException {
InputStream inputStream = this.getClass()
.getResourceAsStream("/EN16931_Einfach.pdf");
ZUGFeRDInvoiceImporter importer = new ZUGFeRDInvoiceImporter(inputStream);
Invoice invoice = importer.extractInvoice();
List<IncludedNote> notesWithSubjectCode = invoice.getNotesWithSubjectCode();
assertThat(notesWithSubjectCode).hasSize(2);
assertThat(notesWithSubjectCode.get(0).getSubjectCode()).isNull();
assertThat(notesWithSubjectCode.get(0).getContent()).isEqualTo("Rechnung gemäß Bestellung vom 01.11.2024.");
assertThat(notesWithSubjectCode.get(1).getSubjectCode()).isEqualTo(SubjectCode.REG);
assertThat(notesWithSubjectCode.get(1).getContent()).isEqualTo("Lieferant GmbH\t\t\t\t\n"
+ "Lieferantenstraße 20\t\t\t\t\n"
+ "80333 München\t\t\t\t\n"
+ "Deutschland\t\t\t\t\n"
+ "Geschäftsführer: Hans Muster\n"
+ "Handelsregisternummer: H A 123");
}
*/
}

Binary file not shown.

View File

@@ -269,13 +269,13 @@ public class XMLValidator extends Validator {
// saxon java net.sf.saxon.Transform -o tcdl2.0.tsdtf.sch.tmp.xsl -s
// tcdl2.0.tsdtf.sch iso_svrl.xsl
} else if (root.getLocalName().equalsIgnoreCase("Invoice")) {
} else if (root.getLocalName().equalsIgnoreCase("Invoice") || root.getLocalName().equalsIgnoreCase("CreditNote") ) {
context.setGeneration("2");
context.setFormat("UBL");
isXRechnung = context.getProfile().contains("xrechnung");
// UBL
LOGGER.debug("UBL");
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "UBL_21/maindoc/UBL-Invoice-2.1.xsd", 18, EPart.fx);
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "UBL_21/maindoc/UBL-"+root.getLocalName()+"-2.1.xsd", 18, EPart.fx);
xsltFilename = "/xslt/en16931schematron/EN16931-UBL-validation.xslt";
mainSchematronSectionErrorTypeCode=24;

View File

@@ -204,6 +204,36 @@ public class XMLValidatorTest extends ResourceCase {
}
public void testXRCIIPeppolFailureValidation() {
final ValidationContext ctx = new ValidationContext(null);
final XMLValidator xv = new XMLValidator(ctx);
final XPathEngine xpath = new JAXPXPathEngine();
// GIVEN XRechnung CII with Peppol rule violation
File file = getResourceAsFile("CII_XRechnung_with_Peppol_violation.xml");
boolean noExceptions = true;
try {
xv.setFilename(file.getAbsolutePath());
// WHEN validated
xv.validate();
Source source = Input.fromString("<validation>" + xv.getXMLResult() + "</validation>").build();
// THEN validation returns only warning message
boolean onlyWarnings = Boolean.parseBoolean(xpath.evaluate("not(//messages/*[not(self::warning)])", source));
assertTrue(onlyWarnings);
// THEN validation returns summary status valid
String status = xpath.evaluate("/validation/summary/@status", source);
assertEquals("valid", status);
} catch (IrrecoverableValidationError e) {
noExceptions = false;
}
assertTrue(noExceptions);
}
public void testXRValidation() {
final ValidationContext ctx = new ValidationContext(null);
final XMLValidator xv = new XMLValidator(ctx);
@@ -298,6 +328,22 @@ public class XMLValidatorTest extends ResourceCase {
noExceptions = false;
}
assertTrue(noExceptions);
tempFile = getResourceAsFile("ubl-tc434-creditnote1.xml");
try {
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
Source source = Input.fromString("<validation>" + xv.getXMLResult() + "</validation>").build();
String content = xpath.evaluate("/validation/summary/@status", source);
assertEquals("valid", content);
} catch (IrrecoverableValidationError e) {
noExceptions = false;
}
assertTrue(noExceptions);
}

View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<rsm:CrossIndustryInvoice xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100">
<rsm:ExchangedDocumentContext>
<ram:BusinessProcessSpecifiedDocumentContextParameter>
<ram:ID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</ram:ID>
</ram:BusinessProcessSpecifiedDocumentContextParameter>
<ram:GuidelineSpecifiedDocumentContextParameter>
<ram:ID>urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0</ram:ID>
</ram:GuidelineSpecifiedDocumentContextParameter>
</rsm:ExchangedDocumentContext>
<rsm:ExchangedDocument>
<ram:ID>RE0021</ram:ID>
<ram:TypeCode>380</ram:TypeCode>
<ram:IssueDateTime>
<udt:DateTimeString format="102">20241002</udt:DateTimeString>
</ram:IssueDateTime>
<ram:IncludedNote>
<ram:Content>Rechnung</ram:Content>
<ram:SubjectCode>AFM</ram:SubjectCode>
</ram:IncludedNote>
<ram:IncludedNote>
<ram:Content>Unsere Lieferungen/Leistungen stellen wir Ihnen wie folgt in Rechnung.</ram:Content>
<ram:SubjectCode>AAI</ram:SubjectCode>
</ram:IncludedNote>
<ram:IncludedNote>
<ram:Content>Vielen Dank für die gute Zusammenarbeit.</ram:Content>
<ram:SubjectCode>SUR</ram:SubjectCode>
</ram:IncludedNote>
</rsm:ExchangedDocument>
<rsm:SupplyChainTradeTransaction>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>1</ram:LineID>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:Name>1</ram:Name>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>140.0000</ram:ChargeAmount>
<ram:BasisQuantity unitCode="H87">1.0000</ram:BasisQuantity>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="H87">1.0000</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>140.00</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:ApplicableHeaderTradeAgreement>
<ram:BuyerReference>992-90009-96</ram:BuyerReference>
<ram:SellerTradeParty>
<ram:ID>231132</ram:ID>
<ram:Name>Max Muster</ram:Name>
<ram:DefinedTradeContact>
<ram:PersonName>Max Muster</ram:PersonName>
<ram:TelephoneUniversalCommunication>
<ram:CompleteNumber>0192435345</ram:CompleteNumber>
</ram:TelephoneUniversalCommunication>
<ram:EmailURIUniversalCommunication>
<ram:URIID>muster@example.com</ram:URIID>
</ram:EmailURIUniversalCommunication>
</ram:DefinedTradeContact>
<ram:PostalTradeAddress>
<ram:PostcodeCode>12345</ram:PostcodeCode>
<ram:LineOne>Straße</ram:LineOne>
<ram:CityName>Stadt</ram:CityName>
<ram:CountryID>DE</ram:CountryID>
</ram:PostalTradeAddress>
<ram:URIUniversalCommunication>
<ram:URIID schemeID="EM">muster@example.com</ram:URIID>
</ram:URIUniversalCommunication>
<ram:SpecifiedTaxRegistration>
<ram:ID schemeID="FC">DE99999/99999</ram:ID>
</ram:SpecifiedTaxRegistration>
<ram:SpecifiedTaxRegistration>
<ram:ID schemeID="VA">DE325845615</ram:ID>
</ram:SpecifiedTaxRegistration>
</ram:SellerTradeParty>
<ram:BuyerTradeParty>
<ram:Name>KUnde</ram:Name>
<ram:PostalTradeAddress>
<ram:PostcodeCode>12345</ram:PostcodeCode>
<ram:LineOne>Straße</ram:LineOne>
<ram:CityName>Stadt</ram:CityName>
<ram:CountryID>DE</ram:CountryID>
</ram:PostalTradeAddress>
</ram:BuyerTradeParty>
</ram:ApplicableHeaderTradeAgreement>
<ram:ApplicableHeaderTradeDelivery>
<ram:ActualDeliverySupplyChainEvent>
<ram:OccurrenceDateTime>
<udt:DateTimeString format="102">20241002</udt:DateTimeString>
</ram:OccurrenceDateTime>
</ram:ActualDeliverySupplyChainEvent>
</ram:ApplicableHeaderTradeDelivery>
<ram:ApplicableHeaderTradeSettlement>
<ram:PaymentReference>RE0021</ram:PaymentReference>
<ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
<ram:SpecifiedTradeSettlementPaymentMeans>
<ram:TypeCode>1</ram:TypeCode>
<ram:Information>Überweisung</ram:Information>
<ram:PayeePartyCreditorFinancialAccount>
<ram:IBANID>DE50110101002129646573</ram:IBANID>
<ram:AccountName>Max Muster</ram:AccountName>
</ram:PayeePartyCreditorFinancialAccount>
<ram:PayeeSpecifiedCreditorFinancialInstitution>
<ram:BICID>BEVODEBBXXX</ram:BICID>
</ram:PayeeSpecifiedCreditorFinancialInstitution>
</ram:SpecifiedTradeSettlementPaymentMeans>
<ram:ApplicableTradeTax>
<ram:CalculatedAmount>26.60</ram:CalculatedAmount>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:BasisAmount>140.00</ram:BasisAmount>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradePaymentTerms>
<ram:Description>Zahlbar sofort, rein netto</ram:Description>
<ram:DueDateDateTime>
<udt:DateTimeString format="102">20241002</udt:DateTimeString>
</ram:DueDateDateTime>
</ram:SpecifiedTradePaymentTerms>
<ram:SpecifiedTradeSettlementHeaderMonetarySummation>
<ram:LineTotalAmount>140.00</ram:LineTotalAmount>
<ram:ChargeTotalAmount>0.00</ram:ChargeTotalAmount>
<ram:AllowanceTotalAmount>0.00</ram:AllowanceTotalAmount>
<ram:TaxBasisTotalAmount>140.00</ram:TaxBasisTotalAmount>
<ram:TaxTotalAmount currencyID="EUR">26.60</ram:TaxTotalAmount>
<ram:GrandTotalAmount>166.60</ram:GrandTotalAmount>
<ram:TotalPrepaidAmount>0.00</ram:TotalPrepaidAmount>
<ram:DuePayableAmount>166.60</ram:DuePayableAmount>
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
</ram:ApplicableHeaderTradeSettlement>
</rsm:SupplyChainTradeTransaction>
</rsm:CrossIndustryInvoice>

View File

@@ -0,0 +1,136 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!--
Licensed under European Union Public Licence (EUPL) version 1.2.
-->
<CreditNote xmlns="urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
<cbc:CustomizationID>urn:cen.eu:en16931:2017</cbc:CustomizationID>
<cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
<cbc:ID>018304 / 28865</cbc:ID>
<cbc:IssueDate>2019-09-23</cbc:IssueDate>
<cbc:CreditNoteTypeCode>381</cbc:CreditNoteTypeCode>
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
<cbc:BuyerReference>018304 / 28865</cbc:BuyerReference>
<cac:InvoicePeriod>
<cbc:StartDate>2019-02-01</cbc:StartDate>
<cbc:EndDate>2019-02-28</cbc:EndDate>
</cac:InvoicePeriod>
<cac:AccountingSupplierParty>
<cac:Party>
<cbc:EndpointID schemeID="0201">0000000196</cbc:EndpointID>
<cac:PartyName>
<cbc:Name>My Supplier Company N.V.</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>De Grote Meir 22</cbc:StreetName>
<cbc:CityName>ANTWERPEN</cbc:CityName>
<cbc:PostalZone>2000</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>BE</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
<cac:PartyTaxScheme>
<cbc:CompanyID>BE0000000196</cbc:CompanyID>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:PartyTaxScheme>
<cac:PartyLegalEntity>
<cbc:RegistrationName>My Supplier Company</cbc:RegistrationName>
<cbc:CompanyID>0000000196</cbc:CompanyID>
</cac:PartyLegalEntity>
<cac:Contact>
<cbc:ElectronicMail>john.doole@mysuppliercompany.be</cbc:ElectronicMail>
</cac:Contact>
</cac:Party>
</cac:AccountingSupplierParty>
<cac:AccountingCustomerParty>
<cac:Party>
<cbc:EndpointID schemeID="0201">0000000295</cbc:EndpointID>
<cac:PartyName>
<cbc:Name>My Customer Company S.A.</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>Boulevard Sint Michel 53</cbc:StreetName>
<cbc:CityName>BRUXELLES</cbc:CityName>
<cbc:PostalZone>1000</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>BE</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
<cac:PartyTaxScheme>
<cbc:CompanyID>BE0000000295</cbc:CompanyID>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:PartyTaxScheme>
<cac:PartyLegalEntity>
<cbc:RegistrationName>My Customer Company</cbc:RegistrationName>
<cbc:CompanyID>0000000295</cbc:CompanyID>
</cac:PartyLegalEntity>
<cac:Contact>
<cbc:ElectronicMail>pete.smith@mycustomercompany.be</cbc:ElectronicMail>
</cac:Contact>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:PaymentMeans>
<cbc:PaymentMeansCode>1</cbc:PaymentMeansCode>
<cbc:PaymentID>010676609538</cbc:PaymentID>
<cac:PayeeFinancialAccount>
<cbc:ID>BE91000000143476</cbc:ID>
<cac:FinancialInstitutionBranch>
<cbc:ID>BPOTBEB1</cbc:ID>
</cac:FinancialInstitutionBranch>
</cac:PayeeFinancialAccount>
</cac:PaymentMeans>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="EUR">0.00</cbc:TaxAmount>
<cac:TaxSubtotal>
<cbc:TaxableAmount currencyID="EUR">100.11</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="EUR">0.00</cbc:TaxAmount>
<cac:TaxCategory>
<cbc:ID>E</cbc:ID>
<cbc:Percent>0.00</cbc:Percent>
<cbc:TaxExemptionReason>Taxes are not applicable</cbc:TaxExemptionReason>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
<cac:LegalMonetaryTotal>
<cbc:LineExtensionAmount currencyID="EUR">100.11</cbc:LineExtensionAmount>
<cbc:TaxExclusiveAmount currencyID="EUR">100.11</cbc:TaxExclusiveAmount>
<cbc:TaxInclusiveAmount currencyID="EUR">100.11</cbc:TaxInclusiveAmount>
<cbc:PayableAmount currencyID="EUR">100.11</cbc:PayableAmount>
</cac:LegalMonetaryTotal>
<cac:CreditNoteLine>
<cbc:ID>1</cbc:ID>
<cbc:CreditedQuantity unitCode="C62">1.00</cbc:CreditedQuantity>
<cbc:LineExtensionAmount currencyID="EUR">100.11</cbc:LineExtensionAmount>
<cac:Item>
<cbc:Description>Exonération du versement du PP</cbc:Description>
<cbc:Name>Exonération du versement du PP</cbc:Name>
<cac:SellersItemIdentification>
<cbc:ID>V55</cbc:ID>
</cac:SellersItemIdentification>
<cac:ClassifiedTaxCategory>
<cbc:ID>E</cbc:ID>
<cbc:Percent>0.00</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:ClassifiedTaxCategory>
<cac:AdditionalItemProperty>
<cbc:Name>2</cbc:Name>
<cbc:Value>Contributions - précompte professionnel</cbc:Value>
</cac:AdditionalItemProperty>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="EUR">100.11</cbc:PriceAmount>
</cac:Price>
</cac:CreditNoteLine>
</CreditNote>