updated some javadoc

This commit is contained in:
jstaerk
2020-11-12 08:06:53 +01:00
parent bb42381c67
commit b6aad03da2
9 changed files with 333 additions and 72 deletions

View File

@@ -2,6 +2,9 @@ package org.mustangproject;
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlementPayment;
/**
* provides e.g. the IBAN to transfer money to :-)
*/
public class BankDetails implements IZUGFeRDTradeSettlementPayment {
protected String IBAN, BIC;
@@ -14,6 +17,14 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
return IBAN;
}
/**
* Sets the IBAN "ID", which means that it only needs to be a way to uniquely
* identify the IBAN. Of course you will specify your own IBAN in full length but
* if you deduct from a customer's account you may e.g. leave out the first or last
* digits so that nobody spying on the invoice gets to know the complete number
* @param IBAN
* @return
*/
public BankDetails setIBAN(String IBAN) {
this.IBAN = IBAN;
return this;
@@ -28,12 +39,17 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
return this;
}
/***
* getOwn... methods will be removed in the future in favor of Tradeparty (e.g. Sender) class
* */
@Override
@Deprecated
public String getOwnBIC() {
return getBIC();
}
@Override
@Deprecated
public String getOwnIBAN() {
return getIBAN();
}

View File

@@ -2,17 +2,39 @@ package org.mustangproject;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
/***
* a named contact person in an organisation
* for the organisation/company itsel please
* @see TradeParty
*/
public class Contact implements IZUGFeRDExportableContact {
protected String name,phone,email,zip,street,location,country;
protected String fax=null;
/***
* default constructor.
* Name, phone and email of sender contact person are e.g. required by XRechnung
* @param name
* @param phone
* @param email
*/
public Contact(String name, String phone, String email) {
this.name = name;
this.phone = phone;
this.email = email;
}
/***
* complete specification of a named contact with a different address
* @param name
* @param phone
* @param email
* @param street
* @param zip
* @param location
* @param country
*/
public Contact(String name, String phone, String email, String street, String zip, String location, String country) {
this.name = name;
this.phone = phone;
@@ -29,6 +51,11 @@ public class Contact implements IZUGFeRDExportableContact {
return name;
}
/**
* the first and last name of the contact
* @param name
* @return
*/
public Contact setName(String name) {
this.name = name;
return this;
@@ -39,6 +66,11 @@ public class Contact implements IZUGFeRDExportableContact {
return phone;
}
/***
* complete phone number of the contact
* @param phone
* @return
*/
public Contact setPhone(String phone) {
this.phone = phone;
return this;
@@ -49,6 +81,11 @@ public class Contact implements IZUGFeRDExportableContact {
return fax;
}
/***
* (optional) complete fax number
* @param fax
* @return
*/
public Contact setFax(String fax) {
this.fax = fax;
return this;
@@ -58,6 +95,11 @@ public class Contact implements IZUGFeRDExportableContact {
return email;
}
/***
* personal email address of the contact person
* @param email
* @return
*/
public Contact setEMail(String email) {
this.email = email;
return this;
@@ -67,6 +109,11 @@ public class Contact implements IZUGFeRDExportableContact {
return zip;
}
/***
* the postcode, if the address is different to the organisation
* @param zip
* @return
*/
public Contact setZIP(String zip) {
this.zip = zip;
return this;
@@ -77,6 +124,11 @@ public class Contact implements IZUGFeRDExportableContact {
return street;
}
/**
* street and number, if the address is different to the organisation
* @param street
* @return
*/
public Contact setStreet(String street) {
this.street = street;
return this;
@@ -87,6 +139,11 @@ public class Contact implements IZUGFeRDExportableContact {
return location;
}
/***
* city of the contact person, if different from organisation
* @param location
* @return
*/
public Contact setLocation(String location) {
this.location = location;
return this;
@@ -97,6 +154,11 @@ public class Contact implements IZUGFeRDExportableContact {
return country;
}
/***
* two-letter ISO country code of the contact, if different from organisation
* @param country
* @return
*/
public Contact setCountry(String country) {
this.country = country;
return this;

View File

@@ -36,13 +36,13 @@ 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, ownForeignOrganisationID = null, ownOrganisationName = null, currency = null, paymentTermDescription = null;
protected Date issueDate = null, dueDate = null, deliveryDate = null;
protected BigDecimal totalPrepaidAmount = null;
protected TradeParty sender=null, recipient = null, deliveryAddress = null;
protected TradeParty sender = null, recipient = null, deliveryAddress = null;
protected ArrayList<IZUGFeRDExportableItem> ZFItems = null;
protected ArrayList<String> notes = null;
protected String contractReferencedDocument = null;
protected Date occurrenceDateFrom = null;
protected Date occurrenceDateTo = null;
protected Date detailedDeliveryDateStart = null;
protected Date detailedDeliveryPeriodEnd = null;
protected ArrayList<IZUGFeRDAllowanceCharge> Allowances = new ArrayList<IZUGFeRDAllowanceCharge>(),
Charges = new ArrayList<IZUGFeRDAllowanceCharge>(), LogisticsServiceCharges = new ArrayList<IZUGFeRDAllowanceCharge>();
@@ -59,7 +59,9 @@ public class Invoice implements IExportableTransaction {
return documentName;
}
public String getContractReferencedDocument() { return contractReferencedDocument; }
public String getContractReferencedDocument() {
return contractReferencedDocument;
}
public Invoice setDocumentName(String documentName) {
this.documentName = documentName;
@@ -94,7 +96,7 @@ public class Invoice implements IExportableTransaction {
*/
public Invoice setCorrection(String number) {
setBuyerOrderReferencedDocumentID(number);
documentCode= DocumentCodeTypeConstants.CORRECTEDINVOICE;
documentCode = DocumentCodeTypeConstants.CORRECTEDINVOICE;
return this;
}
@@ -144,7 +146,6 @@ public class Invoice implements IExportableTransaction {
}
public Invoice setShipToStreet(String shipToStreet) {
this.shipToStreet = shipToStreet;
return this;
@@ -209,6 +210,7 @@ public class Invoice implements IExportableTransaction {
@Deprecated
/***
* @deprecated use TradeParty::addTaxID instead
* @see TradeParty
*/
public Invoice setOwnTaxID(String ownTaxID) {
sender.addTaxID(ownTaxID);
@@ -223,6 +225,7 @@ public class Invoice implements IExportableTransaction {
@Deprecated
/***
* @deprecated use TradeParty::addVATID instead
* @see TradeParty
*/
public Invoice setOwnVATID(String ownVATID) {
sender.addVATID(ownVATID);
@@ -234,6 +237,12 @@ public class Invoice implements IExportableTransaction {
return ownForeignOrganisationID;
}
@Deprecated
/***
* @deprecated use TradeParty instead
* @see TradeParty
*/
public Invoice setOwnForeignOrganisationID(String ownForeignOrganisationID) {
this.ownForeignOrganisationID = ownForeignOrganisationID;
return this;
@@ -244,6 +253,12 @@ public class Invoice implements IExportableTransaction {
return ownOrganisationName;
}
@Deprecated
/***
* @deprecated use senders' TradeParty's name instead
* @see TradeParty
*/
public Invoice setOwnOrganisationName(String ownOrganisationName) {
this.ownOrganisationName = ownOrganisationName;
return this;
@@ -273,7 +288,7 @@ public class Invoice implements IExportableTransaction {
@Override
public String[] getNotes() {
if (notes==null) {
if (notes == null) {
return null;
}
return notes.toArray(new String[0]);
@@ -344,6 +359,11 @@ public class Invoice implements IExportableTransaction {
return sender;
}
/***
* sets a named sender contact
* @param ownContact
* @return
*/
public Invoice setOwnContact(Contact ownContact) {
this.sender.setContact(ownContact);
return this;
@@ -353,14 +373,26 @@ public class Invoice implements IExportableTransaction {
return recipient;
}
/**
* required.
* sets the invoice receiving institution = invoicee
* @param recipient
* @return
*/
public Invoice setRecipient(TradeParty recipient) {
this.recipient = recipient;
return this;
}
/**
* required.
* sets the invoicing institution = invoicer
* @param sender
* @return
*/
public Invoice setSender(TradeParty sender) {
this.sender = sender;
if ((sender.getBankDetails()!=null)&&(sender.getBankDetails().size()>0)) {
if ((sender.getBankDetails() != null) && (sender.getBankDetails().size() > 0)) {
// convert bankdetails
}
@@ -372,7 +404,7 @@ public class Invoice implements IExportableTransaction {
if (Allowances.isEmpty()) {
return null;
} else
return Allowances.toArray(new IZUGFeRDAllowanceCharge[0]);
return Allowances.toArray(new IZUGFeRDAllowanceCharge[0]);
}
@@ -397,11 +429,11 @@ public class Invoice implements IExportableTransaction {
@Override
public IZUGFeRDTradeSettlement[] getTradeSettlement() {
if (getSender()==null) {
if (getSender() == null) {
return null;
}
return ((TradeParty)getSender()).getAsTradeSettlement();
return ((TradeParty) getSender()).getAsTradeSettlement();
}
@@ -421,6 +453,11 @@ public class Invoice implements IExportableTransaction {
return deliveryAddress;
}
/***
* if the delivery address is not the recipient address, it can be specified here
* @param deliveryAddress
* @return
*/
public Invoice setDeliveryAddress(TradeParty deliveryAddress) {
this.deliveryAddress = deliveryAddress;
return this;
@@ -431,14 +468,18 @@ public class Invoice implements IExportableTransaction {
return ZFItems.toArray(new IZUGFeRDExportableItem[0]);
}
/**
* required
* adds invoice "lines" :-)
* @param item
* @return
*/
public Invoice addItem(IZUGFeRDExportableItem item) {
ZFItems.add(item);
return this;
}
/***
* checks if all required items are set in order to be able to export it
* @return true if all required items are set
@@ -454,61 +495,72 @@ public class Invoice implements IExportableTransaction {
// this.country = country;
}
/***
* adds a document level addition to the price
* @param izac
* @return
*/
public Invoice addCharge(IZUGFeRDAllowanceCharge izac) {
Charges.add(izac);
return this;
}
/***
* adds a document level rebate
* @param izac
* @return
*/
public Invoice addAllowance(IZUGFeRDAllowanceCharge izac) {
Allowances.add(izac);
return this;
}
/***
* adds the ID of a contract referenced in the invoice
* @param s
* @return
*/
public Invoice setContractReferencedDocument(String s) {
contractReferencedDocument=s;
contractReferencedDocument = s;
return this;
}
public Invoice setOccurrenceDate(Date occur) {
occurrenceDateFrom=occur;
occurrenceDateTo=null;
/***
* sets a document level delivery period,
* which is optional additional to the mandatory deliverydate
* and which will become a BillingSpecifiedPeriod-Element
* @param start
* @param end
* @return fluent setter
*/
public Invoice setDetailedDeliveryPeriod(Date start, Date end) {
detailedDeliveryDateStart = start;
detailedDeliveryPeriodEnd = end;
return this;
}
public Invoice setOccurrencePeriod(Date start, Date end) {
occurrenceDateFrom=start;
occurrenceDateTo=end;
return this;
@Override
public Date getDetailedDeliveryPeriodFrom() {
return detailedDeliveryDateStart;
}
@Override
public Date getOccurrenceDate() {
return occurrenceDateFrom;
}
@Override
public Date getOccurrencePeriodFrom() {
if (occurrenceDateTo!=null) {
return occurrenceDateFrom;
} else {
return null;
}
}
@Override
public Date getOccurrencePeriodTo() {
if (occurrenceDateTo!=null) {
return occurrenceDateTo;
} else {
return null;
}
public Date getDetailedDeliveryPeriodTo() {
return detailedDeliveryPeriodEnd;
}
/***
* adds a free text paragraph, which will become a includedNote element
* @param text
* @return fluent setter
*/
public Invoice addNote(String text) {
if (notes==null) {
notes=new ArrayList<String>();
if (notes == null) {
notes = new ArrayList<String>();
}
notes.add(text);
return this;

View File

@@ -6,6 +6,9 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDExportableItem;
import java.math.BigDecimal;
import java.util.ArrayList;
/***
* describes any invoice line
*/
public class Item implements IZUGFeRDExportableItem {
protected BigDecimal price, quantity, tax, grossPrice, lineTotalAmount;
protected String id;
@@ -14,6 +17,12 @@ public class Item implements IZUGFeRDExportableItem {
protected ArrayList<IZUGFeRDAllowanceCharge> Allowances = new ArrayList<IZUGFeRDAllowanceCharge>(),
Charges = new ArrayList<IZUGFeRDAllowanceCharge>();
/***
* default constructor
* @param product contains the products name, tax rate, and unit
* @param price the base price of one item the product
* @param quantity the number, dimensions or the weight of the delivered product or good in this context
*/
public Item(Product product, BigDecimal price, BigDecimal quantity) {
this.price = price;
this.quantity = quantity;
@@ -24,6 +33,11 @@ public class Item implements IZUGFeRDExportableItem {
return lineTotalAmount;
}
/**
* should only be set by calculator classes or maybe when reading from XML
* @param lineTotalAmount
* @return
*/
public Item setLineTotalAmount(BigDecimal lineTotalAmount) {
this.lineTotalAmount = lineTotalAmount;
return this;
@@ -33,6 +47,11 @@ public class Item implements IZUGFeRDExportableItem {
return grossPrice;
}
/***
* the list price without VAT (sic!), refer to EN16931-1 for definition
* @return
*/
public Item setGrossPrice(BigDecimal grossPrice) {
this.grossPrice = grossPrice;
return this;
@@ -125,6 +144,11 @@ public class Item implements IZUGFeRDExportableItem {
return this;
}
/***
* adds item level freetext fields (includednote)
* @param text
* @return
*/
public Item addNote(String text) {
if (notes==null) {
notes=new ArrayList<String>();

View File

@@ -4,10 +4,20 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct;
import java.math.BigDecimal;
/***
* describes a product, good or service used in an invoice item line
*/
public class Product implements IZUGFeRDExportableProduct {
protected String unit, name, description, sellerAssignedID, buyerAssignedID;
protected BigDecimal VATPercent;
/***
* default constructor
* @param name
* @param description
* @param unit a two/three letter UN/ECE rec 20 unit code, e.g. "C62" for piece
* @param VATPercent
*/
public Product(String name, String description, String unit, BigDecimal VATPercent) {
this.unit = unit;
this.name = name;
@@ -20,6 +30,11 @@ public class Product implements IZUGFeRDExportableProduct {
return sellerAssignedID;
}
/***
* how the seller identifies this type of product
* @param sellerAssignedID
* @return
*/
public Product setSellerAssignedID(String sellerAssignedID) {
this.sellerAssignedID = sellerAssignedID;
return this;
@@ -29,6 +44,11 @@ public class Product implements IZUGFeRDExportableProduct {
return buyerAssignedID;
}
/***
* if the buyer provided an ID how he refers to this product
* @param buyerAssignedID
* @return
*/
public Product setBuyerAssignedID(String buyerAssignedID) {
this.buyerAssignedID = buyerAssignedID;
return this;
@@ -39,6 +59,11 @@ public class Product implements IZUGFeRDExportableProduct {
return unit;
}
/***
* sets a UN/ECE rec 20 or 21 code which unit the product ships in, e.g. C62=piece
* @param unit
* @return
*/
public Product setUnit(String unit) {
this.unit = unit;
return this;
@@ -49,6 +74,11 @@ public class Product implements IZUGFeRDExportableProduct {
return name;
}
/**
* name of the product
* @param name
* @return
*/
public Product setName(String name) {
this.name = name;
return this;
@@ -59,6 +89,11 @@ public class Product implements IZUGFeRDExportableProduct {
return description;
}
/**
* description of the product (required)
* @param description
* @return
*/
public Product setDescription(String description) {
this.description = description;
return this;
@@ -69,6 +104,11 @@ public class Product implements IZUGFeRDExportableProduct {
return VATPercent;
}
/****
* VAT rate of the product
* @param VATPercent
* @return
*/
public Product setVATPercent(BigDecimal VATPercent) {
this.VATPercent = VATPercent;
return this;

View File

@@ -6,6 +6,9 @@ import org.w3c.dom.NodeList;
import java.util.ArrayList;
/***
* A organisation, i.e. usually a company
*/
public class TradeParty implements IZUGFeRDExportableTradeParty {
protected String name, zip, street, location, country;
@@ -15,6 +18,14 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
protected ArrayList<BankDetails> bankDetails = new ArrayList<BankDetails>();
protected Contact contact = null;
/***
*
* @param name of the company
* @param street street and number (use setAdditionalAddress for more parts)
* @param zip postcode of the company
* @param location city of the company
* @param country two letter ISO code
*/
public TradeParty(String name, String street, String zip, String location, String country) {
this.name = name;
this.street = street;
@@ -24,6 +35,10 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
}
/***
* XML parsing constructor
* @param nodes
*/
public TradeParty(NodeList nodes) {
/**
* <ram:SellerTradeParty>
@@ -92,16 +107,31 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
return ID;
}
/**
* if it's a customer, this can e.g. be the customer ID
* @param ID
* @return
*/
public TradeParty setID(String ID) {
this.ID = ID;
return this;
}
/***
* (optional) a named contact person
* @param c
* @return
*/
public TradeParty setContact(Contact c) {
this.contact = c;
return this;
}
/***
* required (for senders, if payment is not debit): the BIC and IBAN
* @param s
* @return
*/
public TradeParty addBankDetails(BankDetails s) {
bankDetails.add(s);
return this;
@@ -111,11 +141,21 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
return bankDetails;
}
/***
* a general tax ID
* @param taxID
* @return
*/
public TradeParty addTaxID(String taxID) {
this.taxID = taxID;
return this;
}
/***
* the USt-ID
* @param vatID
* @return
*/
public TradeParty addVATID(String vatID) {
this.vatID = vatID;
return this;
@@ -135,6 +175,11 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
return name;
}
/***
* required, usually done in the constructor: the complete name of the organisation
* @return
*/
public TradeParty setName(String name) {
this.name = name;
return this;
@@ -145,6 +190,11 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
return zip;
}
/***
* usually set in the constructor, required for recipients in german invoices: postcode
* @param zip
* @return
*/
public TradeParty setZIP(String zip) {
this.zip = zip;
return this;
@@ -155,6 +205,11 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
return street;
}
/***
* usually set in constructor, required in germany, street and house number
* @param street
* @return
*/
public TradeParty setStreet(String street) {
this.street = street;
return this;
@@ -165,6 +220,11 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
return location;
}
/***
* usually set in constructor, usually required in germany, the city of the organisation
* @param location
* @return
*/
public TradeParty setLocation(String location) {
this.location = location;
return this;
@@ -175,6 +235,11 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
return country;
}
/***
* two-letter ISO code of the country
* @param country
* @return
*/
public TradeParty setCountry(String country) {
this.country = country;
return this;
@@ -206,6 +271,13 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
return additionalAddress;
}
/***
* additional parts of the address, e.g. which floor.
* Street address will become "lineOne", this will become "lineTwo"
* @param additionalAddress
* @return
*/
public TradeParty setAdditionalAddress(String additionalAddress) {
this.additionalAddress = additionalAddress;
return this;

View File

@@ -21,8 +21,8 @@ package org.mustangproject.ZUGFeRD;
* Mustangproject's ZUGFeRD implementation
* Neccessary interface for ZUGFeRD exporter
* Licensed under the APLv2
* @date 2014-05-10 to 2014-06-25
* @version 1.2.0
* @date 2014-05-10 to 2020-11-12
* @version 2.0.0
* @author jstaerk
* */
@@ -36,7 +36,7 @@ import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
/***
* the interface of an transaction, e.g. an invoice, you want to create xml (potentially to be added to a PDF)
* for
* @see Invoice if you want to use an object rather than an interface
* @see org.mustangproject.Invoice
*/
public interface IExportableTransaction {
@@ -431,33 +431,26 @@ public interface IExportableTransaction {
return null;
}
/***
* specify delivery date
* @return the delivery date
*/
default Date getOccurrenceDate() {
return null;
}
/***
* specify delivery period
* specifies the document level delivery period, will be included in a BillingSpecifiedPeriod element
* @return the beginning of the delivery period
*/
default Date getOccurrencePeriodFrom() {
default Date getDetailedDeliveryPeriodFrom() {
return null;
}
/***
* specify delivery period
* specifies the document level delivery period, will be included in a BillingSpecifiedPeriod element
* @return the end of the delivery period
*/
default Date getOccurrencePeriodTo() {
default Date getDetailedDeliveryPeriodTo() {
return null;
}
/**
* get additional referenced documents acccording to BG-24 XRechnung (Rechnungsbegruendende Unterlagen),
* i.e. <ram:AdditionalReferencedDocument> in <ram:ApplicableHeaderTradeAgreement> (only supported for zf2)
* i.e. ram:ApplicableHeaderTradeAgreement/ram:AdditionalReferencedDocument
*
* @return a array of objects from class FileAttachment
*/

View File

@@ -496,13 +496,13 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
}
}
if ((trans.getOccurrencePeriodFrom() != null) || (trans.getOccurrencePeriodTo() != null)) {
if ((trans.getDetailedDeliveryPeriodFrom() != null) || (trans.getDetailedDeliveryPeriodTo() != null)) {
xml = xml + "<ram:BillingSpecifiedPeriod>";
if (trans.getOccurrencePeriodFrom() != null) {
xml = xml + "<ram:StartDateTime><udt:DateTimeString format='102'>" + zugferdDateFormat.format(trans.getOccurrencePeriodFrom()) + "</udt:DateTimeString></ram:StartDateTime>";
if (trans.getDetailedDeliveryPeriodFrom() != null) {
xml = xml + "<ram:StartDateTime><udt:DateTimeString format='102'>" + zugferdDateFormat.format(trans.getDetailedDeliveryPeriodFrom()) + "</udt:DateTimeString></ram:StartDateTime>";
}
if (trans.getOccurrencePeriodTo() != null) {
xml = xml + "<ram:EndDateTime><udt:DateTimeString format='102'>" + zugferdDateFormat.format(trans.getOccurrencePeriodTo()) + "</udt:DateTimeString></ram:EndDateTime>";
if (trans.getDetailedDeliveryPeriodTo() != null) {
xml = xml + "<ram:EndDateTime><udt:DateTimeString format='102'>" + zugferdDateFormat.format(trans.getDetailedDeliveryPeriodTo()) + "</udt:DateTimeString></ram:EndDateTime>";
}
xml = xml + "</ram:BillingSpecifiedPeriod>";

View File

@@ -65,7 +65,7 @@ public class ZF2PushTest extends TestCase {
.load(SOURCE_PDF)) {
try {
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setContractReferencedDocument(contractID).setOccurrencePeriod(new SimpleDateFormat("yyyyMMdd").parse(occurenceFrom), new SimpleDateFormat("yyyyMMdd").parse(occurenceTo)).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addBankDetails(new BankDetails("777666555", "DE4321"))).setOwnTaxID("4711").setOwnVATID("DE19990815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setAdditionalAddress("Hinterhaus 3").setContact(new Contact("nameRep", "phoneRep", "emailRep@test.com"))).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, new BigDecimal(1.0))));
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setContractReferencedDocument(contractID).setDetailedDeliveryPeriod(new SimpleDateFormat("yyyyMMdd").parse(occurenceFrom), new SimpleDateFormat("yyyyMMdd").parse(occurenceTo)).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addBankDetails(new BankDetails("777666555", "DE4321"))).setOwnTaxID("4711").setOwnVATID("DE19990815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setAdditionalAddress("Hinterhaus 3").setContact(new Contact("nameRep", "phoneRep", "emailRep@test.com"))).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, new BigDecimal(1.0))));
} catch (ParseException ex) {
throw new RuntimeException("Parse exception");
}
@@ -209,7 +209,7 @@ public class ZF2PushTest extends TestCase {
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile(Profiles.getByName("en16931")).ignorePDFAErrors()
.load(SOURCE_PDF)) {
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("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
ze.setTransaction(new Invoice().setCurrency("CHF").setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)))
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)))
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)))
@@ -258,12 +258,14 @@ public class ZF2PushTest extends TestCase {
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
try {
ze.setTransaction(new Invoice().setCurrency("CHF").addNote("document level 1/2").addNote("document level 2/2").setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID(taxID)).setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE4711").setContact(new Contact("Franz Müller", "01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE"))).setNumber(number)
ze.setTransaction(new Invoice().setCurrency("CHF").addNote("document level 1/2").addNote("document level 2/2").setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date())
.setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID(taxID).setID("0009845"))
.setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setID("0008734").addVATID("DE4711").setContact(new Contact("Franz Müller", "01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE")))
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(16)), price, new BigDecimal(1.0)).addNote("item level 1/1").addAllowance(new Allowance(new BigDecimal(0.02)).setReason("item discount").setTaxPercent(new BigDecimal(16))))
.addCharge(new Charge(new BigDecimal(0.5)).setReason("quick delivery charge").setTaxPercent(new BigDecimal(16)))
.addAllowance(new Allowance(new BigDecimal(0.2)).setReason("discount").setTaxPercent(new BigDecimal(16)))
.setOccurrenceDate(sdf.parse("2020-01-01"))
.setDeliveryDate(sdf.parse("2020-02-02"))
.setDetailedDeliveryPeriod(sdf.parse("2020-01-01"),sdf.parse("2020-01-31"))
.setDeliveryDate(sdf.parse("2020-02-02")).setOwnVATID("DE0815").setNumber(number)
);
} catch (ParseException e) {
e.printStackTrace();
@@ -298,7 +300,7 @@ public class ZF2PushTest extends TestCase {
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile(Profiles.getByName("en16931")).ignorePDFAErrors()
.load(SOURCE_PDF)) {
ze.setTransaction(new Invoice().setDueDate(new Date()).setOccurrenceDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "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("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), new BigDecimal(500.0), qty).addAllowance(new Allowance(new BigDecimal(300)).setTaxPercent(new BigDecimal(19))))
.addAllowance(new Allowance(new BigDecimal(600)).setTaxPercent(new BigDecimal(19)))
@@ -341,7 +343,7 @@ public class ZF2PushTest extends TestCase {
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile(Profiles.getByName("extended")).ignorePDFAErrors()
.load(SOURCE_PDF)) {
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("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
ze.setTransaction(new Invoice().setCurrency("CHF").setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, new BigDecimal(1.0)))
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, new BigDecimal(1.0)))
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, new BigDecimal(1.0)).addCharge(new Charge().setPercent(new BigDecimal(50)).setTaxPercent(new BigDecimal(19))))
@@ -388,7 +390,7 @@ public class ZF2PushTest extends TestCase {
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
.load(SOURCE_PDF)) {
Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setOccurrencePeriod(new Date(), new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID("4711").addVATID("DE0815")).setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE0815")).setNumber(number)
Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDetailedDeliveryPeriod(new Date(), new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID("4711").addVATID("DE0815")).setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE0815")).setNumber(number)
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, qty))
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, qty))
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), price, qty)).setCorrection("0815");