A Go package to create a UBL (UBL.BE) invoice for Peppol.
This is a minimal implementation for the features we need.
Feel free to send a patch if you are missing something.
You can do a manual validation here: https://www.ubl.be/validator/
Example:
inv := ubl.Invoice{
ID: "INV-12345",
SupplierName: "ABC Supplies Ltd",
SupplierVat: "BE0123456789",
SupplierAddress: ubl.Address{
StreetName: "123 Supplier Street",
CityName: "Supplier City",
PostalZone: "12345",
CountryCode: "BE",
},
CustomerName: "XYZ Corp",
CustomerVat: "BE9876543210",
CustomerAddress: ubl.Address{
StreetName: "789 Customer Avenue",
CityName: "Customer Town",
PostalZone: "67890",
CountryCode: "BE",
},
Iban: "9999999999",
Bic: "GEBABEBB",
Note: "You get a free sticker when you pay fast",
}
inv.Lines = []ubl.InvoiceLine{
ubl.InvoiceLine{
Quantity: 10,
Price: 100,
Name: "Product A",
Description: "High-quality item",
TaxPercentage: 21.0,
},
}
xmlBytes, err := inv.Generate()
v, err := validate.New()
defer v.Free()
err = v.ValidateBytes(xmlBytes)
os.WriteFile("invoice.xml", xmlBytes, 0644)
Build: go build -v ./...
Test: go test -v ./...