Added getInvoiceID() to ZUGFeRDImporter.java

Added Test
This commit is contained in:
Alexander Berndt
2020-06-18 09:56:20 +02:00
parent 4643371038
commit 3bb2a951d9
2 changed files with 17 additions and 0 deletions

View File

@@ -252,6 +252,22 @@ public class ZUGFeRDImporter {
return result; return result;
} }
/**
* @return the Invoice ID
*/
public String getInvoiceID() {
try {
if (getVersion() == 1) {
return extractString("//HeaderExchangedDocument//ID");
} else {
return extractString("//ExchangedDocument//ID");
}
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
/** /**
* @return the document code * @return the document code

View File

@@ -207,6 +207,7 @@ public class ZF2Test extends MustangReaderTestCase {
// Reading ZUGFeRD // Reading ZUGFeRD
assertEquals(zi.getAmount(), "571.04"); assertEquals(zi.getAmount(), "571.04");
assertEquals(zi.getInvoiceID(), "RE-20170509/505");
assertEquals(zi.getHolder(), getOwnOrganisationName()); assertEquals(zi.getHolder(), getOwnOrganisationName());
assertEquals(zi.getDocumentCode(),"380"); assertEquals(zi.getDocumentCode(),"380");
assertEquals(zi.getReference(),"AB321"); assertEquals(zi.getReference(),"AB321");