From cd86300d36d2e8ffadc940a9a50b94606cd81d52 Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 14 Nov 2024 20:28:15 +0100 Subject: [PATCH] Added paymentDescription and buyerReference --- .../kotlin/net/codinux/invoicing/mapper/MustangMapper.kt | 3 +++ .../main/kotlin/net/codinux/invoicing/model/Invoice.kt | 7 +++++++ .../kotlin/net/codinux/invoicing/test/DataGenerator.kt | 8 ++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/mapper/MustangMapper.kt b/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/mapper/MustangMapper.kt index f65c144..d4959ce 100644 --- a/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/mapper/MustangMapper.kt +++ b/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/mapper/MustangMapper.kt @@ -25,6 +25,9 @@ class MustangMapper { this.setZFItems(ArrayList(invoice.items.map { mapLineItem(it) })) this.dueDate = map(invoice.dueDate) + this.paymentTermDescription = invoice.paymentDescription + + this.referenceNumber = invoice.buyerReference } fun mapParty(party: Party): TradeParty = TradeParty( diff --git a/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/model/Invoice.kt b/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/model/Invoice.kt index 6e262df..a53ff76 100644 --- a/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/model/Invoice.kt +++ b/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/model/Invoice.kt @@ -8,7 +8,14 @@ class Invoice( val sender: Party, val recipient: Party, val items: List, + val dueDate: LocalDate? = null, + val paymentDescription: String? = null, + + /** + * Unique reference number of the buyer, e.g. the Leitweg-ID required by German authorities (Behörden) + */ + val buyerReference: String? = null ) { override fun toString() = "$invoicingDate $invoiceNumber to $recipient" } \ No newline at end of file diff --git a/e-invoicing-domain/src/test/kotlin/net/codinux/invoicing/test/DataGenerator.kt b/e-invoicing-domain/src/test/kotlin/net/codinux/invoicing/test/DataGenerator.kt index d564562..c2d114f 100644 --- a/e-invoicing-domain/src/test/kotlin/net/codinux/invoicing/test/DataGenerator.kt +++ b/e-invoicing-domain/src/test/kotlin/net/codinux/invoicing/test/DataGenerator.kt @@ -5,11 +5,13 @@ import net.codinux.invoicing.model.LineItem import net.codinux.invoicing.model.Party import java.math.BigDecimal import java.time.LocalDate +import java.time.format.DateTimeFormatter object DataGenerator { const val InvoiceNumber = "12345" val InvoicingDate = LocalDate.of(2015, 10, 21) + val DueDate = LocalDate.of(2016, 6, 15) const val SenderName = "Hochwürdiger Leistungserbringer" const val SenderStreet = "Fun Street 1" @@ -43,8 +45,10 @@ object DataGenerator { sender: Party = createParty(SenderName, SenderStreet, SenderPostalCode, SenderCity, SenderCountry, SenderVatId, SenderEmail, SenderPhone), recipient: Party = createParty(RecipientName, RecipientStreet, RecipientPostalCode, RecipientCity, RecipientCountry, RecipientVatId, RecipientEmail, RecipientPhone), items: List = listOf(createItem()), - dueDate: LocalDate? = null - ) = Invoice(invoiceNumber, invoicingDate, sender, recipient, items, dueDate) + dueDate: LocalDate? = DueDate, + paymentDescription: String? = dueDate?.let { "Zahlbar ohne Abzug bis ${DateTimeFormatter.ofPattern("dd.MM.yyyy").format(dueDate)}" }, + buyerReference: String? = null + ) = Invoice(invoiceNumber, invoicingDate, sender, recipient, items, dueDate, paymentDescription, buyerReference) fun createParty( name: String,