- invoiceimporter to parse BuyerReference
- support LineThree in TradeParty (BT-165?)
This commit is contained in:
@@ -25,6 +25,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
||||
protected String taxID = null, vatID = null;
|
||||
protected String ID = null;
|
||||
protected String additionalAddress = null;
|
||||
protected String additionalAddressExtension = null;
|
||||
protected List<BankDetails> bankDetails = new ArrayList<>();
|
||||
protected List<IZUGFeRDTradeSettlementDebit> debitDetails = new ArrayList<>();
|
||||
protected Contact contact = null;
|
||||
@@ -120,6 +121,9 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
||||
if (postal.item(postalChildIndex).getLocalName().equals("LineTwo")) {
|
||||
setAdditionalAddress(postal.item(postalChildIndex).getTextContent());
|
||||
}
|
||||
if (postal.item(postalChildIndex).getLocalName().equals("LineThree")) {
|
||||
setAdditionalAddressExtension(postal.item(postalChildIndex).getTextContent());
|
||||
}
|
||||
if (postal.item(postalChildIndex).getLocalName().equals("CityName")) {
|
||||
setLocation(postal.item(postalChildIndex).getTextContent());
|
||||
}
|
||||
@@ -398,9 +402,11 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* additional parts of the address, e.g. which floor.
|
||||
* Street address will become "lineOne", this will become "lineTwo"
|
||||
* additional info of the address, e.g. which building or which floor.
|
||||
* Street address will become "lineOne", this will become "lineTwo".
|
||||
* (see setAdditionalAddressExtension for "lineThree")
|
||||
* @param additionalAddress additional address description
|
||||
* @return fluent setter
|
||||
*/
|
||||
@@ -409,5 +415,41 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
||||
return this;
|
||||
}
|
||||
|
||||
/***
|
||||
* Sets two parts of additional address at once, e.g. which building and which floor
|
||||
* (if building is not in question which floor can also be set with the first part only :-))
|
||||
*
|
||||
* @param additionalAddress1 first part of additional info, e.g. "Rear building"
|
||||
* @param additionalAddress2 second part of additional address info, e.g. "2nd floor"
|
||||
* @return fluent setter
|
||||
*/
|
||||
public TradeParty setAdditionalAddress(String additionalAddress1, String additionalAddress2) {
|
||||
this.additionalAddress = additionalAddress1;
|
||||
this.additionalAddressExtension = additionalAddress2;
|
||||
return this;
|
||||
}
|
||||
|
||||
/***
|
||||
* Sets even advanced additional address information,
|
||||
* e.g. which floor (if LineTwo has already been used e.g. for which building)
|
||||
* This could sometimes be BT-165?
|
||||
*
|
||||
* @param additionalAddress2
|
||||
* @return fluent setter
|
||||
*/
|
||||
public TradeParty setAdditionalAddressExtension(String additionalAddress2) {
|
||||
this.additionalAddressExtension = additionalAddress2;
|
||||
return this;
|
||||
}
|
||||
|
||||
/***
|
||||
* Returns even advanced additional address information,
|
||||
* e.g. which floor (if LineTwo=setAdditionalAddress has already been used e.g. for which building)
|
||||
* @return lineThree
|
||||
*/
|
||||
public String getAdditionalAddressExtension() {
|
||||
return this.additionalAddressExtension;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -119,13 +119,25 @@ public interface IZUGFeRDExportableTradeParty {
|
||||
|
||||
/**
|
||||
* returns additional address information which is display in xml tag "LineTwo"
|
||||
*
|
||||
* e.g. "Rear building"
|
||||
*
|
||||
* @return additional address information
|
||||
*/
|
||||
default String getAdditionalAddress() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns additional address information which is display in xml tag "LineThree"
|
||||
* e.g. "Second floor" if LineTwo is already used, e.g. "Rear Building".
|
||||
* This attribute could sometimes be BT-165?
|
||||
*
|
||||
* @return additional address information
|
||||
*/
|
||||
default String getAdditionalAddressExtension() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* obligatory for sender but not for recipient
|
||||
|
||||
@@ -177,6 +177,10 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
xml += "<ram:LineTwo>" + XMLTools.encodeXML(party.getAdditionalAddress())
|
||||
+ "</ram:LineTwo>";
|
||||
}
|
||||
if (party.getAdditionalAddressExtension() != null) {
|
||||
xml += "<ram:LineThree>" + XMLTools.encodeXML(party.getAdditionalAddressExtension())
|
||||
+ "</ram:LineThree>";
|
||||
}
|
||||
xml += "<ram:CityName>" + XMLTools.encodeXML(party.getLocation())
|
||||
+ "</ram:CityName>"
|
||||
+ "<ram:CountryID>" + XMLTools.encodeXML(party.getCountry())
|
||||
|
||||
@@ -183,6 +183,17 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
|
||||
.setSender(new TradeParty(SellerNodes)).setRecipient(new TradeParty(BuyerNodes)).setNumber(number);
|
||||
//.addItem(new Item(new Product("Testprodukt","","C62",BigDecimal.ZERO),amount,new BigDecimal(1.0)))
|
||||
zpp.setOwnOrganisationName(extractString("//*[local-name()=\"SellerTradeParty\"]/*[local-name()=\"Name\"]"));
|
||||
|
||||
xpr = xpath.compile("//*[local-name()=\"BuyerReference\"]");
|
||||
String buyerReference = null;
|
||||
totalNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||
if (totalNodes.getLength() > 0) {
|
||||
buyerReference = totalNodes.item(0).getTextContent();
|
||||
}
|
||||
if (buyerReference!=null) {
|
||||
zpp.setReferenceNumber(buyerReference);
|
||||
}
|
||||
|
||||
xpr = xpath.compile("//*[local-name()=\"IncludedSupplyChainTradeLineItem\"]");
|
||||
NodeList nodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user