Introduce InvoiceCorrection class and TradeParty
This commit is contained in:
@@ -29,7 +29,7 @@ switch
|
|||||||
- validate as library doc
|
- validate as library doc
|
||||||
- unify loggers
|
- unify loggers
|
||||||
- release notes
|
- release notes
|
||||||
|
- new tradeparty class, switch recipient, shipping address from contact to tradeparty
|
||||||
|
|
||||||
### 2.0 still todo
|
### 2.0 still todo
|
||||||
- verapdf as prevalidation?
|
- verapdf as prevalidation?
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ import java.util.Date;
|
|||||||
|
|
||||||
public class Invoice implements IExportableTransaction {
|
public class Invoice implements IExportableTransaction {
|
||||||
|
|
||||||
protected String documentName = null, documentCode = null, number = null, ownOrganisationFullPlaintextInfo = null, referenceNumber = null, shipToOrganisationID = null, shipToOrganisationName = null, shipToStreet = null, shipToZIP = null, shipToLocation = null, shipToCountry = null, buyerOrderReferencedDocumentID = null, buyerOrderReferencedDocumentIssueDateTime = null, ownTaxID = null, ownVATID = null, ownForeignOrganisationID = null, ownOrganisationName = null, ownStreet = null, ownZIP = null, ownLocation = null, ownCountry = null, currency = null, paymentTermDescription = null;
|
protected String documentName = null, documentCode = null, number = null, ownOrganisationFullPlaintextInfo = null, referenceNumber = null, shipToOrganisationID = null, shipToOrganisationName = null, shipToStreet = null, shipToZIP = null, shipToLocation = null, shipToCountry = null, buyerOrderReferencedDocumentID = null, buyerOrderReferencedDocumentIssueDateTime = null, ownTaxID = null, ownVATID = null, ownForeignOrganisationID = null, ownOrganisationName = null, currency = null, paymentTermDescription = null;
|
||||||
protected Date issueDate = null, dueDate = null, deliveryDate = null;
|
protected Date issueDate = null, dueDate = null, deliveryDate = null;
|
||||||
protected BigDecimal totalPrepaidAmount = null;
|
protected BigDecimal totalPrepaidAmount = null;
|
||||||
protected IZUGFeRDExportableContact ownContact = null, recipient = null, deliveryAddress = null;
|
protected TradeParty sender=null, recipient = null, deliveryAddress = null;
|
||||||
protected ArrayList<IZUGFeRDExportableItem> ZFItems = null;
|
protected ArrayList<IZUGFeRDExportableItem> ZFItems = null;
|
||||||
protected String contractReferencedDocument = null;
|
protected String contractReferencedDocument = null;
|
||||||
|
|
||||||
@@ -223,41 +223,25 @@ public class Invoice implements IExportableTransaction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnStreet() {
|
public String getOwnStreet() {
|
||||||
return ownStreet;
|
return sender.getStreet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Invoice setOwnStreet(String ownStreet) {
|
|
||||||
this.ownStreet = ownStreet;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnZIP() {
|
public String getOwnZIP() {
|
||||||
return ownZIP;
|
return sender.getZIP();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Invoice setOwnZIP(String ownZIP) {
|
|
||||||
this.ownZIP = ownZIP;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOwnLocation() {
|
public String getOwnLocation() {
|
||||||
return ownLocation;
|
return sender.getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Invoice setOwnLocation(String getOwnLocation) {
|
|
||||||
this.ownLocation = getOwnLocation;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOwnCountry() {
|
public String getOwnCountry() {
|
||||||
return ownCountry;
|
return sender.getCountry();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Invoice setOwnCountry(String getOwnCountry) {
|
|
||||||
this.ownCountry = getOwnCountry;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCurrency() {
|
public String getCurrency() {
|
||||||
@@ -320,25 +304,29 @@ public class Invoice implements IExportableTransaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDExportableContact getOwnContact() {
|
public IZUGFeRDExportableTradeParty getSender() {
|
||||||
return ownContact;
|
return sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Invoice setOwnContact(IZUGFeRDExportableContact ownContact) {
|
public Invoice setOwnContact(Contact ownContact) {
|
||||||
this.ownContact = ownContact;
|
this.sender.setContact(ownContact);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public IZUGFeRDExportableTradeParty getRecipient() {
|
||||||
public IZUGFeRDExportableContact getRecipient() {
|
|
||||||
return recipient;
|
return recipient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Invoice setRecipient(IZUGFeRDExportableContact recipient) {
|
public Invoice setRecipient(TradeParty recipient) {
|
||||||
this.recipient = recipient;
|
this.recipient = recipient;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Invoice setSender(TradeParty sender) {
|
||||||
|
this.sender = sender;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDAllowanceCharge[] getZFAllowances() {
|
public IZUGFeRDAllowanceCharge[] getZFAllowances() {
|
||||||
if (Allowances.isEmpty()) {
|
if (Allowances.isEmpty()) {
|
||||||
@@ -386,11 +374,11 @@ public class Invoice implements IExportableTransaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDExportableContact getDeliveryAddress() {
|
public TradeParty getDeliveryAddress() {
|
||||||
return deliveryAddress;
|
return deliveryAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Invoice setDeliveryAddress(IZUGFeRDExportableContact deliveryAddress) {
|
public Invoice setDeliveryAddress(TradeParty deliveryAddress) {
|
||||||
this.deliveryAddress = deliveryAddress;
|
this.deliveryAddress = deliveryAddress;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@@ -413,7 +401,7 @@ public class Invoice implements IExportableTransaction {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return (dueDate != null) && (ownZIP != null) && (ownStreet != null) && (ownLocation != null) && (ownCountry != null) && (ownTaxID != null) && (ownVATID != null) && (recipient != null);
|
return (dueDate != null) && (sender != null) && (ownTaxID != null) && (ownVATID != null) && (recipient != null);
|
||||||
//contact
|
//contact
|
||||||
// this.phone = phone;
|
// this.phone = phone;
|
||||||
// this.email = email;
|
// this.email = email;
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* *********************************************************************
|
||||||
|
* <p>
|
||||||
|
* Copyright 2018 Jochen Staerk
|
||||||
|
* <p>
|
||||||
|
* Use is subject to license terms.
|
||||||
|
* <p>
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy
|
||||||
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
* <p>
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* <p>
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* <p>
|
||||||
|
* **********************************************************************
|
||||||
|
*/
|
||||||
|
package org.mustangproject;
|
||||||
|
|
||||||
|
import org.mustangproject.ZUGFeRD.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class InvoiceCorrection extends Invoice {
|
||||||
|
|
||||||
|
}
|
||||||
73
library/src/main/java/org/mustangproject/TradeParty.java
Normal file
73
library/src/main/java/org/mustangproject/TradeParty.java
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
package org.mustangproject;
|
||||||
|
|
||||||
|
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
|
||||||
|
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableTradeParty;
|
||||||
|
|
||||||
|
public class TradeParty implements IZUGFeRDExportableTradeParty {
|
||||||
|
|
||||||
|
protected String name,zip,street,location,country;
|
||||||
|
protected Contact contact=null;
|
||||||
|
|
||||||
|
public TradeParty(String name, String street, String zip, String location, String country) {
|
||||||
|
this.name = name;
|
||||||
|
this.street = street;
|
||||||
|
this.zip = zip;
|
||||||
|
this.location = location;
|
||||||
|
this.country = country;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public TradeParty setContact(Contact c) {
|
||||||
|
this.contact = c;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TradeParty setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getZIP() {
|
||||||
|
return zip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TradeParty setZIP(String zip) {
|
||||||
|
this.zip = zip;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getStreet() {
|
||||||
|
return street;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TradeParty setStreet(String street) {
|
||||||
|
this.street = street;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TradeParty setLocation(String location) {
|
||||||
|
this.location = location;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCountry() {
|
||||||
|
return country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TradeParty setCountry(String country) {
|
||||||
|
this.country = country;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -101,11 +101,11 @@ public interface IExportableTransaction {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* who processed the order
|
* the sender of the invoice
|
||||||
*
|
*
|
||||||
* @return the contact person at the supplier side
|
* @return the contact person at the supplier side
|
||||||
*/
|
*/
|
||||||
default IZUGFeRDExportableContact getOwnContact() {
|
default IZUGFeRDExportableTradeParty getSender() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ public interface IExportableTransaction {
|
|||||||
*
|
*
|
||||||
* @return the recipient of the invoice
|
* @return the recipient of the invoice
|
||||||
*/
|
*/
|
||||||
IZUGFeRDExportableContact getRecipient();
|
IZUGFeRDExportableTradeParty getRecipient();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -390,7 +390,7 @@ public interface IExportableTransaction {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
default IZUGFeRDExportableContact getDeliveryAddress() {
|
default IZUGFeRDExportableTradeParty getDeliveryAddress() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,24 +38,6 @@ public interface IZUGFeRDExportableContact {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* customer global identification assigned by the seller
|
|
||||||
*
|
|
||||||
* @return customer identification
|
|
||||||
*/
|
|
||||||
default String getGlobalID() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* customer global identification scheme
|
|
||||||
*
|
|
||||||
* @return customer identification
|
|
||||||
*/
|
|
||||||
default String getGlobalIDScheme() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First and last name of the recipient
|
* First and last name of the recipient
|
||||||
|
|||||||
@@ -0,0 +1,130 @@
|
|||||||
|
/** **********************************************************************
|
||||||
|
*
|
||||||
|
* Copyright 2018 Jochen Staerk
|
||||||
|
*
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy
|
||||||
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
*
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*********************************************************************** */
|
||||||
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mustangproject's ZUGFeRD implementation neccessary interface for ZUGFeRD exporter Licensed under the APLv2
|
||||||
|
*
|
||||||
|
* @author jstaerk
|
||||||
|
* @version 1.2.0
|
||||||
|
* dated 2014-05-10
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public interface IZUGFeRDExportableTradeParty {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* customer identification assigned by the seller
|
||||||
|
*
|
||||||
|
* @return customer identification
|
||||||
|
*/
|
||||||
|
default String getID() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* customer global identification assigned by the seller
|
||||||
|
*
|
||||||
|
* @return customer identification
|
||||||
|
*/
|
||||||
|
default String getGlobalID() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* customer global identification scheme
|
||||||
|
*
|
||||||
|
* @return customer identification
|
||||||
|
*/
|
||||||
|
default String getGlobalIDScheme() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
default IZUGFeRDExportableContact getContact() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* First and last name of the recipient
|
||||||
|
*
|
||||||
|
* @return First and last name of the recipient
|
||||||
|
*/
|
||||||
|
default String getName() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Postal code of the recipient
|
||||||
|
*
|
||||||
|
* @return Postal code of the recipient
|
||||||
|
*/
|
||||||
|
default String getZIP() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VAT ID (Umsatzsteueridentifikationsnummer) of the contact
|
||||||
|
*
|
||||||
|
* @return VAT ID (Umsatzsteueridentifikationsnummer) of the contact
|
||||||
|
*/
|
||||||
|
default String getVATID() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* two-letter country code of the contact
|
||||||
|
*
|
||||||
|
* @return two-letter iso country code of the contact
|
||||||
|
*/
|
||||||
|
default String getCountry() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the city of the contact
|
||||||
|
*
|
||||||
|
* @return Returns the city of the recipient
|
||||||
|
*/
|
||||||
|
default String getLocation() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the street address (street+number) of the contact
|
||||||
|
*
|
||||||
|
* @return street address (street+number) of the contact
|
||||||
|
*/
|
||||||
|
default String getStreet() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns additional address information which is display in xml tag "LineTwo"
|
||||||
|
*
|
||||||
|
* @return additional address information
|
||||||
|
*/
|
||||||
|
default String getAdditionalAddress() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -157,7 +157,7 @@ public class ZUGFeRD1PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
return "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort";
|
return "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getContactAsXML(IZUGFeRDExportableContact contact) {
|
protected String getTradePartyAsXML(IZUGFeRDExportableTradeParty contact) {
|
||||||
String xml = " <ram:Name>" + XMLTools.encodeXML(contact.getName()) + "</ram:Name>\n" //$NON-NLS-2$
|
String xml = " <ram:Name>" + XMLTools.encodeXML(contact.getName()) + "</ram:Name>\n" //$NON-NLS-2$
|
||||||
// + " <DefinedTradeContact>\n"
|
// + " <DefinedTradeContact>\n"
|
||||||
// + " <PersonName>xxx</PersonName>\n"
|
// + " <PersonName>xxx</PersonName>\n"
|
||||||
@@ -167,7 +167,7 @@ public class ZUGFeRD1PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
+ "</ram:PostcodeCode>\n"
|
+ "</ram:PostcodeCode>\n"
|
||||||
+ " <ram:LineOne>" + XMLTools.encodeXML(contact.getStreet())
|
+ " <ram:LineOne>" + XMLTools.encodeXML(contact.getStreet())
|
||||||
+ "</ram:LineOne>\n";
|
+ "</ram:LineOne>\n";
|
||||||
if (trans.getRecipient().getAdditionalAddress() != null) {
|
if (contact.getAdditionalAddress() != null) {
|
||||||
xml += " <ram:LineTwo>" + XMLTools.encodeXML(contact.getAdditionalAddress())
|
xml += " <ram:LineTwo>" + XMLTools.encodeXML(contact.getAdditionalAddress())
|
||||||
+ "</ram:LineTwo>\n";
|
+ "</ram:LineTwo>\n";
|
||||||
}
|
}
|
||||||
@@ -270,25 +270,25 @@ public class ZUGFeRD1PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
xml = xml + " <ram:ID>" + XMLTools.encodeXML(trans.getOwnForeignOrganisationID()) + "</ram:ID>\n";
|
xml = xml + " <ram:ID>" + XMLTools.encodeXML(trans.getOwnForeignOrganisationID()) + "</ram:ID>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((trans.getOwnContact()!=null)&&(trans.getOwnContact().getGlobalID()!=null)&&(trans.getOwnContact().getGlobalIDScheme()!=null)) {
|
if ((trans.getSender()!=null)&&(trans.getSender().getGlobalID()!=null)&&(trans.getSender().getGlobalIDScheme()!=null)) {
|
||||||
xml = xml + " <ram:GlobalID schemeID=\"" + XMLTools.encodeXML(trans.getOwnContact().getGlobalIDScheme()) + "\">"
|
xml = xml + " <ram:GlobalID schemeID=\"" + XMLTools.encodeXML(trans.getSender().getGlobalIDScheme()) + "\">"
|
||||||
+ XMLTools.encodeXML(trans.getOwnContact().getGlobalID()) + "</ram:GlobalID>\n";
|
+ XMLTools.encodeXML(trans.getSender().getGlobalID()) + "</ram:GlobalID>\n";
|
||||||
}
|
}
|
||||||
xml = xml + " <ram:Name>" + XMLTools.encodeXML(trans.getOwnOrganisationName()) + "</ram:Name>\n"; //$NON-NLS-2$
|
xml = xml + " <ram:Name>" + XMLTools.encodeXML(trans.getOwnOrganisationName()) + "</ram:Name>\n"; //$NON-NLS-2$
|
||||||
|
|
||||||
if (trans.getOwnContact() != null) {
|
if (trans.getSender().getContact() != null) {
|
||||||
xml = xml + "<ram:DefinedTradeContact>\n" + " <ram:PersonName>" + XMLTools.encodeXML(trans.getOwnContact().getName())
|
xml = xml + "<ram:DefinedTradeContact>\n" + " <ram:PersonName>" + XMLTools.encodeXML(trans.getSender().getContact().getName())
|
||||||
+ "</ram:PersonName>\n";
|
+ "</ram:PersonName>\n";
|
||||||
if (trans.getOwnContact().getPhone() != null) {
|
if (trans.getSender().getContact().getPhone() != null) {
|
||||||
|
|
||||||
xml = xml + " <ram:TelephoneUniversalCommunication>\n" + " <ram:CompleteNumber>"
|
xml = xml + " <ram:TelephoneUniversalCommunication>\n" + " <ram:CompleteNumber>"
|
||||||
+ XMLTools.encodeXML(trans.getOwnContact().getPhone()) + "</ram:CompleteNumber>\n"
|
+ XMLTools.encodeXML(trans.getSender().getContact().getPhone()) + "</ram:CompleteNumber>\n"
|
||||||
+ " </ram:TelephoneUniversalCommunication>\n";
|
+ " </ram:TelephoneUniversalCommunication>\n";
|
||||||
}
|
}
|
||||||
if (trans.getOwnContact().getEMail() != null) {
|
if (trans.getSender().getContact().getEMail() != null) {
|
||||||
|
|
||||||
xml = xml + " <ram:EmailURIUniversalCommunication>\n" + " <ram:URIID>"
|
xml = xml + " <ram:EmailURIUniversalCommunication>\n" + " <ram:URIID>"
|
||||||
+ XMLTools.encodeXML(trans.getOwnContact().getEMail()) + "</ram:URIID>\n"
|
+ XMLTools.encodeXML(trans.getSender().getContact().getEMail()) + "</ram:URIID>\n"
|
||||||
+ " </ram:EmailURIUniversalCommunication>\n";
|
+ " </ram:EmailURIUniversalCommunication>\n";
|
||||||
}
|
}
|
||||||
xml = xml + " </ram:DefinedTradeContact>";
|
xml = xml + " </ram:DefinedTradeContact>";
|
||||||
@@ -310,7 +310,7 @@ public class ZUGFeRD1PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
// + " <ID>GE2020211</ID>\n"
|
// + " <ID>GE2020211</ID>\n"
|
||||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>\n"
|
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>\n"
|
||||||
|
|
||||||
xml+=getContactAsXML(trans.getRecipient());
|
xml+= getTradePartyAsXML(trans.getRecipient());
|
||||||
if ((trans.getOwnVATID()!=null)&&(trans.getOwnOrganisationName()!=null)) {
|
if ((trans.getOwnVATID()!=null)&&(trans.getOwnOrganisationName()!=null)) {
|
||||||
xml = xml + " <ram:SpecifiedTaxRegistration>\n" + " <ram:ID schemeID=\"VA\">"
|
xml = xml + " <ram:SpecifiedTaxRegistration>\n" + " <ram:ID schemeID=\"VA\">"
|
||||||
+ XMLTools.encodeXML(trans.getOwnVATID()) + "</ram:ID>\n"
|
+ XMLTools.encodeXML(trans.getOwnVATID()) + "</ram:ID>\n"
|
||||||
@@ -329,7 +329,7 @@ public class ZUGFeRD1PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
+ " <ram:ApplicableSupplyChainTradeDelivery>\n" ;
|
+ " <ram:ApplicableSupplyChainTradeDelivery>\n" ;
|
||||||
if (this.trans.getDeliveryAddress()!=null) {
|
if (this.trans.getDeliveryAddress()!=null) {
|
||||||
xml += "<ram:ShipToTradeParty>"+
|
xml += "<ram:ShipToTradeParty>"+
|
||||||
getContactAsXML(this.trans.getDeliveryAddress())+
|
getTradePartyAsXML(this.trans.getDeliveryAddress())+
|
||||||
"</ram:ShipToTradeParty>";
|
"</ram:ShipToTradeParty>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
return "urn:cen.eu:en16931:2017";
|
return "urn:cen.eu:en16931:2017";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getContactAsXML(IZUGFeRDExportableContact contact) {
|
protected String getTradePartyAsXML(IZUGFeRDExportableTradeParty contact) {
|
||||||
String xml = " <ram:Name>" + XMLTools.encodeXML(contact.getName()) + "</ram:Name>\n" //$NON-NLS-2$
|
String xml = " <ram:Name>" + XMLTools.encodeXML(contact.getName()) + "</ram:Name>\n" //$NON-NLS-2$
|
||||||
// + " <DefinedTradeContact>\n"
|
// + " <DefinedTradeContact>\n"
|
||||||
// + " <PersonName>xxx</PersonName>\n"
|
// + " <PersonName>xxx</PersonName>\n"
|
||||||
@@ -167,7 +167,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
+ "</ram:PostcodeCode>\n"
|
+ "</ram:PostcodeCode>\n"
|
||||||
+ " <ram:LineOne>" + XMLTools.encodeXML(contact.getStreet())
|
+ " <ram:LineOne>" + XMLTools.encodeXML(contact.getStreet())
|
||||||
+ "</ram:LineOne>\n";
|
+ "</ram:LineOne>\n";
|
||||||
if (trans.getRecipient().getAdditionalAddress() != null) {
|
if (contact.getAdditionalAddress() != null) {
|
||||||
xml += " <ram:LineTwo>" + XMLTools.encodeXML(contact.getAdditionalAddress())
|
xml += " <ram:LineTwo>" + XMLTools.encodeXML(contact.getAdditionalAddress())
|
||||||
+ "</ram:LineTwo>\n";
|
+ "</ram:LineTwo>\n";
|
||||||
}
|
}
|
||||||
@@ -347,9 +347,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
xml = xml + " <ram:ID>" + XMLTools.encodeXML(trans.getOwnForeignOrganisationID()) + "</ram:ID>\n";
|
xml = xml + " <ram:ID>" + XMLTools.encodeXML(trans.getOwnForeignOrganisationID()) + "</ram:ID>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((trans.getOwnContact()!=null)&&(trans.getOwnContact().getGlobalID()!=null)&&(trans.getOwnContact().getGlobalIDScheme()!=null)) {
|
if ((trans.getSender()!=null)&&(trans.getSender().getGlobalID()!=null)&&(trans.getSender().getGlobalIDScheme()!=null)) {
|
||||||
xml = xml + " <ram:GlobalID schemeID=\"" + XMLTools.encodeXML(trans.getOwnContact().getGlobalIDScheme()) + "\">"
|
xml = xml + " <ram:GlobalID schemeID=\"" + XMLTools.encodeXML(trans.getSender().getGlobalIDScheme()) + "\">"
|
||||||
+ XMLTools.encodeXML(trans.getOwnContact().getGlobalID()) + "</ram:GlobalID>\n";
|
+ XMLTools.encodeXML(trans.getSender().getGlobalID()) + "</ram:GlobalID>\n";
|
||||||
}
|
}
|
||||||
xml = xml + " <ram:Name>" + XMLTools.encodeXML(trans.getOwnOrganisationName()) + "</ram:Name>\n"; //$NON-NLS-2$
|
xml = xml + " <ram:Name>" + XMLTools.encodeXML(trans.getOwnOrganisationName()) + "</ram:Name>\n"; //$NON-NLS-2$
|
||||||
|
|
||||||
@@ -361,19 +361,19 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
+ " </ram:SpecifiedLegalOrganization>";
|
+ " </ram:SpecifiedLegalOrganization>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trans.getOwnContact() != null) {
|
if (trans.getSender().getContact() != null) {
|
||||||
xml = xml + "<ram:DefinedTradeContact>\n" + " <ram:PersonName>" + XMLTools.encodeXML(trans.getOwnContact().getName())
|
xml = xml + "<ram:DefinedTradeContact>\n" + " <ram:PersonName>" + XMLTools.encodeXML(trans.getSender().getContact().getName())
|
||||||
+ "</ram:PersonName>\n";
|
+ "</ram:PersonName>\n";
|
||||||
if (trans.getOwnContact().getPhone() != null) {
|
if (trans.getSender().getContact().getPhone() != null) {
|
||||||
|
|
||||||
xml = xml + " <ram:TelephoneUniversalCommunication>\n" + " <ram:CompleteNumber>"
|
xml = xml + " <ram:TelephoneUniversalCommunication>\n" + " <ram:CompleteNumber>"
|
||||||
+ XMLTools.encodeXML(trans.getOwnContact().getPhone()) + "</ram:CompleteNumber>\n"
|
+ XMLTools.encodeXML(trans.getSender().getContact().getPhone()) + "</ram:CompleteNumber>\n"
|
||||||
+ " </ram:TelephoneUniversalCommunication>\n";
|
+ " </ram:TelephoneUniversalCommunication>\n";
|
||||||
}
|
}
|
||||||
if (trans.getOwnContact().getEMail() != null) {
|
if (trans.getSender().getContact().getEMail() != null) {
|
||||||
|
|
||||||
xml = xml + " <ram:EmailURIUniversalCommunication>\n" + " <ram:URIID>"
|
xml = xml + " <ram:EmailURIUniversalCommunication>\n" + " <ram:URIID>"
|
||||||
+ XMLTools.encodeXML(trans.getOwnContact().getEMail()) + "</ram:URIID>\n"
|
+ XMLTools.encodeXML(trans.getSender().getContact().getEMail()) + "</ram:URIID>\n"
|
||||||
+ " </ram:EmailURIUniversalCommunication>\n";
|
+ " </ram:EmailURIUniversalCommunication>\n";
|
||||||
}
|
}
|
||||||
xml = xml + " </ram:DefinedTradeContact>";
|
xml = xml + " </ram:DefinedTradeContact>";
|
||||||
@@ -396,7 +396,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
// + " <ID>GE2020211</ID>\n"
|
// + " <ID>GE2020211</ID>\n"
|
||||||
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>\n"
|
// + " <GlobalID schemeID=\"0088\">4000001987658</GlobalID>\n"
|
||||||
|
|
||||||
xml+=getContactAsXML(trans.getRecipient());
|
xml+=getTradePartyAsXML(trans.getRecipient());
|
||||||
xml += " </ram:BuyerTradeParty>\n";
|
xml += " </ram:BuyerTradeParty>\n";
|
||||||
|
|
||||||
if (trans.getBuyerOrderReferencedDocumentID()!=null) {
|
if (trans.getBuyerOrderReferencedDocumentID()!=null) {
|
||||||
@@ -409,7 +409,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
+ " <ram:ApplicableHeaderTradeDelivery>\n" ;
|
+ " <ram:ApplicableHeaderTradeDelivery>\n" ;
|
||||||
if (this.trans.getDeliveryAddress()!=null) {
|
if (this.trans.getDeliveryAddress()!=null) {
|
||||||
xml += "<ram:ShipToTradeParty>"+
|
xml += "<ram:ShipToTradeParty>"+
|
||||||
getContactAsXML(this.trans.getDeliveryAddress())+
|
getTradePartyAsXML(this.trans.getDeliveryAddress())+
|
||||||
"</ram:ShipToTradeParty>";
|
"</ram:ShipToTradeParty>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package org.mustangproject.ZUGFeRD;
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
import org.mustangproject.Contact;
|
import org.mustangproject.*;
|
||||||
import org.mustangproject.Invoice;
|
|
||||||
import org.mustangproject.Item;
|
|
||||||
import org.mustangproject.Product;
|
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
@@ -18,7 +15,7 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
|
|||||||
public Invoice extractInvoice() {
|
public Invoice extractInvoice() {
|
||||||
|
|
||||||
String number="AB123";
|
String number="AB123";
|
||||||
Invoice zpp=new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new Contact("Franz Müller", "0177123456", "fmueller@test.com", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number);
|
Invoice zpp=new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty("company","teststr","55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number);
|
||||||
//.addItem(new Item(new Product("Testprodukt","","C62",new BigDecimal(0)),amount,new BigDecimal(1.0)))
|
//.addItem(new Item(new Product("Testprodukt","","C62",new BigDecimal(0)),amount,new BigDecimal(1.0)))
|
||||||
zpp.setOwnOrganisationName(extractString("//SellerTradeParty/Name"));
|
zpp.setOwnOrganisationName(extractString("//SellerTradeParty/Name"));
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import java.util.Date;
|
|||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
import org.mustangproject.TradeParty;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* This is a test to confirm the minimum steps to implement a interface are still sufficient
|
* This is a test to confirm the minimum steps to implement a interface are still sufficient
|
||||||
@@ -304,8 +305,8 @@ public class BackwardCompatibilityTest extends TestCase implements IExportableTr
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDExportableContact getRecipient() {
|
public IZUGFeRDExportableTradeParty getRecipient() {
|
||||||
return new Contact();
|
return new TradeParty("name","street","zip","city","DE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class IExportableTransactionImpl implements IExportableTransaction {
|
|||||||
private IZUGFeRDAllowanceCharge[] zFCharges;
|
private IZUGFeRDAllowanceCharge[] zFCharges;
|
||||||
private IZUGFeRDAllowanceCharge[] zFLogisticsServiceCharges;
|
private IZUGFeRDAllowanceCharge[] zFLogisticsServiceCharges;
|
||||||
private IZUGFeRDExportableItem[] zFItems;
|
private IZUGFeRDExportableItem[] zFItems;
|
||||||
private IZUGFeRDExportableContact recipient;
|
private IZUGFeRDExportableTradeParty recipient;
|
||||||
private IZUGFeRDTradeSettlementPayment[] settlementPayments;
|
private IZUGFeRDTradeSettlementPayment[] settlementPayments;
|
||||||
private String ownTaxID;
|
private String ownTaxID;
|
||||||
private String ownVATID;
|
private String ownVATID;
|
||||||
@@ -85,7 +85,7 @@ public class IExportableTransactionImpl implements IExportableTransaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDExportableContact getRecipient() {
|
public IZUGFeRDExportableTradeParty getRecipient() {
|
||||||
return recipient;
|
return recipient;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ public class IExportableTransactionImpl implements IExportableTransaction {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IExportableTransactionImpl setRecipient(IZUGFeRDExportableContact recipient) {
|
public IExportableTransactionImpl setRecipient(IZUGFeRDExportableTradeParty recipient) {
|
||||||
this.recipient = recipient;
|
this.recipient = recipient;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public abstract class MustangReaderTestCase extends TestCase implements IExporta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class RecipientContact implements IZUGFeRDExportableContact {
|
protected class RecipientTradeParty implements IZUGFeRDExportableTradeParty {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCountry() {
|
public String getCountry() {
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import junit.framework.TestSuite;
|
|||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -98,8 +97,8 @@ public class MustangReaderWriterEdgeTest extends MustangReaderTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDExportableContact getRecipient() {
|
public IZUGFeRDExportableTradeParty getRecipient() {
|
||||||
return new RecipientContact();
|
return new RecipientTradeParty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDExportableContact getRecipient() {
|
public IZUGFeRDExportableTradeParty getRecipient() {
|
||||||
return new RecipientContact();
|
return new RecipientTradeParty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -22,10 +22,7 @@
|
|||||||
package org.mustangproject.ZUGFeRD;
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.mustangproject.Contact;
|
import org.mustangproject.*;
|
||||||
import org.mustangproject.Invoice;
|
|
||||||
import org.mustangproject.Item;
|
|
||||||
import org.mustangproject.Product;
|
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.runners.MethodSorters;
|
import org.junit.runners.MethodSorters;
|
||||||
import org.mustangproject.ZUGFeRD.ZUGFeRD2PullProvider;
|
import org.mustangproject.ZUGFeRD.ZUGFeRD2PullProvider;
|
||||||
@@ -49,7 +46,7 @@ public class XRTest extends TestCase {
|
|||||||
String amountStr = "1.00";
|
String amountStr = "1.00";
|
||||||
BigDecimal amount = new BigDecimal(amountStr);
|
BigDecimal amount = new BigDecimal(amountStr);
|
||||||
|
|
||||||
Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setOwnOrganisationName(orgname).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new Contact("Franz Müller", "0177123456", "fmueller@test.com", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)));
|
Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr","55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)));
|
||||||
|
|
||||||
ZUGFeRD2PullProvider zf2p = new ZUGFeRD2PullProvider();
|
ZUGFeRD2PullProvider zf2p = new ZUGFeRD2PullProvider();
|
||||||
zf2p.generateXML(i);
|
zf2p.generateXML(i);
|
||||||
|
|||||||
@@ -173,13 +173,13 @@ public class ZF2EdgeTest extends MustangReaderTestCase implements IExportableTra
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDExportableContact getRecipient() {
|
public IZUGFeRDExportableTradeParty getRecipient() {
|
||||||
return new RecipientContact();
|
return new RecipientTradeParty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDExportableContact getDeliveryAddress() {
|
public IZUGFeRDExportableTradeParty getDeliveryAddress() {
|
||||||
return new RecipientContact();
|
return new RecipientTradeParty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setContractReferencedDocument("0815").setOwnOrganisationName(orgname).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("DE19990815").setRecipient(new Contact("Franz Müller", "0177123456", "fmueller@test.com", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0))));
|
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setContractReferencedDocument("0815").setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("DE19990815").setRecipient(new TradeParty("Franz Müller","teststr.12", "55232", "Entenhausen", "DE")).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0))));
|
||||||
String theXML = new String(ze.getProvider().getXML());
|
String theXML = new String(ze.getProvider().getXML());
|
||||||
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
||||||
ze.export(TARGET_PDF);
|
ze.export(TARGET_PDF);
|
||||||
@@ -77,6 +77,47 @@ public class ZF2PushTest extends TestCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void testInvoiceCorrectionExport() {
|
||||||
|
|
||||||
|
// the writing part
|
||||||
|
|
||||||
|
String orgname = "Test company";
|
||||||
|
String number = "123";
|
||||||
|
String amountStr = "1.00";
|
||||||
|
BigDecimal amount = new BigDecimal(amountStr);
|
||||||
|
try (InputStream SOURCE_PDF = this.getClass()
|
||||||
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf");
|
||||||
|
|
||||||
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
||||||
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
||||||
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
|
ze.setTransaction(new InvoiceCorrection().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setContractReferencedDocument("0815").setSender(new TradeParty(orgname, "teststr","55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("DE19990815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0))));
|
||||||
|
String theXML = new String(ze.getProvider().getXML());
|
||||||
|
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
||||||
|
ze.export(TARGET_PDF);
|
||||||
|
} catch (IOException e) {
|
||||||
|
fail("IOException should not be raised in testEdgeExport");
|
||||||
|
}
|
||||||
|
|
||||||
|
// now check the contents (like MustangReaderTest)
|
||||||
|
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
||||||
|
|
||||||
|
assertTrue(zi.getUTF8().contains("EUR"));
|
||||||
|
assertTrue(zi.getUTF8().contains("0815"));
|
||||||
|
|
||||||
|
// Reading ZUGFeRD
|
||||||
|
assertEquals(amountStr, zi.getAmount());
|
||||||
|
assertEquals(zi.getHolder(), orgname);
|
||||||
|
assertEquals(zi.getForeignReference(), number);
|
||||||
|
try {
|
||||||
|
assertEquals(zi.getVersion(), 2);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
public void testAttachmentsExport() {
|
public void testAttachmentsExport() {
|
||||||
|
|
||||||
String orgname = "Test company";
|
String orgname = "Test company";
|
||||||
@@ -90,7 +131,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setOwnOrganisationName(orgname).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new Contact("Franz Müller", "0177123456", "fmueller@test.com", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)))
|
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setContact(new Contact("Franz Müller","01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE"))).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)))
|
||||||
|
|
||||||
);
|
);
|
||||||
byte[] b={12,13};
|
byte[] b={12,13};
|
||||||
@@ -134,7 +175,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setOwnOrganisationName(orgname).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new Contact("Franz Müller", "0177123456", "fmueller@test.com", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)).addCharge(new Charge(new BigDecimal(0.1),new BigDecimal(0), "","K")))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)).addCharge(new Charge(new BigDecimal(0.1),new BigDecimal(0), "","K")))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal(0.07),new BigDecimal(0), "","K")))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal(0.07),new BigDecimal(0), "","K")))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal(0.07),new BigDecimal(0), "","K")).addCharge(new Charge(new BigDecimal(0.1),new BigDecimal(0), "","K")))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal(0.07),new BigDecimal(0), "","K")).addCharge(new Charge(new BigDecimal(0.1),new BigDecimal(0), "","K")))
|
||||||
@@ -178,7 +219,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(new Invoice().setCurrency("CHF").setDueDate(new Date()).setOccurrenceDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setOwnOrganisationName(orgname).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new Contact("Franz Müller", "0177123456", "fmueller@test.com", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
ze.setTransaction(new Invoice().setCurrency("CHF").setDueDate(new Date()).setOccurrenceDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), amount, new BigDecimal(1.0)))
|
||||||
@@ -226,7 +267,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setOccurrencePeriod(new Date(),new Date()).setDeliveryDate(new Date()).setOwnOrganisationName(orgname).setOwnStreet("teststr").setOwnZIP("55232").setOwnLocation("teststadt").setOwnCountry("DE").setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new Contact("Franz Müller", "0177123456", "fmueller@test.com", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setOccurrencePeriod(new Date(),new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), price, amount))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), price, amount))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), price, amount))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), price, amount))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), price, amount))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(0)), price, amount))
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ public class ZF2Test extends MustangReaderTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDExportableContact getRecipient() {
|
public IZUGFeRDExportableTradeParty getRecipient() {
|
||||||
return new RecipientContact();
|
return new RecipientTradeParty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.mustangproject</groupId>
|
<groupId>org.mustangproject</groupId>
|
||||||
<artifactId>validator</artifactId>
|
<artifactId>validator</artifactId>
|
||||||
<name>Library to validate Factur-X/ZUGFeRD 1.0 and 2.1 as well as XRechnung e-invoices.</name>
|
<name>Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung)</name>
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.9.0-alpha2-SNAPSHOT</version>
|
<version>1.9.0-alpha2-SNAPSHOT</version>
|
||||||
|
|||||||
Reference in New Issue
Block a user