diff --git a/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/creation/MustangMapper.kt b/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/mapper/MustangMapper.kt similarity index 87% rename from e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/creation/MustangMapper.kt rename to e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/mapper/MustangMapper.kt index 0421d38..c98c9a5 100644 --- a/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/creation/MustangMapper.kt +++ b/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/mapper/MustangMapper.kt @@ -1,6 +1,7 @@ -package net.codinux.invoicing.creation +package net.codinux.invoicing.mapper import net.codinux.invoicing.model.LineItem +import net.codinux.invoicing.model.Party import org.mustangproject.Invoice import org.mustangproject.Item import org.mustangproject.Product @@ -25,8 +26,8 @@ class MustangMapper { this.dueDate = map(invoice.dueDate) } - fun mapParty(party: net.codinux.invoicing.model.Party): TradeParty = TradeParty( - party.name, "${party.streetName} ${party.houseNumber}", party.postalCode, party.city, party.country + fun mapParty(party: Party): TradeParty = TradeParty( + party.name, party.street, party.postalCode, party.city, party.country ).apply { this.taxID = party.taxNumber // TODO: vatID? diff --git a/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/model/Party.kt b/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/model/Party.kt index e260fb5..33ed8ea 100644 --- a/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/model/Party.kt +++ b/e-invoicing-domain/src/main/kotlin/net/codinux/invoicing/model/Party.kt @@ -3,8 +3,10 @@ package net.codinux.invoicing.model class Party( val name: String, - val streetName: String, - val houseNumber: String, + /** + * Party's street and house number. + */ + val street: String, var postalCode: String?, val city: String, val country: String? = null, diff --git a/e-invoicing-domain/src/test/kotlin/net/codinux/invoicing/creation/EInvoiceCreatorTest.kt b/e-invoicing-domain/src/test/kotlin/net/codinux/invoicing/creation/EInvoiceCreatorTest.kt index 93033b5..56c0a5b 100644 --- a/e-invoicing-domain/src/test/kotlin/net/codinux/invoicing/creation/EInvoiceCreatorTest.kt +++ b/e-invoicing-domain/src/test/kotlin/net/codinux/invoicing/creation/EInvoiceCreatorTest.kt @@ -44,14 +44,13 @@ class EInvoiceCreatorTest { private fun createParty( name: String, - streetName: String = "Fun Street", - houseNumber: String = "1", + streetName: String = "Fun Street 1", postalCode: String = "12345", city: String = "Glückstadt", country: String? = null, taxNumber: String? = "DE12345678", email: String? = null, - ) = Party(name, streetName, houseNumber, postalCode, city, country, taxNumber, email) + ) = Party(name, streetName, postalCode, city, country, taxNumber, email) private fun createItem( name: String = "Erbrachte Dienstleistungen",