Updated data model names according to ChatGPT suggestions
This commit is contained in:
parent
6a9ed9078e
commit
68b1f56cfa
|
@ -70,8 +70,8 @@ fun create() {
|
|||
private fun createInvoice() = Invoice(
|
||||
invoiceNumber = "RE-00001",
|
||||
invoicingDate = LocalDate.now(),
|
||||
sender = Party("codinux GmbH & Co. KG", "Fun Street 1", "12345", "Glückstadt"),
|
||||
recipient = Party("Abzock GmbH", "Ausbeutstr.", "12345", "Abzockhausen"),
|
||||
supplier = Party("codinux GmbH & Co. KG", "Fun Street 1", null, "12345", "Glückstadt"),
|
||||
customer = Party("Abzock GmbH", "Ausbeutstr.", null, "12345", "Abzockhausen"),
|
||||
items = listOf(InvoiceItem("Erbrachte Dienstleistungen", BigDecimal(170), "HUR", BigDecimal(105), BigDecimal(19))) // HUR = EN code for hour
|
||||
)
|
||||
```
|
||||
|
|
|
@ -0,0 +1,155 @@
|
|||
|
||||
- **Rechnungsaussteller / Rechnungsersteller / Leistungserbringer** – Invoice issuer / Invoice creator / Service provider
|
||||
- **Empfänger der Rechnung / Auftraggeber / Leistungsempfänger** – Invoice recipient / Client / Service recipient
|
||||
- **Rechnungsnummer** – Invoice number
|
||||
- **Rechnungsdatum** – Invoice date
|
||||
- **Fälligkeitsdatum** – Due date
|
||||
|
||||
|
||||
- **Auftragsnummer** – Order number
|
||||
- **Auftragsdatum** – Order date
|
||||
- **Kundennummer** – Customer number
|
||||
- **Kontaktperson / Kontaktadresse** – Contact person / Contact address
|
||||
- **Lieferschein** – Delivery note
|
||||
- **Lieferdatum** – Delivery date
|
||||
|
||||
|
||||
JetBrains Rechnung:
|
||||
|
||||
```text
|
||||
Invoice Details:
|
||||
Reference number: INVCZ7424912
|
||||
Order reference: R20162736
|
||||
Tax point date: 8.3.2024
|
||||
Issue date: 8.3.2024
|
||||
Due date: 8.3.2024
|
||||
Paid via: Credit Card
|
||||
Payment Date: 8.3.2024
|
||||
Transaction: VZ6HHRG7V2KJFXB2
|
||||
|
||||
|
||||
Bill To:
|
||||
Christian Dankl
|
||||
Kürnbergstr. 36
|
||||
81369 München
|
||||
Germany
|
||||
VAT ID: DE306521719
|
||||
|
||||
|
||||
Row 1:
|
||||
|
||||
Customer Id
|
||||
1983447
|
||||
|
||||
Order Date
|
||||
8.3.2024
|
||||
|
||||
Shipped Electronically To
|
||||
mammon@dankito.de
|
||||
|
||||
|
||||
Row 2:
|
||||
|
||||
Part Number
|
||||
P-S.ALL-Y-40C
|
||||
|
||||
<Invoice item name>
|
||||
All Products Pack
|
||||
|
||||
Product Description
|
||||
Personal annual subscription with
|
||||
40% continuity discount
|
||||
Valid from 15.3.2024 through
|
||||
14.3.2025
|
||||
|
||||
|
||||
Price
|
||||
173.00
|
||||
|
||||
Qty
|
||||
1
|
||||
|
||||
Extended Price
|
||||
173.00 EUR
|
||||
|
||||
Subtotal: 173.00 EUR
|
||||
VAT Rate*: 0.00%
|
||||
VAT Amount: 0.00 EUR
|
||||
Total: 173.00 EUR
|
||||
PAID: 173.00 EUR
|
||||
```
|
||||
|
||||
|
||||
Rechnungsaussteller / Leistungserbringer:
|
||||
|
||||
- **CII**: Seller / Supplier
|
||||
- **UBL**: Supplier
|
||||
|
||||
Rechnungsempfänger / Auftraggeber / Leistungsempfänger:
|
||||
|
||||
- **CII**: Buyer / Customer
|
||||
- **UBL**: Buyer / Customer
|
||||
|
||||
|
||||
1. Rechnungsaussteller (die Partei, die die Rechnung stellt):
|
||||
|
||||
Seller – Das ist der häufigste Begriff und bezieht sich auf die Partei, die die Waren oder Produkte verkauft und die Rechnung ausstellt.
|
||||
Supplier – Wird ebenfalls oft verwendet, besonders wenn der Fokus auf der Lieferung von Waren liegt.
|
||||
Vendor – Ein weiterer sehr gebräuchlicher Begriff, vor allem im Einzelhandel und im E-Commerce.
|
||||
|
||||
2. Rechnungsempfänger (die Partei, die die Rechnung erhält und bezahlt):
|
||||
|
||||
Buyer – Der Käufer, die Partei, die die Ware oder Dienstleistung erworben hat und die Rechnung erhält.
|
||||
Customer – Ein sehr allgemeiner Begriff, der häufig für alle Arten von Käufern verwendet wird, sowohl in B2B als auch in B2C.
|
||||
Purchaser – Wird ebenfalls verwendet, besonders in formelleren oder vertraglichen Kontexten.
|
||||
|
||||
|
||||
Die am häufigsten verwendeten Begriffe in Rechnungs- und Geschäftsprozessen sind:
|
||||
|
||||
### Für denjenigen, der die Rechnung ausstellt bzw. die Leistung erbracht hat:
|
||||
- **Service provider** – Dies ist der am häufigsten verwendete Begriff, insbesondere in Dienstleistungsbranchen. Der „Service provider“ ist derjenige, der eine Dienstleistung erbringt und die Rechnung stellt.
|
||||
- **Invoice issuer** oder **Invoice creator** sind zwar korrekt, aber weniger gebräuchlich und klingen formeller oder spezifischer, insbesondere im Kontext von Rechnungsstellung und Buchhaltung. **Service provider** ist der allgemeinere und häufigste Begriff, wenn man von der Leistungserbringung spricht.
|
||||
|
||||
### Für denjenigen, der die Rechnung erhält:
|
||||
- **Client** – Dies ist der am häufigsten verwendete Begriff, besonders in geschäftlichen und dienstleistungsorientierten Kontexten. Der „Client“ ist die Person oder Organisation, die die Leistung in Anspruch nimmt und die Rechnung bezahlt.
|
||||
- **Invoice recipient** ist ebenfalls korrekt, wird aber weniger häufig verwendet, da es eine sehr formale Ausdrucksweise ist.
|
||||
- **Service recipient** ist auch korrekt, wird aber eher in formelleren oder spezialisierten Kontexten verwendet, z.B. in Verträgen, bei denen die Erbringung einer spezifischen Dienstleistung betont wird.
|
||||
|
||||
### Zusammengefasst:
|
||||
- **Für denjenigen, der die Rechnung ausstellt:** **Service provider**
|
||||
- **Für denjenigen, der die Rechnung erhält:** **Client**
|
||||
|
||||
|
||||
## Client vs. Customer
|
||||
|
||||
Der Unterschied zwischen **Customer** und **Client** im Kontext von CII/UBL und allgemeiner Geschäftsbeziehung ist subtil, aber dennoch wichtig. Die Begriffe haben unterschiedliche Konnotationen, abhängig von der Art der Transaktion und dem zugrunde liegenden Geschäftsmodell.
|
||||
|
||||
### **1. Customer (CII / UBL)**
|
||||
- **Kontext**: Der Begriff **Customer** ist weit verbreitet und bezieht sich auf eine Person oder Organisation, die **Waren** oder **Dienstleistungen** kauft. In den **CII** und **UBL** XML-Formaten wird der Begriff "Customer" verwendet, um den Empfänger einer Rechnung zu bezeichnen – also die Partei, die das Produkt oder die Dienstleistung **erwirbt** und **bezahlt**.
|
||||
|
||||
- **Verwendung**:
|
||||
- **B2C (Business-to-Consumer)**: Der Begriff **Customer** wird insbesondere in B2C-Transaktionen verwendet, also bei der Interaktion zwischen einem Unternehmen und einem Endverbraucher.
|
||||
- **B2B (Business-to-Business)**: Auch im B2B-Kontext wird der Begriff oft verwendet, wenn eine Firma Waren oder Dienstleistungen an eine andere Firma verkauft.
|
||||
|
||||
- **Beispiel**: Ein Online-Shop verkauft ein Produkt an einen Endverbraucher. Der Endverbraucher ist der **Customer** des Shops.
|
||||
|
||||
### **2. Client (Allgemein)**
|
||||
- **Kontext**: Der Begriff **Client** ist etwas **formeller** und wird häufiger in bestimmten **Dienstleistungsbranchen** oder in längerfristigen **geschäftlichen Beziehungen** verwendet, wo eine kontinuierliche Betreuung oder ein fortlaufender Service erforderlich ist. Er bezeichnet häufig eine Person oder Organisation, die **eine Dienstleistung in Anspruch nimmt** und häufig eine engere, individuellere Geschäftsbeziehung pflegt.
|
||||
|
||||
- **Verwendung**:
|
||||
- **Dienstleistungsbranche**: **Client** wird vor allem in Bereichen wie **Beratung, Finanzdienstleistungen, Recht, IT-Dienstleistungen** und anderen beratungsintensiven Branchen verwendet.
|
||||
- **Längerfristige Beziehungen**: Der Begriff wird auch verwendet, wenn es eine **langfristige Geschäftsbeziehung** gibt, wie z.B. bei regelmäßigen Verträgen oder individuellen Dienstleistungen.
|
||||
|
||||
- **Beispiel**: Ein Beratungsunternehmen stellt einem Unternehmen eine Rechnung für eine langfristige Dienstleistung. Das Unternehmen ist der **Client** des Beratungsunternehmens.
|
||||
|
||||
### **Wichtige Unterschiede**:
|
||||
|
||||
- **Customer** ist eher allgemein und bezieht sich auf **jeden Käufer** von Waren oder Dienstleistungen, egal ob in einem **einmaligen Kauf** oder einer **langfristigen Beziehung**. Der Begriff ist besonders in **B2C** und **Einzelhandelskontexten** verbreitet.
|
||||
|
||||
- **Client** wird eher in **dienstleistungsorientierten** und **langfristigen** Geschäftsbeziehungen verwendet und suggeriert eine **individuellere, oft persönlichere Beziehung**. Es geht um eine **Dienstleistung** oder **Beratung**, die über einen längeren Zeitraum erfolgt und typischerweise mit einem **Vertrag** oder einer regelmäßigen Interaktion verbunden ist.
|
||||
|
||||
### Fazit:
|
||||
- **Customer** (CII/UBL) ist der häufigere und allgemeinere Begriff für den Empfänger einer Rechnung in den meisten **Warenkauf**-Szenarien und auch in **B2C**-Transaktionen.
|
||||
- **Client** wird häufig in einem **Dienstleistungszusammenhang** verwendet, besonders wenn es um langfristige Beziehungen oder maßgeschneiderte Dienstleistungen geht.
|
||||
|
||||
Im Kontext von **CII** und **UBL**, die häufig für **Produktkäufe** und **Warenlieferungen** verwendet werden, ist **Customer** also der passendere Begriff, während **Client** in einem Geschäfts- oder Beratungsdienstleistungsumfeld gebräuchlicher wäre.
|
|
@ -94,7 +94,7 @@ class InvoicingResource(
|
|||
|
||||
private fun createPdfFileResponse(pdfFile: java.nio.file.Path, invoice: Invoice): Response =
|
||||
Response.ok(pdfFile)
|
||||
.header("Content-Disposition", "attachment;filename=\"${invoice.invoicingDate.toString().replace('-', '.')} ${invoice.recipient.name} ${invoice.invoiceNumber}.pdf\"")
|
||||
.header("Content-Disposition", "attachment;filename=\"${invoice.invoiceDate.toString().replace('-', '.')} ${invoice.customer.name} ${invoice.invoiceNumber}.pdf\"")
|
||||
.build()
|
||||
|
||||
}
|
|
@ -20,16 +20,16 @@ open class MustangMapper(
|
|||
|
||||
open fun mapToTransaction(invoice: net.codinux.invoicing.model.Invoice): IExportableTransaction = Invoice().apply {
|
||||
this.number = invoice.invoiceNumber
|
||||
this.issueDate = map(invoice.invoicingDate)
|
||||
this.sender = mapParty(invoice.sender)
|
||||
this.recipient = mapParty(invoice.recipient)
|
||||
this.issueDate = map(invoice.invoiceDate)
|
||||
this.sender = mapParty(invoice.supplier)
|
||||
this.recipient = mapParty(invoice.customer)
|
||||
|
||||
this.setZFItems(ArrayList(invoice.items.map { mapLineItem(it) }))
|
||||
|
||||
this.dueDate = map(invoice.dueDate)
|
||||
this.paymentTermDescription = invoice.paymentDescription
|
||||
|
||||
this.referenceNumber = invoice.buyerReference
|
||||
this.referenceNumber = invoice.customerReference
|
||||
|
||||
invoice.amountAdjustments?.let { adjustments ->
|
||||
this.totalPrepaidAmount = adjustments.prepaidAmounts
|
||||
|
@ -43,8 +43,10 @@ open class MustangMapper(
|
|||
}
|
||||
|
||||
open fun mapParty(party: Party): TradeParty = TradeParty(
|
||||
party.name, party.street, party.postalCode, party.city, party.countryIsoCode
|
||||
party.name, party.address, party.postalCode, party.city, party.countryIsoCode
|
||||
).apply {
|
||||
this.setAdditionalAddress(party.additionalAddressLine)
|
||||
|
||||
this.setVATID(party.vatId)
|
||||
// TODO: description?
|
||||
|
||||
|
@ -91,15 +93,15 @@ open class MustangMapper(
|
|||
|
||||
open fun mapToInvoice(invoice: Invoice) = net.codinux.invoicing.model.Invoice(
|
||||
invoiceNumber = invoice.number,
|
||||
invoicingDate = map(invoice.issueDate),
|
||||
sender = mapParty(invoice.sender),
|
||||
recipient = mapParty(invoice.recipient),
|
||||
invoiceDate = map(invoice.issueDate),
|
||||
supplier = mapParty(invoice.sender),
|
||||
customer = mapParty(invoice.recipient),
|
||||
items = invoice.zfItems.map { mapLineItem(it) },
|
||||
|
||||
dueDate = map(invoice.dueDate ?: invoice.paymentTerms?.dueDate),
|
||||
paymentDescription = invoice.paymentTermDescription ?: invoice.paymentTerms?.description,
|
||||
|
||||
buyerReference = invoice.referenceNumber,
|
||||
customerReference = invoice.referenceNumber,
|
||||
|
||||
amountAdjustments = mapAmountAdjustments(invoice),
|
||||
|
||||
|
@ -107,7 +109,7 @@ open class MustangMapper(
|
|||
)
|
||||
|
||||
open fun mapParty(party: TradeParty) = Party(
|
||||
party.name, party.street, party.zip, party.location, party.country, party.vatID,
|
||||
party.name, party.street, party.additionalAddress, party.zip, party.location, party.country, party.vatID,
|
||||
party.email ?: party.contact?.eMail, party.contact?.phone, party.contact?.fax, party.contact?.name,
|
||||
party.bankDetails?.firstOrNull()?.let { net.codinux.invoicing.model.BankDetails(it.iban, it.bic, it.accountName) }
|
||||
)
|
||||
|
|
|
@ -4,18 +4,18 @@ import java.time.LocalDate
|
|||
|
||||
class Invoice(
|
||||
val invoiceNumber: String,
|
||||
val invoicingDate: LocalDate,
|
||||
val sender: Party,
|
||||
val recipient: Party,
|
||||
val invoiceDate: LocalDate,
|
||||
val supplier: Party,
|
||||
val customer: Party,
|
||||
val items: List<InvoiceItem>,
|
||||
|
||||
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)
|
||||
* Unique reference number of the customer, e.g. the Leitweg-ID required by German authorities (Behörden)
|
||||
*/
|
||||
val buyerReference: String? = null,
|
||||
val customerReference: String? = null,
|
||||
|
||||
val amountAdjustments: AmountAdjustments? = null,
|
||||
|
||||
|
@ -27,5 +27,5 @@ class Invoice(
|
|||
*/
|
||||
var totalAmounts: TotalAmounts? = null
|
||||
) {
|
||||
override fun toString() = "$invoicingDate $invoiceNumber to $recipient ${totalAmounts?.duePayableAmount?.let { " (${it.toPlainString()})" } ?: ""}"
|
||||
override fun toString() = "$invoiceDate $invoiceNumber to $customer ${totalAmounts?.duePayableAmount?.let { " (${it.toPlainString()})" } ?: ""}"
|
||||
}
|
|
@ -6,7 +6,8 @@ class Party(
|
|||
/**
|
||||
* Party's street and house number.
|
||||
*/
|
||||
val street: String,
|
||||
val address: String,
|
||||
val additionalAddressLine: String? = null,
|
||||
var postalCode: String?,
|
||||
val city: String,
|
||||
/**
|
||||
|
|
|
@ -85,9 +85,9 @@ class Demonstration {
|
|||
|
||||
private fun createInvoice() = Invoice(
|
||||
invoiceNumber = "RE-00001",
|
||||
invoicingDate = LocalDate.now(),
|
||||
sender = Party("codinux GmbH & Co. KG", "Fun Street 1", "12345", "Glückstadt"),
|
||||
recipient = Party("Abzock GmbH", "Ausbeutstr.", "12345", "Abzockhausen"),
|
||||
invoiceDate = LocalDate.now(),
|
||||
supplier = Party("codinux GmbH & Co. KG", "Fun Street 1", null, "12345", "Glückstadt"),
|
||||
customer = Party("Abzock GmbH", "Ausbeutstr.", null, "12345", "Abzockhausen"),
|
||||
items = listOf(InvoiceItem("Erbrachte Dienstleistungen", BigDecimal(170), "HUR", BigDecimal(1_000_000), BigDecimal(19))) // HUR = EN code for hour
|
||||
)
|
||||
}
|
|
@ -11,28 +11,32 @@ import java.time.format.DateTimeFormatter
|
|||
object DataGenerator {
|
||||
|
||||
const val InvoiceNumber = "12345"
|
||||
val InvoicingDate = LocalDate.of(2015, 10, 21)
|
||||
val InvoiceDate = LocalDate.of(2015, 10, 21)
|
||||
val DueDate = LocalDate.of(2016, 6, 15)
|
||||
|
||||
const val SenderName = "Hochwürdiger Leistungserbringer"
|
||||
const val SenderStreet = "Fun Street 1"
|
||||
const val SenderPostalCode = "12345"
|
||||
const val SenderCity = "Glückstadt"
|
||||
const val SenderCountry = "DE"
|
||||
const val SenderVatId = "DE123456789"
|
||||
const val SenderEmail = "working-class-hero@rock.me"
|
||||
const val SenderPhone = "+4917012345678"
|
||||
val SenderBankDetails = BankDetails("DE00123456780987654321", "ABZODEFFXXX", "Manuela Musterfrau")
|
||||
const val SupplierName = "Hochwürdiger Leistungserbringer"
|
||||
const val SupplierAddress = "Fun Street 1"
|
||||
val SupplierAdditionalAddressLine: String? = null
|
||||
const val SupplierPostalCode = "12345"
|
||||
const val SupplierCity = "Glückstadt"
|
||||
const val SupplierCountry = "DE"
|
||||
const val SupplierVatId = "DE123456789"
|
||||
const val SupplierEmail = "working-class-hero@rock.me"
|
||||
const val SupplierPhone = "+4917012345678"
|
||||
val SupplierFax: String? = null
|
||||
val SupplierBankDetails = BankDetails("DE00123456780987654321", "ABZODEFFXXX", "Manuela Musterfrau")
|
||||
|
||||
const val RecipientName = "Untertänigster Leistungsempfänger"
|
||||
const val RecipientStreet = "Party Street 1"
|
||||
const val RecipientPostalCode = SenderPostalCode
|
||||
const val RecipientCity = SenderCity
|
||||
const val RecipientCountry = "DE"
|
||||
const val RecipientVatId = "DE987654321"
|
||||
const val RecipientEmail = "exploiter@your.boss"
|
||||
const val RecipientPhone = "+491234567890"
|
||||
val RecipientBankDetails: BankDetails? = null
|
||||
const val CustomerName = "Untertänigster Leistungsempfänger"
|
||||
const val CustomerAddress = "Party Street 1"
|
||||
val CustomerAdditionalAddressLine: String? = null
|
||||
const val CustomerPostalCode = SupplierPostalCode
|
||||
const val CustomerCity = SupplierCity
|
||||
const val CustomerCountry = "DE"
|
||||
const val CustomerVatId = "DE987654321"
|
||||
const val CustomerEmail = "exploiter@your.boss"
|
||||
const val CustomerPhone = "+491234567890"
|
||||
val CustomerFax: String? = null
|
||||
val CustomerBankDetails: BankDetails? = null
|
||||
|
||||
const val ItemName = "Erbrachte Dienstleistungen"
|
||||
val ItemQuantity = BigDecimal(1)
|
||||
|
@ -44,30 +48,31 @@ object DataGenerator {
|
|||
|
||||
fun createInvoice(
|
||||
invoiceNumber: String = InvoiceNumber,
|
||||
invoicingDate: LocalDate = InvoicingDate,
|
||||
sender: Party = createParty(SenderName, SenderStreet, SenderPostalCode, SenderCity, SenderCountry, SenderVatId, SenderEmail, SenderPhone,
|
||||
bankDetails = SenderBankDetails),
|
||||
recipient: Party = createParty(RecipientName, RecipientStreet, RecipientPostalCode, RecipientCity, RecipientCountry, RecipientVatId, RecipientEmail, RecipientPhone,
|
||||
bankDetails = RecipientBankDetails),
|
||||
invoiceDate: LocalDate = InvoiceDate,
|
||||
supplier: Party = createParty(SupplierName, SupplierAddress, SupplierAdditionalAddressLine, SupplierPostalCode, SupplierCity, SupplierCountry,
|
||||
SupplierVatId, SupplierEmail, SupplierPhone, SupplierFax, bankDetails = SupplierBankDetails),
|
||||
customer: Party = createParty(CustomerName, CustomerAddress, CustomerAdditionalAddressLine, CustomerPostalCode, CustomerCity, CustomerCountry,
|
||||
CustomerVatId, CustomerEmail, CustomerPhone, CustomerFax, bankDetails = CustomerBankDetails),
|
||||
items: List<InvoiceItem> = listOf(createItem()),
|
||||
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)
|
||||
) = Invoice(invoiceNumber, invoiceDate, supplier, customer, items, dueDate, paymentDescription, buyerReference)
|
||||
|
||||
fun createParty(
|
||||
name: String,
|
||||
streetName: String = SenderStreet,
|
||||
postalCode: String = SenderPostalCode,
|
||||
city: String = SenderCity,
|
||||
country: String? = SenderCountry,
|
||||
vatId: String? = SenderVatId,
|
||||
email: String? = SenderEmail,
|
||||
phone: String? = SenderPhone,
|
||||
fax: String? = null,
|
||||
address: String = SupplierAddress,
|
||||
additionalAddressLine: String? = SupplierAdditionalAddressLine,
|
||||
postalCode: String = SupplierPostalCode,
|
||||
city: String = SupplierCity,
|
||||
country: String? = SupplierCountry,
|
||||
vatId: String? = SupplierVatId,
|
||||
email: String? = SupplierEmail,
|
||||
phone: String? = SupplierPhone,
|
||||
fax: String? = SupplierFax,
|
||||
contactName: String? = null,
|
||||
bankDetails: BankDetails? = null
|
||||
) = Party(name, streetName, postalCode, city, country, vatId, email, phone, fax, contactName, bankDetails)
|
||||
) = Party(name, address, additionalAddressLine, postalCode, city, country, vatId, email, phone, fax, contactName, bankDetails)
|
||||
|
||||
fun createItem(
|
||||
name: String = ItemName,
|
||||
|
|
|
@ -16,22 +16,22 @@ object InvoiceAsserter {
|
|||
val asserter = XPathAsserter(xml)
|
||||
|
||||
asserter.xpathHasValue("//rsm:ExchangedDocument/ram:ID", DataGenerator.InvoiceNumber)
|
||||
asserter.xpathHasValue("//rsm:ExchangedDocument/ram:IssueDateTime/udt:DateTimeString", DataGenerator.InvoicingDate.toString().replace("-", ""))
|
||||
asserter.xpathHasValue("//rsm:ExchangedDocument/ram:IssueDateTime/udt:DateTimeString", DataGenerator.InvoiceDate.toString().replace("-", ""))
|
||||
|
||||
val senderXPath = "//rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty"
|
||||
assertParty(asserter, senderXPath, DataGenerator.SenderName, DataGenerator.SenderStreet, DataGenerator.SenderPostalCode, DataGenerator.SenderCity, DataGenerator.SenderVatId, DataGenerator.SenderEmail, DataGenerator.SenderPhone)
|
||||
val supplierXPath = "//rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty"
|
||||
assertParty(asserter, supplierXPath, DataGenerator.SupplierName, DataGenerator.SupplierAddress, DataGenerator.SupplierPostalCode, DataGenerator.SupplierCity, DataGenerator.SupplierVatId, DataGenerator.SupplierEmail, DataGenerator.SupplierPhone)
|
||||
|
||||
val receiverXPath = "//rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty"
|
||||
assertParty(asserter, receiverXPath, DataGenerator.RecipientName, DataGenerator.RecipientStreet, DataGenerator.RecipientPostalCode, DataGenerator.RecipientCity, DataGenerator.RecipientVatId, DataGenerator.RecipientEmail, DataGenerator.RecipientPhone)
|
||||
val customerXPath = "//rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty"
|
||||
assertParty(asserter, customerXPath, DataGenerator.CustomerName, DataGenerator.CustomerAddress, DataGenerator.CustomerPostalCode, DataGenerator.CustomerCity, DataGenerator.CustomerVatId, DataGenerator.CustomerEmail, DataGenerator.CustomerPhone)
|
||||
|
||||
val lineItemXPath = "//rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem"
|
||||
assertLineItem(asserter, lineItemXPath, DataGenerator.ItemName, DataGenerator.ItemQuantity, DataGenerator.ItemUnit, DataGenerator.ItemUnitPrice, DataGenerator.ItemVatRate, DataGenerator.ItemDescription)
|
||||
}
|
||||
|
||||
private fun assertParty(asserter: XPathAsserter, partyXPath: String, name: String, street: String, postalCode: String, city: String, vatId: String, email: String, phone: String) {
|
||||
private fun assertParty(asserter: XPathAsserter, partyXPath: String, name: String, address: String, postalCode: String, city: String, vatId: String, email: String, phone: String) {
|
||||
asserter.xpathHasValue("$partyXPath/ram:Name", name)
|
||||
|
||||
asserter.xpathHasValue("$partyXPath/ram:PostalTradeAddress/ram:LineOne", street)
|
||||
asserter.xpathHasValue("$partyXPath/ram:PostalTradeAddress/ram:LineOne", address)
|
||||
asserter.xpathHasValue("$partyXPath/ram:PostalTradeAddress/ram:PostcodeCode", postalCode)
|
||||
asserter.xpathHasValue("$partyXPath/ram:PostalTradeAddress/ram:CityName", city)
|
||||
|
||||
|
@ -60,20 +60,20 @@ object InvoiceAsserter {
|
|||
assertThat(invoice).isNotNull()
|
||||
|
||||
assertThat(invoice!!.invoiceNumber).isEqualTo(DataGenerator.InvoiceNumber)
|
||||
assertThat(invoice.invoicingDate).isEqualTo(DataGenerator.InvoicingDate)
|
||||
assertThat(invoice.invoiceDate).isEqualTo(DataGenerator.InvoiceDate)
|
||||
|
||||
assertParty(invoice.sender, DataGenerator.SenderName, DataGenerator.SenderStreet, DataGenerator.SenderPostalCode, DataGenerator.SenderCity, DataGenerator.SenderCountry, DataGenerator.SenderVatId, DataGenerator.SenderEmail, DataGenerator.SenderPhone, DataGenerator.SenderBankDetails)
|
||||
assertParty(invoice.supplier, DataGenerator.SupplierName, DataGenerator.SupplierAddress, DataGenerator.SupplierPostalCode, DataGenerator.SupplierCity, DataGenerator.SupplierCountry, DataGenerator.SupplierVatId, DataGenerator.SupplierEmail, DataGenerator.SupplierPhone, DataGenerator.SupplierBankDetails)
|
||||
|
||||
assertParty(invoice.recipient, DataGenerator.RecipientName, DataGenerator.RecipientStreet, DataGenerator.RecipientPostalCode, DataGenerator.RecipientCity, DataGenerator.RecipientCountry, DataGenerator.RecipientVatId, DataGenerator.RecipientEmail, DataGenerator.RecipientPhone, DataGenerator.RecipientBankDetails)
|
||||
assertParty(invoice.customer, DataGenerator.CustomerName, DataGenerator.CustomerAddress, DataGenerator.CustomerPostalCode, DataGenerator.CustomerCity, DataGenerator.CustomerCountry, DataGenerator.CustomerVatId, DataGenerator.CustomerEmail, DataGenerator.CustomerPhone, DataGenerator.CustomerBankDetails)
|
||||
|
||||
assertThat(invoice.items).hasSize(1)
|
||||
assertLineItem(invoice.items.first(), DataGenerator.ItemName, DataGenerator.ItemQuantity, DataGenerator.ItemUnit, DataGenerator.ItemUnitPrice, DataGenerator.ItemVatRate, DataGenerator.ItemDescription)
|
||||
}
|
||||
|
||||
private fun assertParty(party: Party, name: String, street: String, postalCode: String, city: String, country: String?, vatId: String, email: String, phone: String, bankDetails: BankDetails?) {
|
||||
private fun assertParty(party: Party, name: String, address: String, postalCode: String, city: String, country: String?, vatId: String, email: String, phone: String, bankDetails: BankDetails?) {
|
||||
assertThat(party.name).isEqualTo(name)
|
||||
|
||||
assertThat(party.street).isEqualTo(street)
|
||||
assertThat(party.address).isEqualTo(address)
|
||||
assertThat(party.postalCode).isEqualTo(postalCode)
|
||||
assertThat(party.city).isEqualTo(city)
|
||||
assertThat(party.countryIsoCode).isEqualTo(country)
|
||||
|
|
Loading…
Reference in New Issue