cii

package module
v0.85.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 30 Imported by: 9 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

GOBL.CII

GOBL conversion into Cross Industry Invoice (CII) XML format and vice versa.

codecov Ask DeepWiki

Copyright Invopop Ltd. 2025. Released publicly under the Apache License Version 2.0. For commercial licenses, please contact the dev team at invopop. To accept contributions to this library, we require transferring copyrights to Invopop Ltd.

Usage

Go Package

Usage of the GOBL to CII conversion library is straightforward and supports bidirectional conversion:

  1. Convert GOBL to CII XML: You must first have a GOBL Envelope, including an invoice, ready to convert. There are some samples in the test/data directory.

  2. Parse CII XML into GOBL: You need to have a valid CII XML document that you want to convert to GOBL format.

The package uses the same terms as GOBL's convert package: export maps a GOBL envelope into a CII document and import maps it back, while encode and decode turn CII documents into XML bytes and back.

Export GOBL to CII
package main

import (
    "encoding/json"
    "os"

    "github.com/invopop/gobl"
    cii "github.com/invopop/gobl.cii"
)

func main() {
    data, _ := os.ReadFile("./test/data/invoice-sample.json")

    env := new(gobl.Envelope)
    if err := json.Unmarshal(data, env); err != nil {
        panic(err)
    }

    // Export the CII document
    doc, err := cii.Export(env)
    if err != nil {
        panic(err)
    }

    // Encode the XML output
    out, err := cii.Encode(doc)
    if err != nil {
        panic(err)
    }
}

To export into a format other than the default EN 16931, such as one registered by a regional module, add it as an option. ExportInvoice does the same when an invoice is expected:

doc, err := cii.ExportInvoice(env, cii.WithFormat(cii.FormatEN16931))

To embed files in the invoice, such as a PDF version of it, add them with WithAttachments. Each is written as an AdditionalReferencedDocument with an AttachmentBinaryObject:

doc, err := cii.ExportInvoice(env,
    cii.WithAttachments(cii.BinaryAttachment{
        ID:          "INV-001-PDF",
        Description: "Invoice INV-001",
        Data:        pdf,
        MimeCode:    "application/pdf",
        Filename:    "INV-001.pdf",
    }),
)

Through the GOBL convert register, pass them with convert.WithAttachments. Only formats that set Attachments embed them, using the attachment's name as its ID when it has none; the register refuses the others:

out, err := convert.Export(env, "cii+en16931-v2017", convert.WithAttachments(&convert.Attachment{
    Name: "INV-001.pdf",
    MIME: "application/pdf",
    Data: pdf,
}))
Formats

This package provides the base CII import and export, and the formats that apply in any country:

Key Format
cii+en16931-v2017 FormatEN16931

CII invoices that declare no known specification are imported under the cii key, but cannot be exported.

A format lists the GOBL schemas it imports into and exports from in Import and Export. Formats without Import schemas are export-only and never detected. This is the case for formats whose documents only differ from another format's by their container: Factur-X and ZUGFeRD EN 16931 documents declare exactly the EN 16931 guideline, as only their PDF tells them apart, so they are imported as cii+en16931-v2017.

A format sets Attachments when its specification allows embedded files in additional referenced documents. FormatEN16931 does.

The base import and export have no format-specific behavior. A format adds the rules of its specification with ExportFuncs and ImportFuncs, which adjust the finished document in order: an export function receives the GOBL envelope and the exported CII document, and an import function the CII document and the imported envelope, before it is calculated.

Regional formats live in their own modules, which register them with cii.RegisterFormats when imported, making them available to FindFormat, Import, and the GOBL convert register:

Key Module
cii+fr-ctc-cius-v1, cii+fr-ctc-extended-v1, cii+fr-ctc-facturx-v1 gobl.fr.ctc (_ "github.com/invopop/gobl.fr.ctc/cii")
cii+fr-facturx-v1, cii+fr-facturx-v1+basic, cii+fr-facturx-v1+extended gobl.fr.ctc (_ "github.com/invopop/gobl.fr.ctc/cii")
cii+fr-choruspro-v1 gobl.fr.ctc (_ "github.com/invopop/gobl.fr.ctc/cii")
cii+de-xrechnung-v3, cii+de-zugferd-v2, cii+de-zugferd-v2+basic, cii+de-zugferd-v2+extended gobl.de.xinvoice
cii+peppol+bis-v3 gobl.peppol (_ "github.com/invopop/gobl.peppol/cii")

Peppol BIS Billing 3.0 is no longer part of this package: import gobl.peppol to convert to and from it.

CDAR

Decode and Encode also handle UN/CEFACT Cross Domain Acknowledgement and Response (CDAR) documents, as a *CDAR. Their mapping to GOBL is specific to each specification, so it lives in the regional modules: the French CTC Flow 6 lifecycle statuses and payments are in gobl.fr.ctc (_ "github.com/invopop/gobl.fr.ctc/cdar"), under the cdar+fr-ctc-cdv-v1 and cdar+fr-ctc-cdv-v1+ppf keys.

Import CII to GOBL
package main

import (
    "encoding/json"
    "os"

    cii "github.com/invopop/gobl.cii"
)

func main() {
    // Read the CII XML file
    data, err := os.ReadFile("path/to/cii_invoice.xml")
    if err != nil {
        panic(err)
    }

    // Decode the CII document
    doc, err := cii.Decode(data)
    if err != nil {
        panic(err)
    }

    // Import into a GOBL envelope, with the format found from the document
    env, err := cii.Import(doc)
    if err != nil {
        panic(err)
    }

    out, err := json.MarshalIndent(env, "", "  ")
    if err != nil {
        panic(err)
    }
}

Through the GOBL convert register, convert.Import returns the files embedded in an invoice as Attachments, alongside the envelope:

res, err := convert.Import(data)
for _, a := range res.Attachments {
    // store a.Data as a.Name
}

Command Line

This package no longer includes a command-line tool. The gobl CLI from gobl.dev converts between GOBL and every format registered with the GOBL convert register, including CII:

go install github.com/invopop/gobl.dev/cmd/gobl@latest

gobl convert invoice.json invoice.xml --to cii+en16931-v2017   # export
gobl convert invoice.xml                                       # import, format detected
gobl convert --list                                            # registered formats

Testing

Run tests with:

go test ./...

To update test fixtures:

go test ./... -update
Schematron validation

Beyond the golden-file comparisons, the generated XML can be pushed through the real EN 16931 schematron rule set. Validation runs against phorm, the standalone validation service that replaced the now-archived invopop/phive gRPC wrapper, using the invopop/phorm HTTP client.

Start a service locally:

docker run -d --name phorm -p 8080:8080 phelger/phorm

Use phelger/phorm-arm64 on Apple Silicon. Note the image is phelger/phorm, not phax/phorm — the latter does not exist.

It takes a few seconds to boot. It is ready once this returns HTTP 200:

curl -s -o /dev/null -w '%{http_code}\n' \
  -H 'X-Token: phorm-dev-token' \
  'http://localhost:8080/api/get/vesids?include-deprecated=true'

Then run the suite with -validate:

go test ./... -validate

Without -validate the validating tests are skipped, so the plain go test ./... never needs a service and CI stays offline.

PHORM_URL and PHORM_TOKEN default to http://localhost:8080 and phorm's stock development token. Override them for a shared instance, or when port 8080 is already taken locally:

docker run -d --name phorm -p 8085:8080 phelger/phorm
PHORM_URL=http://localhost:8085 go test ./... -validate

All fixtures currently pass schematron across every format.

