Skip to content

Commit

Permalink
Merge branch 'master' into issues/373-pdfbox
Browse files Browse the repository at this point in the history
# Conflicts:
#	library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java
  • Loading branch information
jstaerk committed May 24, 2024
2 parents 296620e + ed0c12d commit c72a65c
Show file tree
Hide file tree
Showing 65 changed files with 37,263 additions and 16,138 deletions.
13 changes: 11 additions & 2 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
- EN16931 validation 1.3.11 codelists v11 #357

2.11.0
=======
2024-05-22

- EN16931 validation 1.3.12 codelists v11 #357
- Fonts removed #358
- xrechnungimporter to read from filename, inputstream
- invoice's getSender/getRecipient() now return tradeparty no IZUGFeRDExportableTradeParty
- (first) IBAN is now parsed into sender's getBankDetails
- zugferdimporter to accept xml files
- UBL importer to also parse contacts
- https://github.com/ZUGFeRD/mustangproject/pull/369
- upgrade ph-scematron from 6.3.3 to 8
- support inputstreams https://github.com/ZUGFeRD/mustangproject/pull/379
- #314 ZUGFeRDInvoiceImporter additional constructur
- add XML cash discount write support (new class, previously only possible for XRechnung, not ZF Extended, using a manually encoded setPaymentTermDescription)
- surrendered to XRechnung 3 compromises, e.g. no longer put gross amount if it does not deviate from net
- be able to programmatically access validation messages https://github.com/ZUGFeRD/mustangproject/pull/382

2.10.0
=======
Expand Down
8 changes: 4 additions & 4 deletions Mustang-CLI/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<parent>
<groupId>org.mustangproject</groupId>
<artifactId>core</artifactId>
<version>2.10.1-SNAPSHOT</version>
<version>2.11.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.mustangproject</groupId>
<artifactId>Mustang-CLI</artifactId>
<name>e-invoices commandline tool, allowing to create(embed), split and validate Factur-X/ZUGFeRD files. Validation should also work for XRechnung/CII. </name>
<packaging>jar</packaging>
<version>2.10.1-SNAPSHOT</version>
<version>2.11.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.compilerVersion>8</maven.compiler.compilerVersion>
Expand All @@ -21,7 +21,7 @@
<dependency>
<groupId>org.mustangproject</groupId>
<artifactId>validator</artifactId>
<version>2.10.1-SNAPSHOT</version>
<version>2.11.1-SNAPSHOT</version>
<!-- prototypes of new mustangproject versions can be installed by referring to them and installed to the local repo from a jar file with
mvn install:install-file -Dfile=mustang-1.5.4-SNAPSHOT.jar -DgroupId=org.mustangproject.ZUGFeRD -DartifactId=mustang -Dversion=1.5.4 -Dpackaging=jar -DgeneratePom=true
-->
Expand Down Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<version>2.9.0</version>
<version>2.10.0</version>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
Expand Down
14 changes: 13 additions & 1 deletion doc/development_documentation.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

## General approach
## Typical process

1. build

Expand Down Expand Up @@ -29,6 +29,18 @@ If you do a pull request, please do a feature branch, e.g. if you are working on
Most of mustang is a library, adding (autmated junit) test cases is often not only the most sustainable but also the fastest way to see if new/changed functionality works. If something is changed so that old test cases break on purpose please do not just remove them but take the time to fix the test cases


## Typical workflow

If e.g. new elements or attributes are added, they are often added
* in the object so that a developer can use them
* in the interface so that a old fashioned developer could use them as well
* in the pullprovider so that it actually finds it's way into the XML
* in at least one test (the ...edgeTest are supposed to handle edge cases, ~all bells and whistles, maybe it fits there), after the test has been run this should at least once be
* validated. If that works one can start implementing the
* reading part (along with tests), then it needs to be
* documented e.g. on the homepage and
* communicated, at the very least by mentioning it in the history.md

## Architecture

