- invoiceimporter to parse BuyerReference
- support LineThree in TradeParty (BT-165?)
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
2.5.8
|
||||
=======
|
||||
|
||||
|
||||
- invoiceimporter to parse BuyerReference
|
||||
- support LineThree in TradeParty (BT-165?)
|
||||
- Corrected forgotten --d CLI shortcut
|
||||
|
||||
2.5.7
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -76,6 +76,16 @@ public abstract class MustangReaderTestCase extends TestCase implements IExporta
|
||||
return "Bahnstr. 42";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalAddress() {
|
||||
return "Hinterhaus";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalAddressExtension() {
|
||||
return "Zweiter Stock";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVATID() {
|
||||
return "DE999999999";
|
||||
|
||||
@@ -215,8 +215,8 @@ public class ZF2Test extends MustangReaderTestCase {
|
||||
assertEquals(zi.getForeignReference(), getNumber());
|
||||
assertEquals(zi.getBuyerTradePartyAddress().getPostcodeCode(), "88802");
|
||||
assertEquals(zi.getBuyerTradePartyAddress().getLineOne(), "Bahnstr. 42");
|
||||
assertEquals(zi.getBuyerTradePartyAddress().getLineTwo(), null);
|
||||
assertEquals(zi.getBuyerTradePartyAddress().getLineThree(), null);
|
||||
assertEquals(zi.getBuyerTradePartyAddress().getLineTwo(), "Hinterhaus");
|
||||
assertEquals(zi.getBuyerTradePartyAddress().getLineThree(), "Zweiter Stock");
|
||||
assertEquals(zi.getBuyerTradePartyAddress().getCountrySubDivisionName(), null);
|
||||
assertEquals(zi.getBuyerTradePartyAddress().getCountryID(), "DE");
|
||||
assertEquals(zi.getBuyerTradePartyAddress().getCityName(), "Spielkreis");
|
||||
|
||||
@@ -65,6 +65,7 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
assertEquals(3, invoice.getZFItems().length);
|
||||
assertEquals("400.0000", invoice.getZFItems()[1].getQuantity().toString());
|
||||
|
||||
assertEquals("AB321", invoice.getReferenceNumber());
|
||||
assertEquals("160.0000", invoice.getZFItems()[0].getPrice().toString());
|
||||
assertEquals("Heiße Luft pro Liter", invoice.getZFItems()[2].getProduct().getName());
|
||||
assertEquals("LTR", invoice.getZFItems()[2].getProduct().getUnit());
|
||||
@@ -77,6 +78,8 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
||||
assertEquals("2017-05-30",sdf.format(invoice.getDueDate()));
|
||||
|
||||
assertEquals("Bahnstr. 42", invoice.getRecipient().getStreet());
|
||||
assertEquals("Hinterhaus", invoice.getRecipient().getAdditionalAddress());
|
||||
assertEquals("Zweiter Stock", invoice.getRecipient().getAdditionalAddressExtension());
|
||||
assertEquals("88802", invoice.getRecipient().getZIP());
|
||||
assertEquals("DE", invoice.getRecipient().getCountry());
|
||||
assertEquals("Spielkreis", invoice.getRecipient().getLocation());
|
||||
|
||||
Reference in New Issue
Block a user