From 91bd1301669ca8e95fff2948aae4c28445543d7a Mon Sep 17 00:00:00 2001 From: Michael Winkler Date: Mon, 23 Nov 2026 14:06:20 +0100 Subject: [PATCH] Add BT-13, BT-8; rename leitwegId; fix order of BT-121 * add purchase order reference BT-13 * add VAT point date code BT-8 * deprecate leitwegId, rename to buyerReference * fix order in XML of VAT exemption reason code BT-121 --- README.md | 10 +- .../gallop/cii/CIIXMLEInvoiceWriter.java | 56 ++++-- .../de/codebarista/gallop/model/Invoice.java | 85 ++++++++- .../codebarista/gallop/BuildInvoiceTest.java | 2 +- .../de/codebarista/gallop/ScenarioHelper.java | 2 + .../invoice/order_with_allowance/invoice.json | 2 +- .../invoice.json | 2 +- .../invoice.json | 2 +- .../order_with_cash_payment/invoice.json | 2 +- .../invoice.json | 2 +- .../invoice.json | 2 +- .../order_with_customer_vatid/invoice.json | 2 +- .../invoice.json | 2 +- .../invoice.json | 2 +- .../invoice.json | 2 +- .../invoice.json | 2 +- .../en16931-core.xml | 173 ++++++++++++++++++ .../invoice.json | 141 ++++++++++++++ .../invoice.json | 2 +- .../invoice.json | 2 +- .../invoice.json | 2 +- .../invoice/order_with_paypal/invoice.json | 2 +- .../invoice.json | 2 +- .../invoice.json | 2 +- .../order_with_paypal_invoice/invoice.json | 2 +- .../order_with_rounding_amount/invoice.json | 2 +- .../invoice.json | 2 +- .../invoice.json | 2 +- .../order_with_tax_free_product/invoice.json | 2 +- .../en16931-core.xml | 141 ++++++++++++++ .../invoice.json | 115 ++++++++++++ .../xrechnung.xml | 144 +++++++++++++++ .../invoice/order_without_vatid/invoice.json | 2 +- 33 files changed, 863 insertions(+), 52 deletions(-) create mode 100644 src/test/resources/invoice/order_with_french_purchase_order_and_vat_on_debits/en16931-core.xml create mode 100644 src/test/resources/invoice/order_with_french_purchase_order_and_vat_on_debits/invoice.json create mode 100644 src/test/resources/invoice/order_with_vat_exemption_reason_code/en16931-core.xml create mode 100644 src/test/resources/invoice/order_with_vat_exemption_reason_code/invoice.json create mode 100644 src/test/resources/invoice/order_with_vat_exemption_reason_code/xrechnung.xml diff --git a/README.md b/README.md index 8c33e3d..59e720b 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ public class InvoiceGenerator { Invoice invoice = Invoice.create() .documentTypeCode(InvoiceType.COMMERCIAL_INVOICE.getValue()) // Define invoice type .documentId("INV-2025-1001") // Unique invoice identifier - .leitwegId("N/A") // Buyer reference (BT-10) + .buyerReference("N/A") // Buyer reference (BT-10) .currency("EUR") // Currency used for the invoice // Payment details including method and terms @@ -202,9 +202,13 @@ public class InvoiceGenerator { - UNRELEASED: Optional elements are only written when they have a value: the seller contact (BG-6) and each of its details, and the seller/buyer electronic address (BT-34/BT-49). The electronic address is now written with its scheme (`SellerOrBuyer.electronicAddressScheme`, falling back to `EM`) instead of always `EM`. **Behavior change:** - `BuyerReference` (BT-10) is only written if `Invoice.leitwegId` is set; Gallop no longer + `BuyerReference` (BT-10) is only written if `Invoice.buyerReference` is set; Gallop no longer writes `N/A` without it. XRechnung requires BT-10 (BR-DE-15), so set e.g. `N/A` yourself if there is no - reference. Includes the changes of 3.1.0. + reference. Add purchase order reference (`Invoice.buyerOrderReference`, BT-13) and VAT point date code + (`Invoice.vatPointDateCode`, BT-8, written as `ram:DueDateTypeCode` in every VAT breakdown, e.g. `5` for VAT on + debits). `Invoice.leitwegId` was renamed to `buyerReference` (BT-10); `leitwegId(...)`/`getLeitwegId()` are + deprecated. **Fix:** the VAT exemption reason code (BT-121) is now written after `ram:CategoryCode` as required by + the CII schema; before, invoices with BT-121 were schema-invalid. Includes the changes of 3.1.0. - 3.1.0: Add the fields required by the French rules for Factur-X: invoice note subject code (`InvoiceNote.subjectCode`, BT-21), business process type (`Invoice.businessProcessType`, BT-23, overrides the format's default) and seller/buyer identifier with scheme (`SellerOrBuyer.identifier`/ diff --git a/src/main/java/de/codebarista/gallop/cii/CIIXMLEInvoiceWriter.java b/src/main/java/de/codebarista/gallop/cii/CIIXMLEInvoiceWriter.java index 45770e6..396262e 100644 --- a/src/main/java/de/codebarista/gallop/cii/CIIXMLEInvoiceWriter.java +++ b/src/main/java/de/codebarista/gallop/cii/CIIXMLEInvoiceWriter.java @@ -184,7 +184,7 @@ private static Element createTradeLineItem(Item lineItem, XmlDocumentBuilder bui Element specifiedSettlement = builder.createElement(NS_RAM, "SpecifiedLineTradeSettlement"); tradeLineItem.appendChild(specifiedSettlement); if (lineItem.getVat() != null) { - specifiedSettlement.appendChild(createTax(builder, lineItem.getVat())); + specifiedSettlement.appendChild(createTax(builder, lineItem.getVat(), null)); } if (lineItem.getItemTotalNetAmount() != null) { Element taxSummation = builder.createElement(NS_RAM, "SpecifiedTradeSettlementLineMonetarySummation"); @@ -199,9 +199,9 @@ private static Element createTradeLineItem(Item lineItem, XmlDocumentBuilder bui private Element createTradeHeader(XmlDocumentBuilder builder) { Element tradeHeader = builder.createElement(NS_RAM, "ApplicableHeaderTradeAgreement"); - if (GallopUtils.isNotNullOrBlank(invoice.getLeitwegId())) { - Element buyerRef = builder.createElement(NS_RAM, "BuyerReference"); - buyerRef.setTextContent(invoice.getLeitwegId()); + if (GallopUtils.isNotNullOrBlank(invoice.getBuyerReference())) { + Element buyerRef = builder.createElement(NS_RAM, "BuyerReference"); // BT-10 + buyerRef.setTextContent(invoice.getBuyerReference()); tradeHeader.appendChild(buyerRef); } @@ -276,17 +276,26 @@ private Element createTradeHeader(XmlDocumentBuilder builder) { } } - if (GallopUtils.isNotNullOrBlank(invoice.getSalesOrderReference())) { - Element sellerRefDoc = builder.createElement(NS_RAM, "SellerOrderReferencedDocument"); - tradeHeader.appendChild(sellerRefDoc); - Element issuerId = builder.createElement(NS_RAM, "IssuerAssignedID"); - issuerId.setTextContent(invoice.getSalesOrderReference()); - sellerRefDoc.appendChild(issuerId); + if (GallopUtils.isNotNullOrBlank(invoice.getSalesOrderReference())) { // BT-14 + tradeHeader.appendChild(createReferencedDocument( + builder, "SellerOrderReferencedDocument", invoice.getSalesOrderReference())); + } + if (GallopUtils.isNotNullOrBlank(invoice.getBuyerOrderReference())) { // BT-13 + tradeHeader.appendChild(createReferencedDocument( + builder, "BuyerOrderReferencedDocument", invoice.getBuyerOrderReference())); } return tradeHeader; } + private static Element createReferencedDocument(XmlDocumentBuilder builder, String elementName, String id) { + Element referencedDocument = builder.createElement(NS_RAM, elementName); + Element issuerId = builder.createElement(NS_RAM, "IssuerAssignedID"); + issuerId.setTextContent(id); + referencedDocument.appendChild(issuerId); + return referencedDocument; + } + private Element createTradeDelivery(XmlDocumentBuilder builder) { Element tradeDelivery = builder.createElement(NS_RAM, "ApplicableHeaderTradeDelivery"); DeliveryInformation deliveryInfo = invoice.getDeliveryInfo(); @@ -339,7 +348,7 @@ private Element createTradeSettlement(XmlDocumentBuilder builder) { } } for (Vat totalVat : invoice.getVatTotals()) { - tradeSettlement.appendChild(createTax(builder, totalVat)); + tradeSettlement.appendChild(createTax(builder, totalVat, invoice.getVatPointDateCode())); } for (Allowance allowance : invoice.getAllowances()) { tradeSettlement.appendChild(createAllowance(builder, allowance)); @@ -635,7 +644,13 @@ private static Element createAddress(XmlDocumentBuilder builder, PostalAddress a return tradeAddress; } - private static Element createTax(XmlDocumentBuilder builder, Vat vat) { + /** + * Writes a VAT breakdown (BG-23) or the line VAT information (BG-30). + * + * @param vatPointDateCode the VAT point date code (BT-8), only for the VAT breakdown on document level; + * {@code null} for invoice lines + */ + private static Element createTax(XmlDocumentBuilder builder, Vat vat, String vatPointDateCode) { Element tradeTax = builder.createElement(NS_RAM, "ApplicableTradeTax"); if (vat != null) { if (vat.getTaxAmount() != null) { @@ -649,19 +664,24 @@ private static Element createTax(XmlDocumentBuilder builder, Vat vat) { exemptionReasonText.setTextContent(vat.getVatExemptionReasonText()); tradeTax.appendChild(exemptionReasonText); } - if (GallopUtils.isNotNullOrBlank(vat.getVatExemptionReasonCode())) { - Element exemptionReasonCode = builder.createElement(NS_RAM, "ExemptionReasonCode"); // BT-121 - exemptionReasonCode.setTextContent(vat.getVatExemptionReasonCode()); - tradeTax.appendChild(exemptionReasonCode); - } if (vat.getTaxableAmount() != null) { - Element basis = builder.createElement(NS_RAM, "BasisAmount"); + Element basis = builder.createElement(NS_RAM, "BasisAmount"); // BT-116 basis.setTextContent(vat.getTaxableAmount().toString()); tradeTax.appendChild(basis); } if (vat.getCategory() != null) { tradeTax.appendChild(createCategoryCode(builder, vat.getCategory().getCategoryCode())); } + if (GallopUtils.isNotNullOrBlank(vat.getVatExemptionReasonCode())) { + Element exemptionReasonCode = builder.createElement(NS_RAM, "ExemptionReasonCode"); // BT-121 + exemptionReasonCode.setTextContent(vat.getVatExemptionReasonCode()); + tradeTax.appendChild(exemptionReasonCode); + } + if (GallopUtils.isNotNullOrBlank(vatPointDateCode)) { + Element dueDateTypeCode = builder.createElement(NS_RAM, "DueDateTypeCode"); // BT-8 + dueDateTypeCode.setTextContent(vatPointDateCode); + tradeTax.appendChild(dueDateTypeCode); + } if (vat.getRate() != null) { tradeTax.appendChild(createRate(builder, vat.getRate().toString())); } diff --git a/src/main/java/de/codebarista/gallop/model/Invoice.java b/src/main/java/de/codebarista/gallop/model/Invoice.java index a17aa73..572d792 100644 --- a/src/main/java/de/codebarista/gallop/model/Invoice.java +++ b/src/main/java/de/codebarista/gallop/model/Invoice.java @@ -32,10 +32,31 @@ public class Invoice { private String currency; /** - * BuyerReference (BT-10)
- * Usually a "Leitweg-ID" + * Buyer reference (BT-10) + *

+ * An identifier assigned by the buyer used for internal routing purposes, e.g. the German "Leitweg-ID" or + * the French service code (code service) of Chorus Pro. + */ + private String buyerReference; + + /** + * Value added tax point date code (BT-8) + *

+ * The code of the date when the VAT becomes accountable for the seller and the buyer. Code list UNTDID 2475 + * in CII: {@code 5} (invoice date), {@code 29} (delivery date), {@code 72} (paid to date). + *

+ * It is written in every VAT breakdown (BG-23). According to BR-CO-3 it must not be used together with the + * VAT point date (BT-7). + */ + private String vatPointDateCode; + + /** + * Purchase order reference (BT-13) + *

+ * An identifier of a referenced purchase order, issued by the buyer. For the French public sector this is + * e.g. the commitment number (numéro d'engagement). */ - private String leitwegId; + private String buyerOrderReference; /** * Business process type (BT-23) @@ -197,10 +218,36 @@ public Invoice currency(String currency) { } /** - * Sets the {@link #leitwegId} + * Sets the {@link #buyerReference} */ + public Invoice buyerReference(String buyerReference) { + this.buyerReference = buyerReference; + return this; + } + + /** + * Sets the {@link #buyerReference} + * + * @deprecated use {@link #buyerReference(String)} instead + */ + @Deprecated public Invoice leitwegId(String leitwegId) { - this.leitwegId = leitwegId; + return buyerReference(leitwegId); + } + + /** + * Sets the {@link #vatPointDateCode} + */ + public Invoice vatPointDateCode(String vatPointDateCode) { + this.vatPointDateCode = vatPointDateCode; + return this; + } + + /** + * Sets the {@link #buyerOrderReference} + */ + public Invoice buyerOrderReference(String buyerOrderReference) { + this.buyerOrderReference = buyerOrderReference; return this; } @@ -491,10 +538,34 @@ public String getCurrency() { } /** - * Gets the {@link #leitwegId}. + * Gets the {@link #buyerReference}. */ + public String getBuyerReference() { + return buyerReference; + } + + /** + * Gets the {@link #buyerReference}. + * + * @deprecated use {@link #getBuyerReference()} instead + */ + @Deprecated public String getLeitwegId() { - return leitwegId; + return getBuyerReference(); + } + + /** + * Gets the {@link #vatPointDateCode}. + */ + public String getVatPointDateCode() { + return vatPointDateCode; + } + + /** + * Gets the {@link #buyerOrderReference}. + */ + public String getBuyerOrderReference() { + return buyerOrderReference; } /** diff --git a/src/test/java/de/codebarista/gallop/BuildInvoiceTest.java b/src/test/java/de/codebarista/gallop/BuildInvoiceTest.java index bec1014..5a32420 100644 --- a/src/test/java/de/codebarista/gallop/BuildInvoiceTest.java +++ b/src/test/java/de/codebarista/gallop/BuildInvoiceTest.java @@ -31,7 +31,7 @@ public void buildInvoice() { Invoice invoice = Invoice.create() .documentTypeCode(InvoiceType.COMMERCIAL_INVOICE.getValue()) // Define invoice type .documentId("INV-2025-1001") // Unique invoice identifier - .leitwegId("N/A") // Buyer reference (BT-10) + .buyerReference("N/A") // Buyer reference (BT-10) e.g. German "Leitweg-ID" or French "code service" .currency("EUR") // Currency used for the invoice // Payment details including method and terms diff --git a/src/test/java/de/codebarista/gallop/ScenarioHelper.java b/src/test/java/de/codebarista/gallop/ScenarioHelper.java index 8b0659c..89cdd39 100644 --- a/src/test/java/de/codebarista/gallop/ScenarioHelper.java +++ b/src/test/java/de/codebarista/gallop/ScenarioHelper.java @@ -37,6 +37,7 @@ public ScenarioFormats(String scenario, EInvoiceFormat... formats) { new ScenarioFormats("order_with_discount_code_and_shipping_costs_with_multiple_taxes", XRECHNUNG, EN16931_CORE), new ScenarioFormats("order_with_french_b2c_billing_note_without_buyer_identifiers", EN16931_CORE), new ScenarioFormats("order_with_french_mandatory_notes_and_billing_mode", EN16931_CORE), + new ScenarioFormats("order_with_french_purchase_order_and_vat_on_debits", EN16931_CORE), new ScenarioFormats("order_with_legal_registration_identifiers", XRECHNUNG, EN16931_CORE), new ScenarioFormats("order_with_leitweg_id_partial_seller_contact_and_buyer_address_scheme", XRECHNUNG, EN16931_CORE), new ScenarioFormats("order_with_payment_in_advance", XRECHNUNG, EN16931_CORE), @@ -48,6 +49,7 @@ public ScenarioFormats(String scenario, EInvoiceFormat... formats) { new ScenarioFormats("order_with_seller_and_buyer_identifiers", XRECHNUNG, EN16931_CORE), new ScenarioFormats("order_with_shipping_costs_with_multiple_taxes", XRECHNUNG, EN16931_CORE), new ScenarioFormats("order_with_tax_free_product", XRECHNUNG, EN16931_CORE), + new ScenarioFormats("order_with_vat_exemption_reason_code", XRECHNUNG, EN16931_CORE), new ScenarioFormats("order_without_vatid", XRECHNUNG, EN16931_CORE) ); diff --git a/src/test/resources/invoice/order_with_allowance/invoice.json b/src/test/resources/invoice/order_with_allowance/invoice.json index 0508cae..9d4e6ba 100644 --- a/src/test/resources/invoice/order_with_allowance/invoice.json +++ b/src/test/resources/invoice/order_with_allowance/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1049", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "58", diff --git a/src/test/resources/invoice/order_with_already_paid_amount/invoice.json b/src/test/resources/invoice/order_with_already_paid_amount/invoice.json index c2f615c..6cab9b1 100644 --- a/src/test/resources/invoice/order_with_already_paid_amount/invoice.json +++ b/src/test/resources/invoice/order_with_already_paid_amount/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1012", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "10", diff --git a/src/test/resources/invoice/order_with_belgian_tax_rates_and_document_comment/invoice.json b/src/test/resources/invoice/order_with_belgian_tax_rates_and_document_comment/invoice.json index 86aa618..6b300ac 100644 --- a/src/test/resources/invoice/order_with_belgian_tax_rates_and_document_comment/invoice.json +++ b/src/test/resources/invoice/order_with_belgian_tax_rates_and_document_comment/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1086", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "58", diff --git a/src/test/resources/invoice/order_with_cash_payment/invoice.json b/src/test/resources/invoice/order_with_cash_payment/invoice.json index 7368ef8..b458e5e 100644 --- a/src/test/resources/invoice/order_with_cash_payment/invoice.json +++ b/src/test/resources/invoice/order_with_cash_payment/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1012", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "10", diff --git a/src/test/resources/invoice/order_with_credit_and_surcharge/invoice.json b/src/test/resources/invoice/order_with_credit_and_surcharge/invoice.json index d95456e..0ef6653 100644 --- a/src/test/resources/invoice/order_with_credit_and_surcharge/invoice.json +++ b/src/test/resources/invoice/order_with_credit_and_surcharge/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1014", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "10", diff --git a/src/test/resources/invoice/order_with_custom_line_item_type/invoice.json b/src/test/resources/invoice/order_with_custom_line_item_type/invoice.json index eac8035..6f4ab4e 100644 --- a/src/test/resources/invoice/order_with_custom_line_item_type/invoice.json +++ b/src/test/resources/invoice/order_with_custom_line_item_type/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1074", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "10", diff --git a/src/test/resources/invoice/order_with_customer_vatid/invoice.json b/src/test/resources/invoice/order_with_customer_vatid/invoice.json index e2c3338..a41acc6 100644 --- a/src/test/resources/invoice/order_with_customer_vatid/invoice.json +++ b/src/test/resources/invoice/order_with_customer_vatid/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1012", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "58", diff --git a/src/test/resources/invoice/order_with_different_billing_and_shipping_address/invoice.json b/src/test/resources/invoice/order_with_different_billing_and_shipping_address/invoice.json index fe99198..7685679 100644 --- a/src/test/resources/invoice/order_with_different_billing_and_shipping_address/invoice.json +++ b/src/test/resources/invoice/order_with_different_billing_and_shipping_address/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1081", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "58", diff --git a/src/test/resources/invoice/order_with_discount_code_and_shipping_costs_with_multiple_taxes/invoice.json b/src/test/resources/invoice/order_with_discount_code_and_shipping_costs_with_multiple_taxes/invoice.json index 60c2359..cd840aa 100644 --- a/src/test/resources/invoice/order_with_discount_code_and_shipping_costs_with_multiple_taxes/invoice.json +++ b/src/test/resources/invoice/order_with_discount_code_and_shipping_costs_with_multiple_taxes/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1012", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "10", diff --git a/src/test/resources/invoice/order_with_french_b2c_billing_note_without_buyer_identifiers/invoice.json b/src/test/resources/invoice/order_with_french_b2c_billing_note_without_buyer_identifiers/invoice.json index 5db7c89..8ca8025 100644 --- a/src/test/resources/invoice/order_with_french_b2c_billing_note_without_buyer_identifiers/invoice.json +++ b/src/test/resources/invoice/order_with_french_b2c_billing_note_without_buyer_identifiers/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1014", - "leitwegId": "N/A", + "buyerReference": "N/A", "businessProcessType": "B1", "currency": "EUR", "paymentInstructions": { diff --git a/src/test/resources/invoice/order_with_french_mandatory_notes_and_billing_mode/invoice.json b/src/test/resources/invoice/order_with_french_mandatory_notes_and_billing_mode/invoice.json index a19a0a7..fb41b36 100644 --- a/src/test/resources/invoice/order_with_french_mandatory_notes_and_billing_mode/invoice.json +++ b/src/test/resources/invoice/order_with_french_mandatory_notes_and_billing_mode/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1013", - "leitwegId": "N/A", + "buyerReference": "N/A", "businessProcessType": "B1", "currency": "EUR", "paymentInstructions": { diff --git a/src/test/resources/invoice/order_with_french_purchase_order_and_vat_on_debits/en16931-core.xml b/src/test/resources/invoice/order_with_french_purchase_order_and_vat_on_debits/en16931-core.xml new file mode 100644 index 0000000..755b6fe --- /dev/null +++ b/src/test/resources/invoice/order_with_french_purchase_order_and_vat_on_debits/en16931-core.xml @@ -0,0 +1,173 @@ + + + + + B1 + + + urn:cen.eu:en16931:2017 + + + + 1013 + 380 + + 20241207 + + + Indemnité forfaitaire pour frais de recouvrement en cas de retard de paiement : 40 € + PMT + + + Pénalités de retard : trois fois le taux d'intérêt légal + PMD + + + Pas d'escompte pour paiement anticipé + AAB + + + + + + 1 + + + 10001 + Hauptartikel + + + + 416.7600 + 1 + + + + 1 + + + + VAT + S + 19 + + + 416.76 + + + + + N/A + + Beispiel GmbH + + 552081317 + + + Max Mustermann + + 030123456789 + + + kontakt@beispiel-gmbh.de + + + + 10115 + Musterstraße 42 + Berlin + DE + + + info@beispiel-gmbh.de + + + DE987654321 + + + + Gerhard Gewerbetreibender + + 4000000123456 + + + 64521 + Gerhardstraße + Großgerau + DE + + + gerhard@gerhards-gmbh.de + + + DE123456789 + + + + 10011 + + + EJ-2024-000123 + + + + + Gerhard Gewerbetreibender + + 64521 + Gerhardstraße + Großgerau + DE + + + + + RE-2024-0042 + EUR + + 58 + + DE86500105173557491398 + Firmenkonto Beispiel GmbH + + + AAAAZZZ0BBB + + + + 79.19 + VAT + 416.76 + S + 5 + 19 + + + + true + + 0.00 + Versandkosten + + VAT + S + 19 + + + + Zahlung innerhalb von 30 Tagen nach Erhalt der Rechnung. + + + 416.76 + 0.00 + 0.00 + 416.76 + 79.19 + 495.95 + 495.95 + + + + diff --git a/src/test/resources/invoice/order_with_french_purchase_order_and_vat_on_debits/invoice.json b/src/test/resources/invoice/order_with_french_purchase_order_and_vat_on_debits/invoice.json new file mode 100644 index 0000000..ad3e787 --- /dev/null +++ b/src/test/resources/invoice/order_with_french_purchase_order_and_vat_on_debits/invoice.json @@ -0,0 +1,141 @@ +{ + "documentTypeCode": "380", + "documentId": "1013", + "buyerReference": "N/A", + "businessProcessType": "B1", + "currency": "EUR", + "paymentInstructions": { + "meansType": "58", + "meansText": null, + "remittanceInfo": "RE-2024-0042", + "paymentTerms": "Zahlung innerhalb von 30 Tagen nach Erhalt der Rechnung.", + "creditTransfers": [ + { + "iban": "DE86500105173557491398", + "accountName": "Firmenkonto Beispiel GmbH", + "bic": "AAAAZZZ0BBB" + } + ], + "paymentCardInformation": null, + "directDebit": null + }, + "issueDate": "2024-12-07T10:33:25.540+00:00", + "seller": { + "name": "Beispiel GmbH", + "tradingName": "Beispiel Handelsgesellschaft", + "legalRegistrationIdentifier": "552081317", + "legalRegistrationIdentifierScheme": "0002", + "vatId": "DE987654321", + "electronicAddress": "info@beispiel-gmbh.de", + "electronicAddressScheme": "EM", + "address": { + "addressLineOne": "Musterstraße 42", + "addressLineTwo": null, + "addressLineThree": null, + "city": "Berlin", + "zipCode": "10115", + "countryIsoCode": "DE" + }, + "contact": { + "name": "Max Mustermann", + "phone": "030123456789", + "email": "kontakt@beispiel-gmbh.de" + } + }, + "buyer": { + "name": "Gerhard Gewerbetreibender", + "tradingName": null, + "legalRegistrationIdentifier": "4000000123456", + "legalRegistrationIdentifierScheme": "0088", + "vatId": "DE123456789", + "electronicAddress": "gerhard@gerhards-gmbh.de", + "electronicAddressScheme": null, + "address": { + "addressLineOne": "Gerhardstraße", + "addressLineTwo": null, + "addressLineThree": null, + "city": "Großgerau", + "zipCode": "64521", + "countryIsoCode": "DE" + }, + "contact": null + }, + "deliveryInfo": { + "name": "Gerhard Gewerbetreibender", + "deliveryAddress": { + "addressLineOne": "Gerhardstraße", + "addressLineTwo": null, + "addressLineThree": null, + "city": "Großgerau", + "zipCode": "64521", + "countryIsoCode": "DE" + }, + "actualDeliveryDate": null + }, + "items": [ + { + "id": 1, + "quantity": 1, + "unitCode": "XPP", + "itemTotalNetAmount": 416.76, + "name": "Hauptartikel", + "description": null, + "unitPrice": 416.7600, + "vat": { + "rate": 19, + "category": "S", + "taxableAmount": null, + "taxAmount": null, + "vatExemptionReasonText": null, + "vatExemptionReasonCode": null + }, + "sellerAssignedId": "10001", + "itemAttributes": [], + "netAmount": 416.76 + } + ], + "vatTotals": [ + { + "rate": 19, + "category": "S", + "taxableAmount": 416.76, + "taxAmount": 79.19, + "vatExemptionReasonText": null, + "vatExemptionReasonCode": null + } + ], + "precedingInvoiceReferences": [], + "lineTotalAmount": 416.76, + "allowanceTotalAmount": 0.00, + "chargeTotalAmount": 0.00, + "taxBasisTotalAmount": 416.76, + "taxTotalAmount": 79.19, + "grandTotalAmount": 495.95, + "duePayableAmount": 495.95, + "salesOrderReference": "10011", + "buyerOrderReference": "EJ-2024-000123", + "vatPointDateCode": "5", + "invoiceNotes": [ + { + "note": "Indemnité forfaitaire pour frais de recouvrement en cas de retard de paiement : 40 €", + "subjectCode": "PMT" + }, + { + "note": "Pénalités de retard : trois fois le taux d'intérêt légal", + "subjectCode": "PMD" + }, + { + "note": "Pas d'escompte pour paiement anticipé", + "subjectCode": "AAB" + } + ], + "allowances": [], + "charges": [ + { + "netAmount": 0.00, + "vatCategory": "S", + "vatRate": 19, + "reason": "Versandkosten" + } + ] +} diff --git a/src/test/resources/invoice/order_with_legal_registration_identifiers/invoice.json b/src/test/resources/invoice/order_with_legal_registration_identifiers/invoice.json index 831758b..98e6a23 100644 --- a/src/test/resources/invoice/order_with_legal_registration_identifiers/invoice.json +++ b/src/test/resources/invoice/order_with_legal_registration_identifiers/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1013", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "58", diff --git a/src/test/resources/invoice/order_with_leitweg_id_partial_seller_contact_and_buyer_address_scheme/invoice.json b/src/test/resources/invoice/order_with_leitweg_id_partial_seller_contact_and_buyer_address_scheme/invoice.json index 714f39c..89bc190 100644 --- a/src/test/resources/invoice/order_with_leitweg_id_partial_seller_contact_and_buyer_address_scheme/invoice.json +++ b/src/test/resources/invoice/order_with_leitweg_id_partial_seller_contact_and_buyer_address_scheme/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1012", - "leitwegId": "04011000-12345-34", + "buyerReference": "04011000-12345-34", "currency": "EUR", "paymentInstructions": { "meansType": "58", diff --git a/src/test/resources/invoice/order_with_payment_in_advance/invoice.json b/src/test/resources/invoice/order_with_payment_in_advance/invoice.json index a192507..8f2c8e5 100644 --- a/src/test/resources/invoice/order_with_payment_in_advance/invoice.json +++ b/src/test/resources/invoice/order_with_payment_in_advance/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1075", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "58", diff --git a/src/test/resources/invoice/order_with_paypal/invoice.json b/src/test/resources/invoice/order_with_paypal/invoice.json index 05473e1..ff88949 100644 --- a/src/test/resources/invoice/order_with_paypal/invoice.json +++ b/src/test/resources/invoice/order_with_paypal/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1009", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "68", diff --git a/src/test/resources/invoice/order_with_paypal_credit_card/invoice.json b/src/test/resources/invoice/order_with_paypal_credit_card/invoice.json index b3f337d..ae5de81 100644 --- a/src/test/resources/invoice/order_with_paypal_credit_card/invoice.json +++ b/src/test/resources/invoice/order_with_paypal_credit_card/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1007", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "68", diff --git a/src/test/resources/invoice/order_with_paypal_direct_debit/invoice.json b/src/test/resources/invoice/order_with_paypal_direct_debit/invoice.json index a286690..bc8ea30 100644 --- a/src/test/resources/invoice/order_with_paypal_direct_debit/invoice.json +++ b/src/test/resources/invoice/order_with_paypal_direct_debit/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1008", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "68", diff --git a/src/test/resources/invoice/order_with_paypal_invoice/invoice.json b/src/test/resources/invoice/order_with_paypal_invoice/invoice.json index 3fe5820..fb71425 100644 --- a/src/test/resources/invoice/order_with_paypal_invoice/invoice.json +++ b/src/test/resources/invoice/order_with_paypal_invoice/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1010", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "58", diff --git a/src/test/resources/invoice/order_with_rounding_amount/invoice.json b/src/test/resources/invoice/order_with_rounding_amount/invoice.json index 22419eb..8a1120a 100644 --- a/src/test/resources/invoice/order_with_rounding_amount/invoice.json +++ b/src/test/resources/invoice/order_with_rounding_amount/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1012", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "10", diff --git a/src/test/resources/invoice/order_with_seller_and_buyer_identifiers/invoice.json b/src/test/resources/invoice/order_with_seller_and_buyer_identifiers/invoice.json index bc3ef62..bad2935 100644 --- a/src/test/resources/invoice/order_with_seller_and_buyer_identifiers/invoice.json +++ b/src/test/resources/invoice/order_with_seller_and_buyer_identifiers/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1013", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "58", diff --git a/src/test/resources/invoice/order_with_shipping_costs_with_multiple_taxes/invoice.json b/src/test/resources/invoice/order_with_shipping_costs_with_multiple_taxes/invoice.json index 443a174..7d40456 100644 --- a/src/test/resources/invoice/order_with_shipping_costs_with_multiple_taxes/invoice.json +++ b/src/test/resources/invoice/order_with_shipping_costs_with_multiple_taxes/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1013", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "10", diff --git a/src/test/resources/invoice/order_with_tax_free_product/invoice.json b/src/test/resources/invoice/order_with_tax_free_product/invoice.json index 351c353..01a7b01 100644 --- a/src/test/resources/invoice/order_with_tax_free_product/invoice.json +++ b/src/test/resources/invoice/order_with_tax_free_product/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1032", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "10", diff --git a/src/test/resources/invoice/order_with_vat_exemption_reason_code/en16931-core.xml b/src/test/resources/invoice/order_with_vat_exemption_reason_code/en16931-core.xml new file mode 100644 index 0000000..7deaa27 --- /dev/null +++ b/src/test/resources/invoice/order_with_vat_exemption_reason_code/en16931-core.xml @@ -0,0 +1,141 @@ + + + + + urn:cen.eu:en16931:2017 + + + + 1032 + 380 + + 20241216 + + + + + + 1 + + + SW10002 + Tax free product + + + + 100.0000 + 1 + + + + 1 + + + + VAT + E + 0 + + + 100.00 + + + + + N/A + + Example Company + + Marianne Maier + + 0123456/789 + + + firma@example.com + + + + 12123 + Teststraße 42 + Testdorf + DE + + + firma@example.com + + + DE-123456789 + + + + Testonia Test + + 12345 + Teststreet + Testing + DE + + + test@test.test + + + + 10013 + + + + + Testonia Test + + 12345 + Teststreet + Testing + DE + + + + + EUR + + 10 + Cash on delivery + + + 0.00 + VAT + Exempt based on article 132 of Council Directive 2006/112/EC + 105.00 + E + VATEX-EU-132 + 0 + + + + true + + 5.00 + Versandkosten + + VAT + E + 0 + + + + Die Ware bleibt, bis zur vollständigen Bezahlung, unser Eigentum. +Leistungsdatum entspricht Rechnungsdatum + + + 100.00 + 5.00 + 0.00 + 105.00 + 0.00 + 105.00 + 105.00 + + + + diff --git a/src/test/resources/invoice/order_with_vat_exemption_reason_code/invoice.json b/src/test/resources/invoice/order_with_vat_exemption_reason_code/invoice.json new file mode 100644 index 0000000..5b08412 --- /dev/null +++ b/src/test/resources/invoice/order_with_vat_exemption_reason_code/invoice.json @@ -0,0 +1,115 @@ +{ + "documentTypeCode": "380", + "documentId": "1032", + "buyerReference": "N/A", + "currency": "EUR", + "paymentInstructions": { + "meansType": "10", + "meansText": "Cash on delivery", + "remittanceInfo": null, + "paymentTerms": "Die Ware bleibt, bis zur vollständigen Bezahlung, unser Eigentum.\nLeistungsdatum entspricht Rechnungsdatum", + "creditTransfers": [], + "paymentCardInformation": null, + "directDebit": null + }, + "issueDate": "2024-12-16T11:28:15.698+00:00", + "seller": { + "name": "Example Company", + "tradingName": null, + "vatId": "DE-123456789", + "electronicAddress": "firma@example.com", + "electronicAddressScheme": "EM", + "address": { + "addressLineOne": "Teststraße 42", + "addressLineTwo": null, + "addressLineThree": null, + "city": "Testdorf", + "zipCode": "12123", + "countryIsoCode": "DE" + }, + "contact": { + "name": "Marianne Maier", + "phone": "0123456/789", + "email": "firma@example.com" + } + }, + "buyer": { + "name": "Testonia Test", + "tradingName": null, + "vatId": null, + "electronicAddress": "test@test.test", + "electronicAddressScheme": null, + "address": { + "addressLineOne": "Teststreet", + "addressLineTwo": null, + "addressLineThree": null, + "city": "Testing", + "zipCode": "12345", + "countryIsoCode": "DE" + }, + "contact": null + }, + "deliveryInfo": { + "name": "Testonia Test", + "deliveryAddress": { + "addressLineOne": "Teststreet", + "addressLineTwo": null, + "addressLineThree": null, + "city": "Testing", + "zipCode": "12345", + "countryIsoCode": "DE" + }, + "actualDeliveryDate": null + }, + "items": [ + { + "id": 1, + "quantity": 1, + "unitCode": "XPP", + "itemTotalNetAmount": 100.00, + "name": "Tax free product", + "description": null, + "unitPrice": 100.0000, + "vat": { + "rate": 0, + "category": "E", + "taxableAmount": null, + "taxAmount": null, + "vatExemptionReasonText": null, + "vatExemptionReasonCode": null + }, + "sellerAssignedId": "SW10002", + "itemAttributes": [], + "netAmount": 100.00 + } + ], + "vatTotals": [ + { + "rate": 0, + "category": "E", + "taxableAmount": 105.00, + "taxAmount": 0.00, + "vatExemptionReasonText": "Exempt based on article 132 of Council Directive 2006/112/EC", + "vatExemptionReasonCode": "VATEX-EU-132" + } + ], + "precedingInvoiceReferences": [], + "lineTotalAmount": 100.00, + "allowanceTotalAmount": 0.00, + "chargeTotalAmount": 5.00, + "taxBasisTotalAmount": 105.00, + "taxTotalAmount": 0.00, + "grandTotalAmount": 105.00, + "duePayableAmount": 105.00, + "salesOrderReference": "10013", + "invoiceNotes": [], + "allowances": [], + "charges": [ + { + "netAmount": 5.00, + "vatCategory": "E", + "vatRate": 0, + "reason": "Versandkosten" + } + ] +} \ No newline at end of file diff --git a/src/test/resources/invoice/order_with_vat_exemption_reason_code/xrechnung.xml b/src/test/resources/invoice/order_with_vat_exemption_reason_code/xrechnung.xml new file mode 100644 index 0000000..902613a --- /dev/null +++ b/src/test/resources/invoice/order_with_vat_exemption_reason_code/xrechnung.xml @@ -0,0 +1,144 @@ + + + + + urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 + + + urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0 + + + + 1032 + 380 + + 20241216 + + + + + + 1 + + + SW10002 + Tax free product + + + + 100.0000 + 1 + + + + 1 + + + + VAT + E + 0 + + + 100.00 + + + + + N/A + + Example Company + + Marianne Maier + + 0123456/789 + + + firma@example.com + + + + 12123 + Teststraße 42 + Testdorf + DE + + + firma@example.com + + + DE-123456789 + + + + Testonia Test + + 12345 + Teststreet + Testing + DE + + + test@test.test + + + + 10013 + + + + + Testonia Test + + 12345 + Teststreet + Testing + DE + + + + + EUR + + 10 + Cash on delivery + + + 0.00 + VAT + Exempt based on article 132 of Council Directive 2006/112/EC + 105.00 + E + VATEX-EU-132 + 0 + + + + true + + 5.00 + Versandkosten + + VAT + E + 0 + + + + Die Ware bleibt, bis zur vollständigen Bezahlung, unser Eigentum. +Leistungsdatum entspricht Rechnungsdatum + + + 100.00 + 5.00 + 0.00 + 105.00 + 0.00 + 105.00 + 105.00 + + + + diff --git a/src/test/resources/invoice/order_without_vatid/invoice.json b/src/test/resources/invoice/order_without_vatid/invoice.json index 5bdb549..58f0be0 100644 --- a/src/test/resources/invoice/order_without_vatid/invoice.json +++ b/src/test/resources/invoice/order_without_vatid/invoice.json @@ -1,7 +1,7 @@ { "documentTypeCode": "380", "documentId": "1032", - "leitwegId": "N/A", + "buyerReference": "N/A", "currency": "EUR", "paymentInstructions": { "meansType": "10",