diff --git a/library/src/main/java/org/mustangproject/IncludedNote.java b/library/src/main/java/org/mustangproject/IncludedNote.java index 219f9e20..5eeea22e 100644 --- a/library/src/main/java/org/mustangproject/IncludedNote.java +++ b/library/src/main/java/org/mustangproject/IncludedNote.java @@ -30,6 +30,12 @@ public class IncludedNote { 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 String getContent() { return content; diff --git a/library/src/main/java/org/mustangproject/Invoice.java b/library/src/main/java/org/mustangproject/Invoice.java index 2f63578b..606d19ba 100644 --- a/library/src/main/java/org/mustangproject/Invoice.java +++ b/library/src/main/java/org/mustangproject/Invoice.java @@ -699,7 +699,7 @@ public class Invoice implements IExportableTransaction { * @param content freeform UTF8 plain text * @return fluent setter */ - public Invoice regulatoryNote(String content) { + public Invoice addRegulatoryNote(String content) { if (includedNotes == null) { includedNotes = new ArrayList<>(); } @@ -713,7 +713,7 @@ public class Invoice implements IExportableTransaction { * @param content freeform UTF8 plain text * @return fluent setter */ - public Invoice legalNote(String content) { + public Invoice addLegalNote(String content) { if (includedNotes == null) { includedNotes = new ArrayList<>(); } @@ -727,7 +727,7 @@ public class Invoice implements IExportableTransaction { * @param content freeform UTF8 plain text * @return fluent setter */ - public Invoice customsNote(String content) { + public Invoice addCustomsNote(String content) { if (includedNotes == null) { includedNotes = new ArrayList<>(); } @@ -741,7 +741,7 @@ public class Invoice implements IExportableTransaction { * @param content freeform UTF8 plain text * @return fluent setter */ - public Invoice sellerNote(String content) { + public Invoice addSellerNote(String content) { if (includedNotes == null) { includedNotes = new ArrayList<>(); } @@ -755,7 +755,7 @@ public class Invoice implements IExportableTransaction { * @param content freeform UTF8 plain text * @return fluent setter */ - public Invoice taxNote(String content) { + public Invoice addTaxNote(String content) { if (includedNotes == null) { includedNotes = new ArrayList<>(); } @@ -763,6 +763,33 @@ public class Invoice implements IExportableTransaction { return this; } + /** + * adds a free text paragraph, which will become an includedNote element with explicit + * subjectCode {@link SubjectCode#ACY} + * @param content freeform UTF8 plain text + * @return fluent setter + */ + public Invoice addIntroductionNote(String content) { + if (includedNotes == null) { + includedNotes = new ArrayList<>(); + } + includedNotes.add(IncludedNote.introductionNote(content)); + return this; + } + /** + * adds a free text paragraph, which will become an includedNote element with explicit + * subjectCode {@link SubjectCode#AAK} + * @param content freeform UTF8 plain text + * @return fluent setter + */ + public Invoice addDiscountBonusNote(String content) { + if (includedNotes == null) { + includedNotes = new ArrayList<>(); + } + includedNotes.add(IncludedNote.discountBonusNote(content)); + return this; + } + @Override public String getSpecifiedProcuringProjectID() { return specifiedProcuringProjectID; diff --git a/library/src/main/java/org/mustangproject/SubjectCode.java b/library/src/main/java/org/mustangproject/SubjectCode.java index fb388c1f..52cc698a 100644 --- a/library/src/main/java/org/mustangproject/SubjectCode.java +++ b/library/src/main/java/org/mustangproject/SubjectCode.java @@ -27,5 +27,13 @@ public enum SubjectCode { /** * Customs information */ - CUS + CUS, + /** + * introduction + */ + ACY, + /** + * Discount and bonus agreements + */ + AAK } diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java index c45d628a..4c632db1 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java @@ -41,6 +41,7 @@ import org.dom4j.DocumentHelper; import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; import org.mustangproject.FileAttachment; +import org.mustangproject.SubjectCode; import org.mustangproject.XMLTools; import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants; @@ -753,13 +754,17 @@ public class ZUGFeRD2PullProvider implements IXMLProvider { if (trans.rebateAgreementExists()) { notes.append("") .append("Es bestehen Rabatt- und Bonusvereinbarungen.") - .append("AAK"); + .append("") + .append(SubjectCode.AAK) + .append(""); } if (trans.getOwnOrganisationFullPlaintextInfo() != null) { notes.append("") .append(XMLTools.encodeXML(trans.getOwnOrganisationFullPlaintextInfo())) .append("") - .append("REG"); + .append("") + .append(SubjectCode.REG) + .append(""); } if (trans.getSubjectNote() != null) { notes.append("")