add document code
This commit is contained in:
@@ -27,10 +27,21 @@ package org.mustangproject.ZUGFeRD;
|
|||||||
* */
|
* */
|
||||||
|
|
||||||
|
|
||||||
|
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public interface IZUGFeRDExportableTransaction {
|
public interface IZUGFeRDExportableTransaction {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return Code of Document
|
||||||
|
*/
|
||||||
|
default String getDocumentCode() {
|
||||||
|
return DocumentCodeTypeConstants.INVOICE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number, typically invoice number of the invoice
|
* Number, typically invoice number of the invoice
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -209,6 +209,13 @@ public class ZUGFeRDImporter {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the document code
|
||||||
|
*/
|
||||||
|
public String getDocumentCode() {
|
||||||
|
return extractString("//HeaderExchangedDocument/TypeCode");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the sender's bank's BLZ code
|
* @return the sender's bank's BLZ code
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class ZUGFeRDTransactionModelConverter {
|
|||||||
document.setIssueDateTime(issueDateTime);
|
document.setIssueDateTime(issueDateTime);
|
||||||
|
|
||||||
DocumentCodeType documentCodeType = xmlFactory.createDocumentCodeType();
|
DocumentCodeType documentCodeType = xmlFactory.createDocumentCodeType();
|
||||||
documentCodeType.setValue(DocumentCodeTypeConstants.INVOICE);
|
documentCodeType.setValue(trans.getDocumentCode());
|
||||||
document.setTypeCode(documentCodeType);
|
document.setTypeCode(documentCodeType);
|
||||||
|
|
||||||
TextType name = xmlFactory.createTextType();
|
TextType name = xmlFactory.createTextType();
|
||||||
|
|||||||
@@ -348,6 +348,7 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
||||||
assertEquals(zi.getDueDate(), "20170530");
|
assertEquals(zi.getDueDate(), "20170530");
|
||||||
assertEquals(zi.getForeignReference(), getNumber());
|
assertEquals(zi.getForeignReference(), getNumber());
|
||||||
|
assertEquals(zi.getDocumentCode(), "380");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -350,32 +350,13 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
|||||||
ZUGFeRDImporter zi = new ZUGFeRDImporter(inputStream);
|
ZUGFeRDImporter zi = new ZUGFeRDImporter(inputStream);
|
||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
String amount = null;
|
assertEquals(zi.getAmount(), "571.04");
|
||||||
String blz = null;
|
assertEquals(zi.getBLZ(), getOwnBLZ());
|
||||||
String bic = null;
|
assertEquals(zi.getBIC(), getOwnBIC());
|
||||||
String iban = null;
|
assertEquals(zi.getIBAN(), getOwnIBAN());
|
||||||
String kto = null;
|
assertEquals(zi.getKTO(), getOwnKto());
|
||||||
String holder = null;
|
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
||||||
String ref = null;
|
assertEquals(zi.getForeignReference(), "RE-20170509/505");
|
||||||
|
|
||||||
if (zi.canParse()) {
|
|
||||||
amount = zi.getAmount();
|
|
||||||
blz = zi.getBLZ();
|
|
||||||
bic = zi.getBIC();
|
|
||||||
iban = zi.getIBAN();
|
|
||||||
kto = zi.getKTO();
|
|
||||||
holder = zi.getHolder();
|
|
||||||
ref = zi.getForeignReference();
|
|
||||||
}
|
|
||||||
// this resembles the data written in MustangReaderWriterCustomXMLTest
|
|
||||||
assertEquals(amount, "571.04");
|
|
||||||
assertEquals(blz, "41441604");
|
|
||||||
assertEquals(bic, "COBADEFFXXX");
|
|
||||||
assertEquals(iban, "DE88 2008 0000 0970 3757 00");
|
|
||||||
assertEquals(kto, "44421800");
|
|
||||||
assertEquals(holder, "Bei Spiel GmbH");
|
|
||||||
assertEquals(ref, "RE-20170509/505");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testForeignImport() throws IOException {
|
public void testForeignImport() throws IOException {
|
||||||
|
|||||||
Reference in New Issue
Block a user