closes #455
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
- refactor(ZUGFeRDVisualizer): improve PDF visualization performance #438
|
||||
- trying to default product on empty description
|
||||
- #452
|
||||
- #447 legalorganisation tradingbusinessname
|
||||
- #455
|
||||
-
|
||||
2.12.0
|
||||
=======
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlementPayment;
|
||||
|
||||
/**
|
||||
@@ -18,6 +20,10 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
|
||||
* the "name" of the bank account (holder)
|
||||
*/
|
||||
protected String accountName=null;
|
||||
/***
|
||||
* bean constructor
|
||||
*/
|
||||
public BankDetails() { }
|
||||
|
||||
/***
|
||||
* constructor for IBAN only :-)
|
||||
@@ -80,12 +86,14 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
|
||||
* */
|
||||
@Override
|
||||
@Deprecated
|
||||
@JsonIgnore
|
||||
public String getOwnBIC() {
|
||||
return getBIC();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
@JsonIgnore
|
||||
public String getOwnIBAN() {
|
||||
return getIBAN();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@ import java.util.HashMap;
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
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 boolean isReverseCharge = false;
|
||||
protected boolean isIntraCommunitySupply = false;
|
||||
|
||||
@@ -18,12 +18,15 @@
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
public interface IZUGFeRDTradeSettlement {
|
||||
|
||||
/***
|
||||
* gets the applicableHeaderTradeSettlement
|
||||
* @return zf2 xml
|
||||
*/
|
||||
@JsonIgnore
|
||||
String getSettlementXML();
|
||||
|
||||
|
||||
@@ -31,6 +34,7 @@ public interface IZUGFeRDTradeSettlement {
|
||||
* gets the applicableHeaderTradePayment
|
||||
* @return zf2 xml
|
||||
*/
|
||||
@JsonIgnore
|
||||
default String getPaymentXML() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import org.mustangproject.XMLTools;
|
||||
|
||||
public interface IZUGFeRDTradeSettlementPayment extends IZUGFeRDTradeSettlement {
|
||||
@@ -27,6 +28,7 @@ public interface IZUGFeRDTradeSettlementPayment extends IZUGFeRDTradeSettlement
|
||||
*
|
||||
* @return payment information text
|
||||
*/
|
||||
@JsonIgnore
|
||||
default String getOwnPaymentInfoText() {
|
||||
return null;
|
||||
}
|
||||
@@ -59,6 +61,7 @@ public interface IZUGFeRDTradeSettlementPayment extends IZUGFeRDTradeSettlement
|
||||
|
||||
|
||||
@Override
|
||||
@JsonIgnore
|
||||
default String getSettlementXML() {
|
||||
String accountNameStr="";
|
||||
if (getAccountName()!=null) {
|
||||
|
||||
@@ -96,6 +96,7 @@ public class ZUGFeRDVisualizer {
|
||||
private TransformerFactory mFactory = null;
|
||||
private Templates mXsltXRTemplate = null;
|
||||
private Templates mXsltUBLTemplate = null;
|
||||
private Templates mXsltCIOTemplate = null;
|
||||
private Templates mXsltHTMLTemplate = null;
|
||||
private Templates mXsltPDFTemplate = null;
|
||||
private Templates mXsltZF1HTMLTemplate = null;
|
||||
@@ -151,6 +152,8 @@ public class ZUGFeRDVisualizer {
|
||||
String zf2Signature = "CrossIndustryInvoice";
|
||||
String ublSignature = "Invoice";
|
||||
String ublCreditNoteSignature = "CreditNote";
|
||||
String cioSignature = "SCRDMCCBDACIOMessageStructure" +
|
||||
"";
|
||||
boolean doPostProcessing = false;
|
||||
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
@@ -173,6 +176,10 @@ public class ZUGFeRDVisualizer {
|
||||
//zf2 or fx
|
||||
applyUBLCreditNote2XSLT(fis, iaos);
|
||||
doPostProcessing = true;
|
||||
} else if (root.getLocalName().equals(cioSignature)) {
|
||||
//zf2 or fx
|
||||
applyCIO2XSLT(fis, iaos);
|
||||
doPostProcessing = true;
|
||||
} else {
|
||||
throw new IllegalArgumentException("File does not look like CII or UBL");
|
||||
}
|
||||
@@ -277,20 +284,6 @@ public class ZUGFeRDVisualizer {
|
||||
} catch (FileNotFoundException | TransformerException 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();
|
||||
|
||||
Configuration cfg = null;
|
||||
@@ -351,6 +344,17 @@ public class ZUGFeRDVisualizer {
|
||||
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)
|
||||
throws TransformerException {
|
||||
if (mXsltUBLTemplate == null) {
|
||||
|
||||
@@ -36,7 +36,7 @@ public class DeSerializationTest extends TestCase {
|
||||
public void testJackson() throws JsonProcessingException {
|
||||
|
||||
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);
|
||||
|
||||
// [{"stringValue":"a","intValue":1,"booleanValue":true},
|
||||
|
||||
Reference in New Issue
Block a user