Documentation
¶
Overview ¶
Package fatturapa implements the conversion from GOBL to FatturaPA XML.
Index ¶
- func Parse(doc []byte) (*gobl.Envelope, error)
- type Address
- type Body
- type Contact
- type Customer
- type Despatch
- type Document
- type DocumentRef
- type FundContribution
- type GeneralData
- type GeneralDocumentData
- type GoodsServices
- type Header
- type Identity
- type LineDetail
- type Option
- type OtherData
- type PaymentData
- type PaymentDetailRow
- type PermanentEstablishment
- type PriceAdjustment
- type Profile
- type Registration
- type RetainedTax
- type StampDuty
- type Supplier
- type TaxID
- type TaxSummary
- type TransmissionData
- type Transmitter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Address ¶ added in v0.33.0
type Address struct {
Street string `xml:"Indirizzo"` // Street
Number string `xml:"NumeroCivico,omitempty"` // Number
Code string `xml:"CAP"` // Post Code
Locality string `xml:"Comune"` // Locality
Region string `xml:"Provincia,omitempty"` // Region
Country string `xml:"Nazione"` // Country Code
}
Address from IndirizzoType
type Body ¶ added in v0.47.0
type Body struct {
GeneralData *GeneralData `xml:"DatiGenerali,omitempty"`
GoodsServices *GoodsServices `xml:"DatiBeniServizi,omitempty"`
PaymentsData []*PaymentData `xml:"DatiPagamento,omitempty"`
}
Body contains all invoice data apart from the parties involved, which are contained in Header.
type Contact ¶ added in v0.33.0
type Contact struct {
Telephone string `xml:"Telefono,omitempty"`
Email string `xml:"Email,omitempty"`
}
Contact describes how the party can be contacted
type Customer ¶ added in v0.33.0
Customer contains the details about who the invoice is addressed to.
type Despatch ¶ added in v0.51.0
type Despatch struct {
Code string `xml:"NumeroDDT"` // document number
IssueDate string `xml:"DataDDT"` // document date (expressed according to the ISO
Lines []int `xml:"RiferimentoNumeroLinea,omitempty"` // detail row of the invoice referred to (if the reference is to the entire invoice, this is not filled in)
}
Despatch contains data about a Delivery Document.
type Document ¶
type Document struct {
XMLName xml.Name `xml:"p:FatturaElettronica"`
FPANamespace string `xml:"xmlns:p,attr"`
DSigNamespace string `xml:"xmlns:ds,attr"`
XSINamespace string `xml:"xmlns:xsi,attr"`
Versione string `xml:"versione,attr"`
SchemaLocation string `xml:"xsi:schemaLocation,attr"`
Header *Header `xml:"FatturaElettronicaHeader"`
Body []*Body `xml:"FatturaElettronicaBody"`
Signature *xmldsig.Signature `xml:"ds:Signature,omitempty"`
// contains filtered or unexported fields
}
Document is a pseudo-model for containing the XML document being created.
func Convert ¶ added in v0.47.0
Convert expects the base envelope and provides a new Document containing the XML version.
type DocumentRef ¶ added in v0.39.0
type DocumentRef struct {
Lines []int `xml:"RiferimentoNumeroLinea"` // detail row of the invoice referred to (if the reference is to the entire invoice, this is not filled in)
Code string `xml:"IdDocumento"` // document number
IssueDate string `xml:"Data,omitempty"` // document date (expressed according to the ISO 8601:2004 format)
LineCode string `xml:"NumItem,omitempty"` // identification of the single item on the document (e.g. in the case of a purchase order, this is the number of the row of the purchase order, or, in the case of a contract, it is the number of the row of the contract, etc. )
OrderCode string `xml:"CodiceCommessaConvenzione,omitempty"` // order or agreement code
CUPCode string `xml:"CodiceCUP,omitempty"` // code managed by the CIPE (Interministerial Committee for Economic Planning) which characterises every public investment project (Individual Project Code).
CIGCode string `xml:"CodiceCIG,omitempty"` // Tender procedure identification code
}
DocumentRef contains data about a previous document.
type FundContribution ¶ added in v0.58.0
type FundContribution struct {
Type string `xml:"TipoCassa"`
Rate string `xml:"AlCassa"`
Amount string `xml:"ImportoContributoCassa"`
TaxBase string `xml:"ImponibileCassa,omitempty"`
TaxRate string `xml:"AliquotaIVA"`
Retained string `xml:"Ritenuta,omitempty"`
TaxNature string `xml:"Natura,omitempty"`
AdminRef string `xml:"RiferimentoAmministrazione,omitempty"`
}
FundContribution contains data about a professional fund contribution (DatiCassaPrevidenziale)
type GeneralData ¶ added in v0.39.0
type GeneralData struct {
Document *GeneralDocumentData `xml:"DatiGeneraliDocumento"`
Purchases []*DocumentRef `xml:"DatiOrdineAcquisto,omitempty"`
Contracts []*DocumentRef `xml:"DatiContratto,omitempty"`
Tender []*DocumentRef `xml:"DatiConvenzione,omitempty"`
Receiving []*DocumentRef `xml:"DatiRicezione,omitempty"`
Preceding []*DocumentRef `xml:"DatiFattureCollegate,omitempty"`
Despatch []*Despatch `xml:"DatiDDT,omitempty"`
}
GeneralData contains general data about the invoice such as retained taxes, invoice number, invoice date, document type, etc.
type GeneralDocumentData ¶ added in v0.47.0
type GeneralDocumentData struct {
DocumentType string `xml:"TipoDocumento"`
Currency string `xml:"Divisa"`
IssueDate string `xml:"Data"`
Number string `xml:"Numero"`
RetainedTaxes []*RetainedTax `xml:"DatiRitenuta,omitempty"`
StampDuty *StampDuty `xml:"DatiBollo,omitempty"`
FundContributions []*FundContribution `xml:"DatiCassaPrevidenziale,omitempty"`
PriceAdjustments []*PriceAdjustment `xml:"ScontoMaggiorazione,omitempty"`
TotalAmount string `xml:"ImportoTotaleDocumento,omitempty"`
Rounding string `xml:"Arrotondamento,omitempty"`
Reasons []string `xml:"Causale,omitempty"`
}
GeneralDocumentData contains data about the general document
type GoodsServices ¶ added in v0.47.0
type GoodsServices struct {
LineDetails []*LineDetail `xml:"DettaglioLinee"`
TaxSummary []*TaxSummary `xml:"DatiRiepilogo"`
}
GoodsServices contains all data related to the goods and services sold.
type Header ¶ added in v0.47.0
type Header struct {
TransmissionData *TransmissionData `xml:"DatiTrasmissione,omitempty"`
Supplier *Supplier `xml:"CedentePrestatore,omitempty"`
Customer *Customer `xml:"CessionarioCommittente,omitempty"`
}
Header contains all data related to the parties involved in the document.
type Identity ¶ added in v0.33.0
type Identity struct {
TaxID *TaxID `xml:"IdFiscaleIVA,omitempty"` // nolint:revive
FiscalCode string `xml:"CodiceFiscale,omitempty"`
Profile *Profile `xml:"Anagrafica"`
// FiscaleRegime identifies the tax system to be applied
// Has the form RFXX where XX is numeric; required only for the supplier
FiscalRegime string `xml:"RegimeFiscale,omitempty"`
}
Identity (DatiAnagrafici) contains information related to an individual or company
type LineDetail ¶ added in v0.47.0
type LineDetail struct {
LineNumber string `xml:"NumeroLinea"`
Description string `xml:"Descrizione"`
Quantity string `xml:"Quantita"`
Unit string `xml:"UnitaMisura,omitempty"`
PeriodStart string `xml:"DataInizioPeriodo,omitempty"`
PeriodEnd string `xml:"DataFinePeriodo,omitempty"`
UnitPrice string `xml:"PrezzoUnitario"`
PriceAdjustments []*PriceAdjustment `xml:"ScontoMaggiorazione,omitempty"`
TotalPrice string `xml:"PrezzoTotale"`
TaxRate string `xml:"AliquotaIVA"`
Retained string `xml:"Ritenuta,omitempty"`
TaxNature string `xml:"Natura,omitempty"`
OtherData []*OtherData `xml:"AltriDatiGestionali,omitempty"`
}
LineDetail contains line data such as description, quantity, price, etc.
type Option ¶
type Option func(*config)
Option is a function that can be passed to NewConverter to configure it
func WithCertificate ¶
func WithCertificate(cert *xmldsig.Certificate) Option
WithCertificate will ensure the XML document is signed with the given certificate
func WithCurrentTime ¶ added in v0.35.0
WithCurrentTime will ensure the XML document is signed with the given current time
func WithTimestamp ¶
func WithTimestamp() Option
WithTimestamp will ensure the XML document is timestamped
func WithTransmitterData ¶
func WithTransmitterData(transmitter *Transmitter) Option
WithTransmitterData will ensure the XML document contains the given transmitter data
type OtherData ¶ added in v0.60.0
type OtherData struct {
DataType string `xml:"TipoDato"`
TextReference string `xml:"RiferimentoTesto,omitempty"`
NumReference string `xml:"RiferimentoNumero,omitempty"`
DateReference string `xml:"RiferimentoData,omitempty"`
}
OtherData contains additional management data for a line item.
type PaymentData ¶ added in v0.47.0
type PaymentData struct {
Conditions string `xml:"CondizioniPagamento"`
Payments []*PaymentDetailRow `xml:"DettaglioPagamento,omitempty"`
}
PaymentData contains all data related to the payment of the document.
type PaymentDetailRow ¶ added in v0.47.0
type PaymentDetailRow struct {
Beneficiary string `xml:"Beneficiario,omitempty"`
Method string `xml:"ModalitaPagamento"`
Date string `xml:"DataRiferimentoTerminiPagamento,omitempty"`
Days int64 `xml:"GiorniTerminiPagamento,omitempty"`
DueDate string `xml:"DataScadenzaPagamento,omitempty"`
Amount string `xml:"ImportoPagamento"`
FinancialInstitution string `xml:"IstitutoFinanziario,omitempty"`
IBAN string `xml:"IBAN,omitempty"`
ABI string `xml:"ABI,omitempty"`
CAB string `xml:"CAB,omitempty"`
BIC string `xml:"BIC,omitempty"`
Code string `xml:"CodicePagamento,omitempty"`
}
PaymentDetailRow contains data related to a single payment.
type PermanentEstablishment ¶ added in v0.33.0
type PermanentEstablishment struct {
Street string `xml:"Indirizzo"`
Number string `xml:"NumeroCivico,omitempty"`
PostCode string `xml:"CAP"`
Locality string `xml:"Comune"`
Region string `xml:"Provincia,omitempty"` // Province initials (2 characters) for IT country
Country string `xml:"Nazione"` // Country code ISO alpha-2
}
PermanentEstablishment (StabileOrganizzazione) to be filled in if the seller/provider is not resident, but has a permanent establishment in Italy
type PriceAdjustment ¶ added in v0.47.0
type PriceAdjustment struct {
Type string `xml:"Tipo"`
Percent string `xml:"Percentuale,omitempty"`
Amount string `xml:"Importo,omitempty"`
}
PriceAdjustment contains data about price adjustments like discounts and charges.
type Profile ¶ added in v0.33.0
type Profile struct {
// Name of the organization
Name string `xml:"Denominazione,omitempty"`
// Natural person's first or given name if no "Denominazione" is provided
Given string `xml:"Nome,omitempty"`
// Surname of the person
Surname string `xml:"Cognome,omitempty"`
// Title of the person
Title string `xml:"Titolo,omitempty"`
// EORI (Economic Operator Registration and Identification) code
EORI string `xml:"CodEORI,omitempty"`
}
Profile contains identity data of the seller/provider
type Registration ¶ added in v0.33.0
type Registration struct {
// Initials of the province where the company's Registry Office is located
Office string `xml:"Ufficio,omitempty"`
// Company's REA registration number
Entry string `xml:"NumeroREA,omitempty"`
// Company's share capital
Capital string `xml:"CapitaleSociale,omitempty"`
// Indication of whether the Company is in liquidation or not.
// Possible values: LS (in liquidation), LN (not in liquidation)
LiquidationState string `xml:"StatoLiquidazione,omitempty"`
}
Registration contains information related to the company registration details (REA)
type RetainedTax ¶ added in v0.47.0
type RetainedTax struct {
Type string `xml:"TipoRitenuta"`
Amount string `xml:"ImportoRitenuta"`
Rate string `xml:"AliquotaRitenuta"`
Reason string `xml:"CausalePagamento"`
}
RetainedTax represents a retained tax.
type StampDuty ¶ added in v0.47.0
type StampDuty struct {
VirtualStamp string `xml:"BolloVirtuale"`
Amount string `xml:"ImportoBollo,omitempty"`
}
StampDuty contains data about the stamp duty
type Supplier ¶ added in v0.33.0
type Supplier struct {
Identity *Identity `xml:"DatiAnagrafici"`
Address *Address `xml:"Sede"`
PermanentEstablishment *PermanentEstablishment `xml:"StabileOrganizzazione,omitempty"`
Registration *Registration `xml:"IscrizioneREA,omitempty"`
Contact *Contact `xml:"Contatti,omitempty"`
}
Supplier describes the seller/provider of the invoice.
type TaxID ¶ added in v0.33.0
type TaxID struct {
Country string `xml:"IdPaese"` // ISO 3166-1 alpha-2 country code
Code string `xml:"IdCodice"`
}
TaxID is the VAT identification number consisting of a country code and the actual VAT number.
type TaxSummary ¶ added in v0.47.0
type TaxSummary struct {
TaxRate string `xml:"AliquotaIVA"`
TaxNature string `xml:"Natura,omitempty"`
TaxableAmount string `xml:"ImponibileImporto"`
TaxAmount string `xml:"Imposta"`
TaxLiability string `xml:"EsigibilitaIVA,omitempty"`
LegalReference string `xml:"RiferimentoNormativo,omitempty"`
}
TaxSummary contains tax summary data such as tax rate, tax amount, etc.
type TransmissionData ¶ added in v0.47.0
type TransmissionData struct {
TransmitterID *TaxID `xml:"IdTrasmittente,omitempty"` // nolint:revive
ProgressiveNumber string `xml:"ProgressivoInvio,omitempty"`
TransmissionFormat string `xml:"FormatoTrasmissione,omitempty"`
RecipientCode string `xml:"CodiceDestinatario"`
RecipientPEC string `xml:"PECDestinatario,omitempty"`
}
TransmissionData contains data related to the transmission of the invoice
type Transmitter ¶
Transmitter contains information about the entity integrating directly with the SDI to submit and receive invoices
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
gobl.fatturapa
command
Package main implements the CLI as well as mage commands (toplevel mage.go)
|
Package main implements the CLI as well as mage commands (toplevel mage.go) |
|
Package test provides tools for testing the library both manually as well as helpers for writing test code.
|
Package test provides tools for testing the library both manually as well as helpers for writing test code. |