add fax number to contact. Allow access to lineTwo(additionaladdress)
This commit is contained in:
@@ -46,6 +46,7 @@ switch
|
|||||||
- corrected invoices,
|
- corrected invoices,
|
||||||
- contacts also for recipients
|
- contacts also for recipients
|
||||||
- absolute and relative allowances and charges on item and document level,
|
- absolute and relative allowances and charges on item and document level,
|
||||||
|
- support contact fax numbers
|
||||||
|
|
||||||
### 2.0 still todo
|
### 2.0 still todo
|
||||||
- dont show empty tax number field
|
- dont show empty tax number field
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
|
|||||||
public class Contact implements IZUGFeRDExportableContact {
|
public class Contact implements IZUGFeRDExportableContact {
|
||||||
|
|
||||||
protected String name,phone,email,zip,street,location,country;
|
protected String name,phone,email,zip,street,location,country;
|
||||||
|
protected String fax=null;
|
||||||
|
|
||||||
public Contact(String name, String phone, String email) {
|
public Contact(String name, String phone, String email) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -43,6 +44,16 @@ public class Contact implements IZUGFeRDExportableContact {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFax() {
|
||||||
|
return fax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Contact setFax(String fax) {
|
||||||
|
this.fax = fax;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public String getEMail() {
|
public String getEMail() {
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlement;
|
|||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
import javax.xml.xpath.XPathConstants;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class TradeParty implements IZUGFeRDExportableTradeParty {
|
public class TradeParty implements IZUGFeRDExportableTradeParty {
|
||||||
|
|
||||||
protected String name, zip, street, location, country;
|
protected String name, zip, street, location, country;
|
||||||
protected String taxID = null, vatID = null;
|
protected String taxID = null, vatID = null;
|
||||||
|
protected String additionalAddress = null;
|
||||||
protected ArrayList<BankDetails> bankDetails = new ArrayList<BankDetails>();
|
protected ArrayList<BankDetails> bankDetails = new ArrayList<BankDetails>();
|
||||||
protected Contact contact = null;
|
protected Contact contact = null;
|
||||||
|
|
||||||
@@ -66,6 +66,9 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
|||||||
if (postal.item(postalChildIndex).getNodeName().equals("ram:LineOne")) {
|
if (postal.item(postalChildIndex).getNodeName().equals("ram:LineOne")) {
|
||||||
setStreet(postal.item(postalChildIndex).getTextContent());
|
setStreet(postal.item(postalChildIndex).getTextContent());
|
||||||
}
|
}
|
||||||
|
if (postal.item(postalChildIndex).getNodeName().equals("ram:LineTwo")) {
|
||||||
|
setAdditionalAddress(postal.item(postalChildIndex).getTextContent());
|
||||||
|
}
|
||||||
if (postal.item(postalChildIndex).getNodeName().equals("ram:CityName")) {
|
if (postal.item(postalChildIndex).getNodeName().equals("ram:CityName")) {
|
||||||
setLocation(postal.item(postalChildIndex).getTextContent());
|
setLocation(postal.item(postalChildIndex).getTextContent());
|
||||||
}
|
}
|
||||||
@@ -188,4 +191,15 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
|||||||
}
|
}
|
||||||
return bankDetails.toArray(new IZUGFeRDTradeSettlement[0]);
|
return bankDetails.toArray(new IZUGFeRDTradeSettlement[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAdditionalAddress() {
|
||||||
|
return additionalAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TradeParty setAdditionalAddress(String additionalAddress) {
|
||||||
|
this.additionalAddress = additionalAddress;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,11 +51,15 @@ public interface IZUGFeRDExportableContact {
|
|||||||
default String getPhone() {
|
default String getPhone() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
default String getEMail() {
|
default String getEMail() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default String getFax() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Postal code of the recipient
|
* Postal code of the recipient
|
||||||
|
|||||||
@@ -235,12 +235,20 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IAbsoluteValueProvide
|
|||||||
+ XMLTools.encodeXML(party.getContact().getPhone()) + "</ram:CompleteNumber>\n"
|
+ XMLTools.encodeXML(party.getContact().getPhone()) + "</ram:CompleteNumber>\n"
|
||||||
+ " </ram:TelephoneUniversalCommunication>\n";
|
+ " </ram:TelephoneUniversalCommunication>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (party.getContact().getFax() != null) {
|
||||||
|
|
||||||
|
xml = xml + " <ram:FaxUniversalCommunication>\n" + " <ram:CompleteNumber>"
|
||||||
|
+ XMLTools.encodeXML(party.getContact().getFax()) + "</ram:CompleteNumber>\n"
|
||||||
|
+ " </ram:FaxUniversalCommunication>\n";
|
||||||
|
}
|
||||||
if (party.getContact().getEMail() != null) {
|
if (party.getContact().getEMail() != null) {
|
||||||
|
|
||||||
xml = xml + " <ram:EmailURIUniversalCommunication>\n" + " <ram:URIID>"
|
xml = xml + " <ram:EmailURIUniversalCommunication>\n" + " <ram:URIID>"
|
||||||
+ XMLTools.encodeXML(party.getContact().getEMail()) + "</ram:URIID>\n"
|
+ XMLTools.encodeXML(party.getContact().getEMail()) + "</ram:URIID>\n"
|
||||||
+ " </ram:EmailURIUniversalCommunication>\n";
|
+ " </ram:EmailURIUniversalCommunication>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
xml = xml + " </ram:DefinedTradeContact>";
|
xml = xml + " </ram:DefinedTradeContact>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,13 +63,10 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
try {
|
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").setContact(new Contact("nameRep", "phoneRep", "emailRep@test.com"))).setNumber(number).addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0))));
|
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)), amount, new BigDecimal(1.0))));
|
||||||
} catch (ParseException ex) {
|
} catch (ParseException ex) {
|
||||||
throw new RuntimeException("Parse exception");
|
throw new RuntimeException("Parse exception");
|
||||||
}
|
}
|
||||||
String theXML = new String(ze.getProvider().getXML());
|
|
||||||
assertTrue(theXML.contains("777666555")); //the iban
|
|
||||||
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
|
||||||
|
|
||||||
ze.export(TARGET_PDF);
|
ze.export(TARGET_PDF);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -78,11 +75,15 @@ public class ZF2PushTest extends TestCase {
|
|||||||
|
|
||||||
// now check the contents (like MustangReaderTest)
|
// now check the contents (like MustangReaderTest)
|
||||||
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
||||||
|
assertTrue(zi.getUTF8().contains("777666555")); //the iban
|
||||||
|
|
||||||
assertTrue(zi.getUTF8().contains("EUR"));
|
assertTrue(zi.getUTF8().contains("<rsm:CrossIndustryInvoice"));
|
||||||
|
|
||||||
|
assertTrue(zi.getUTF8().contains("EUR")); //default invoice currency
|
||||||
assertTrue(zi.getUTF8().contains(occurenceFrom));
|
assertTrue(zi.getUTF8().contains(occurenceFrom));
|
||||||
assertTrue(zi.getUTF8().contains(occurenceTo));
|
assertTrue(zi.getUTF8().contains(occurenceTo));
|
||||||
assertTrue(zi.getUTF8().contains(contractID));
|
assertTrue(zi.getUTF8().contains(contractID));
|
||||||
|
assertTrue(zi.getUTF8().contains("Hinterhaus")); // lineTwo/additionalAddress
|
||||||
assertTrue(zi.getUTF8().contains("0815"));
|
assertTrue(zi.getUTF8().contains("0815"));
|
||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
@@ -159,7 +160,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
// .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance().setPercent(new BigDecimal(50)))));
|
// .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance().setPercent(new BigDecimal(50)))));
|
||||||
|
|
||||||
|
|
||||||
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)
|
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").setContact(new Contact("contact testname","123456","contact.testemail@example.org" ).setFax("0911623562"))).setNumber(number)
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal("0.1"))))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal("0.1"))))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance().setPercent(new BigDecimal(50))))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance().setPercent(new BigDecimal(50))))
|
||||||
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(2.0)).addCharge(new Charge(new BigDecimal(1))))
|
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(2.0)).addCharge(new Charge(new BigDecimal(1))))
|
||||||
@@ -178,6 +179,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_ITEMCHARGESALLOWANCESPDF);
|
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_ITEMCHARGESALLOWANCESPDF);
|
||||||
|
|
||||||
assertTrue(zi.getUTF8().contains("EUR"));
|
assertTrue(zi.getUTF8().contains("EUR"));
|
||||||
|
assertTrue(zi.getUTF8().contains("0911623562")); // fax number
|
||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals("18.33", zi.getAmount());
|
assertEquals("18.33", zi.getAmount());
|
||||||
|
|||||||
Reference in New Issue
Block a user