Issue #458 Restore old public api
This commit is contained in:
@@ -57,7 +57,7 @@ public class Invoice implements IExportableTransaction {
|
|||||||
|
|
||||||
protected ArrayList<IZUGFeRDAllowanceCharge> Allowances = new ArrayList<>(),
|
protected ArrayList<IZUGFeRDAllowanceCharge> Allowances = new ArrayList<>(),
|
||||||
Charges = new ArrayList<>(), LogisticsServiceCharges = new ArrayList<>();
|
Charges = new ArrayList<>(), LogisticsServiceCharges = new ArrayList<>();
|
||||||
protected IZUGFeRDPaymentTerms[] paymentTerms = null;
|
protected ArrayList<IZUGFeRDPaymentTerms> paymentTerms = new ArrayList<>();
|
||||||
|
|
||||||
protected String invoiceReferencedDocumentID = null;
|
protected String invoiceReferencedDocumentID = null;
|
||||||
protected Date invoiceReferencedIssueDate;
|
protected Date invoiceReferencedIssueDate;
|
||||||
@@ -642,24 +642,41 @@ public class Invoice implements IExportableTransaction {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDPaymentTerms[] getPaymentTerms() {
|
public IZUGFeRDPaymentTerms getPaymentTerms() {
|
||||||
return paymentTerms;
|
if (!paymentTerms.isEmpty()) {
|
||||||
|
return paymentTerms.get(0);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonProperty
|
@JsonProperty
|
||||||
public Invoice setPaymentTerms(IZUGFeRDPaymentTerms[] paymentTerms) {
|
public Invoice setPaymentTerms(IZUGFeRDPaymentTerms paymentTerm) {
|
||||||
this.paymentTerms = paymentTerms;
|
if (paymentTerms.isEmpty()) {
|
||||||
|
paymentTerms.add(paymentTerm);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
paymentTerms.set(0, paymentTerm);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Invoice setPaymentTerms(IZUGFeRDPaymentTerms paymentTerms) {
|
@Override
|
||||||
if (null != paymentTerms) {
|
public IZUGFeRDPaymentTerms[] getExtendedPaymentTerms() {
|
||||||
this.paymentTerms = new IZUGFeRDPaymentTerms[] { paymentTerms };
|
return paymentTerms.toArray(new IZUGFeRDPaymentTerms[0]);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
this.paymentTerms = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public Invoice setExtendedPaymentTerms(IZUGFeRDPaymentTerms[] paymentTerms) {
|
||||||
|
this.paymentTerms.clear();
|
||||||
|
this.paymentTerms.addAll(Arrays.asList(paymentTerms));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set multiple payment terms when using the EXTENDED profile.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Invoice addPaymentTerms(IZUGFeRDPaymentTerms paymentTerm) {
|
||||||
|
paymentTerms.add(paymentTerm);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -305,15 +305,22 @@ public interface IExportableTransaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get payment terms. if set, getPaymentTermDescription() and getDueDate() are
|
* get payment terms. if set, getPaymentTermDescription() and getDueDate() are ignored
|
||||||
* ignored
|
|
||||||
*
|
*
|
||||||
* @return the IZUGFeRDPaymentTerms of the invoice
|
* @return the IZUGFeRDPaymentTerms of the invoice
|
||||||
*/
|
*/
|
||||||
default IZUGFeRDPaymentTerms[] getPaymentTerms() {
|
default IZUGFeRDPaymentTerms getPaymentTerms() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get payment terms for the EXTENDED profile (multiple terms are allowed)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
default IZUGFeRDPaymentTerms[] getExtendedPaymentTerms() {
|
||||||
|
return new IZUGFeRDPaymentTerms[0];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns if a rebate agreements exists
|
* returns if a rebate agreements exists
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ public class OXPullProvider extends ZUGFeRD2PullProvider {
|
|||||||
|
|
||||||
private String buildPaymentTermsXml() {
|
private String buildPaymentTermsXml() {
|
||||||
|
|
||||||
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getPaymentTerms();
|
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getExtendedPaymentTerms();
|
||||||
|
|
||||||
String paymentTermsXml = "";
|
String paymentTermsXml = "";
|
||||||
if (paymentTerms == null || paymentTerms.length == 0) {
|
if (paymentTerms == null || paymentTerms.length == 0) {
|
||||||
|
|||||||
@@ -433,7 +433,7 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String buildPaymentTermsXml() {
|
private String buildPaymentTermsXml() {
|
||||||
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getPaymentTerms();
|
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getExtendedPaymentTerms();
|
||||||
|
|
||||||
String paymentTermsXml = "";
|
String paymentTermsXml = "";
|
||||||
if (paymentTerms == null || paymentTerms.length == 0) {
|
if (paymentTerms == null || paymentTerms.length == 0) {
|
||||||
|
|||||||
@@ -963,7 +963,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String buildPaymentTermsXml() {
|
private String buildPaymentTermsXml() {
|
||||||
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getPaymentTerms();
|
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getExtendedPaymentTerms();
|
||||||
|
|
||||||
String paymentTermsXml = "";
|
String paymentTermsXml = "";
|
||||||
if (paymentTerms == null || paymentTerms.length == 0) {
|
if (paymentTerms == null || paymentTerms.length == 0) {
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ public class ZF2EdgeTest extends MustangReaderTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDPaymentTerms[] getPaymentTerms() {
|
public IZUGFeRDPaymentTerms getPaymentTerms() {
|
||||||
PaymentDiscountTerms paymentDiscountTerms =
|
PaymentDiscountTerms paymentDiscountTerms =
|
||||||
new PaymentDiscountTerms(
|
new PaymentDiscountTerms(
|
||||||
new BigDecimal(2), // skonto prozent
|
new BigDecimal(2), // skonto prozent
|
||||||
@@ -240,13 +240,11 @@ public class ZF2EdgeTest extends MustangReaderTestCase {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
return new IZUGFeRDPaymentTerms[]{
|
return new PaymentTerms(
|
||||||
new PaymentTerms(
|
|
||||||
"14 Tage 2% Skonto, 30 Tage rein netto",
|
"14 Tage 2% Skonto, 30 Tage rein netto",
|
||||||
due,// fälligkeitsdatum
|
due,// fälligkeitsdatum
|
||||||
paymentDiscountTerms //PaymentDiscountTerms
|
paymentDiscountTerms //PaymentDiscountTerms
|
||||||
)
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user