Skip to content

Commit 23a7d00

Browse files
committed
Read contact´s faxNumber.
1 parent 046bc09 commit 23a7d00

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

library/src/main/java/org/mustangproject/Contact.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,21 @@ public Contact(NodeList nodes) {
130130
} else if (currentItemNode.getLocalName().equals("Telephone")) { /* UBL */
131131
setPhone(currentItemNode.getTextContent());
132132
}
133+
134+
// CII: only for Extended profile
135+
if (currentItemNode.getLocalName().equals("FaxUniversalCommunication")) { /* CII */
136+
NodeList fax = currentItemNode.getChildNodes();
137+
for (int faxChildIndex = 0; faxChildIndex < fax.getLength(); faxChildIndex++) {
138+
if (fax.item(faxChildIndex).getLocalName() != null) {
139+
if (fax.item(faxChildIndex).getLocalName().equals("CompleteNumber")) {
140+
setFax(fax.item(faxChildIndex).getTextContent());
141+
}
142+
}
143+
}
144+
} else if (currentItemNode.getLocalName().equals("Telefax")) { /* UBL */
145+
setFax(currentItemNode.getTextContent());
146+
}
147+
133148
if (currentItemNode.getLocalName().equals("EmailURIUniversalCommunication")) { /* CII */
134149
NodeList email = currentItemNode.getChildNodes();
135150
for (int emailChildIndex = 0; emailChildIndex < email.getLength(); emailChildIndex++) {

library/src/test/java/org/mustangproject/ZUGFeRD/UBLTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public void testEdgeInvoiceImportUBL2() {
139139
assertFalse(hasExceptions);
140140

141141
assertEquals(new BigDecimal("10000.0"), invoice.getTotalPrepaidAmount());
142+
assertEquals("4621231", invoice.getSender().getContact().getFax());
142143
}
143144

144145
}

library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,8 @@ public void testPushEdge() {
603603
assertEquals("Verwendungszweck", i.getPaymentReference());
604604
assertEquals("Rechnung", i.getDocumentName());
605605

606+
assertEquals("++49555123456",i.getRecipient().getContact().getFax());
607+
606608
} catch (XPathExpressionException e) {
607609
fail("XPathExpressionException should not be raised");
608610
} catch (ParseException e) {

library/src/test/resources/ubl/04.01a-INVOICE_ubl.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<cac:Contact>
4141
<cbc:Name>M. Meier Handwerk GbR</cbc:Name>
4242
<cbc:Telephone>010/12345</cbc:Telephone>
43+
<cbc:Telefax>4621231</cbc:Telefax>
4344
<cbc:ElectronicMail>info@m-meier.de</cbc:ElectronicMail>
4445
</cac:Contact>
4546
</cac:Party>

0 commit comments

Comments
 (0)