Updated ZUGFeRDImporter.java -> getDocumentCode() to fit ZUGFeRD 2.1
Added Test
This commit is contained in:
@@ -259,7 +259,16 @@ public class ZUGFeRDImporter {
|
||||
* @return the document code
|
||||
*/
|
||||
public String getDocumentCode() {
|
||||
return extractString("//HeaderExchangedDocument/TypeCode");
|
||||
try {
|
||||
if (getVersion() == 1) {
|
||||
return extractString("//HeaderExchangedDocument/TypeCode");
|
||||
} else {
|
||||
return extractString("//ExchangedDocument/TypeCode");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -458,6 +467,10 @@ public class ZUGFeRDImporter {
|
||||
return s.hasNext() ? s.next() : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an instance of PostalTradeAddress for SellerTradeParty section
|
||||
* @return an instance of PostalTradeAddress
|
||||
*/
|
||||
public PostalTradeAddress getSellerTradePartyAddress() {
|
||||
|
||||
NodeList nl = null;
|
||||
|
||||
@@ -207,7 +207,7 @@ public class ZF2Test extends MustangReaderTestCase {
|
||||
// Reading ZUGFeRD
|
||||
assertEquals(zi.getAmount(), "571.04");
|
||||
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
||||
|
||||
assertEquals(zi.getDocumentCode(),"380");
|
||||
assertEquals(zi.getAmount(), "571.04");
|
||||
assertEquals(zi.getBIC(), getTradeSettlementPayment()[0].getOwnBIC());
|
||||
assertEquals(zi.getIBAN(),getTradeSettlementPayment()[0].getOwnIBAN());
|
||||
|
||||
Reference in New Issue
Block a user