Documentation
¶
Overview ¶
Package einvoice provides the domain model for German E-Invoices (E-Rechnung) compliant with EN 16931.
The Invoice type is the entry point. Serialize it to XRechnung 3.0 / CII XML with the cii package, and embed that XML into a PDF/A-3 (ZUGFeRD / Factur-X) with the zugferd package.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Invoice ¶
type Invoice struct {
Number string
IssueDate time.Time
DueDate time.Time
Currency string
Note string
BuyerReference string
Seller Party
Buyer Party
Payment Payment
LineItems []LineItem
TaxTotal decimal.Decimal
GrandTotal decimal.Decimal
}
Example ¶
package main
import (
"fmt"
einvoice "github.com/dotwavehq/go-einvoice"
"github.com/dotwavehq/go-einvoice/cii"
"github.com/shopspring/decimal"
)
func main() {
inv := &einvoice.Invoice{
Number: "RE-2025-1001",
Currency: "EUR",
Seller: einvoice.Party{Name: "Seller GmbH", CountryCode: "DE", VATID: "DE123456789"},
Buyer: einvoice.Party{Name: "Buyer AG", CountryCode: "DE"},
LineItems: []einvoice.LineItem{{
Description: "Consulting",
Quantity: decimal.NewFromInt(10),
UnitCode: "HUR",
UnitPrice: decimal.RequireFromString("100.00"),
TaxRate: decimal.NewFromInt(19),
}},
TaxTotal: decimal.RequireFromString("190.00"),
GrandTotal: decimal.RequireFromString("1190.00"),
}
xmlBytes, err := cii.NewSerializer().Serialize(inv)
if err != nil {
panic(err)
}
fmt.Println(len(xmlBytes) > 0)
}
Output: true
type InvoiceSerializer ¶
InvoiceSerializer defines the contract for converting the domain model into a spec format.
Click to show internal directories.
Click to hide internal directories.