This page documents the key data structures (Go structs) used in the gobl.cii conversion system. These structs represent the CII (Cross Industry Invoice) XML document structure and are used both for generating CII XML from GOBL invoices and parsing CII XML back to GOBL format.
For information about the conversion process and functions that use these models, see Core Conversion API. For details on specific field transformations and mappings, see Extension Keys and Code Mappings.
The CII document structure is organized hierarchically, with the Invoice struct as the root containing the Transaction struct, which in turn contains component structs for different aspects of the invoice.
Sources: invoice.go15-24 invoice.go26-32
The Invoice struct is the root document structure containing XML namespace declarations and the three main document sections.
| Field | Type | XML Tag | Description |
|---|---|---|---|
XMLName | xml.Name | rsm:CrossIndustryInvoice | Root element name |
RSMNamespace | string | xmlns:rsm,attr | Cross Industry Invoice namespace |
RAMNamespace | string | xmlns:ram,attr | Reusable Aggregate Business Information Entity namespace |
QDTNamespace | string | xmlns:qdt,attr | Qualified Data Type namespace |
UDTNamespace | string | xmlns:udt,attr | Unqualified Data Type namespace |
ExchangedContext | *ExchangedContext | rsm:ExchangedDocumentContext | Document context with guideline and business process IDs |
ExchangedDocument | *Header | rsm:ExchangedDocument | Document header with ID, type code, and issue date |
Transaction | *Transaction | rsm:SupplyChainTradeTransaction | Main transaction data |
Sources: invoice.go12-21
The Transaction struct contains the four main components of an invoice transaction: line items, agreement details, delivery information, and settlement terms.
| Field | Type | XML Tag | Description |
|---|---|---|---|
Lines | []*Line | ram:IncludedSupplyChainTradeLineItem | Array of line items |
Agreement | *Agreement | ram:ApplicableHeaderTradeAgreement | Buyer/seller agreement details |
Delivery | *Delivery | ram:ApplicableHeaderTradeDelivery | Delivery information |
Settlement | *Settlement | ram:ApplicableHeaderTradeSettlement | Payment and tax settlement details |
Sources: invoice.go24-29
| Struct | Purpose | Location |
|---|---|---|
Tax | Tax calculation details with type code, category, rate, and amounts | invoice.go32-39 |
Date | Date representation with value and format code (102 for YYYYMMDD) | invoice.go42-45 |
Note | Document or line notes with content and optional subject code | invoice.go48-51 |
Party structures represent the organizations and individuals involved in the invoice: supplier, customer, tax representative, and payee.
Sources: party.go14-24
The Party struct represents a business entity (supplier, customer, tax representative, or payee) with complete identification and contact information.
| Field | Type | XML Tag | Description |
|---|---|---|---|
ID | *PartyID | ram:ID | Internal party identifier |
GlobalID | *PartyID | ram:GlobalID | Global identifier (e.g., Peppol participant ID) |
Name | string | ram:Name | Party legal name |
Description | string | ram:Description | Additional description |
LegalOrganization | *LegalOrganization | ram:SpecifiedLegalOrganization | Legal organization details (used for Chorus Pro) |
Contact | *Contact | ram:DefinedTradeContact | Contact person information |
PostalTradeAddress | *PostalTradeAddress | ram:PostalTradeAddress | Physical address |
URIUniversalCommunication | *URIUniversalCommunication | ram:URIUniversalCommunication | Electronic address (email or Peppol inbox) |
SpecifiedTaxRegistration | []*SpecifiedTaxRegistration | ram:SpecifiedTaxRegistration | Tax registration numbers |
Sources: party.go14-24
The PartyID struct represents an identifier with an optional scheme qualifier.
| Field | Type | XML Attribute/Tag | Description |
|---|---|---|---|
SchemeID | string | schemeID,attr | Identifier scheme (e.g., "0088" for GLN, "9920" for EORI, "VA" for VAT) |
Value | string | ,chardata | The actual identifier value |
Sources: party.go27-30
Represents a physical address with structured fields.
| Field | Type | XML Tag | Description |
|---|---|---|---|
Postcode | string | ram:PostcodeCode | Postal/ZIP code |
LineOne | string | ram:LineOne | First address line (typically street and number) |
LineTwo | string | ram:LineTwo | Second address line (optional additional info) |
City | string | ram:CityName | City name |
CountryID | string | ram:CountryID | ISO 3166-1 alpha-2 country code |
Region | string | ram:CountrySubDivisionName | State/province/region name |
Sources: party.go33-40
Contains contact person information including name, department, and communication details.
| Field | Type | XML Tag | Description |
|---|---|---|---|
PersonName | string | ram:PersonName | Full contact person name |
Department | string | ram:DepartmentName | Department or role |
Phone | *PhoneNumber | ram:TelephoneUniversalCommunication | Phone number |
Email | *Email | ram:EmailURIUniversalCommunication | Email address |
Sources: party.go59-64
Used primarily for French Chorus Pro invoices to specify organizational identifiers.
| Field | Type | XML Tag | Description |
|---|---|---|---|
ID | *PartyID | ram:ID | Organization identifier (SIRET for France) |
Name | string | ram:TradingBusinessName | Trading business name |
Sources: party.go53-56
The Agreement section contains information about the parties' agreement, including buyer/seller identities, ordering references, and contract details.
Sources: agreement.go9-19
The Agreement struct represents the ApplicableHeaderTradeAgreement section of the CII standard.
| Field | Type | XML Tag | Description |
|---|---|---|---|
BuyerReference | string | ram:BuyerReference | Buyer's internal reference (required for Peppol/XRechnung) |
Seller | *Party | ram:SellerTradeParty | Supplier party details |
Buyer | *Party | ram:BuyerTradeParty | Customer party details |
TaxRepresentative | *Party | ram:SellerTaxRepresentativeTradeParty | Tax representative when seller uses fiscal representative |
Sales | *IssuerID | ram:SellerOrderReferencedDocument | Seller's order reference |
Purchase | *IssuerID | ram:BuyerOrderReferencedDocument | Buyer's purchase order reference |
Contract | *IssuerID | ram:ContractReferencedDocument | Contract reference |
AdditionalDocument | []*AdditionalDocument | ram:AdditionalReferencedDocument | Additional referenced documents |
Project | *Project | ram:SpecifiedProcurringProject | Project reference |
Sources: agreement.go9-19
Simple wrapper for document reference identifiers.
| Field | Type | XML Tag | Description |
|---|---|---|---|
ID | string | ram:IssuerAssignedID | Document reference identifier |
Sources: agreement.go36-38
Represents project information for project-based invoicing.
| Field | Type | XML Tag | Description |
|---|---|---|---|
ID | string | ram:ID | Project identifier code |
Name | string | ram:Name | Project name or description |
Sources: agreement.go22-25
Represents additional referenced documents such as shipping documents, purchase orders, or supporting files. Also used for attachments with the TypeCode "916".
| Field | Type | XML Tag | Description |
|---|---|---|---|
ID | string | ram:IssuerAssignedID | Document identifier |
TypeCode | string | ram:TypeCode | Document type code (UNTDID 1001, "916" for attachments) |
Name | string | ram:Name | Document name or description |
IssueDate | *FormattedIssueDate | ram:FormattedIssueDateTime | Document issue date |
URIID | string | ram:URIID | URI reference for external documents |
AttachmentBinaryObject | *BinaryObject | ram:AttachedSpecifiedBinaryObject | Embedded binary data (for attachments) |
Sources: agreement.go28-33 attachments.go14-30
Line items represent individual products or services in the invoice. Each line contains product details, pricing, quantities, and line-level settlement information.
Sources: lines.go12-18 lines.go26-31 lines.go51-54 lines.go97-104
The Line struct represents an individual line item in the invoice (IncludedSupplyChainTradeLineItem).
| Field | Type | XML Tag | Description |
|---|---|---|---|
LineDoc | *LineDoc | ram:AssociatedDocumentLineDocument | Line document with ID and notes |
Product | *Product | ram:SpecifiedTradeProduct | Product/service details |
Agreement | *LineAgreement | ram:SpecifiedLineTradeAgreement | Pricing agreement details |
Quantity | *LineDelivery | ram:SpecifiedLineTradeDelivery | Quantity information |
TradeSettlement | *TradeSettlement | ram:SpecifiedLineTradeSettlement | Line-level settlement with tax and total |
Sources: lines.go12-18
Represents the product or service being invoiced.
| Field | Type | XML Tag | Description |
|---|---|---|---|
GlobalID | *GlobalID | ram:GlobalID | Global product identifier (GTIN, EAN, etc.) with scheme |
SellerAssignedID | *string | ram:SellerAssignedID | Seller's product code |
BuyerAssignedID | *string | ram:BuyerAssignedID | Buyer's product code |
Name | string | ram:Name | Product name (required) |
Description | *string | ram:Description | Detailed product description |
Characteristics | []*Characteristic | ram:ApplicableProductCharacteristic | Product attributes (stored in GOBL as Item.Meta) |
Classification | *Classification | ram:DesignatedProductClassification | Product classification code |
Origin | *string | ram:OriginTradeCountry>ram:ID | Country of origin (ISO 3166-1 alpha-2) |
Sources: lines.go56-66
Contains pricing and reference information for the line.
| Field | Type | XML Tag | Description |
|---|---|---|---|
OrderReference | *LineOrderReference | ram:BuyerOrderReferencedDocument | Purchase order line reference |
AdditionalReference | *LineDocReference | ram:AdditionalReferencedDocument | Object identifier reference |
NetPrice | *NetPrice | ram:NetPriceProductTradePrice | Net unit price |
Sources: lines.go26-31
Represents the unit price with optional base quantity for normalization.
| Field | Type | XML Tag | Description |
|---|---|---|---|
Amount | string | ram:ChargeAmount | Unit price amount |
BaseQuantity | *Quantity | ram:BasisQuantity | Base quantity for price (e.g., "100" for price per 100 units) |
Sources: lines.go46-49
Contains line-level settlement information including taxes and totals.
| Field | Type | XML Tag | Description |
|---|---|---|---|
ApplicableTradeTax | []*Tax | ram:ApplicableTradeTax | Tax information for this line |
Period | *Period | ram:BillingSpecifiedPeriod | Billing period for this line |
AllowanceCharge | []*AllowanceCharge | ram:SpecifiedTradeAllowanceCharge | Line-level discounts and charges |
Sum | *Summation | ram:SpecifiedTradeSettlementLineMonetarySummation | Line total amount |
AccountingAccount | *AccountingAccount | ram:ReceivableSpecifiedTradeAccountingAccount | Buyer accounting reference |
Sources: lines.go97-104
Allowances (discounts) and charges appear both at document level and line level, using the same structure.
The AllowanceCharge struct represents both discounts (allowances) and charges in CII format.
| Field | Type | XML Tag | Description |
|---|---|---|---|
ChargeIndicator | Indicator | ram:ChargeIndicator | true for charge, false for allowance (discount) |
Percent | string | ram:CalculationPercent | Percentage rate (if percentage-based) |
Base | string | ram:BasisAmount | Base amount for percentage calculation |
Amount | string | ram:ActualAmount | Actual discount/charge amount |
ReasonCode | string | ram:ReasonCode | UNTDID code for reason |
Reason | string | ram:Reason | Human-readable reason text |
Tax | *Tax | ram:CategoryTradeTax | Tax category for this allowance/charge |
Sources: allowance_charge.go11-19
Simple boolean wrapper used for charge/allowance indication.
| Field | Type | XML Tag | Description |
|---|---|---|---|
Value | bool | udt:Indicator | Boolean value |
Sources: allowance_charge.go22-24
| Function | Purpose | Location |
|---|---|---|
newAllowanceCharges() | Converts document-level GOBL charges/discounts to CII | allowance_charge.go26-38 |
newLineAllowanceCharges() | Converts line-level GOBL charges/discounts to CII | allowance_charge.go40-52 |
goblNewCharge() | Parses CII charge back to GOBL | allowance_charge_parse.go48-109 |
goblNewDiscount() | Parses CII allowance back to GOBL | allowance_charge_parse.go111-172 |
Sources: allowance_charge.go26-154 allowance_charge_parse.go48-230
Delivery information includes the ship-to party, delivery date, and location identifiers.
The Delivery struct represents the ApplicableHeaderTradeDelivery section.
| Field | Type | XML Tag | Description |
|---|---|---|---|
Receiver | *Party | ram:ShipToTradeParty | Ship-to party (only name and address) |
Event | *ChainEvent | ram:ActualDeliverySupplyChainEvent | Delivery date event |
Despatch | *IssuerID | ram:DespatchAdviceReferencedDocument | Despatch advice reference |
Receiving | *IssuerID | ram:ReceivingAdviceReferencedDocument | Receiving advice reference |
Sources: delivery.go8-14
Represents a delivery event with an occurrence date.
| Field | Type | XML Tag | Description |
|---|---|---|---|
OccurrenceDate | *IssueDate | ram:OccurrenceDateTime | Date of delivery |
Sources: delivery.go16-19
| Function | Input | Output | Purpose |
|---|---|---|---|
newDelivery() | *bill.Invoice | *Delivery | Converts GOBL delivery details to CII |
newDeliveryParty() | *org.Party | *Party | Creates limited party with only name and address |
goblNewDeliveryDetails() | *Delivery | *bill.DeliveryDetails | Parses CII delivery back to GOBL |
goblNewDeliveryParty() | *Party | *org.Party | Extracts delivery party from CII |
Sources: delivery.go22-82 delivery_parse.go9-63
Attachments can be embedded as binary data or referenced by URL.
User-facing struct for working with binary attachments.
| Field | Type | Description |
|---|---|---|
ID | string | Attachment identifier |
Description | string | Human-readable description |
Data | []byte | Raw binary data |
MimeCode | string | MIME type (e.g., "application/pdf") |
Filename | string | Original filename |
Sources: attachments.go18-30
Internal XML representation of embedded binary data.
| Field | Type | XML Tag | Description |
|---|---|---|---|
Value | string | ,chardata | Base64-encoded binary data |
MimeCode | string | mimeCode,attr | MIME type attribute |
Filename | string | filename,attr | Filename attribute |
Sources: Referenced in attachments.go89-94
| Function | Purpose | Location |
|---|---|---|
addAttachments() | Converts GOBL attachments to CII AdditionalDocument | attachments.go33-52 |
goblAttachments() | Parses CII documents back to GOBL attachments | attachments.go54-78 |
AddBinaryAttachment() | Adds embedded binary data to invoice | attachments.go82-100 |
ExtractBinaryAttachments() | Extracts all embedded binaries | attachments.go103-130 |
Sources: attachments.go33-130
The Settlement section contains payment terms, payment means, tax calculations, and monetary summaries.
Sources: settlement.go17-29
The Settlement struct represents the ApplicableHeaderTradeSettlement section containing payment and tax information.
| Field | Type | XML Tag | Description |
|---|---|---|---|
CreditorRefID | string | ram:CreditorReferenceID | Creditor reference ID for direct debit |
Currency | string | ram:InvoiceCurrencyCode | ISO 4217 currency code |
Payee | *Party | ram:PayeeTradeParty | Payee if different from supplier |
PaymentMeans | []*PaymentMeans | ram:SpecifiedTradeSettlementPaymentMeans | Payment methods (credit transfer, card, etc.) |
Tax | []*Tax | ram:ApplicableTradeTax | Tax breakdown by category and rate |
Period | *Period | ram:BillingSpecifiedPeriod | Billing period for the invoice |
AllowanceCharges | []*AllowanceCharge | ram:SpecifiedTradeAllowanceCharge | Document-level discounts and charges |
PaymentTerms | []*Terms | ram:SpecifiedTradePaymentTerms | Payment terms and due dates |
Summary | *Summary | ram:SpecifiedTradeSettlementHeaderMonetarySummation | Monetary summary with totals |
ReferencedDocument | []*ReferencedDocument | ram:InvoiceReferencedDocument | Referenced preceding invoices (for credit notes) |
Advance | []*Advance | ram:SpecifiedAdvancePayment | Advance payments already made |
Sources: settlement.go17-29
Describes the payment method and account details.
| Field | Type | XML Tag | Description |
|---|---|---|---|
TypeCode | string | ram:TypeCode | UNTDID 4461 payment means code (e.g., "30" for credit transfer, "48" for card) |
Information | string | ram:Information | Additional payment information text |
Card | *Card | ram:ApplicableTradeSettlementFinancialCard | Card payment details |
Debtor | *DebtorAccount | ram:PayerPartyDebtorFinancialAccount | Debtor account for direct debit |
Creditor | *Creditor | ram:PayeePartyCreditorFinancialAccount | Creditor account for credit transfer |
CreditorInstitution | *CreditorInstitution | ram:PayeeSpecifiedCreditorFinancialInstitution | Creditor's bank details |
Sources: settlement.go41-48
Bank account information for receiving payments.
| Field | Type | XML Tag | Description |
|---|---|---|---|
IBAN | string | ram:IBANID | IBAN account number |
Name | string | ram:AccountName | Account holder name |
Number | string | ram:ProprietaryID | Proprietary account number (non-IBAN) |
Sources: settlement.go56-60
Credit/debit card payment details.
| Field | Type | XML Tag | Description |
|---|---|---|---|
ID | string | ram:ID | Card identifier (typically last 4 digits) |
Name | string | ram:CardholderName | Cardholder name |
Sources: settlement.go68-71
Payment terms including due dates and discounts.
| Field | Type | XML Tag | Description |
|---|---|---|---|
Description | string | ram:Description | Payment terms description |
DueDate | *IssueDate | ram:DueDateDateTime | Payment due date |
Mandate | string | ram:DirectDebitMandateID | Direct debit mandate reference |
Amount | string | ram:PartialPaymentAmount | Partial payment amount |
Percent | string | ram:PartialPaymentPercent | Partial payment percentage |
Sources: settlement.go32-38
Monetary totals for the invoice, representing the SpecifiedTradeSettlementHeaderMonetarySummation.
| Field | Type | XML Tag | Description |
|---|---|---|---|
LineTotalAmount | string | ram:LineTotalAmount | Sum of line net amounts |
Charges | string | ram:ChargeTotalAmount | Total document-level charges |
Discounts | string | ram:AllowanceTotalAmount | Total document-level discounts |
TaxBasisTotalAmount | string | ram:TaxBasisTotalAmount | Tax basis (subtotal after discounts/charges) |
TaxTotalAmount | *TaxTotalAmount | ram:TaxTotalAmount | Total tax amount with currency |
RoundingAmount | string | ram:RoundingAmount | Rounding adjustment |
GrandTotalAmount | string | ram:GrandTotalAmount | Total including tax |
TotalPrepaidAmount | string | ram:TotalPrepaidAmount | Total prepaid/advance amount |
DuePayableAmount | string | ram:DuePayableAmount | Amount due for payment |
Sources: settlement.go93-103
Represents a time period with start and end dates.
| Field | Type | XML Tag | Description |
|---|---|---|---|
Description | *string | ram:Description | Period description |
Start | *IssueDate | ram:StartDateTime | Period start date |
End | *IssueDate | ram:EndDateTime | Period end date |
Sources: settlement.go86-90
References a preceding invoice (used in credit notes).
| Field | Type | XML Tag | Description |
|---|---|---|---|
IssuerAssignedID | string | ram:IssuerAssignedID | Referenced invoice number |
IssueDate | *FormattedIssueDate | ram:FormattedIssueDateTime | Referenced invoice date |
Sources: settlement.go80-83
The following diagram shows how GOBL invoice structures map to CII data models during the conversion process.
Sources: invoice.go89-112 invoice.go115-133 header.go41-69 party.go80-172 settlement.go115-174 settlement.go273-302 settlement.go304-316 lines.go116-124 lines.go127-214 delivery.go22-70 attachments.go33-52
| Function | Input | Output | Purpose | Location |
|---|---|---|---|---|
newInvoice() | *bill.Invoice, Context | *Invoice, error | Creates complete CII document structure with context | invoice.go89-112 |
addHeader() | *bill.Invoice | error | Populates ExchangedDocument header | header.go41-69 |
addTransaction() | *bill.Invoice | error | Orchestrates transaction component creation | invoice.go115-133 |
newParty() | *org.Party | *Party | Converts GOBL party to CII with identities and addresses | party.go80-172 |
newSettlement() | *bill.Invoice | *Settlement, error | Builds settlement with payment, tax, and totals | settlement.go115-174 |
newSummary() | *bill.Totals, string | *Summary | Creates monetary summary with all totals | settlement.go273-302 |
newTaxes() | *bill.Invoice, *tax.Total | []*Tax | Converts GOBL tax breakdown to CII tax entries | settlement.go304-316 |
addLines() | []*bill.Line | error | Converts all invoice lines to CII format | lines.go116-124 |
newLine() | *bill.Line | *Line | Converts single GOBL line to CII line | lines.go127-214 |
newDelivery() | *bill.Invoice | *Delivery | Creates delivery section from GOBL delivery details | delivery.go22-70 |
addAttachments() | *bill.Invoice | - | Adds attachments as AdditionalReferencedDocuments | attachments.go33-52 |
addPaymentInstructions() | *Settlement, *pay.Instructions | error | Maps payment instructions to PaymentMeans | settlement.go205-271 |
Sources: invoice.go89-133 header.go41-69 party.go80-172 settlement.go115-378 lines.go116-260 delivery.go22-82 attachments.go33-52
When parsing CII XML back to GOBL format, dedicated parsing functions extract data from CII structures.
Sources: invoice_parse.go17-203 lines_parse.go18-272 allowance_charge_parse.go14-230 delivery_parse.go9-63 attachments.go54-78
| Function | Input | Output | Purpose | Location |
|---|---|---|---|---|
parseInvoice() | []byte | *bill.Invoice, error | Entry point: unmarshals XML and converts to GOBL | invoice_parse.go17-31 |
goblInvoice() | *Invoice | *bill.Invoice, error | Orchestrates conversion from CII to GOBL invoice | invoice_parse.go33-154 |
buildTaxCategoryMap() | []*Tax | map[string]*taxCategoryInfo | Builds lookup map for tax exemption codes | invoice_parse.go163-177 |
goblNewParty() | *Party | *org.Party | Extracts party information including addresses and tax IDs | party_parse.go |
goblAddLines() | *Transaction, *bill.Invoice, taxMap | error | Parses all line items with products and taxes | lines_parse.go18-32 |
goblNewLine() | *Line, taxMap | *bill.Line, error | Converts single CII line to GOBL line | lines_parse.go34-113 |
goblLinePrice() | *NetPrice | num.Amount, error | Extracts and normalizes unit price | lines_parse.go116-133 |
goblLineProduct() | *Product, *org.Item | - | Populates item identities and metadata | lines_parse.go136-176 |
goblLineTaxes() | []*Tax, *bill.Line, taxMap | error | Maps CII taxes to GOBL with exemption codes | lines_parse.go197-230 |
goblNewPaymentDetails() | *Settlement | *pay.Instructions, error | Extracts payment means and terms | Referenced in invoice_parse.go92-94 |
goblNewDeliveryDetails() | *Delivery | *bill.DeliveryDetails, error | Parses delivery information | delivery_parse.go9-46 |
goblAttachments() | []*AdditionalDocument | []*org.Attachment | Converts CII documents to GOBL attachments | attachments.go54-78 |
goblAddChargesAndDiscounts() | *Settlement, *bill.Invoice, taxMap | error | Parses document-level allowances and charges | allowance_charge_parse.go14-46 |
Sources: invoice_parse.go17-203 lines_parse.go18-272 delivery_parse.go9-63 attachments.go54-78 allowance_charge_parse.go14-230
All monetary amounts in CII are represented as strings to preserve precision. Dates use a specific format code.
Dates in CII use the Date struct with format code "102" representing YYYYMMDD format:
| Struct | XML Tag | Format Code | Usage |
|---|---|---|---|
IssueDate | udt:DateTimeString | "102" | Document and due dates |
FormattedIssueDate | qdt:DateTimeString | "102" | Referenced document dates |
Sources: header.go30-38
The format code "102" corresponds to the YYYYMMDD format (e.g., "20240213" for February 13, 2024).
| Function | Input | Output | Purpose | Location |
|---|---|---|---|---|
formatIssueDate() | cal.Date | string | Converts GOBL date to "YYYYMMDD" string | utils.go34-40 |
parseDate() | string | cal.Date, error | Parses "YYYYMMDD" string to GOBL date | utils.go34-40 |
documentDate() | *cal.Date | *Date | Creates Date struct with format "102" | Referenced in settlement.go130 |
Sources: utils.go34-40 header.go30-38
All monetary amounts are stored as strings and use specific precision rules:
| Amount Type | Precision | Example | Notes |
|---|---|---|---|
| Line totals | 2 decimals | "1800.00" | Uses Rescale(2) |
| Tax amounts | 2 decimals | "342.00" | Uses Rescale(2) |
| Summary totals | 2 decimals | "2142.00" | Uses Rescale(2) |
| Unit prices | Variable (up to 4) | "90.00" or "90.0000" | Preserved from GOBL |
| Tax rates | No decimals | "19" | Percentage without "%" symbol |
| Base quantities | Variable | "1" or "100" | Used for price normalization |
String-to-amount conversion during parsing:
CII "1800.00" → num.AmountFromString() → GOBL num.Amount(180000, 2)
Amount-to-string conversion during generation:
GOBL num.Amount(180000, 2) → Rescale(2).String() → CII "1800.00"
Sources: settlement.go273-302 lines.go143 lines_parse.go116-133
Tax rates are stored without the "%" symbol but parsed with it added:
<ram:RateApplicablePercent>19</ram:RateApplicablePercent>"19" → "19%" → num.PercentageSources: settlement.go329-334 lines_parse.go214-227 allowance_charge.go147-152
CII structures support extensions through the Extensions field (type tax.Extensions) in GOBL structs, allowing storage of additional metadata that doesn't map to standard CII fields.
Common extension keys used:
untdid-tax-category: Maps GOBL tax categories to UNTDID 5305 codesuntdid-payment-means: Specifies payment method codes (UNTDID 4461)cef-vatex: VAT exemption reason codes (CEF-VATEX)iso-scheme-id: ISO 6523 ICD scheme identifiersfr-choruspro-scheme: French Chorus Pro scheme identifiersFor complete extension key documentation, see Extension Keys and Code Mappings.
Sources: settlement.go307-325 party.go90-97
Refresh this wiki