Notes
  • A failed validation is not an error. phorm answers a document that breaks a rule with an HTTP 400 carrying the report, which it also uses for a request it rejects outright, so invopop/phorm separates the two by whether the body is a validation report. An error from ValidateXml therefore means the validation never ran — unreachable service, rejected token, unresolvable VESID, or a body that is not XML — and the tests treat it as fatal, since nothing was checked.
  • phorm normalises VESID versions, so a 1.4.0-03 spelling resolves to its published 1.4-03 rule set. The resolved id comes back as ves.vesid, worth checking when a rule set behaves unexpectedly.
  • phive-rules keeps only a rolling window of releases, so the VESIDs in format.go need periodic updating; GET /api/get/vesids?include-deprecated=true lists what a given phorm build carries, along with a deprecated flag.

Considerations

There are certain assumptions and lost information in the conversion from CII to GOBL that should be considered:

  1. GOBL does not currently support additional embedded documents, so the AdditionalReferencedDocument field (BG-24 in EN 16931) is not supported and lost in the conversion.
  2. Payment advances do not include their own tax rate, they use the global tax rate of the invoice.
  3. The fields ReceivableSpecifiedTradeAccountingAccount (BT-133) and DesignatedProductClassification (BT-158) are added as a note to the line, with the type code as the key.

Development

The main source of information for this project comes from the EN 16931 standard, developed by the EU for electronic invoicing. Part 1 of the standard defines the semantic data model that forms an invoice, but does not provide a concrete implementation. Part 3.3 defines the mappings from the semantic data model to the CII XML format covered in this repository.

Useful links:

Documentation

Overview

Package cii helps convert GOBL into Cross Industry Invoice documents and vice versa.

Index

Constants

View Source
const (
	NamespaceRSM = "urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
	NamespaceRAM = "urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
	NamespaceQDT = "urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
	NamespaceUDT = "urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
)

CII namespaces

View Source
const (
	VersionD16B string = "D16B"
	VersionD22B string = "D22B"
)

CII Versions

View Source
const (
	AdditionalDocumentTypeTender         = "50"
	AdditionalDocumentTypeProductInvoice = "130"
)

Values for AdditionalReferencedDocument.TypeCode

View Source
const (
	// SchemeIDEmail represents the Scheme ID for email addresses
	SchemeIDEmail = "EM"
	// SchemeIDVAT represents a VAT registration (BT-31, BT-48, BT-63)
	SchemeIDVAT = "VA"
	// SchemeIDTaxRegistration represents a non-VAT tax registration (BT-32)
	SchemeIDTaxRegistration = "FC"
)
View Source
const AdditionalDocumentTypeAttachment = "916"

AdditionalDocumentTypeAttachment is the TypeCode for additional supporting documents

View Source
const GuidelineIDEN16931 = "urn:cen.eu:en16931:2017"

GuidelineIDEN16931 identifies plain EN 16931 documents (BT-24), which most specifications build on.

View Source
const KeyCII cbc.Key = "cii"

KeyCII identifies CII invoices that do not declare a known specification. They can be imported, but not exported.

View Source
const (
	NamespaceCDARRSM = "urn:un:unece:uncefact:data:standard:CrossDomainAcknowledgementAndResponse:100"
)

CDAR namespaces

Variables

View Source
var (
	// ErrUnknownDocumentType is returned when the document type
	// is not recognized during parsing.
	ErrUnknownDocumentType = fmt.Errorf("unknown document type")

	// ErrUnsupportedDocumentType is returned when the document type
	// is not supported for conversion.
	ErrUnsupportedDocumentType = fmt.Errorf("unsupported document type")
)
View Source
var FormatEN16931 = Format{
	Key:         "cii+en16931-v2017",
	Name:        i18n.NewString("CII EN 16931:2017"),
	Import:      []schema.ID{invoiceSchema},
	Export:      []schema.ID{invoiceSchema},
	GuidelineID: GuidelineIDEN16931,
	Version:     VersionD16B,
	Addons:      []cbc.Key{en16931.V2017},
	Attachments: true,
	VESID:       vesIDEN16931CII,
}

FormatEN16931 is used for EN 16931 documents, and is the default.

Functions

func CleanString added in v0.67.0

func CleanString(s string) string

CleanString removes the replacement characters left by broken text encodings from incoming text.

func Encode added in v0.67.0

func Encode(doc Document) ([]byte, error)

Encode returns the XML of the document, including the XML header.

func ExpandGroupLines added in v0.67.0

func ExpandGroupLines(inv *bill.Invoice, out *Invoice)

ExpandGroupLines writes the breakdown of each invoice line as sub-lines after it, turning the line into a GROUP line, as the EXTENDED profiles allow. Formats that support sub-lines call it from their export functions.

func Import added in v0.67.0

func Import(doc Document, opts ...Option) (*gobl.Envelope, error)

Import converts the CII invoice into a GOBL envelope. The format is determined from the document's guideline and business process IDs, unless a WithFormat option is provided. Other documents, such as a CDAR, are imported by the packages that implement their formats.

func ParseParty added in v0.67.0

func ParseParty(party *Party) *org.Party

ParseParty converts the CII trade party into a GOBL party, without any format specific adjustments.

func RegisterFormats added in v0.67.0

func RegisterFormats(fs ...Format)

RegisterFormats makes the formats available to FindFormat, and registers them with the GOBL convert register. Packages that implement regional formats call it from their init function.

Types

type AccountingAccount added in v0.28.0

type AccountingAccount struct {
	ID string `xml:"ram:ID,omitempty"`
}

AccountingAccount defines the structure of ReceivableSpecifiedTradeAccountingAccount

type AdditionalDocument added in v0.7.0

type AdditionalDocument struct {
	ID                     string              `xml:"ram:IssuerAssignedID,omitempty"`
	URIID                  string              `xml:"ram:URIID,omitempty"`
	TypeCode               string              `xml:"ram:TypeCode,omitempty"`
	Name                   string              `xml:"ram:Name,omitempty"`
	AttachmentBinaryObject *BinaryObject       `xml:"ram:AttachmentBinaryObject,omitempty"`
	IssueDate              *FormattedIssueDate `xml:"ram:FormattedIssueDateTime,omitempty"`
}

AdditionalDocument defines the structure of AdditionalReferencedDocument of the CII standard

type Advance added in v0.7.0

type Advance struct {
	Amount string              `xml:"ram:PaidAmount"`
	Date   *FormattedIssueDate `xml:"ram:FormattedReceivedDateTime,omitempty"`
}

Advance defines the structure of SpecifiedAdvancePayment of the CII standard

type Agreement added in v0.7.0

type Agreement struct {
	BuyerReference     string                `xml:"ram:BuyerReference,omitempty"`
	Seller             *Party                `xml:"ram:SellerTradeParty,omitempty"`
	Buyer              *Party                `xml:"ram:BuyerTradeParty,omitempty"`
	SalesAgent         *Party                `xml:"ram:SalesAgentTradeParty,omitempty"`
	TaxRepresentative  *Party                `xml:"ram:SellerTaxRepresentativeTradeParty,omitempty"`
	DeliveryTerms      *DeliveryTerms        `xml:"ram:ApplicableTradeDeliveryTerms,omitempty"`
	Sales              *IssuerID             `xml:"ram:SellerOrderReferencedDocument,omitempty"`
	Purchase           *IssuerID             `xml:"ram:BuyerOrderReferencedDocument,omitempty"`
	Contract           *IssuerID             `xml:"ram:ContractReferencedDocument,omitempty"`
	AdditionalDocument []*AdditionalDocument `xml:"ram:AdditionalReferencedDocument,omitempty"`
	BuyerAgent         *Party                `xml:"ram:BuyerAgentTradeParty,omitempty"`
	Project            *Project              `xml:"ram:SpecifiedProcurringProject,omitempty"`
}

