closes #878
This commit is contained in:
@@ -24,8 +24,6 @@ import javax.xml.xpath.XPathFactory;
|
||||
import org.mustangproject.CalculatedInvoice;
|
||||
import org.mustangproject.Exceptions.ArithmetricException;
|
||||
import org.mustangproject.XMLTools;
|
||||
import org.mustangproject.ZUGFeRD.TransactionCalculator;
|
||||
import org.mustangproject.ZUGFeRD.ZUGFeRDImporter;
|
||||
import org.mustangproject.ZUGFeRD.ZUGFeRDInvoiceImporter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -393,7 +391,7 @@ public class XMLValidator extends Validator {
|
||||
}
|
||||
}
|
||||
}
|
||||
checkArithmetrics(context);
|
||||
checkArithmetics(context);
|
||||
|
||||
|
||||
} 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();
|
||||
try {
|
||||
zi.fromXML(zfXML);
|
||||
CalculatedInvoice ci=new CalculatedInvoice();
|
||||
zi.extractInto(ci);
|
||||
|
||||
} catch ( ArithmetricException e) {
|
||||
} catch ( ArithmeticException e) {
|
||||
try {
|
||||
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 XMLValidator xv = new XMLValidator(ctx);
|
||||
final XPathEngine xpath = new JAXPXPathEngine();
|
||||
|
||||
File tempFile = getResourceAsFile("invalidArithmetrics.xml");
|
||||
File tempFile = getResourceAsFile("invalidArithmetics.xml");
|
||||
try {
|
||||
xv.setFilename(tempFile.getAbsolutePath());
|
||||
xv.validate();
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
<ram:SpecifiedLineTradeAgreement>
|
||||
<ram:GrossPriceProductTradePrice>
|
||||
<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:NetPriceProductTradePrice>
|
||||
<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:SpecifiedLineTradeAgreement>
|
||||
<ram:SpecifiedLineTradeDelivery>
|
||||
@@ -179,7 +179,7 @@
|
||||
<ram:TaxBasisTotalAmount>496.00</ram:TaxBasisTotalAmount>
|
||||
<ram:TaxTotalAmount currencyID="EUR">75.04</ram:TaxTotalAmount>
|
||||
<ram:GrandTotalAmount>571.04</ram:GrandTotalAmount>
|
||||
<ram:DuePayableAmount>571.05</ram:DuePayableAmount>
|
||||
<ram:DuePayableAmount>571.04</ram:DuePayableAmount>
|
||||
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
|
||||
</ram:ApplicableHeaderTradeSettlement>
|
||||
</rsm:SupplyChainTradeTransaction>
|
||||
Reference in New Issue
Block a user