closes #878
This commit is contained in:
@@ -12,6 +12,8 @@
|
|||||||
- #855
|
- #855
|
||||||
- #874
|
- #874
|
||||||
- #876/830
|
- #876/830
|
||||||
|
- #878
|
||||||
|
- corrected typo ArithmetricException to ArithmeticException
|
||||||
|
|
||||||
2.17.0
|
2.17.0
|
||||||
=======
|
=======
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ import java.text.ParseException;
|
|||||||
|
|
||||||
/***
|
/***
|
||||||
* will be thrown if an invoice cant be reproduced numerically
|
* will be thrown if an invoice cant be reproduced numerically
|
||||||
|
* ArithmetricException for backwards compatibility, was a spelling error
|
||||||
*/
|
*/
|
||||||
public class ArithmeticException extends ArithmetricException {
|
public class ArithmeticException extends ArithmetricException {
|
||||||
public ArithmeticException() {
|
public ArithmeticException() {
|
||||||
this("");
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArithmeticException(String details) {
|
public ArithmeticException(String details) {
|
||||||
// super("Could not reproduce the invoice. " + details, 0);
|
super(details);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import org.apache.pdfbox.pdmodel.common.PDNameTreeNode;
|
|||||||
import org.apache.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification;
|
import org.apache.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification;
|
||||||
import org.apache.pdfbox.pdmodel.common.filespecification.PDEmbeddedFile;
|
import org.apache.pdfbox.pdmodel.common.filespecification.PDEmbeddedFile;
|
||||||
import org.mustangproject.*;
|
import org.mustangproject.*;
|
||||||
import org.mustangproject.Exceptions.ArithmetricException;
|
|
||||||
import org.mustangproject.Exceptions.StructureException;
|
import org.mustangproject.Exceptions.StructureException;
|
||||||
import org.mustangproject.util.NodeMap;
|
import org.mustangproject.util.NodeMap;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -1096,7 +1095,7 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
.collect(Collectors.joining(" + "));
|
.collect(Collectors.joining(" + "));
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
throw new ArithmetricException("Payable total in XML is " + payableTotalFromXml + ", but calculated total is " + calculatedPayableTotal + moreDetails);
|
throw new ArithmeticException("Payable total in XML is " + payableTotalFromXml + ", but calculated total is " + calculatedPayableTotal + moreDetails);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ import javax.xml.xpath.XPathFactory;
|
|||||||
import org.mustangproject.CalculatedInvoice;
|
import org.mustangproject.CalculatedInvoice;
|
||||||
import org.mustangproject.Exceptions.ArithmetricException;
|
import org.mustangproject.Exceptions.ArithmetricException;
|
||||||
import org.mustangproject.XMLTools;
|
import org.mustangproject.XMLTools;
|
||||||
import org.mustangproject.ZUGFeRD.TransactionCalculator;
|
|
||||||
import org.mustangproject.ZUGFeRD.ZUGFeRDImporter;
|
|
||||||
import org.mustangproject.ZUGFeRD.ZUGFeRDInvoiceImporter;
|
import org.mustangproject.ZUGFeRD.ZUGFeRDInvoiceImporter;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -393,7 +391,7 @@ public class XMLValidator extends Validator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkArithmetrics(context);
|
checkArithmetics(context);
|
||||||
|
|
||||||
|
|
||||||
} catch (final IrrecoverableValidationError er) {
|
} catch (final IrrecoverableValidationError er) {
|
||||||
@@ -417,14 +415,14 @@ public class XMLValidator extends Validator {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkArithmetrics(ValidationContext context) {
|
private void checkArithmetics(ValidationContext context) {
|
||||||
ZUGFeRDInvoiceImporter zi=new ZUGFeRDInvoiceImporter();
|
ZUGFeRDInvoiceImporter zi=new ZUGFeRDInvoiceImporter();
|
||||||
try {
|
try {
|
||||||
zi.fromXML(zfXML);
|
zi.fromXML(zfXML);
|
||||||
CalculatedInvoice ci=new CalculatedInvoice();
|
CalculatedInvoice ci=new CalculatedInvoice();
|
||||||
zi.extractInto(ci);
|
zi.extractInto(ci);
|
||||||
|
|
||||||
} catch ( ArithmetricException e) {
|
} catch ( ArithmeticException e) {
|
||||||
try {
|
try {
|
||||||
context.addResultItem(new ValidationResultItem(ESeverity.warning, "Arithmetical issue:"+e.getMessage()).setSection(10));
|
context.addResultItem(new ValidationResultItem(ESeverity.warning, "Arithmetical issue:"+e.getMessage()).setSection(10));
|
||||||
|
|
||||||
|
|||||||
@@ -284,12 +284,12 @@ public class XMLValidatorTest extends ResourceCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testArithmetrics() {
|
public void testArithmetics() {
|
||||||
final ValidationContext ctx = new ValidationContext(null);
|
final ValidationContext ctx = new ValidationContext(null);
|
||||||
final XMLValidator xv = new XMLValidator(ctx);
|
final XMLValidator xv = new XMLValidator(ctx);
|
||||||
final XPathEngine xpath = new JAXPXPathEngine();
|
final XPathEngine xpath = new JAXPXPathEngine();
|
||||||
|
|
||||||
File tempFile = getResourceAsFile("invalidArithmetrics.xml");
|
File tempFile = getResourceAsFile("invalidArithmetics.xml");
|
||||||
try {
|
try {
|
||||||
xv.setFilename(tempFile.getAbsolutePath());
|
xv.setFilename(tempFile.getAbsolutePath());
|
||||||
xv.validate();
|
xv.validate();
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
<ram:SpecifiedLineTradeAgreement>
|
<ram:SpecifiedLineTradeAgreement>
|
||||||
<ram:GrossPriceProductTradePrice>
|
<ram:GrossPriceProductTradePrice>
|
||||||
<ram:ChargeAmount>160.0000</ram:ChargeAmount>
|
<ram:ChargeAmount>160.0000</ram:ChargeAmount>
|
||||||
<ram:BasisQuantity unitCode="HUR">2.0000</ram:BasisQuantity>
|
<ram:BasisQuantity unitCode="HUR">1.0000</ram:BasisQuantity>
|
||||||
</ram:GrossPriceProductTradePrice>
|
</ram:GrossPriceProductTradePrice>
|
||||||
<ram:NetPriceProductTradePrice>
|
<ram:NetPriceProductTradePrice>
|
||||||
<ram:ChargeAmount>160.0000</ram:ChargeAmount>
|
<ram:ChargeAmount>160.0000</ram:ChargeAmount>
|
||||||
<ram:BasisQuantity unitCode="HUR">2.0000</ram:BasisQuantity>
|
<ram:BasisQuantity unitCode="HUR">1.0000</ram:BasisQuantity>
|
||||||
</ram:NetPriceProductTradePrice>
|
</ram:NetPriceProductTradePrice>
|
||||||
</ram:SpecifiedLineTradeAgreement>
|
</ram:SpecifiedLineTradeAgreement>
|
||||||
<ram:SpecifiedLineTradeDelivery>
|
<ram:SpecifiedLineTradeDelivery>
|
||||||
@@ -179,7 +179,7 @@
|
|||||||
<ram:TaxBasisTotalAmount>496.00</ram:TaxBasisTotalAmount>
|
<ram:TaxBasisTotalAmount>496.00</ram:TaxBasisTotalAmount>
|
||||||
<ram:TaxTotalAmount currencyID="EUR">75.04</ram:TaxTotalAmount>
|
<ram:TaxTotalAmount currencyID="EUR">75.04</ram:TaxTotalAmount>
|
||||||
<ram:GrandTotalAmount>571.04</ram:GrandTotalAmount>
|
<ram:GrandTotalAmount>571.04</ram:GrandTotalAmount>
|
||||||
<ram:DuePayableAmount>571.05</ram:DuePayableAmount>
|
<ram:DuePayableAmount>571.04</ram:DuePayableAmount>
|
||||||
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
|
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
|
||||||
</ram:ApplicableHeaderTradeSettlement>
|
</ram:ApplicableHeaderTradeSettlement>
|
||||||
</rsm:SupplyChainTradeTransaction>
|
</rsm:SupplyChainTradeTransaction>
|
||||||
Reference in New Issue
Block a user