cii

package module
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: Apache-2.0 Imports: 36 Imported by: 3

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 two key actions

  1. Conversion of 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. Parsing of CII XML to GOBL: You need to have a valid CII XML document that you want to convert to GOBL format.

Both conversion directions are supported, allowing you to seamlessly transform between GOBL and CII XML formats as needed.

Converting GOBL to CII Invoice
package main

import (
    "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)
    }

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

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

}

Contexts are supported to include specific Guideline and Business rules. Available contexts include:

  • ContextEN16931V2017 (default)
  • ContextPeppolV3
  • ContextFacturXV1
  • ContextXRechnungV3
  • ContextZUGFeRDV2
  • ContextChorusProV1
  • ContextPeppolFranceFacturXV1
  • ContextPeppolFranceCIUSV1
  • ContextPeppolFranceExtendedV1

Example:

doc, err := cii.ConvertInvoice(env, cii.WithContext(cii.ContextXRechnungV3))
Parsing CII Invoice into GOBL
package main

import (
    "io"

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

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

    env, err := cii.Parse(data)
    if err != nil {
        panic(err)
    }

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

Command Line

The GOBL to CII tool includes a command-line helper. You can install it manually in your Go environment with:

go install ./cmd/gobl.cii

Usage:

gobl.cii convert <input> <output> [--context <format>]

The tool automatically detects the input file type (JSON/XML) and performs the appropriate conversion. Optionally specify a context format:

gobl.cii convert invoice.json invoice.xml --context xrechnung

Testing

Run tests with:

go test ./...

To update test fixtures:

go test ./... -update

To validate XML output using Phive:

go test ./... -validate

Validation requires a running Phive service on 127.0.0.1:9091

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 (
	// CDARGuidelineInvoice is the GuidelineID for end-party CDARs
	// (treatment phase). Pairs with ack TypeCode 23.
	CDARGuidelineInvoice = "urn.cpro.gouv.fr:1p0:CDV:invoice"
	// CDARGuidelinePPF is the GuidelineID for CDARs transmitted to the
	// PPF (transmission phase). Pairs with ack TypeCode 305.
	CDARGuidelinePPF = "urn.cpro.gouv.fr:1p0:CDV:einvoicingF2"
)

CDAR GuidelineID URNs per BR-FR-CDV-02 (MDT-3). Used as the stable identifier that distinguishes one CDAR Context from another — the rest of the converter looks up the ack TypeCode from this URN.

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 (
	ProfileIDPeppolBilling       = "urn:fdc:peppol.eu:2017:poacc:billing:01:1.0"
	ProfileIDPeppolFranceBilling = "urn:peppol:france:billing:regulated"
)

Profile ID codes

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 AdditionalDocumentTypeAttachment = "916"

AdditionalDocumentTypeAttachment is the TypeCode for additional supporting documents

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

CDAR namespaces

View Source
const SchemeIDEmail = "EM"

SchemeIDEmail represents the Scheme ID for email addresses

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 ContextCDARFlow6 = Context{

	GuidelineID:       "urn:peppol:france:billing:cdv:1.0",
	OutputGuidelineID: CDARGuidelineInvoice,

	BusinessID:       ProfileIDPeppolFranceBilling,
	OutputBusinessID: "REGULATED",
	Version:          VersionD22B,
	Addons:           []cbc.Key{flow6.V1},
	VESID:            "fr.ctc:cdar:1.3.1",
}

ContextCDARFlow6 is used for French CTC Flow 6 CDARs addressed to an end-party: the GuidelineID is the "invoice" URN (BR-FR-CDV-02) with the REGULATED BusinessProcessParameter. The ack TypeCode (23 vs 305) is independent of the context — it follows the ProcessConditionCode's phase (see cdarAckTypeForCode).

View Source
var ContextCDARFlow6PPF = Context{
	GuidelineID: CDARGuidelinePPF,
	Addons:      []cbc.Key{flow6.V1},
	VESID:       "fr.ctc:cdar:1.3.1",
}

ContextCDARFlow6PPF is used for French CTC Flow 6 CDAR copies sent to the PPF: the GuidelineID is the einvoicingF2 URN per BR-FR-CDV-02, no BusinessProcessParameter is emitted, and the single recipient is the PPF party (9998 / 0238 / DFH).

View Source
var ContextChorusProV1 = Context{
	GuidelineID: "A1",
	Version:     VersionD16B,
	Addons:      []cbc.Key{choruspro.V1},
	VESID:       "",
}

ContextChorusProV1 is used for Chorus Pro V1 documents.

View Source
var ContextEN16931V2017 = Context{
	GuidelineID: guidelineIDEN16931V2017,
	Version:     VersionD16B,
	Addons:      []cbc.Key{en16931.V2017},
	VESID:       vesIDEN16931CII,
}

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

View Source
var ContextFacturXV1 = Context{
	GuidelineID: guidelineIDEN16931V2017,
	Version:     VersionD22B,
	Addons:      []cbc.Key{facturx.V1},
	VESID:       "fr.factur-x:en16931:1.0.8",
}

ContextFacturXV1 is used for Factur-X V1 documents.

View Source
var ContextPeppolFranceCIUSV1 = Context{
	GuidelineID:       guidelineIDEN16931V2017 + "#compliant#urn:peppol:france:billing:cius:1.0",
	BusinessID:        ProfileIDPeppolFranceBilling,
	OutputGuidelineID: guidelineIDEN16931V2017,
	Version:           VersionD22B,
	Addons:            []cbc.Key{flow2.V1},
	VESID:             "fr.ctc:cii:1.3.1",
}

ContextPeppolFranceCIUSV1 is used for Peppol France CIUS documents.

View Source
var ContextPeppolFranceFacturXV1 = Context{
	GuidelineID:       guidelineIDEN16931V2017 + "#conformant#urn:peppol:france:billing:Factur-X:1.0",
	BusinessID:        ProfileIDPeppolFranceBilling,
	OutputGuidelineID: guidelineIDEN16931V2017 + "#conformant#urn.cpro.gouv.fr:1p0:extended-ctc-fr",
	Version:           VersionD16B,
	Addons:            []cbc.Key{flow2.V1},
	VESID:             "fr.ctc:extended-cii:1.3.1",
}

ContextPeppolFranceFacturXV1 is used for Peppol France Factur-X documents.

View Source
var ContextPeppolV3 = Context{
	GuidelineID: guidelineIDEN16931V2017 + "#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0",
	BusinessID:  ProfileIDPeppolBilling,
	Version:     VersionD16B,
	Addons:      []cbc.Key{en16931.V2017},
	VESID:       vesIDEN16931CII,
}

ContextPeppolV3 for Peppol Billing V3.0 context.

View Source
var ContextXRechnungV3 = Context{
	GuidelineID: guidelineIDEN16931V2017 + "#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0",
	BusinessID:  ProfileIDPeppolBilling,
	Version:     VersionD16B,
	Addons:      []cbc.Key{xrechnung.V3},
	VESID:       "de.xrechnung:cii:3.0.2",
}

ContextXRechnungV3 is used for XRechnung documents

View Source
var ContextZUGFeRDV2 = Context{
	GuidelineID: guidelineIDEN16931V2017,
	Version:     VersionD16B,
	Addons:      []cbc.Key{zugferd.V2},
	VESID:       "de.zugferd:en16931:2.4",
}

ContextZUGFeRDV2 is the context used for ZUGFeRD documents.

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

Functions

func Convert added in v0.14.0

func Convert(env *gobl.Envelope, opts ...Option) (any, error)

Convert takes a gobl envelope and converts it into a CII document ready to be serialized into an XML data object.

func PPFPlatformParty added in v0.37.0

func PPFPlatformParty(matricule string) *org.Party

PPFPlatformParty builds the dematerialisation platform's (PDP) sender party for a CDV transmitted to the PPF: role WK with the platform's PA matricule as a GlobalID under the 0238 scheme. PPF rejects a CDV whose SenderTradeParty has no GlobalID (MDT-19). Pass it via WithSenderTradeParty; an empty matricule returns the bare WK party.

func Parse added in v0.14.0

func Parse(data []byte, opts ...ParseOption) (*gobl.Envelope, error)

Parse parses a raw XML CII invoice document and converts it into a GOBL envelope. If the type is unsupported, an ErrUnknownDocumentType is provided. CDAR and other non-invoice CII documents are not supported by Parse and should be handled using Unmarshal.

func ParseCDARPayment added in v0.37.0

func ParseCDARPayment(data []byte) (*bill.Payment, error)

ParseCDARPayment parses a raw CDAR XML byte slice carrying a payment lifecycle code (211 / 212) into a *bill.Payment without going through an envelope. Like ParseCDARStatus, the returned document carries the CDAR codes on the flow6 extensions; wrap it in an envelope or run Calculate to complete the derived fields.

func ParseCDARStatus added in v0.37.0

func ParseCDARStatus(data []byte) (*bill.Status, error)

ParseCDARStatus parses a raw CDAR XML byte slice into a *bill.Status without going through an envelope.

The returned status carries the CDAR codes on the flow6 extensions (fr-ctc-flow6-status / -reason / -action) with the addon declared; the GOBL-level fields they derive (Status.Type, line and reason keys) are filled by the flow6 normalizer when the document is calculated — wrap it in an envelope (gobl.Envelop / Envelope.Insert) or run Calculate to complete it.

func Unmarshal added in v0.27.0

func Unmarshal(data []byte) (any, error)

Unmarshal detects the document type and unmarshals XML into the appropriate Go struct. Returns either *Invoice (for CII) or *CDAR (for acknowledgements). This is pure unmarshaling without GOBL conversion.

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"`
	TaxRepresentative  *Party                `xml:"ram:SellerTaxRepresentativeTradeParty,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"`
	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

func NewCDARFromPayment added in v0.37.0

func NewCDARFromPayment(pmt *bill.Payment, ctx Context) (*CDAR, error)

NewCDARFromPayment converts a *bill.Payment into a CDAR XML document using the provided context. Flow 6 payment lifecycle messages map a payment advice to ProcessConditionCode 211 (Paiement transmis) and a payment receipt to 212 (Encaissée); the code is read from the fr-ctc-flow6-status extension that the flow6 normalizer derives from Payment.Type — run Calculate on the enclosing envelope first.

Amounts are carried as SpecifiedDocumentCharacteristics: the payment's fr-ctc-flow6-condition extension (MEN / MPA / RAP) types the main amount characteristic for each line, and a line with a Due remainder also emits a RAP (reste à payer) characteristic — one 212 per partial cash-in event.

func NewCDARFromPaymentWithSender added in v0.37.0

func NewCDARFromPaymentWithSender(pmt *bill.Payment, ctx Context, sender *org.Party) (*CDAR, error)

NewCDARFromPaymentWithSender is the same as NewCDARFromPayment but carries the supplied *org.Party as the CDAR ExchangedDocument/SenderTradeParty (MDT-21) — typically the dematerialisation platform's identity.

func NewCDARFromStatus added in v0.37.0

func NewCDARFromStatus(st *bill.Status, ctx Context) (*CDAR, error)

NewCDARFromStatus is the exported entry point for converting a *bill.Status into a CDAR XML document using the provided context. Most callers should use Convert with a *gobl.Envelope wrapping the status; this helper is useful when the caller wants to bypass envelope-level validation (for example, in tests).

The status must carry the flow6 extensions (fr-ctc-flow6-status on each line, fr-ctc-flow6-role on the parties) — run Calculate on the enclosing envelope with the fr-ctc-flow6-v1 addon declared so the normalizer derives them.

SenderTradeParty is emitted as a bare <ram:RoleCode>WK</ram:RoleCode>. To carry an identified platform party in that slot, use NewCDARFromStatusWithSender or pass WithSenderTradeParty to Convert.

func NewCDARFromStatusWithSender added in v0.37.0

func NewCDARFromStatusWithSender(st *bill.Status, ctx Context, sender *org.Party) (*CDAR, error)

NewCDARFromStatusWithSender is the same as NewCDARFromStatus but carries the supplied *org.Party as the CDAR ExchangedDocument/SenderTradeParty (MDT-21) — typically the dematerialisation platform's identity (Name + GlobalID + Inbox).

func UnmarshalCDAR added in v0.27.0

func UnmarshalCDAR(data []byte) (*CDAR, error)

UnmarshalCDAR unmarshals a raw XML CDAR document into a CDAR struct

func (*CDAR) Bytes added in v0.27.0

func (c *CDAR) Bytes() ([]byte, error)

Bytes converts the CDAR document to XML bytes

func (*CDAR) String added in v0.27.0

func (c *CDAR) String() (string, error)

String converts the CDAR document to an XML string

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                  int                           `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"`
	Value       string `xml:"ram:Value,omitempty"`
}

