Documentation
¶
Overview ¶
Package xinvoice converts GOBL envelopes into the German electronic invoicing formats and back: XRechnung 3.0 in UBL and CII syntax, and ZUGFeRD's EN 16931 profile.
Index ¶
Constants ¶
const ( // CustomizationIDXRechnung identifies XRechnung 3.0 documents in // both syntaxes (BT-24). CustomizationIDXRechnung = "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0" // GuidelineIDEN16931 identifies plain EN 16931 CII documents, the // guideline ZUGFeRD's EN 16931 profile uses. GuidelineIDEN16931 = "urn:cen.eu:en16931:2017" // ProfileIDPeppolBilling is the Peppol billing process identifier. ProfileIDPeppolBilling = "urn:fdc:peppol.eu:2017:poacc:billing:01:1.0" )
German document identifiers, written into the identity headers of the converted documents.
const ( // FormatXRechnungUBL is XRechnung 3.0 in UBL syntax. FormatXRechnungUBL cbc.Key = "xrechnung-ubl-v3" // FormatXRechnungCII is XRechnung 3.0 in CII syntax. FormatXRechnungCII cbc.Key = "xrechnung-cii-v3" // FormatZUGFeRD is the XML side of ZUGFeRD's EN 16931 profile. // Readers locate the XML inside the PDF/A-3 by the exact file name // factur-x.xml. FormatZUGFeRD cbc.Key = "zugferd-v2" )
Format keys for the supported German document formats.
Variables ¶
var ErrUnknownDocument = errors.New("not a recognized UBL or CII invoice")
ErrUnknownDocument is returned when the data is neither a UBL nor a CII invoice.
var ErrUnsupportedFormat = errors.New("unsupported format")
ErrUnsupportedFormat is returned for an unknown format key.
Functions ¶
This section is empty.
Types ¶
type BinaryAttachment ¶
type BinaryAttachment struct {
// ID is the identifier for this attachment reference.
ID string
// Description provides a human-readable description.
Description string
// Data contains the raw binary data.
Data []byte
// MimeCode specifies the MIME type (e.g. "application/pdf").
MimeCode string
// Filename is the name of the file.
Filename string
}
BinaryAttachment represents a file embedded inside the XML document, unifying the attachment shape of the two conversion libraries.
type Document ¶
type Document struct {
// Data is the XML document.
Data []byte
// Format is the format the document was generated in.
Format *Format
// Namespace and Element identify the XML root.
Namespace string
Element string
// CustomizationID and ProfileID identify the document flavor and
// business process.
CustomizationID string
ProfileID string
// Version is the syntax version (UBL "2.1", CII "D16B").
Version string
// VESID is the validation rule set the document must satisfy.
VESID string
}
Document carries the serialized XML and its transmission metadata.
type Format ¶
type Format struct {
Key cbc.Key
Name string
FileName string
// contains filtered or unexported fields
}
Format describes one supported German document format.
type Option ¶
type Option func(*options)
Option configures a conversion.
func WithAttachment ¶
func WithAttachment(a BinaryAttachment) Option
WithAttachment embeds a file inside the generated XML.
type ParseOption ¶
type ParseOption func(*parseOptions)
ParseOption configures parsing.
func WithRouting ¶
func WithRouting(from, to cbc.URI) ParseOption
WithRouting records the transport direction on the parsed envelope's header. Both values must be set for the option to take effect.
type Parsed ¶
type Parsed struct {
// Envelope contains the GOBL invoice.
Envelope *gobl.Envelope
// Attachments are the binary attachments embedded in the XML.
Attachments []BinaryAttachment
// Syntax the document was written in.
Syntax Syntax
}
Parsed carries the outcome of parsing a German XML document.