feat(event): add invoice.issued and invoice.paid event contracts

This commit is contained in:
mats committed 2026-08-14 08:24:08 +02:00
1 parent d6af4dbc0b
commit 4bf00314d3
3 files changed
+91

No files matched your search

+38
View File
@@ -58,3 +58,41 @@ func Decode(raw []byte) (Created, error) {
err := json.Unmarshal(raw, &c)
return c, err
}
// InvoiceIssued is the payload of an event.InvoiceIssued envelope.
type InvoiceIssued struct {
OrderID string `json:"order_id"`
InvoiceNumber string `json:"invoice_number"`
CompanyID string `json:"company_id,omitempty"`
CustomerEmail string `json:"customer_email,omitempty"`
AmountIncVat int64 `json:"amount_inc_vat"`
DueDate string `json:"due_date"`
OCRReference string `json:"ocr_reference"`
IssuedAtMs int64 `json:"issued_at_ms"`
}
func (i InvoiceIssued) Encode() ([]byte, error) { return json.Marshal(i) }
func DecodeInvoiceIssued(raw []byte) (InvoiceIssued, error) {
var i InvoiceIssued
err := json.Unmarshal(raw, &i)
return i, err
}
// InvoicePaid is the payload of an event.InvoicePaid envelope.
type InvoicePaid struct {
OrderID string `json:"order_id"`
InvoiceNumber string `json:"invoice_number"`
CompanyID string `json:"company_id,omitempty"`
AmountPaid int64 `json:"amount_paid"`
PaidAtMs int64 `json:"paid_at_ms"`
}
func (i InvoicePaid) Encode() ([]byte, error) { return json.Marshal(i) }
func DecodeInvoicePaid(raw []byte) (InvoicePaid, error) {
var i InvoicePaid
err := json.Unmarshal(raw, &i)
return i, err
}