Moved MustangMapper to package mapper; merged Party.street and .houseNumber into street

This commit is contained in:
dankito 2024-11-14 14:33:52 +01:00
parent 3bd3024f11
commit 29650d2660
3 changed files with 10 additions and 8 deletions

View File

@ -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?

View File

@ -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,

View File

@ -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",