Mustang contains a library to read/write e-invoices,
Expand Down
183 changes: 183 additions & 0 deletions doc/mustang-validation.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="validation">
<xs:complexType>
<xs:sequence>
<xs:element ref="pdf"/>
<xs:element ref="messages"/>
<xs:element ref="summary"/>
</xs:sequence>
<xs:attribute name="datetime" use="required"/>
<xs:attribute name="filename" use="required" type="xs:NCName"/>
</xs:complexType>
</xs:element>
<xs:element name="pdf">
<xs:complexType>
<xs:sequence>
<xs:element ref="report"/>
<xs:element ref="info"/>
<xs:element ref="messages"/>
<xs:element ref="summary"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="report">
<xs:complexType>
<xs:sequence>
<xs:element ref="buildInformation"/>
<xs:element ref="jobs"/>
<xs:element ref="batchSummary"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="buildInformation">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="releaseDetails"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="releaseDetails">
<xs:complexType>
<xs:attribute name="buildDate" use="required" type="xs:dateTime"/>
<xs:attribute name="id" use="required" type="xs:NCName"/>
<xs:attribute name="version" use="required" type="xs:NMTOKEN"/>
</xs:complexType>
</xs:element>
<xs:element name="jobs">
<xs:complexType>
<xs:sequence>
<xs:element ref="job"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="job">
<xs:complexType>
<xs:sequence>
<xs:element ref="item"/>
<xs:element ref="validationReport"/>
<xs:element ref="duration"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="item">
<xs:complexType>
<xs:sequence>
<xs:element ref="name"/>
</xs:sequence>
<xs:attribute name="size" use="required" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="name" type="xs:string"/>
<xs:element name="validationReport">
<xs:complexType>
<xs:sequence>
<xs:element ref="details"/>
</xs:sequence>
<xs:attribute name="isCompliant" use="required" type="xs:boolean"/>
<xs:attribute name="profileName" use="required"/>
<xs:attribute name="statement" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="details">
<xs:complexType>
<xs:attribute name="failedChecks" use="required" type="xs:integer"/>
<xs:attribute name="failedRules" use="required" type="xs:integer"/>
<xs:attribute name="passedChecks" use="required" type="xs:integer"/>
<xs:attribute name="passedRules" use="required" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="batchSummary">
<xs:complexType>
<xs:sequence>
<xs:element ref="validationReports"/>
<xs:element ref="featureReports"/>
<xs:element ref="repairReports"/>
<xs:element ref="duration"/>
</xs:sequence>
<xs:attribute name="encrypted" use="required" type="xs:integer"/>
<xs:attribute name="failedToParse" use="required" type="xs:integer"/>
<xs:attribute name="outOfMemory" use="required" type="xs:integer"/>
<xs:attribute name="totalJobs" use="required" type="xs:integer"/>
<xs:attribute name="veraExceptions" use="required" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="validationReports">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="compliant" use="required" type="xs:integer"/>
<xs:attribute name="failedJobs" use="required" type="xs:integer"/>
<xs:attribute name="nonCompliant" use="required" type="xs:integer"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="featureReports">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="failedJobs" use="required" type="xs:integer"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="repairReports">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="failedJobs" use="required" type="xs:integer"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="info">
<xs:complexType>
<xs:sequence>
<xs:element ref="signature"/>
<xs:element ref="duration"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="signature" type="xs:NCName"/>
<xs:element name="duration">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:NMTOKEN">
<xs:attribute name="finish" type="xs:integer"/>
<xs:attribute name="start" type="xs:integer"/>
<xs:attribute name="unit" type="xs:NCName"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="messages">
<xs:complexType>
<xs:choice>
<xs:element ref="exception"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="error"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="notice"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="exception">
<xs:complexType mixed="true">
<xs:attribute name="type" use="required" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="error">
<xs:complexType mixed="true">
<xs:attribute name="type" use="required" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="notice">
<xs:complexType mixed="true">
<xs:attribute name="type" use="required" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="summary">
<xs:complexType>
<xs:attribute name="status" use="required" type="xs:NCName"/>
</xs:complexType>
</xs:element>
</xs:schema>
6 changes: 3 additions & 3 deletions library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<parent>
<groupId>org.mustangproject</groupId>
<artifactId>core</artifactId>
<version>2.10.1-SNAPSHOT</version>
<version>2.11.1-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<groupId>org.mustangproject</groupId>
<artifactId>library</artifactId>
<version>2.10.1-SNAPSHOT</version>
<version>2.11.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Library to write, read and validate e-invoices (Factur-X, ZUGFeRD, Order-X, XRechnung/CII)</name>
<description>FOSS Java library to read, write and validate european electronic invoices and orders in the UN/CEFACT Cross Industry Invoice based formats Factur-X/ZUGFeRD, XRechnung and Order-X in your invoice PDFs.
Expand Down Expand Up @@ -125,7 +125,7 @@
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<version>2.9.0</version>
<version>2.10.0</version>
<scope>test</scope>
</dependency>

Expand Down
59 changes: 59 additions & 0 deletions library/src/main/java/org/mustangproject/CashDiscount.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package org.mustangproject;

import org.mustangproject.ZUGFeRD.IZUGFeRDCashDiscount;

import java.math.BigDecimal;

/***
* A class to represent discounts for early payments ("Skonto")
*/
public class CashDiscount implements IZUGFeRDCashDiscount {

/***
* the reduction percent allowed in the period
*/
protected BigDecimal percent;
/***
* the period (usually days) count how long the percent apply
*/
protected Integer days=null;

/***
* Create a cash discount (skonto) with the specified height in the specified period.
* Should someone add more period types than just "days" there
* is be space for a (optional) third parameter
*
* @param percent max 3 decimals "behind the dot", more precision is currently ignored
* @param days the count of the periods (usually days) the percentage applies
*/
public CashDiscount(BigDecimal percent, int days) {
this.percent = percent;
this.days = days;
}

/***
* @return this particular cash discount as cross industry invoice XML
*/
public String getAsCII() {
return "<ram:SpecifiedTradePaymentTerms>"+
"<ram:Description>Cash Discount</ram:Description>"+
" <ram:ApplicableTradePaymentDiscountTerms>"+
" <ram:BasisPeriodMeasure unitCode=\"DAY\">"+days+"</ram:BasisPeriodMeasure>"+
" <ram:CalculationPercent>"+XMLTools.nDigitFormat(percent,3)+"</ram:CalculationPercent>"+
" </ram:ApplicableTradePaymentDiscountTerms>"+
"</ram:SpecifiedTradePaymentTerms>";
}

/***
* since EN16931 voted not to have (or even allow) cash discounts in their core invoice the german
* XRechnung CIUS defined it's own proprietary format for a freetext field
* @return this particular cash discount in proprietary xrechnung format
*/
public String getAsXRechnung() {
return "#SKONTO#TAGE="+days+"#PROZENT="+XMLTools.nDigitFormat(percent,2)+"#\n";
}




}
Loading

0 comments on commit c72a65c

Please sign in to comment.