closes #530
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
- 518 corrently validate more XRechnung versions
|
- 518 corrently validate more XRechnung versions
|
||||||
- make document charges and allowances serializable
|
- make document charges and allowances serializable
|
||||||
- 523
|
- 523
|
||||||
|
- 530
|
||||||
|
|
||||||
|
|
||||||
2.14.2
|
2.14.2
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
this.trans = trans;
|
this.trans = trans;
|
||||||
this.calc = new TransactionCalculator(trans);
|
this.calc = new TransactionCalculator(trans);
|
||||||
|
|
||||||
boolean hasDueDate = false;
|
boolean hasDueDate = trans.getDueDate()!=null;
|
||||||
final SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
final SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||||
|
|
||||||
String exemptionReason = "";
|
String exemptionReason = "";
|
||||||
@@ -818,7 +818,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((trans.getPaymentTerms() == null) && (getProfile() != Profiles.getByName("Minimum")) && ((paymentTermsDescription != null) || (trans.getTradeSettlement() != null) || (hasDueDate))) {
|
if ((trans.getPaymentTerms() == null) && (getProfile() != Profiles.getByName("Minimum")) && ((paymentTermsDescription != null) || (trans.getTradeSettlement() != null) || (hasDueDate))) {
|
||||||
xml += "<ram:SpecifiedTradePaymentTerms>";
|
xml += "<ram:SpecifiedTradePaymentTerms>";
|
||||||
|
|
||||||
@@ -834,7 +833,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasDueDate && (trans.getDueDate() != null)) {
|
if (trans.getDueDate() != null) {
|
||||||
xml += "<ram:DueDateDateTime>" // $NON-NLS-2$
|
xml += "<ram:DueDateDateTime>" // $NON-NLS-2$
|
||||||
+ DATE.udtFormat(trans.getDueDate())
|
+ DATE.udtFormat(trans.getDueDate())
|
||||||
+ "</ram:DueDateDateTime>";// 20130704
|
+ "</ram:DueDateDateTime>";// 20130704
|
||||||
|
|||||||
@@ -130,5 +130,61 @@ public class DeSerializationTest extends TestCase {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void testDueDateRoundtrip() throws JsonProcessingException {
|
||||||
|
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
|
// [{"stringValue":"a","intValue":1,"booleanValue":true},
|
||||||
|
// {"stringValue":"bc","intValue":3,"booleanValue":false}]
|
||||||
|
|
||||||
|
Invoice fromJSON = mapper.readValue("{\n" +
|
||||||
|
" \"number\": \"RE - 228\",\n" +
|
||||||
|
" \"currency\": \"EUR\",\n" +
|
||||||
|
" \"issueDate\": \"2024-10-24\",\n" +
|
||||||
|
" \"dueDate\": \"2024-10-26\",\n" +
|
||||||
|
" \"deliveryDate\": \"2024-10-25\",\n" +
|
||||||
|
" \"sender\": {\n" +
|
||||||
|
" \"name\": \"Amazing Company\",\n" +
|
||||||
|
" \"zip\": \"10000\",\n" +
|
||||||
|
" \"street\": \"Straße der Kosmonauten 20\",\n" +
|
||||||
|
" \"location\": \"Berlin\",\n" +
|
||||||
|
" \"country\": \"DE\",\n" +
|
||||||
|
" \"taxID\": \"201/113/40209\",\n" +
|
||||||
|
" \"vatID\": \"DE123456789\",\n" +
|
||||||
|
" \"globalID\": \"4000001123452\",\n" +
|
||||||
|
" \"globalIDScheme\": \"0088\"\n" +
|
||||||
|
" },\n" +
|
||||||
|
" \"recipient\": {\n" +
|
||||||
|
" \"name\": \"Amazing Company\",\n" +
|
||||||
|
" \"zip\": \"1000\",\n" +
|
||||||
|
" \"street\": \"Straße der Kosmonauten 10\",\n" +
|
||||||
|
" \"location\": \"Berlin\",\n" +
|
||||||
|
" \"taxID\": \"201/113/40209\",\n" +
|
||||||
|
" \"vatID\": \"DE123456789\",\n" +
|
||||||
|
" \"country\": \"DE\"\n" +
|
||||||
|
" },\n" +
|
||||||
|
" \"zfitems\": [\n" +
|
||||||
|
" {\n" +
|
||||||
|
" \"price\": 99.9,\n" +
|
||||||
|
" \"quantity\": 10,\n" +
|
||||||
|
" \"product\": {\n" +
|
||||||
|
" \"unit\": \"H87\",\n" +
|
||||||
|
" \"name\": \"Amazing Archives\",\n" +
|
||||||
|
" \"description\": \"123\",\n" +
|
||||||
|
" \"vatpercent\": \"19\",\n" +
|
||||||
|
" \"taxCategoryCode\": \"3\"\n" +
|
||||||
|
" }\n" +
|
||||||
|
" }\n" +
|
||||||
|
" ]\n" +
|
||||||
|
"}\n", Invoice.class);
|
||||||
|
ZUGFeRD2PullProvider zf2p = new ZUGFeRD2PullProvider();
|
||||||
|
zf2p.setProfile(Profiles.getByName("XRechnung"));
|
||||||
|
zf2p.generateXML(fromJSON);
|
||||||
|
String theXML = new String(zf2p.getXML());
|
||||||
|
assertTrue(theXML.contains("<udt:DateTimeString format=\"102\">20241026</udt:DateTimeString>"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user