Characteristic defines the structure of the ApplicableProductCharacteristic of the CII standard

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 Context added in v0.7.0

type Context struct {
	GuidelineID string
	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 context to be identified by one ID externally while
	// generating different values in the XML output.
	OutputGuidelineID string
	// OutputBusinessID optionally specifies a different BusinessID to write
	// into the generated CII/CDAR XML's BusinessProcessParameter. If empty,
	// BusinessID is used. This lets BusinessID carry the external busdox
	// process id (SMP/SBD routing) while the XML keeps a distinct value
	// (e.g. CDAR MDT-2 "REGULATED" vs busdox process
	// urn:peppol:france:billing:regulated).
	OutputBusinessID string
	Version          string
	Addons           []cbc.Key
	// VESID is the Validation Exchange Specification ID used for validation
	VESID string
}

Context is used to ensure that the generated CII document uses a specific set of Guidline and Business rules when generating the output.

func FindContext added in v0.28.0

func FindContext(guidelineID string, businessID string) *Context

FindContext looks up a context by GuidelineID and optionally BusinessID. Returns nil if no matching context is found.

The lookup logic works as follows:

  1. If the BusinessID is a French billing mode code, checks for a context whose OutputGuidelineID matches (France CIUS documents use EN16931's GuidelineID in the XML but can be identified by their billing mode BusinessID)
  2. Tries to match on the full GuidelineID (for external identification)
  3. If not found, tries to match on OutputGuidelineID (for parsing incoming documents)

func (*Context) Is added in v0.33.0

func (c *Context) Is(c2 Context) bool

Is checks if two contexts are the same.

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 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 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 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 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 ConvertInvoice added in v0.7.0

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

ConvertInvoice is a convenience function that converts a GOBL envelope containing an invoice into a CII Invoice.

func UnmarshalInvoice added in v0.27.0

func UnmarshalInvoice(data []byte) (*Invoice, error)

UnmarshalInvoice unmarshals CII invoice XML into an Invoice struct without converting to GOBL.

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) Bytes added in v0.7.0

