working on first functionality
This commit is contained in:
@@ -172,6 +172,22 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
icnm.getAsNodeMap("ApplicableTradeTax")
|
icnm.getAsNodeMap("ApplicableTradeTax")
|
||||||
.flatMap(cnm -> cnm.getAsBigDecimal("RateApplicablePercent", "ApplicablePercent"))
|
.flatMap(cnm -> cnm.getAsBigDecimal("RateApplicablePercent", "ApplicablePercent"))
|
||||||
.ifPresent(product::setVATPercent);
|
.ifPresent(product::setVATPercent);
|
||||||
|
icnm.getAsNodeMap("SpecifiedTradeAllowanceCharge").ifPresent(stac -> {
|
||||||
|
stac.getAsNodeMap("ChargeIndicator").ifPresent(ci -> {
|
||||||
|
String isChargeString=ci.getAsString("Indicator").get();
|
||||||
|
String percentString=stac.getAsStringOrNull("CalculationPercent");
|
||||||
|
String reason=stac.getAsStringOrNull("Reason");
|
||||||
|
Allowance izac=null;
|
||||||
|
if (isChargeString.equalsIgnoreCase("false")) {
|
||||||
|
izac = new Allowance();
|
||||||
|
}
|
||||||
|
|
||||||
|
izac.setPercent(new BigDecimal(percentString));
|
||||||
|
izac.setReason(reason);
|
||||||
|
addAllowance(izac);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
if (recalcPrice && !BigDecimal.ZERO.equals(quantity)) {
|
if (recalcPrice && !BigDecimal.ZERO.equals(quantity)) {
|
||||||
icnm.getAsNodeMap("SpecifiedTradeSettlementLineMonetarySummation")
|
icnm.getAsNodeMap("SpecifiedTradeSettlementLineMonetarySummation")
|
||||||
|
|||||||
@@ -103,6 +103,32 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void testTheInvoiceImport() {
|
||||||
|
|
||||||
|
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("C:\\Users\\jstaerk\\workspace\\XMLExamples\\zfdiverses\\20250108_\\xmlDieWirLesenSollten.xml");
|
||||||
|
|
||||||
|
boolean hasExceptions = false;
|
||||||
|
Invoice invoice = null;
|
||||||
|
try {
|
||||||
|
invoice = zii.extractInvoice();
|
||||||
|
} catch (XPathExpressionException | ParseException e) {
|
||||||
|
hasExceptions = true;
|
||||||
|
}
|
||||||
|
assertFalse(hasExceptions);
|
||||||
|
// Reading ZUGFeRD
|
||||||
|
|
||||||
|
TransactionCalculator tc = new TransactionCalculator(invoice);
|
||||||
|
assertEquals(new BigDecimal("0.00"), tc.getDuePayable());
|
||||||
|
assertEquals(new BigDecimal("0.00"), tc.getGrandTotal());
|
||||||
|
|
||||||
|
|
||||||
|
// name street location zip country, contact name phone email, total amount
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void testInvoiceImportUBL() {
|
public void testInvoiceImportUBL() {
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user