Item: add BillingSpecifiedPeriod
parses SpecifiedLineTradeSettlement->BillingSpecifiedPeriod to detailedDeliveryPeriod also fix parser for multiple ApplicableProductCharacteristics
This commit is contained in:
@@ -206,6 +206,12 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
icnm.getAllNodes("AdditionalReferencedDocument").map(ReferencedDocument::fromNode).forEach(this::addAdditionalReference);
|
icnm.getAllNodes("AdditionalReferencedDocument").map(ReferencedDocument::fromNode).forEach(this::addAdditionalReference);
|
||||||
|
|
||||||
|
icnm.getAsNodeMap("BillingSpecifiedPeriod").ifPresent(periodNode -> {
|
||||||
|
Date start = periodNode.getAsNodeMap("StartDateTime").flatMap(dateTimeNode -> dateTimeNode.getNode("DateTimeString")).map(dts -> XMLTools.tryDate(dts)).orElse(null);
|
||||||
|
Date end = periodNode.getAsNodeMap("EndDateTime").flatMap(dateTimeNode -> dateTimeNode.getNode("DateTimeString")).map(dts -> XMLTools.tryDate(dts)).orElse(null);
|
||||||
|
setDetailedDeliveryPeriod(start, end);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
itemMap.getAsNodeMap("AssociatedDocumentLineDocument").ifPresent(adld -> {
|
itemMap.getAsNodeMap("AssociatedDocumentLineDocument").ifPresent(adld -> {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class Product implements IZUGFeRDExportableProduct {
|
|||||||
nodeMap.getAsString("Description").ifPresent(this::setDescription);
|
nodeMap.getAsString("Description").ifPresent(this::setDescription);
|
||||||
|
|
||||||
|
|
||||||
nodeMap.getAsNodeMap("ApplicableProductCharacteristic").ifPresent(apcNodes -> {
|
nodeMap.getAllNodes("ApplicableProductCharacteristic").map(NodeMap::new).forEach(apcNodes -> { // ApplicableProductCharacteristic is 0 .. unbounded
|
||||||
String key = apcNodes.getAsStringOrNull("Description");
|
String key = apcNodes.getAsStringOrNull("Description");
|
||||||
String value = apcNodes.getAsStringOrNull("Value");
|
String value = apcNodes.getAsStringOrNull("Value");
|
||||||
if (key != null && value != null) {
|
if (key != null && value != null) {
|
||||||
@@ -80,7 +80,6 @@ public class Product implements IZUGFeRDExportableProduct {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//UBL
|
//UBL
|
||||||
nodeMap.getAsNodeMap("AdditionalItemProperty").ifPresent(aipNodes -> {
|
nodeMap.getAsNodeMap("AdditionalItemProperty").ifPresent(aipNodes -> {
|
||||||
String name = aipNodes.getAsStringOrNull("Name");
|
String name = aipNodes.getAsStringOrNull("Name");
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import java.nio.file.Paths;
|
|||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
@@ -492,6 +493,17 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
public void testItemsBillingSpecifiedPeriod() throws FileNotFoundException, XPathExpressionException, ParseException {
|
||||||
|
File inputFile = getResourceAsFile("factur-x_invoicingPeriod.xml");
|
||||||
|
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(inputFile));
|
||||||
|
|
||||||
|
CalculatedInvoice invoice = new CalculatedInvoice();
|
||||||
|
zii.extractInto(invoice);
|
||||||
|
assertEquals(3, invoice.getZFItems().length);
|
||||||
|
assertEquals(new Date(2022-1900, 8-1, 29), invoice.getZFItems()[0].getDetailedDeliveryPeriodFrom());
|
||||||
|
assertEquals(new Date(2022-1900, 8-1, 31), invoice.getZFItems()[0].getDetailedDeliveryPeriodTo());
|
||||||
|
}
|
||||||
|
|
||||||
public void testImportPositionIncludedNotes() throws FileNotFoundException, XPathExpressionException, ParseException {
|
public void testImportPositionIncludedNotes() throws FileNotFoundException, XPathExpressionException, ParseException {
|
||||||
File inputFile = getResourceAsFile("ZTESTZUGFERD_1_INVDSS_012015738820PDF-1.pdf");
|
File inputFile = getResourceAsFile("ZTESTZUGFERD_1_INVDSS_012015738820PDF-1.pdf");
|
||||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(inputFile));
|
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(inputFile));
|
||||||
|
|||||||
Reference in New Issue
Block a user