Agreement defines the structure of the ApplicableHeaderTradeAgreement of the CII standard

type AllowanceCharge added in v0.7.0

type AllowanceCharge struct {
	ChargeIndicator Indicator `xml:"ram:ChargeIndicator"`
	Percent         string    `xml:"ram:CalculationPercent,omitempty"`
	Base            string    `xml:"ram:BasisAmount,omitempty"`
	Amount          string    `xml:"ram:ActualAmount,omitempty"`
	ReasonCode      string    `xml:"ram:ReasonCode,omitempty"`
	Reason          string    `xml:"ram:Reason,omitempty"`
	Tax             *Tax      `xml:"ram:CategoryTradeTax,omitempty"`
}

AllowanceCharge defines the structure of SpecifiedTradeAllowanceCharge of the CII standard, also used for line items

type BinaryAttachment added in v0.28.0

type BinaryAttachment struct {
	// ID is the identifier for this attachment reference
	ID string
	// Description provides a human-readable description of the attachment
	Description string
	// Data contains the raw binary data (automatically base64-encoded/decoded as needed)
	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 binary attachment that can be extracted from or added to a CII invoice.

type BinaryObject added in v0.28.0

type BinaryObject struct {
	Value    string `xml:",chardata"`
	MimeCode string `xml:"mimeCode,attr,omitempty"`
	Filename string `xml:"filename,attr,omitempty"`
}

BinaryObject represents binary data with associated metadata in CII

type CDAR added in v0.27.0

type CDAR struct {
	XMLName                  xml.Name               `xml:"rsm:CrossDomainAcknowledgementAndResponse"`
	RSMNamespace             string                 `xml:"xmlns:rsm,attr"`
	RAMNamespace             string                 `xml:"xmlns:ram,attr"`
	QDTNamespace             string                 `xml:"xmlns:qdt,attr"`
	UDTNamespace             string                 `xml:"xmlns:udt,attr"`
	ExchangedDocumentContext *CDARExchangedContext  `xml:"rsm:ExchangedDocumentContext,omitempty"`
	ExchangedDocument        *CDARExchangedDocument `xml:"rsm:ExchangedDocument"`
	AcknowledgementDocuments []*CDARAcknowledgement `xml:"rsm:AcknowledgementDocument"`
}

CDAR represents the root structure for Cross Domain Acknowledgement and Response

func NewCDAR added in v0.27.0

func NewCDAR() *CDAR

NewCDAR creates a new CDAR document with the necessary namespaces

type CDARAcknowledgement added in v0.27.0

type CDARAcknowledgement struct {
	MultipleReferencesIndicator *CDARIndicator            `xml:"ram:MultipleReferencesIndicator,omitempty"`
	ID                          string                    `xml:"ram:ID,omitempty"`
	TypeCode                    string                    `xml:"ram:TypeCode,omitempty"`
	Name                        string                    `xml:"ram:Name,omitempty"`
	IssueDateTime               *CDARIssueDateTime        `xml:"ram:IssueDateTime,omitempty"`
	StatusCode                  string                    `xml:"ram:StatusCode,omitempty"`
	AcknowledgementStatusCode   string                    `xml:"ram:AcknowledgementStatusCode,omitempty"`
	ItemIdentificationID        string                    `xml:"ram:ItemIdentificationID,omitempty"`
	ReasonInformation           []string                  `xml:"ram:ReasonInformation,omitempty"`
	ChannelCode                 string                    `xml:"ram:ChannelCode,omitempty"`
	Status                      []string                  `xml:"ram:Status,omitempty"`
	ReferenceReferencedDocument []*CDARReferencedDocument `xml:"ram:ReferenceReferencedDocument"`
}

CDARAcknowledgement represents an AcknowledgementDocument in the CDAR standard

type CDARBinaryObject added in v0.27.0

type CDARBinaryObject struct {
	Value        string `xml:",chardata"`
	MimeCode     string `xml:"mimeCode,attr,omitempty"`
	Filename     string `xml:"filename,attr,omitempty"`
	CharacterSet string `xml:"characterSet,attr,omitempty"`
}

CDARBinaryObject represents a binary object attachment

type CDARDateTimeString added in v0.27.0

type CDARDateTimeString struct {
	Value  string `xml:",chardata"`
	Format string `xml:"format,attr,omitempty"`
}

CDARDateTimeString defines a date-time with format attribute

type CDARDocumentCharacteristic added in v0.27.0

type CDARDocumentCharacteristic struct {
	ID                    string               `xml:"ram:ID,omitempty"`
	TypeCode              string               `xml:"ram:TypeCode,omitempty"`
	ValueChangedIndicator *CDARIndicatorString `xml:"ram:ValueChangedIndicator,omitempty"`
	Name                  string               `xml:"ram:Name,omitempty"`
	Location              string               `xml:"ram:Location,omitempty"`
	ValueAmount           *CDARValueAmount     `xml:"ram:ValueAmount,omitempty"`
	ValuePercent          string               `xml:"ram:ValuePercent,omitempty"`
	ValueDateTime         *CDARIssueDateTime   `xml:"ram:ValueDateTime,omitempty"`
}

CDARDocumentCharacteristic represents a characteristic attached to a document status

type CDARDocumentContextParameter added in v0.27.0

type CDARDocumentContextParameter struct {
	ID string `xml:"ram:ID"`
}

CDARDocumentContextParameter defines the structure of DocumentContextParameter of the CDAR standard

type CDARDocumentStatus added in v0.27.0

type CDARDocumentStatus struct {
	ReferenceDateTime                *CDARIssueDateTime            `xml:"ram:ReferenceDateTime,omitempty"`
	ConditionCode                    string                        `xml:"ram:ConditionCode,omitempty"`
	ReasonCode                       string                        `xml:"ram:ReasonCode,omitempty"`
	Reason                           []string                      `xml:"ram:Reason,omitempty"`
	RequestedActionCode              string                        `xml:"ram:RequestedActionCode,omitempty"`
	RequestedAction                  string                        `xml:"ram:RequestedAction,omitempty"`
	SequenceNumeric                  string                        `xml:"ram:SequenceNumeric,omitempty"`
	IncludedNotes                    []*CDARNote                   `xml:"ram:IncludedNote,omitempty"`
	SpecifiedDocumentCharacteristics []*CDARDocumentCharacteristic `xml:"ram:SpecifiedDocumentCharacteristic,omitempty"`
}

CDARDocumentStatus represents a document status with conditions and reasons

type CDARExchangedContext added in v0.27.0

type CDARExchangedContext struct {
	BusinessProcessParameter *CDARDocumentContextParameter `xml:"ram:BusinessProcessSpecifiedDocumentContextParameter,omitempty"`
	GuidelineParameter       *CDARDocumentContextParameter `xml:"ram:GuidelineSpecifiedDocumentContextParameter"`
}

CDARExchangedContext defines the structure of the ExchangedDocumentContext of the CDAR standard

type CDARExchangedDocument added in v0.27.0

type CDARExchangedDocument struct {
	ID                     string               `xml:"ram:ID,omitempty"`
	Name                   string               `xml:"ram:Name,omitempty"`
	TypeCode               string               `xml:"ram:TypeCode,omitempty"`
	StatusCode             string               `xml:"ram:StatusCode,omitempty"`
	IssueDateTime          *CDARIssueDateTime   `xml:"ram:IssueDateTime,omitempty"`
	LanguageID             string               `xml:"ram:LanguageID,omitempty"`
	ElectronicPresentation *CDARIndicator       `xml:"ram:ElectronicPresentationIndicator,omitempty"`
	VersionID              string               `xml:"ram:VersionID,omitempty"`
	GlobalID               string               `xml:"ram:GlobalID,omitempty"`
	IncludedNotes          []*CDARNote          `xml:"ram:IncludedNote,omitempty"`
	EffectivePeriod        *CDARSpecifiedPeriod `xml:"ram:EffectiveSpecifiedPeriod,omitempty"`
	SenderTradeParty       *CDARTradeParty      `xml:"ram:SenderTradeParty,omitempty"`
	IssuerTradeParty       *CDARTradeParty      `xml:"ram:IssuerTradeParty,omitempty"`
	RecipientTradeParties  []*CDARTradeParty    `xml:"ram:RecipientTradeParty,omitempty"`
}

CDARExchangedDocument defines the structure of the ExchangedDocument of the CDAR standard

type CDARFormattedIssueDateTime added in v0.27.0

type CDARFormattedIssueDateTime struct {
	DateTimeString *CDARQDTDateTimeString `xml:"qdt:DateTimeString"`
}

CDARFormattedIssueDateTime defines formatted issue date time with qdt namespace

type CDARGlobalID added in v0.27.0

type CDARGlobalID struct {
	Value    string `xml:",chardata"`
	SchemeID string `xml:"schemeID,attr,omitempty"`
}

CDARGlobalID represents global identifier with scheme

type CDARID added in v0.27.0

type CDARID struct {
	Value    string `xml:",chardata"`
	SchemeID string `xml:"schemeID,attr,omitempty"`
}

CDARID represents an identifier

type CDARIndicator added in v0.27.0

type CDARIndicator struct {
	Value bool `xml:"udt:Indicator"`
}

CDARIndicator represents a boolean indicator

type CDARIndicatorString added in v0.27.0

type CDARIndicatorString struct {
	Value string `xml:"udt:IndicatorString"`
}

CDARIndicatorString represents a boolean indicator using udt:IndicatorString

type CDARIssueDateTime added in v0.27.0

type CDARIssueDateTime struct {
	DateTimeString *CDARDateTimeString `xml:"udt:DateTimeString"`
}

CDARIssueDateTime defines the structure of IssueDateTime of the CDAR standard

type CDARNote added in v0.27.0

type CDARNote struct {
	ContentCode string   `xml:"ram:ContentCode,omitempty"`
	Content     []string `xml:"ram:Content,omitempty"`
	SubjectCode string   `xml:"ram:SubjectCode,omitempty"`
}

CDARNote defines note in the RAM structure

type CDARQDTDateTimeString added in v0.27.0

type CDARQDTDateTimeString struct {
	Value  string `xml:",chardata"`
	Format string `xml:"format,attr,omitempty"`
}

CDARQDTDateTimeString defines a date-time in qdt namespace with format attribute

type CDARReferencedDocument added in v0.27.0

type CDARReferencedDocument struct {
	IssuerAssignedID          string                      `xml:"ram:IssuerAssignedID,omitempty"`
	StatusCode                string                      `xml:"ram:StatusCode,omitempty"`
	CopyIndicator             *CDARIndicator              `xml:"ram:CopyIndicator,omitempty"`
	LineID                    string                      `xml:"ram:LineID,omitempty"`
	TypeCode                  string                      `xml:"ram:TypeCode,omitempty"`
	GlobalID                  string                      `xml:"ram:GlobalID,omitempty"`
	RevisionID                string                      `xml:"ram:RevisionID,omitempty"`
	Name                      string                      `xml:"ram:Name,omitempty"`
	ReceiptDateTime           *CDARIssueDateTime          `xml:"ram:ReceiptDateTime,omitempty"`
	AttachmentBinaryObjects   []*CDARBinaryObject         `xml:"ram:AttachmentBinaryObject,omitempty"`
	ReferenceTypeCode         string                      `xml:"ram:ReferenceTypeCode,omitempty"`
	FormattedIssueDateTime    *CDARFormattedIssueDateTime `xml:"ram:FormattedIssueDateTime,omitempty"`
	ProcessConditionCode      string                      `xml:"ram:ProcessConditionCode,omitempty"`
	ProcessCondition          string                      `xml:"ram:ProcessCondition,omitempty"`
	IssuerTradeParty          *CDARTradeParty             `xml:"ram:IssuerTradeParty,omitempty"`
	RecipientTradeParties     []*CDARTradeParty           `xml:"ram:RecipientTradeParty,omitempty"`
	SpecifiedDocumentStatuses []*CDARDocumentStatus       `xml:"ram:SpecifiedDocumentStatus,omitempty"`
}

CDARReferencedDocument represents a referenced document in the CDAR standard

type CDARSpecifiedPeriod added in v0.27.0

type CDARSpecifiedPeriod struct {
	StartDateTime *CDARIssueDateTime `xml:"ram:StartDateTime,omitempty"`
	EndDateTime   *CDARIssueDateTime `xml:"ram:EndDateTime,omitempty"`
}

CDARSpecifiedPeriod defines a period with start and end dates

type CDARTradeAddress added in v0.27.0

type CDARTradeAddress struct {
	PostcodeCode string `xml:"ram:PostcodeCode,omitempty"`
	LineOne      string `xml:"ram:LineOne,omitempty"`
	LineTwo      string `xml:"ram:LineTwo,omitempty"`
	LineThree    string `xml:"ram:LineThree,omitempty"`
	LineFour     string `xml:"ram:LineFour,omitempty"`
	LineFive     string `xml:"ram:LineFive,omitempty"`
	StreetName   string `xml:"ram:StreetName,omitempty"`
	CityName     string `xml:"ram:CityName,omitempty"`
	CountryID    string `xml:"ram:CountryID,omitempty"`
	CountryName  string `xml:"ram:CountryName,omitempty"`
}

CDARTradeAddress represents address information

type CDARTradeContact added in v0.27.0

type CDARTradeContact struct {
	ID                              string                        `xml:"ram:ID,omitempty"`
	PersonName                      string                        `xml:"ram:PersonName,omitempty"`
	DepartmentName                  string                        `xml:"ram:DepartmentName,omitempty"`
	TypeCode                        string                        `xml:"ram:TypeCode,omitempty"`
	TelephoneUniversalCommunication []*CDARUniversalCommunication `xml:"ram:TelephoneUniversalCommunication,omitempty"`
	FaxUniversalCommunication       []*CDARUniversalCommunication `xml:"ram:FaxUniversalCommunication,omitempty"`
	EmailURIUniversalCommunication  *CDARUniversalCommunication   `xml:"ram:EmailURIUniversalCommunication,omitempty"`
}

CDARTradeContact represents contact details

type CDARTradeParty added in v0.27.0

type CDARTradeParty struct {
	IDs                       []*CDARID                   `xml:"ram:ID,omitempty"`
	GlobalIDs                 []*CDARGlobalID             `xml:"ram:GlobalID,omitempty"`
	Name                      string                      `xml:"ram:Name,omitempty"`
	RoleCode                  string                      `xml:"ram:RoleCode,omitempty"`
	DefinedTradeContacts      []*CDARTradeContact         `xml:"ram:DefinedTradeContact,omitempty"`
	PostalTradeAddress        *CDARTradeAddress           `xml:"ram:PostalTradeAddress,omitempty"`
	URIUniversalCommunication *CDARUniversalCommunication `xml:"ram:URIUniversalCommunication,omitempty"`
}

CDARTradeParty represents party information (sender, issuer, recipient)

type CDARURIID added in v0.27.0

type CDARURIID struct {
	Value    string `xml:",chardata"`
	SchemeID string `xml:"schemeID,attr,omitempty"`
}

CDARURIID represents electronic address identifier with scheme

type CDARUniversalCommunication added in v0.27.0

type CDARUniversalCommunication struct {
	URIID          *CDARURIID `xml:"ram:URIID,omitempty"`
	CompleteNumber string     `xml:"ram:CompleteNumber,omitempty"`
}

CDARUniversalCommunication represents electronic communication details

type CDARValueAmount added in v0.37.0

type CDARValueAmount struct {
	Value      string `xml:",chardata"`
	CurrencyID string `xml:"currencyID,attr,omitempty"`
}

CDARValueAmount represents a monetary value with the currencyID attribute required by the CDAR XSD for ValueAmount elements.

type Card added in v0.7.0

type Card struct {
	ID   string `xml:"ram:ID,omitempty"`
	Name string `xml:"ram:CardholderName,omitempty"`
}

Card defines the structure of ApplicableTradeSettlementFinancialCard of the CII standard

type ChainEvent added in v0.7.0

type ChainEvent struct {
	OccurrenceDate *IssueDate `xml:"ram:OccurrenceDateTime"`
}

ChainEvent defines the structure of the OccurrenceDateTime of the CII standard

type Characteristic added in v0.7.0

type Characteristic struct {
	Description  string    `xml:"ram:Description,omitempty"`
	ValueMeasure *Quantity `xml:"ram:ValueMeasure,omitempty"`
	Value        string    `xml:"ram:Value,omitempty"`
}

Characteristic defines the structure of the ApplicableProductCharacteristic of the CII standard. ValueMeasure is only ever read: documents from senders using the CII extended profile may carry one, but the EN 16931 profiles do not accept it on output.

type Classification added in v0.7.0

type Classification struct {
	Code *ListID `xml:"ram:ClassCode,omitempty"`
}

Classification defines the structure of the DesignatedProductClassification of the CII standard

type Contact added in v0.7.0

type Contact struct {
	PersonName string       `xml:"ram:PersonName,omitempty"`
	Department string       `xml:"ram:DepartmentName,omitempty"`
	Phone      *PhoneNumber `xml:"ram:TelephoneUniversalCommunication,omitempty"`
	Email      *Email       `xml:"ram:EmailURIUniversalCommunication,omitempty"`
}

Contact defines the structure of the DefinedTradeContact of the CII standard

type Creditor added in v0.7.0

type Creditor struct {
	IBAN   string `xml:"ram:IBANID,omitempty"`
	Name   string `xml:"ram:AccountName,omitempty"`
	Number string `xml:"ram:ProprietaryID,omitempty"`
}

Creditor defines the structure of PayeePartyCreditorFinancialAccount of the CII standard

type CreditorInstitution added in v0.7.0

type CreditorInstitution struct {
	BIC string `xml:"ram:BICID,omitempty"`
}

CreditorInstitution defines the structure of PayeeSpecifiedCreditorFinancialInstitution of the CII standard

type Date added in v0.7.0

type Date struct {
	Value  string `xml:",chardata"`
	Format string `xml:"format,attr,omitempty"`
}

Date defines date in the UDT structure

type DebtorAccount added in v0.7.0

type DebtorAccount struct {
	IBAN string `xml:"ram:IBANID,omitempty"`
}

DebtorAccount defines the structure of PayerPartyDebtorFinancialAccount of the CII standard

type Delivery added in v0.7.0

type Delivery struct {
	Receiver  *Party      `xml:"ram:ShipToTradeParty,omitempty"`
	Event     *ChainEvent `xml:"ram:ActualDeliverySupplyChainEvent,omitempty"`
	Despatch  *IssuerID   `xml:"ram:DespatchAdviceReferencedDocument,omitempty"`
	Receiving *IssuerID   `xml:"ram:ReceivingAdviceReferencedDocument,omitempty"`
}

Delivery defines the structure of ApplicableHeaderTradeDelivery of the CII standard

type DeliveryTerms added in v0.81.0

type DeliveryTerms struct {
	Code     string         `xml:"ram:DeliveryTypeCode,omitempty"`
	Location *TradeLocation `xml:"ram:RelevantTradeLocation,omitempty"`
}

DeliveryTerms defines the structure of the ApplicableTradeDeliveryTerms of the CII standard. EN 16931 has no business term for it, so the formats that define it, such as the French CTC Extended profile, map it themselves.

type Document added in v0.67.0

type Document interface {
	// contains filtered or unexported methods
}

Document is a UN/CEFACT document: an *Invoice (Cross Industry Invoice) or a *CDAR (Cross Domain Acknowledgement and Response).

func Decode added in v0.67.0

func Decode(data []byte) (Document, error)

Decode reads raw XML data into the Document it contains, chosen by the root element's namespace.

func Export added in v0.67.0

func Export(env *gobl.Envelope, opts ...Option) (Document, error)

Export converts the GOBL envelope containing an invoice into a CII document.

Add a WithFormat option to specify the desired CII format. If none is provided, EN 16931 will be used by default.

type Email added in v0.7.0

type Email struct {
	URIID string `xml:"ram:URIID,omitempty"`
}

Email defines the structure of the EmailURIUniversalCommunication of the CII standard

type ExchangedContext added in v0.7.0

type ExchangedContext struct {
	BusinessContext  *ExchangedContextParameter `xml:"ram:BusinessProcessSpecifiedDocumentContextParameter,omitempty"`
	GuidelineContext *ExchangedContextParameter `xml:"ram:GuidelineSpecifiedDocumentContextParameter"`
}

ExchangedContext defines the structure of the ExchangedDocumentContext of the CII standard

type ExchangedContextParameter added in v0.7.0

type ExchangedContextParameter struct {
	ID string `xml:"ram:ID"`
}

ExchangedContextParameter defines the structure of the ExchangedDocumentContextParameter of the CII standard

type ExportFunc added in v0.67.0

type ExportFunc func(f *Format, env *gobl.Envelope, doc Document) error

ExportFunc adjusts the CII document exported from the GOBL envelope for a format.

type Format added in v0.67.0

type Format struct {
	// Key identifies the format in the GOBL convert register, with one layer
	// for each specification it builds on, e.g. "cii+fr-ctc-cius-v1".
	Key cbc.Key
	// Name of the format.
	Name i18n.String
	// Countries where the format applies. Empty means no restriction.
	Countries []l10n.Code
	// Import lists the schemas of the GOBL documents the format's documents
	// are imported into. Formats without any are never detected, such as
	// those whose documents only differ from another format's by their
	// container.
	Import []schema.ID
	// Export lists the schemas of the GOBL documents the format exports.
	Export []schema.ID
	// GuidelineID identifies the specification (BT-24).
	GuidelineID string
	// BusinessID identifies the business process (BT-23).
	BusinessID string
	// OutputGuidelineID optionally specifies a different GuidelineID
	// to use in the actual generated CII XML document. If empty, GuidelineID
	// is used. This allows the format to be identified by one ID externally while
	// generating different values in the XML output.
	OutputGuidelineID string
	// Version of the CII syntax the format uses.
	Version string
	// Addons required by the format.
	Addons []cbc.Key
	// Attachments is true when the format's documents can embed files, such
	// as a PDF version of the invoice, in additional referenced documents.
	// The GOBL convert register only passes attachments to these formats.
	Attachments bool
	// VESID is the Validation Exchange Specification ID used for validation
	VESID string
	// Match optionally identifies the format's documents before the
	// GuidelineID and BusinessID are compared.
	Match func(guidelineID, businessID string) bool
	// Fallback optionally claims documents that no format matched.
	Fallback func(guidelineID, businessID string) bool
	// OnRequest formats are never detected: they import only when asked for
	// by key, as their documents can't be told from another format's by
	// their contents, only by their container.
	OnRequest bool
	// ExportFuncs adjust the CII document exported from GOBL, in order, after
	// the base export.
	ExportFuncs []ExportFunc
	// ImportFuncs adjust the GOBL envelope imported from CII, in order, after
	// the base import and before the document is calculated.
	ImportFuncs []ImportFunc
}

Format defines a CII format: the guideline and business process its documents carry, and the functions that adjust the base import and export for the specification it represents.

func FindFormat added in v0.67.0

func FindFormat(guidelineID string, businessID string) *Format

FindFormat looks up a registered format by GuidelineID and optionally BusinessID, among those with Import schemas. Returns nil if no matching format is found.

The lookup logic works as follows:

  1. Formats whose Match function claims the document
  2. Tries to match on the full GuidelineID (for external identification)
  3. If not found, tries to match on OutputGuidelineID (for parsing incoming documents)
  4. Formats whose Fallback function claims the document

func FormatFor added in v0.67.0

func FormatFor(key cbc.Key) *Format

FormatFor provides the registered format with the key, or nil.

func (*Format) Is added in v0.67.0

func (f *Format) Is(f2 Format) bool

Is checks if two formats are the same.

type FormattedIssueDate added in v0.7.0

type FormattedIssueDate struct {
	DateFormat *Date `xml:"qdt:DateTimeString"`
}

FormattedIssueDate defines the structure of the FormattedIssueDateTime of the CII standard

type GlobalID added in v0.7.0

type GlobalID struct {
	SchemeID string `xml:"schemeID,attr"`
	Value    string `xml:",chardata"`
}

GlobalID defines the structure of the GlobalID of the CII standard

type GrossPrice added in v0.68.0

type GrossPrice struct {
	Amount          string           `xml:"ram:ChargeAmount"`
	BaseQuantity    *Quantity        `xml:"ram:BasisQuantity,omitempty"`
	AllowanceCharge *AllowanceCharge `xml:"ram:AppliedTradeAllowanceCharge,omitempty"`
}

GrossPrice defines the structure of the GrossPriceProductTradePrice in the CII standard: the list price (BT-148) and the price discount (BT-147).

type Header struct {
	ID           string     `xml:"ram:ID"`
	TypeCode     string     `xml:"ram:TypeCode"`
	IssueDate    *IssueDate `xml:"ram:IssueDateTime"`
	IncludedNote []*Note    `xml:"ram:IncludedNote,omitempty"`
}

Header a collection of data for a Cross Industry Invoice Header that is exchanged between two or more parties in written, printed or electronic form.

type HeaderInfo added in v0.67.0

type HeaderInfo struct {
	// Namespace of the root element.
	Namespace string
	// GuidelineID declares the specification the document follows.
	GuidelineID string
	// BusinessID declares the business process.
	BusinessID string
	// Err is set if the identifiers could not be read.
	Err error
}

HeaderInfo holds the identifiers at the start of a CII or CDAR document that determine its format.

func ReadHeader added in v0.67.0

func ReadHeader(in *convert.Input) *HeaderInfo

ReadHeader provides the root namespace and the guideline and business process identifiers of the input, reading them only once for all the converters that ask.

type ImportFunc added in v0.67.0

type ImportFunc func(f *Format, doc Document, env *gobl.Envelope) error

ImportFunc adjusts the GOBL envelope imported from the CII document for a format, before the envelope is calculated.

type Indicator added in v0.7.0

type Indicator struct {
	Value bool `xml:"udt:Indicator"`
}

Indicator defines the structure of Indicator of the CII standard

type Invoice added in v0.7.0

type Invoice struct {
	XMLName           xml.Name          `xml:"rsm:CrossIndustryInvoice"`
	RSMNamespace      string            `xml:"xmlns:rsm,attr"`
	RAMNamespace      string            `xml:"xmlns:ram,attr"`
	QDTNamespace      string            `xml:"xmlns:qdt,attr"`
	UDTNamespace      string            `xml:"xmlns:udt,attr"`
	ExchangedContext  *ExchangedContext `xml:"rsm:ExchangedDocumentContext"`
	ExchangedDocument *Header           `xml:"rsm:ExchangedDocument"`
	Transaction       *Transaction      `xml:"rsm:SupplyChainTradeTransaction"`
}

Invoice is a pseudo-model for containing the XML document being created

func ExportInvoice added in v0.67.0

func ExportInvoice(env *gobl.Envelope, opts ...Option) (*Invoice, error)

ExportInvoice is a convenience function that exports a GOBL envelope containing an invoice into a CII Invoice.

func (*Invoice) AddBinaryAttachment added in v0.28.0

func (out *Invoice) AddBinaryAttachment(att BinaryAttachment)

AddBinaryAttachment adds an embedded binary attachment to the CII Invoice. The binary data will be automatically base64-encoded.

func (*Invoice) ExtractBinaryAttachments added in v0.28.0

func (out *Invoice) ExtractBinaryAttachments() []BinaryAttachment

ExtractBinaryAttachments extracts all binary attachments from the CII Invoice. It returns a slice of BinaryAttachment containing the ID, description, and decoded binary data.

type IssueDate added in v0.7.0

type IssueDate struct {
	DateFormat *Date `xml:"udt:DateTimeString"`
}

IssueDate defines the structure of the IssueDateTime of the CII standard

type IssuerID added in v0.7.0

type IssuerID struct {
	ID                string `xml:"ram:IssuerAssignedID,omitempty"`
	ReferenceTypeCode string `xml:"ram:ReferenceTypeCode,omitempty"`
}

IssuerID defines the structure of IssuerAssignedID of the CII standard. ReferenceTypeCode (UNCL 1153) is left for profiles that define it, such as the French contract type.

type LegalOrganization added in v0.7.0

type LegalOrganization struct {
	ID   *PartyID `xml:"ram:ID"`
	Name string   `xml:"ram:TradingBusinessName,omitempty"`
}

LegalOrganization defines the structure of the SpecifiedLegalOrganization of the CII standard

type Line added in v0.7.0

type Line struct {
	LineDoc         *LineDoc         `xml:"ram:AssociatedDocumentLineDocument"`
	Product         *Product         `xml:"ram:SpecifiedTradeProduct"`
	Agreement       *LineAgreement   `xml:"ram:SpecifiedLineTradeAgreement"`
	Quantity        *LineDelivery    `xml:"ram:SpecifiedLineTradeDelivery"`
	TradeSettlement *TradeSettlement `xml:"ram:SpecifiedLineTradeSettlement"`
}

Line defines the structure of the IncludedSupplyChainTradeLineItem in the CII standard

type LineAgreement added in v0.7.0

type LineAgreement struct {
	OrderReference      *LineOrderReference `xml:"ram:BuyerOrderReferencedDocument,omitempty"`
	AdditionalReference *LineDocReference   `xml:"ram:AdditionalReferencedDocument,omitempty"`
	GrossPrice          *GrossPrice         `xml:"ram:GrossPriceProductTradePrice,omitempty"`
	NetPrice            *NetPrice           `xml:"ram:NetPriceProductTradePrice"`
	// The XSD sequence places the item seller after the prices, before
	// ItemBuyerTradeParty.
	ItemSellerParty *Party `xml:"ram:ItemSellerTradeParty,omitempty"`
}

LineAgreement defines the structure of the SpecifiedLineTradeAgreement in the CII standard

type LineDelivery added in v0.7.0

type LineDelivery struct {
	Quantity *Quantity `xml:"ram:BilledQuantity"`
}

LineDelivery defines the structure of the SpecifiedLineTradeDelivery in the CII standard

type LineDoc added in v0.7.0

type LineDoc struct {
	ID string `xml:"ram:LineID"`
	// EXT-FR-FE-162/163. LineStatusCode is only read.
	ParentLineID         string  `xml:"ram:ParentLineID,omitempty"`
	LineStatusCode       string  `xml:"ram:LineStatusCode,omitempty"`
	LineStatusReasonCode string  `xml:"ram:LineStatusReasonCode,omitempty"`
	Note                 []*Note `xml:"ram:IncludedNote,omitempty"`
}

LineDoc defines the structure of the AssociatedDocumentLineDocument in the CII standard

type LineDocReference added in v0.28.0

type LineDocReference struct {
	ID       string  `xml:"ram:IssuerAssignedID"`
	TypeCode string  `xml:"ram:TypeCode"`
	RefCode  *string `xml:"ram:ReferenceTypeCode,omitempty"`
}

LineDocReference defines the structure of AdditionalReferencedDocument at line level

type LineOrderReference added in v0.28.0

type LineOrderReference struct {
	LineID string `xml:"ram:LineID,omitempty"`
}

LineOrderReference defines the structure of BuyerOrderReferencedDocument at line level

type ListID added in v0.7.0

type ListID struct {
	Value  string `xml:",chardata"`
	ListID string `xml:"listID,attr,omitempty"`
}

ListID defines the structure of the ListID of the CII standard

type NetPrice added in v0.7.0

type NetPrice struct {
	Amount       string    `xml:"ram:ChargeAmount"`
	BaseQuantity *Quantity `xml:"ram:BasisQuantity,omitempty"`
}

NetPrice defines the structure of the NetPriceProductTradePrice in the CII standard

type Note added in v0.7.0

type Note struct {
	Content     string `xml:"ram:Content,omitempty"`
	SubjectCode string `xml:"ram:SubjectCode,omitempty"`
}

Note defines note in the RAM structure

type Option added in v0.7.0

type Option func(*options)

Option is used to define configuration options to use during the import and export processes.

func WithAttachments added in v0.75.0

func WithAttachments(atts ...BinaryAttachment) Option

WithAttachments embeds files, such as a PDF version of the invoice, in the exported invoice.

func WithFormat added in v0.67.0

func WithFormat(f Format) Option

WithFormat sets the format to use instead of the default on export, or the one detected on import.

func WithRouting added in v0.37.0

func WithRouting(from, to cbc.URI) Option

WithRouting supplies the transport addresses a received document was routed with — the Peppol SBD From / To — as fully-qualified participant URIs (e.g. "iso6523-actorid-upis::0225:code"). They are recorded verbatim on the envelope's Head.From / Head.To to mark who sent and who received the document.

type Party added in v0.7.0

type Party struct {
	ID                        []*PartyID                  `xml:"ram:ID,omitempty"`
	GlobalID                  []*PartyID                  `xml:"ram:GlobalID,omitempty"`
	Name                      string                      `xml:"ram:Name,omitempty"`
	RoleCode                  string                      `xml:"ram:RoleCode,omitempty"`
	Description               string                      `xml:"ram:Description,omitempty"`
	LegalOrganization         *LegalOrganization          `xml:"ram:SpecifiedLegalOrganization,omitempty"`
	Contact                   *Contact                    `xml:"ram:DefinedTradeContact,omitempty"`
	PostalTradeAddress        *PostalTradeAddress         `xml:"ram:PostalTradeAddress,omitempty"`
	URIUniversalCommunication *URIUniversalCommunication  `xml:"ram:URIUniversalCommunication,omitempty"`
	SpecifiedTaxRegistration  []*SpecifiedTaxRegistration `xml:"ram:SpecifiedTaxRegistration,omitempty"`
}

Party defines the structure of the TradePartyType of the CII standard

func NewDeliveryParty added in v0.67.0

func NewDeliveryParty(party *org.Party) *Party

NewDeliveryParty creates a Party with only the BTs available for the delivery party (BT-70 name, BG-15 address).

func NewParty added in v0.67.0

func NewParty(party *org.Party) *Party

NewParty converts the GOBL party into a CII trade party, without any format specific adjustments.

type PartyID added in v0.7.0

type PartyID struct {
	SchemeID string `xml:"schemeID,attr,omitempty"`
	Value    string `xml:",chardata"`
}

PartyID defines the structure of the ID of the CII standard

type PaymentMeans added in v0.7.0

type PaymentMeans struct {
	TypeCode            string               `xml:"ram:TypeCode"`
	Information         string               `xml:"ram:Information,omitempty"`
	Card                *Card                `xml:"ram:ApplicableTradeSettlementFinancialCard,omitempty"`
	Debtor              *DebtorAccount       `xml:"ram:PayerPartyDebtorFinancialAccount,omitempty"`
	Creditor            *Creditor            `xml:"ram:PayeePartyCreditorFinancialAccount,omitempty"`
	CreditorInstitution *CreditorInstitution `xml:"ram:PayeeSpecifiedCreditorFinancialInstitution,omitempty"`
}

PaymentMeans defines the structure of SpecifiedTradeSettlementPaymentMeans of the CII standard

type Period added in v0.7.0

type Period struct {
	Description *string    `xml:"ram:Description,omitempty"`
	Start       *IssueDate `xml:"ram:StartDateTime"`
	End         *IssueDate `xml:"ram:EndDateTime"`
}

Period defines the structure of the ExpectedDeliveryPeriod of the CII standard

type PhoneNumber added in v0.7.0

type PhoneNumber struct {
	CompleteNumber string `xml:"ram:CompleteNumber,omitempty"`
}

PhoneNumber defines the structure of the TelephoneUniversalCommunication of the CII standard

type PostalTradeAddress added in v0.7.0

type PostalTradeAddress struct {
	Postcode  string `xml:"ram:PostcodeCode,omitempty"`
	LineOne   string `xml:"ram:LineOne,omitempty"`
	LineTwo   string `xml:"ram:LineTwo,omitempty"`
	City      string `xml:"ram:CityName,omitempty"`
	CountryID string `xml:"ram:CountryID"`
	Region    string `xml:"ram:CountrySubDivisionName,omitempty"`
}

PostalTradeAddress defines the structure of the PostalTradeAddress of the CII standard

type Product added in v0.7.0

type Product struct {
	GlobalID         *GlobalID         `xml:"ram:GlobalID,omitempty"`
	SellerAssignedID *string           `xml:"ram:SellerAssignedID,omitempty"`
	BuyerAssignedID  *string           `xml:"ram:BuyerAssignedID,omitempty"`
	Name             string            `xml:"ram:Name"`
	Description      *string           `xml:"ram:Description,omitempty"`
	Characteristics  []*Characteristic `xml:"ram:ApplicableProductCharacteristic,omitempty"`
	Classification   *Classification   `xml:"ram:DesignatedProductClassification,omitempty"`
	Origin           *string           `xml:"ram:OriginTradeCountry>ram:ID,omitempty"`
}

Product defines the structure of the SpecifiedTradeProduct of the CII standard

type Project added in v0.7.0

type Project struct {
	ID   string `xml:"ram:ID,omitempty"`
	Name string `xml:"ram:Name,omitempty"`
}

Project defines common architecture of document reference fields in the CII standard

type Quantity added in v0.7.0

type Quantity struct {
	Amount   string `xml:",chardata"`
	UnitCode string `xml:"unitCode,attr"`
}

Quantity defines the structure of the quantity with its attributes for the CII standard

type ReferencedDocument added in v0.7.0

type ReferencedDocument struct {
	IssuerAssignedID string              `xml:"ram:IssuerAssignedID,omitempty"`
	IssueDate        *FormattedIssueDate `xml:"ram:FormattedIssueDateTime,omitempty"`
}

ReferencedDocument defines the structure of InvoiceReferencedDocument of the CII standard

type Settlement added in v0.7.0

type Settlement struct {
	CreditorRefID      string                `xml:"ram:CreditorReferenceID,omitempty"`
	PaymentReference   string                `xml:"ram:PaymentReference,omitempty"`
	Currency           string                `xml:"ram:InvoiceCurrencyCode"`
	Invoicer           *Party                `xml:"ram:InvoicerTradeParty,omitempty"`
	Invoicee           *Party                `xml:"ram:InvoiceeTradeParty,omitempty"`
	Payee              *Party                `xml:"ram:PayeeTradeParty,omitempty"`
	Payer              *Party                `xml:"ram:PayerTradeParty,omitempty"`
	PaymentMeans       []*PaymentMeans       `xml:"ram:SpecifiedTradeSettlementPaymentMeans"`
	Tax                []*Tax                `xml:"ram:ApplicableTradeTax"`
	Period             *Period               `xml:"ram:BillingSpecifiedPeriod,omitempty"`
	AllowanceCharges   []*AllowanceCharge    `xml:"ram:SpecifiedTradeAllowanceCharge,omitempty"`
	PaymentTerms       []*Terms              `xml:"ram:SpecifiedTradePaymentTerms,omitempty"`
	Summary            *Summary              `xml:"ram:SpecifiedTradeSettlementHeaderMonetarySummation"`
	ReferencedDocument []*ReferencedDocument `xml:"ram:InvoiceReferencedDocument,omitempty"`
	AccountingAccount  *AccountingAccount    `xml:"ram:ReceivableSpecifiedTradeAccountingAccount,omitempty"`
	Advance            []*Advance            `xml:"ram:SpecifiedAdvancePayment,omitempty"`
}

Settlement defines the structure of ApplicableHeaderTradeSettlement of the CII standard

type SpecifiedTaxRegistration added in v0.7.0

type SpecifiedTaxRegistration struct {
	ID *PartyID `xml:"ram:ID"`
}

SpecifiedTaxRegistration defines the structure of the SpecifiedTaxRegistration of the CII standard

type Summary added in v0.7.0

type Summary struct {
	LineTotalAmount     string            `xml:"ram:LineTotalAmount"`
	Charges             string            `xml:"ram:ChargeTotalAmount,omitempty"`
	Discounts           string            `xml:"ram:AllowanceTotalAmount,omitempty"`
	TaxBasisTotalAmount string            `xml:"ram:TaxBasisTotalAmount"`
	TaxTotalAmount      []*TaxTotalAmount `xml:"ram:TaxTotalAmount"`
	RoundingAmount      string            `xml:"ram:RoundingAmount,omitempty"`
	GrandTotalAmount    string            `xml:"ram:GrandTotalAmount"`
	TotalPrepaidAmount  string            `xml:"ram:TotalPrepaidAmount,omitempty"`
	DuePayableAmount    string            `xml:"ram:DuePayableAmount"`
}

Summary defines the structure of SpecifiedTradeSettlementHeaderMonetarySummation of the CII standard

type Summation added in v0.7.0

type Summation struct {
	Amount string `xml:"ram:LineTotalAmount"`
}

Summation defines the structure of the SpecifiedTradeSettlementLineMonetarySummation of the CII standard

type Tax added in v0.7.0

type Tax struct {
	CalculatedAmount      string     `xml:"ram:CalculatedAmount,omitempty"`
	TypeCode              string     `xml:"ram:TypeCode,omitempty"`
	ExemptionReason       string     `xml:"ram:ExemptionReason,omitempty"`
	BasisAmount           string     `xml:"ram:BasisAmount,omitempty"`
	CategoryCode          string     `xml:"ram:CategoryCode,omitempty"`
	ExemptionReasonCode   string     `xml:"ram:ExemptionReasonCode,omitempty"`
	DueDateTypeCode       string     `xml:"ram:DueDateTypeCode,omitempty"`
	TaxPointDate          *IssueDate `xml:"ram:TaxPointDate,omitempty"`
	RateApplicablePercent string     `xml:"ram:RateApplicablePercent,omitempty"`
}

Tax defines the structure of ApplicableTradeTax of the CII standard

type TaxTotalAmount added in v0.7.0

type TaxTotalAmount struct {
	Amount   string `xml:",chardata"`
	Currency string `xml:"currencyID,attr"`
}

TaxTotalAmount defines the structure of the TaxTotalAmount of the CII standard

type Terms added in v0.7.0

type Terms struct {
	Description string     `xml:"ram:Description,omitempty"`
	DueDate     *IssueDate `xml:"ram:DueDateDateTime,omitempty"`
	Mandate     string     `xml:"ram:DirectDebitMandateID,omitempty"`
	// Amount and Percent are parse-only: present in some CII documents but not emitted
	// as PartialPaymentAmount is not in the EN16931/Factur-X/ZUGFeRD schema.
	Amount  string `xml:"ram:PartialPaymentAmount,omitempty"`
	Percent string `xml:"ram:PartialPaymentPercent,omitempty"`
}

Terms defines the structure of SpecifiedTradePaymentTerms of the CII standard

type TradeLocation added in v0.81.0

type TradeLocation struct {
	Name string `xml:"ram:Name,omitempty"`
}

TradeLocation defines the structure of a RelevantTradeLocation of the CII standard.

type TradeSettlement added in v0.7.0

type TradeSettlement struct {
	ApplicableTradeTax []*Tax             `xml:"ram:ApplicableTradeTax"`
	Period             *Period            `xml:"ram:BillingSpecifiedPeriod,omitempty"`
	AllowanceCharge    []*AllowanceCharge `xml:"ram:SpecifiedTradeAllowanceCharge,omitempty"`
	Sum                *Summation         `xml:"ram:SpecifiedTradeSettlementLineMonetarySummation"`
	AccountingAccount  *AccountingAccount `xml:"ram:ReceivableSpecifiedTradeAccountingAccount,omitempty"`
}

TradeSettlement defines the structure of the SpecifiedLineTradeSettlement of the CII standard

type Transaction added in v0.7.0

type Transaction struct {
	Lines      []*Line     `xml:"ram:IncludedSupplyChainTradeLineItem"`
	Agreement  *Agreement  `xml:"ram:ApplicableHeaderTradeAgreement"`
	Delivery   *Delivery   `xml:"ram:ApplicableHeaderTradeDelivery"`
	Settlement *Settlement `xml:"ram:ApplicableHeaderTradeSettlement"`
}

Transaction defines the structure of the transaction in the CII standard

type URIUniversalCommunication added in v0.7.0

type URIUniversalCommunication struct {
	ID *PartyID `xml:"ram:URIID"`
}

URIUniversalCommunication defines the structure of URIUniversalCommunication of the CII standard

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址