This commit is contained in:
jstaerk
2023-12-22 16:16:21 +01:00
parent 93aaf74d92
commit c6173dd124
6 changed files with 257 additions and 225 deletions

View File

@@ -1,5 +1,11 @@
2.10.0
-
- also accept pdf/a3 from inputstream - also accept pdf/a3 from inputstream
- closes #354 factur-x 1 from commandline - closes #354 factur-x 1 from commandline
- support XR 3.0.1 (#343),
- i.e. processid
- set email in tradeparty class
- empty description remove
2.9.0 2.9.0
======= =======

View File

@@ -69,15 +69,6 @@ mvnw clean package -P generateXSLTFromSchematron
`package -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8001 -Xnoagent -Djava.compiler=NONE"` `package -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8001 -Xnoagent -Djava.compiler=NONE"`
can be used as debug configuration goal in Eclipse. In that case you can set breakpoints in tests. can be used as debug configuration goal in Eclipse. In that case you can set breakpoints in tests.
## Validate
The former ZUGFeRD VeraPDF [ZUV](https://github.com/ZUGFeRD/ZUV/) validator
is now part of Mustangproject.
The JUnit tests of the validator component will also run through a couple of
test files of the library component.
## Deployment ## Deployment

View File

@@ -31,7 +31,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
protected Contact contact = null; protected Contact contact = null;
protected LegalOrganisation legalOrg = null; protected LegalOrganisation legalOrg = null;
protected SchemedID globalId=null; protected SchemedID globalId=null;
protected SchemedID uriUniversalCommunicationId=null; protected SchemedID uriUniversalCommunicationId=null; //e.g. the email address of the organization
/** /**
* Default constructor. * Default constructor.
@@ -412,6 +412,30 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
} }
/***
* sets the email of the organization (not the one of the contact person)
* @return fluent setter
*/
public TradeParty setEmail(String eMail) {
SchemedID theSchemedID=new SchemedID("EM", eMail);
addUriUniversalCommunicationID(theSchemedID);
return this;
}
/***
* gets the email of the organization (not the one of the contact person)
* will return null if not set or if the provided UriUniversalCommunicationID
* is not a email address
*
* @return String the email, or null
*/
public String getEmail() {
if (uriUniversalCommunicationId.getScheme().equals("EM")) {
return uriUniversalCommunicationId.getID();
}
return null;
}
/** /**
* if it's a customer, this can e.g. be the customer ID * if it's a customer, this can e.g. be the customer ID

View File

@@ -33,7 +33,7 @@ public class Profiles {
{"BASIC", new Profile("BASIC", "urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic")}, {"BASIC", new Profile("BASIC", "urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic")},
{"EN16931", new Profile("EN16931", "urn:cen.eu:en16931:2017")}, {"EN16931", new Profile("EN16931", "urn:cen.eu:en16931:2017")},
{"EXTENDED", new Profile("EXTENDED", "urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended")}, {"EXTENDED", new Profile("EXTENDED", "urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended")},
{"XRECHNUNG", new Profile("XRECHNUNG", "urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_2.3")} // up next: urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0 {"XRECHNUNG", new Profile("XRECHNUNG", "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0")} // up next: urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1])); }).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));
static Map<String, Profile> zf1Map = Stream.of(new Object[][]{ static Map<String, Profile> zf1Map = Stream.of(new Object[][]{

View File

@@ -308,11 +308,18 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
+ " xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\"" + " xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\""
+ " xmlns:qdt=\"urn:un:unece:uncefact:data:standard:QualifiedDataType:100\">" + " xmlns:qdt=\"urn:un:unece:uncefact:data:standard:QualifiedDataType:100\">"
+ "<!-- generated by: mustangproject.org v" + ZUGFeRD2PullProvider.class.getPackage().getImplementationVersion() + "-->" + "<!-- generated by: mustangproject.org v" + ZUGFeRD2PullProvider.class.getPackage().getImplementationVersion() + "-->"
+ "<rsm:ExchangedDocumentContext>" + "<rsm:ExchangedDocumentContext>\n";
// + " // + "
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>" // <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>"
// //
+ "<ram:GuidelineSpecifiedDocumentContextParameter>"
if (getProfile() == Profiles.getByName("XRechnung")) {
xml += " <ram:BusinessProcessSpecifiedDocumentContextParameter>\n"
+ " <ram:ID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</ram:ID>\n"
+ " </ram:BusinessProcessSpecifiedDocumentContextParameter>\n";
}
xml +=
"<ram:GuidelineSpecifiedDocumentContextParameter>"
+ "<ram:ID>" + getProfile().getID() + "</ram:ID>" + "<ram:ID>" + getProfile().getID() + "</ram:ID>"
+ "</ram:GuidelineSpecifiedDocumentContextParameter>" + "</ram:GuidelineSpecifiedDocumentContextParameter>"
+ "</rsm:ExchangedDocumentContext>" + "</rsm:ExchangedDocumentContext>"
@@ -374,10 +381,13 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
} }
} }
xml += "<ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>" xml += "<ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>";
+ "<ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription()) if (currentItem.getProduct().getDescription().length() > 0) {
+ "</ram:Description>" xml += "<ram:Description>" +
+ "</ram:SpecifiedTradeProduct>" XMLTools.encodeXML(currentItem.getProduct().getDescription()) +
"</ram:Description>";
}
xml += "</ram:SpecifiedTradeProduct>"
+ "<ram:SpecifiedLineTradeAgreement>"; + "<ram:SpecifiedLineTradeAgreement>";
if (currentItem.getReferencedDocuments() != null) { if (currentItem.getReferencedDocuments() != null) {

View File

@@ -48,6 +48,7 @@ public class XRTest extends TestCase {
// the writing part // the writing part
TradeParty recipient = new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE"); TradeParty recipient = new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE");
recipient.setEmail("quack@ducktown.org");
Invoice i = createInvoice(recipient); Invoice i = createInvoice(recipient);
ZUGFeRD2PullProvider zf2p = new ZUGFeRD2PullProvider(); ZUGFeRD2PullProvider zf2p = new ZUGFeRD2PullProvider();
@@ -153,7 +154,7 @@ public class XRTest extends TestCase {
String amountStr = "1.00"; String amountStr = "1.00";
BigDecimal amount = new BigDecimal(amountStr); BigDecimal amount = new BigDecimal(amountStr);
return new Invoice().setDueDate(new java.util.Date()).setIssueDate(new java.util.Date()).setDeliveryDate(new java.util.Date()) return new Invoice().setDueDate(new java.util.Date()).setIssueDate(new java.util.Date()).setDeliveryDate(new java.util.Date())
.setSender(new TradeParty(orgname,"teststr","55232","teststadt","DE").addTaxID("DE4711").addVATID("DE0815").setContact(new org.mustangproject.Contact("Hans Test","+49123456789","test@example.org")).addBankDetails(new org.mustangproject.BankDetails("DE12500105170648489890","COBADEFXXX"))) .setSender(new TradeParty(orgname,"teststr","55232","teststadt","DE").addTaxID("DE4711").addVATID("DE0815").setEmail("info@example.org").setContact(new org.mustangproject.Contact("Hans Test","+49123456789","test@example.org")).addBankDetails(new org.mustangproject.BankDetails("DE12500105170648489890","COBADEFXXX")))
.setRecipient(recipient) .setRecipient(recipient)
.setReferenceNumber("991-01484-64")//leitweg-id .setReferenceNumber("991-01484-64")//leitweg-id
// not using any VAT, this is also a test of zero-rated goods: // not using any VAT, this is also a test of zero-rated goods: