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<>(),
|
||||
Charges = new ArrayList<>(), LogisticsServiceCharges = new ArrayList<>();
|
||||
protected IZUGFeRDPaymentTerms[] paymentTerms = null;
|
||||
protected ArrayList<IZUGFeRDPaymentTerms> paymentTerms = new ArrayList<>();
|
||||
|
||||
protected String invoiceReferencedDocumentID = null;
|
||||
protected Date invoiceReferencedIssueDate;
|
||||
@@ -642,24 +642,41 @@ public class Invoice implements IExportableTransaction {
|
||||
|
||||
|
||||
@Override
|
||||
public IZUGFeRDPaymentTerms[] getPaymentTerms() {
|
||||
return paymentTerms;
|
||||
public IZUGFeRDPaymentTerms getPaymentTerms() {
|
||||
if (!paymentTerms.isEmpty()) {
|
||||
return paymentTerms.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
public Invoice setPaymentTerms(IZUGFeRDPaymentTerms[] paymentTerms) {
|
||||
this.paymentTerms = paymentTerms;
|
||||
public Invoice setPaymentTerms(IZUGFeRDPaymentTerms paymentTerm) {
|
||||
if (paymentTerms.isEmpty()) {
|
||||
paymentTerms.add(paymentTerm);
|
||||
}
|
||||
else {
|
||||
paymentTerms.set(0, paymentTerm);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Invoice setPaymentTerms(IZUGFeRDPaymentTerms paymentTerms) {
|
||||
if (null != paymentTerms) {
|
||||
this.paymentTerms = new IZUGFeRDPaymentTerms[] { paymentTerms };
|
||||
}
|
||||
else {
|
||||
this.paymentTerms = null;
|
||||
}
|
||||
@Override
|
||||
public IZUGFeRDPaymentTerms[] getExtendedPaymentTerms() {
|
||||
return paymentTerms.toArray(new IZUGFeRDPaymentTerms[0]);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -305,15 +305,22 @@ public interface IExportableTransaction {
|
||||
}
|
||||
|
||||
/**
|
||||
* get payment terms. if set, getPaymentTermDescription() and getDueDate() are
|
||||
* ignored
|
||||
* get payment terms. if set, getPaymentTermDescription() and getDueDate() are ignored
|
||||
*
|
||||
* @return the IZUGFeRDPaymentTerms of the invoice
|
||||
*/
|
||||
default IZUGFeRDPaymentTerms[] getPaymentTerms() {
|
||||
default IZUGFeRDPaymentTerms getPaymentTerms() {
|
||||
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
|
||||
*
|
||||
|
||||
@@ -505,7 +505,7 @@ public class OXPullProvider extends ZUGFeRD2PullProvider {
|
||||
|
||||
private String buildPaymentTermsXml() {
|
||||
|
||||
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getPaymentTerms();
|
||||
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getExtendedPaymentTerms();
|
||||
|
||||
String paymentTermsXml = "";
|
||||
if (paymentTerms == null || paymentTerms.length == 0) {
|
||||
|
||||
@@ -433,7 +433,7 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider {
|
||||
}
|
||||
|
||||
private String buildPaymentTermsXml() {
|
||||
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getPaymentTerms();
|
||||
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getExtendedPaymentTerms();
|
||||
|
||||
String paymentTermsXml = "";
|
||||
if (paymentTerms == null || paymentTerms.length == 0) {
|
||||
|
||||
@@ -963,7 +963,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
private String buildPaymentTermsXml() {
|
||||
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getPaymentTerms();
|
||||
final IZUGFeRDPaymentTerms[] paymentTerms = trans.getExtendedPaymentTerms();
|
||||
|
||||
String paymentTermsXml = "";
|
||||
if (paymentTerms == null || paymentTerms.length == 0) {
|
||||
|
||||
@@ -225,7 +225,7 @@ public class ZF2EdgeTest extends MustangReaderTestCase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IZUGFeRDPaymentTerms[] getPaymentTerms() {
|
||||
public IZUGFeRDPaymentTerms getPaymentTerms() {
|
||||
PaymentDiscountTerms paymentDiscountTerms =
|
||||
new PaymentDiscountTerms(
|
||||
new BigDecimal(2), // skonto prozent
|
||||
@@ -240,13 +240,11 @@ public class ZF2EdgeTest extends MustangReaderTestCase {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
return new IZUGFeRDPaymentTerms[]{
|
||||
new PaymentTerms(
|
||||
return new PaymentTerms(
|
||||
"14 Tage 2% Skonto, 30 Tage rein netto",
|
||||
due,// fälligkeitsdatum
|
||||
paymentDiscountTerms //PaymentDiscountTerms
|
||||
)
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user