allow some more JSONing
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/***
|
||||
* (absolute) allowances on item and document level
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Allowance extends Charge {
|
||||
|
||||
/***
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlementPayment;
|
||||
/**
|
||||
* provides e.g. the IBAN to transfer money to :-)
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class BankDetails implements IZUGFeRDTradeSettlementPayment {
|
||||
/**
|
||||
* the bank account number
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package org.mustangproject;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.mustangproject.ZUGFeRD.TransactionCalculator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -9,8 +10,10 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class CalculatedInvoice extends Invoice implements Serializable {
|
||||
|
||||
protected BigDecimal duePayable=null;
|
||||
protected BigDecimal grandTotal=null;
|
||||
protected BigDecimal lineTotalAmount=null;
|
||||
|
||||
@@ -18,6 +21,7 @@ public class CalculatedInvoice extends Invoice implements Serializable {
|
||||
TransactionCalculator tc=new TransactionCalculator(this);
|
||||
grandTotal=tc.getGrandTotal();
|
||||
lineTotalAmount=tc.getValue();
|
||||
duePayable=tc.getDuePayable();
|
||||
}
|
||||
public BigDecimal getGrandTotal() {
|
||||
if (grandTotal==null) {
|
||||
@@ -29,6 +33,18 @@ public class CalculatedInvoice extends Invoice implements Serializable {
|
||||
grandTotal=grand;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getDuePayable() {
|
||||
if (duePayable==null) {
|
||||
calculate();
|
||||
}
|
||||
return duePayable;
|
||||
}
|
||||
public CalculatedInvoice setDuePayable(BigDecimal due) {
|
||||
duePayable=due;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getLineTotalAmount() {
|
||||
if (lineTotalAmount==null) {
|
||||
calculate();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDCashDiscount;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -7,6 +8,7 @@ import java.math.BigDecimal;
|
||||
/***
|
||||
* A class to represent discounts for early payments ("Skonto")
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class CashDiscount implements IZUGFeRDCashDiscount {
|
||||
|
||||
/***
|
||||
@@ -31,6 +33,31 @@ public class CashDiscount implements IZUGFeRDCashDiscount {
|
||||
this.days = days;
|
||||
}
|
||||
|
||||
/***
|
||||
* bean contructor
|
||||
*/
|
||||
public CashDiscount() {
|
||||
|
||||
}
|
||||
|
||||
public BigDecimal getPercent() {
|
||||
return percent;
|
||||
}
|
||||
|
||||
public CashDiscount setPercent(BigDecimal percent) {
|
||||
this.percent = percent;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getDays() {
|
||||
return days;
|
||||
}
|
||||
|
||||
public CashDiscount setDays(Integer days) {
|
||||
this.days = days;
|
||||
return this;
|
||||
}
|
||||
|
||||
/***
|
||||
* @return this particular cash discount as cross industry invoice XML
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.mustangproject.ZUGFeRD.IAbsoluteValueProvider;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
|
||||
|
||||
@@ -9,6 +10,7 @@ import java.math.BigDecimal;
|
||||
/***
|
||||
* Absolute and relative charges for document and item level
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Charge implements IZUGFeRDAllowanceCharge {
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,12 +20,14 @@
|
||||
*/
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
* A schemed classification for products. The scheme can be anything defined in UNTDID 7143.
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ClassCode {
|
||||
private final String listID;
|
||||
private final String code;
|
||||
|
||||
@@ -20,12 +20,14 @@
|
||||
*/
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.mustangproject.ZUGFeRD.IDesignatedProductClassification;
|
||||
|
||||
/**
|
||||
* An implementation of {@link IDesignatedProductClassification} for describing a {@link org.mustangproject.Product}
|
||||
*
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DesignatedProductClassification implements IDesignatedProductClassification {
|
||||
private final ClassCode classCode;
|
||||
private String className;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlementDebit;
|
||||
|
||||
/**
|
||||
* provides e.g. the IBAN to transfer money to :-)
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
|
||||
/**
|
||||
* Debited account identifier (BT-91)
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class FileAttachment {
|
||||
|
||||
protected String filename;
|
||||
|
||||
@@ -1,75 +1,98 @@
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
/**
|
||||
* A grouping of business terms to indicate accounting-relevant free texts including a qualification of these.
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class IncludedNote {
|
||||
private String content;
|
||||
private SubjectCode subjectCode;
|
||||
private String content;
|
||||
|
||||
private static final String INCLUDE_START = "<ram:IncludedNote>";
|
||||
private static final String INCLUDE_END = "</ram:IncludedNote>";
|
||||
private static final String CONTENT_START = "<ram:Content>";
|
||||
private static final String CONTENT_END = "</ram:Content>";
|
||||
private static final String SUBJECT_CODE_START = "<ram:SubjectCode>";
|
||||
private static final String SUBJECT_CODE_END = "</ram:SubjectCode>";
|
||||
private SubjectCode subjectCode;
|
||||
|
||||
private IncludedNote(String content, SubjectCode subjectCode) {
|
||||
this.content = content;
|
||||
this.subjectCode = subjectCode;
|
||||
}
|
||||
private static final String INCLUDE_START = "<ram:IncludedNote>";
|
||||
private static final String INCLUDE_END = "</ram:IncludedNote>";
|
||||
private static final String CONTENT_START = "<ram:Content>";
|
||||
private static final String CONTENT_END = "</ram:Content>";
|
||||
private static final String SUBJECT_CODE_START = "<ram:SubjectCode>";
|
||||
private static final String SUBJECT_CODE_END = "</ram:SubjectCode>";
|
||||
|
||||
private IncludedNote(String content, SubjectCode subjectCode) {
|
||||
this.content = content;
|
||||
this.subjectCode = subjectCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* bean constructor
|
||||
*/
|
||||
public IncludedNote() {
|
||||
public IncludedNote() {
|
||||
|
||||
}
|
||||
|
||||
public static IncludedNote generalNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.AAI);
|
||||
}
|
||||
public static IncludedNote regulatoryNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.REG);
|
||||
}
|
||||
public static IncludedNote legalNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.ABL);
|
||||
}
|
||||
public static IncludedNote customsNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.CUS);
|
||||
}
|
||||
public static IncludedNote sellerNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.SUR);
|
||||
}
|
||||
public static IncludedNote taxNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.TXD);
|
||||
}
|
||||
public static IncludedNote introductionNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.ACY);
|
||||
}
|
||||
public static IncludedNote discountBonusNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.AAK);
|
||||
}
|
||||
public static IncludedNote generalNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.AAI);
|
||||
}
|
||||
|
||||
public static IncludedNote unspecifiedNote(String content) {
|
||||
return new IncludedNote(content, null);
|
||||
}
|
||||
public static IncludedNote regulatoryNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.REG);
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
public static IncludedNote legalNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.ABL);
|
||||
}
|
||||
|
||||
public static IncludedNote customsNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.CUS);
|
||||
}
|
||||
|
||||
public static IncludedNote sellerNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.SUR);
|
||||
}
|
||||
|
||||
public static IncludedNote taxNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.TXD);
|
||||
}
|
||||
|
||||
public static IncludedNote introductionNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.ACY);
|
||||
}
|
||||
|
||||
public static IncludedNote discountBonusNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.AAK);
|
||||
}
|
||||
|
||||
public static IncludedNote unspecifiedNote(String content) {
|
||||
return new IncludedNote(content, null);
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public SubjectCode getSubjectCode() {
|
||||
return subjectCode;
|
||||
}
|
||||
|
||||
|
||||
public IncludedNote setSubjectCode(SubjectCode subjectCode) {
|
||||
this.subjectCode = subjectCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IncludedNote setContent(String content) {
|
||||
this.content = content;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public String toCiiXml() {
|
||||
String result = INCLUDE_START + CONTENT_START +
|
||||
XMLTools.encodeXML(getContent()) + CONTENT_END;
|
||||
if (getSubjectCode() != null) {
|
||||
result += SUBJECT_CODE_START + getSubjectCode() + SUBJECT_CODE_END;
|
||||
}
|
||||
return result + INCLUDE_END;
|
||||
}
|
||||
|
||||
public SubjectCode getSubjectCode() {
|
||||
return subjectCode;
|
||||
}
|
||||
|
||||
public String toCiiXml(){
|
||||
String result = INCLUDE_START + CONTENT_START +
|
||||
XMLTools.encodeXML(getContent() )+ CONTENT_END;
|
||||
if (getSubjectCode() != null) {
|
||||
result += SUBJECT_CODE_START + getSubjectCode() + SUBJECT_CODE_END;
|
||||
}
|
||||
return result + INCLUDE_END;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -413,6 +413,11 @@ public class Invoice implements IExportableTransaction {
|
||||
return includedNotes;
|
||||
}
|
||||
|
||||
public Invoice setNotesWithSubjectCode(List<IncludedNote> theList) {
|
||||
includedNotes=theList;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency() {
|
||||
return currency;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.mustangproject.ZUGFeRD.IReferencedDocument;
|
||||
import org.mustangproject.util.NodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ReferencedDocument implements IReferencedDocument {
|
||||
|
||||
String issuerAssignedID;
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package org.mustangproject;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class SchemedID {
|
||||
protected String scheme;
|
||||
protected String id;
|
||||
|
||||
@@ -415,6 +415,14 @@ public class ZUGFeRDInvoiceImporter {
|
||||
}
|
||||
}
|
||||
|
||||
xpr = xpath.compile("//*[local-name()=\"SpecifiedTradeSettlementHeaderMonetarySummation\"]/*[local-name()=\"DuePayableAmount\"]|//*[local-name()=\"LegalMonetaryTotal\"]/*[local-name()=\"PayableAmount\"]");
|
||||
NodeList lineDueNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||
if (lineDueNodes.getLength() > 0) {
|
||||
if (zpp instanceof CalculatedInvoice) {
|
||||
((CalculatedInvoice) zpp).setDuePayable(new BigDecimal(XMLTools.trimOrNull(lineDueNodes.item(0))));
|
||||
}
|
||||
}
|
||||
|
||||
Date issueDate = null;
|
||||
Date dueDate = null;
|
||||
Date deliveryDate = null;
|
||||
|
||||
Reference in New Issue
Block a user