func (out *Invoice) Bytes() ([]byte, error)

Bytes returns the XML representation of the document in bytes

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"`
}

IssuerID defines the structure of IssuerAssignedID of the CII standard

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"`
	NetPrice            *NetPrice           `xml:"ram:NetPriceProductTradePrice"`
}

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"`
	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 conversion processes.

func WithContext added in v0.7.0

func WithContext(context Context) Option

WithContext sets the context for the output CII document if not using the default.

func WithSenderTradeParty added in v0.37.0

func WithSenderTradeParty(p *org.Party) Option

WithSenderTradeParty pins the *org.Party emitted as the CDAR ExchangedDocument/SenderTradeParty (MDT-21). Use this to carry the dematerialisation platform's identity (Name + GlobalID + Inbox + RoleCode) on the wire when it isn't anonymous. When unset, the writer emits a bare <ram:RoleCode>WK</ram:RoleCode> — matching the anonymous- platform pattern used throughout the official UC1 corpus.

The option is a no-op for non-CDAR conversions.

type ParseOption added in v0.37.0

type ParseOption func(*routing)

ParseOption configures Parse.

func WithRouting added in v0.37.0

func WithRouting(from, to cbc.URI) ParseOption

WithRouting supplies the envelope's From / To transport addresses to Parse. On a received CDAR the issuer party's electronic address may be absent from the document body (carried instead at the SBD/transport layer); these let the parser populate the missing party inbox so the result satisfies BR-FR-CDV-08.

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"`
	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

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"`
	Payee              *Party                `xml:"ram:PayeeTradeParty,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"`
	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 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

Directories

Path Synopsis
cmd
gobl.cii command
Package main provides a CLI interface for the library
Package main provides a CLI interface for the library

Jump to

Keyboard shortcuts

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