closes #455
This commit is contained in:
@@ -10,6 +10,8 @@
|
|||||||
- refactor(ZUGFeRDVisualizer): improve PDF visualization performance #438
|
- refactor(ZUGFeRDVisualizer): improve PDF visualization performance #438
|
||||||
- trying to default product on empty description
|
- trying to default product on empty description
|
||||||
- #452
|
- #452
|
||||||
|
- #447 legalorganisation tradingbusinessname
|
||||||
|
- #455
|
||||||
-
|
-
|
||||||
2.12.0
|
2.12.0
|
||||||
=======
|
=======
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package org.mustangproject;
|
package org.mustangproject;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlementPayment;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlementPayment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,6 +20,10 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
|
|||||||
* the "name" of the bank account (holder)
|
* the "name" of the bank account (holder)
|
||||||
*/
|
*/
|
||||||
protected String accountName=null;
|
protected String accountName=null;
|
||||||
|
/***
|
||||||
|
* bean constructor
|
||||||
|
*/
|
||||||
|
public BankDetails() { }
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* constructor for IBAN only :-)
|
* constructor for IBAN only :-)
|
||||||
@@ -80,12 +86,14 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
|
|||||||
* */
|
* */
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@JsonIgnore
|
||||||
public String getOwnBIC() {
|
public String getOwnBIC() {
|
||||||
return getBIC();
|
return getBIC();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@JsonIgnore
|
||||||
public String getOwnIBAN() {
|
public String getOwnIBAN() {
|
||||||
return getIBAN();
|
return getIBAN();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import java.util.HashMap;
|
|||||||
*/
|
*/
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
public class Product implements IZUGFeRDExportableProduct {
|
public class Product implements IZUGFeRDExportableProduct {
|
||||||
protected String unit, name, description, sellerAssignedID, buyerAssignedID;
|
protected String unit, name, sellerAssignedID, buyerAssignedID;
|
||||||
|
protected String description="";
|
||||||
protected BigDecimal VATPercent;
|
protected BigDecimal VATPercent;
|
||||||
protected boolean isReverseCharge = false;
|
protected boolean isReverseCharge = false;
|
||||||
protected boolean isIntraCommunitySupply = false;
|
protected boolean isIntraCommunitySupply = false;
|
||||||
|
|||||||
@@ -18,12 +18,15 @@
|
|||||||
*********************************************************************** */
|
*********************************************************************** */
|
||||||
package org.mustangproject.ZUGFeRD;
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
public interface IZUGFeRDTradeSettlement {
|
public interface IZUGFeRDTradeSettlement {
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* gets the applicableHeaderTradeSettlement
|
* gets the applicableHeaderTradeSettlement
|
||||||
* @return zf2 xml
|
* @return zf2 xml
|
||||||
*/
|
*/
|
||||||
|
@JsonIgnore
|
||||||
String getSettlementXML();
|
String getSettlementXML();
|
||||||
|
|
||||||
|
|
||||||
@@ -31,6 +34,7 @@ public interface IZUGFeRDTradeSettlement {
|
|||||||
* gets the applicableHeaderTradePayment
|
* gets the applicableHeaderTradePayment
|
||||||
* @return zf2 xml
|
* @return zf2 xml
|
||||||
*/
|
*/
|
||||||
|
@JsonIgnore
|
||||||
default String getPaymentXML() {
|
default String getPaymentXML() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*********************************************************************** */
|
*********************************************************************** */
|
||||||
package org.mustangproject.ZUGFeRD;
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.mustangproject.XMLTools;
|
import org.mustangproject.XMLTools;
|
||||||
|
|
||||||
public interface IZUGFeRDTradeSettlementPayment extends IZUGFeRDTradeSettlement {
|
public interface IZUGFeRDTradeSettlementPayment extends IZUGFeRDTradeSettlement {
|
||||||
@@ -27,6 +28,7 @@ public interface IZUGFeRDTradeSettlementPayment extends IZUGFeRDTradeSettlement
|
|||||||
*
|
*
|
||||||
* @return payment information text
|
* @return payment information text
|
||||||
*/
|
*/
|
||||||
|
@JsonIgnore
|
||||||
default String getOwnPaymentInfoText() {
|
default String getOwnPaymentInfoText() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -59,6 +61,7 @@ public interface IZUGFeRDTradeSettlementPayment extends IZUGFeRDTradeSettlement
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@JsonIgnore
|
||||||
default String getSettlementXML() {
|
default String getSettlementXML() {
|
||||||
String accountNameStr="";
|
String accountNameStr="";
|
||||||
if (getAccountName()!=null) {
|
if (getAccountName()!=null) {
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ public class ZUGFeRDVisualizer {
|
|||||||
private TransformerFactory mFactory = null;
|
private TransformerFactory mFactory = null;
|
||||||
private Templates mXsltXRTemplate = null;
|
private Templates mXsltXRTemplate = null;
|
||||||
private Templates mXsltUBLTemplate = null;
|
private Templates mXsltUBLTemplate = null;
|
||||||
|
private Templates mXsltCIOTemplate = null;
|
||||||
private Templates mXsltHTMLTemplate = null;
|
private Templates mXsltHTMLTemplate = null;
|
||||||
private Templates mXsltPDFTemplate = null;
|
private Templates mXsltPDFTemplate = null;
|
||||||
private Templates mXsltZF1HTMLTemplate = null;
|
private Templates mXsltZF1HTMLTemplate = null;
|
||||||
@@ -151,6 +152,8 @@ public class ZUGFeRDVisualizer {
|
|||||||
String zf2Signature = "CrossIndustryInvoice";
|
String zf2Signature = "CrossIndustryInvoice";
|
||||||
String ublSignature = "Invoice";
|
String ublSignature = "Invoice";
|
||||||
String ublCreditNoteSignature = "CreditNote";
|
String ublCreditNoteSignature = "CreditNote";
|
||||||
|
String cioSignature = "SCRDMCCBDACIOMessageStructure" +
|
||||||
|
"";
|
||||||
boolean doPostProcessing = false;
|
boolean doPostProcessing = false;
|
||||||
|
|
||||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||||
@@ -173,6 +176,10 @@ public class ZUGFeRDVisualizer {
|
|||||||
//zf2 or fx
|
//zf2 or fx
|
||||||
applyUBLCreditNote2XSLT(fis, iaos);
|
applyUBLCreditNote2XSLT(fis, iaos);
|
||||||
doPostProcessing = true;
|
doPostProcessing = true;
|
||||||
|
} else if (root.getLocalName().equals(cioSignature)) {
|
||||||
|
//zf2 or fx
|
||||||
|
applyCIO2XSLT(fis, iaos);
|
||||||
|
doPostProcessing = true;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("File does not look like CII or UBL");
|
throw new IllegalArgumentException("File does not look like CII or UBL");
|
||||||
}
|
}
|
||||||
@@ -277,20 +284,6 @@ public class ZUGFeRDVisualizer {
|
|||||||
} catch (FileNotFoundException | TransformerException e) {
|
} catch (FileNotFoundException | TransformerException e) {
|
||||||
LOGGER.error("Failed to apply FOP", e);
|
LOGGER.error("Failed to apply FOP", e);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
FopConfParser parser = null;
|
|
||||||
try {
|
|
||||||
//parsing configuration
|
|
||||||
parser = new FopConfParser(CLASS_LOADER.getResourceAsStream("fop-config.xconf"), new URI("file:///"));
|
|
||||||
|
|
||||||
} catch (SAXException e) {
|
|
||||||
throw new UncheckedIOException(new IOException(e));
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new UncheckedIOException(e);
|
|
||||||
} catch (URISyntaxException e) {
|
|
||||||
Logger.getLogger(ZUGFeRDVisualizer.class.getName()).log(Level.SEVERE, null, e);
|
|
||||||
}*/
|
|
||||||
// FopFactoryBuilder builder = parser.getFopFactoryBuilder();
|
|
||||||
DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
|
DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
|
||||||
|
|
||||||
Configuration cfg = null;
|
Configuration cfg = null;
|
||||||
@@ -351,6 +344,17 @@ public class ZUGFeRDVisualizer {
|
|||||||
transformer.transform(new StreamSource(xmlFile), new StreamResult(HTMLOutstream));
|
transformer.transform(new StreamSource(xmlFile), new StreamResult(HTMLOutstream));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void applyCIO2XSLT(final InputStream xmlFile, final OutputStream HTMLOutstream)
|
||||||
|
throws TransformerException {
|
||||||
|
if (mXsltCIOTemplate == null) {
|
||||||
|
mXsltCIOTemplate = mFactory.newTemplates(
|
||||||
|
new StreamSource(CLASS_LOADER.getResourceAsStream(RESOURCE_PATH + "stylesheets/cio-xr.xsl")));
|
||||||
|
}
|
||||||
|
Transformer transformer = mXsltCIOTemplate.newTransformer();
|
||||||
|
|
||||||
|
transformer.transform(new StreamSource(xmlFile), new StreamResult(HTMLOutstream));
|
||||||
|
}
|
||||||
|
|
||||||
protected void applyUBL2XSLT(final InputStream xmlFile, final OutputStream HTMLOutstream)
|
protected void applyUBL2XSLT(final InputStream xmlFile, final OutputStream HTMLOutstream)
|
||||||
throws TransformerException {
|
throws TransformerException {
|
||||||
if (mXsltUBLTemplate == null) {
|
if (mXsltUBLTemplate == null) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class DeSerializationTest extends TestCase {
|
|||||||
public void testJackson() throws JsonProcessingException {
|
public void testJackson() throws JsonProcessingException {
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty("some org", "teststr", "55232", "teststadt", "DE").addTaxID("taxID")).setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE4711").setContact(new Contact("Franz Müller", "01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE"))).setNumber("0185").addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), new BigDecimal("1"), new BigDecimal(1.0)));
|
Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty("some org", "teststr", "55232", "teststadt", "DE").addTaxID("taxID").addBankDetails(new BankDetails("DE3600000123456", "ABCDEFG1001").setAccountName("Donald Duck"))).setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE4711").setContact(new Contact("Franz Müller", "01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE"))).setNumber("0185").addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), new BigDecimal("1"), new BigDecimal(1.0)));
|
||||||
String jsonArray = mapper.writeValueAsString(i);
|
String jsonArray = mapper.writeValueAsString(i);
|
||||||
|
|
||||||
// [{"stringValue":"a","intValue":1,"booleanValue":true},
|
// [{"stringValue":"a","intValue":1,"booleanValue":true},
|
||||||
|
|||||||
Reference in New Issue
Block a user