Documentation
¶
Overview ¶
Package cfdi implements the conversion from GOBL to CFDI XML
Index ¶
Constants ¶
View Source
const ( CFDINamespace = "http://www.sat.gob.mx/cfd/4" XSINamespace = "http://www.w3.org/2001/XMLSchema-instance" SchemaLocation = "http://www.sat.gob.mx/cfd/4 http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv40.xsd" CFDIVersion = "4.0" )
CFDI schema constants
View Source
const ( FakeNoCertificado = "00000000000000000000" TipoDeComprobanteIngreso = "I" ExportacionNoAplica = "01" MetodoPagoUnaExhibicion = "PUE" ClaveProdServNoExiste = "01010101" ClaveUnidadMutuamenteDefinida = "H87" ObjetoImpSi = "02" ImpuestoIVA = "002" TipoFactorTasa = "Tasa" RegimenFiscalGeneral = "601" )
Hard-coded values for (yet) unsupported mappings
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Concepto ¶
type Concepto struct {
ClaveProdServ string `xml:",attr"`
Cantidad string `xml:",attr"`
ClaveUnidad string `xml:",attr"`
Descripcion string `xml:",attr"` // nolint:misspell
ValorUnitario string `xml:",attr"`
Importe string `xml:",attr"`
ObjetoImp string `xml:",attr"`
Impuestos *Impuestos `xml:"cfdi:Impuestos,omitempty"`
}
Concepto stores an invoice line data
type Conceptos ¶
type Conceptos struct {
Concepto []*Concepto `xml:"cfdi:Concepto"`
}
Conceptos list invoice lines nolint:misspell
type Document ¶
type Document struct {
XMLName xml.Name `xml:"cfdi:Comprobante"`
CFDINamespace string `xml:"xmlns:cfdi,attr"`
XSINamespace string `xml:"xmlns:xsi,attr"`
SchemaLocation string `xml:"xsi:schemaLocation,attr"`
Version string `xml:"Version,attr"`
TipoDeComprobante string `xml:",attr"`
Serie string `xml:",attr,omitempty"`
Folio string `xml:",attr,omitempty"`
Fecha string `xml:",attr"`
LugarExpedicion string `xml:",attr"`
SubTotal string `xml:",attr"`
Total string `xml:",attr"`
Moneda string `xml:",attr"`
Exportacion string `xml:",attr"`
MetodoPago string `xml:",attr,omitempty"`
FormaPago string `xml:",attr,omitempty"`
Sello string `xml:",attr"`
NoCertificado string `xml:",attr"`
Certificado string `xml:",attr"`
Emisor *Emisor `xml:"cfdi:Emisor"`
Receptor *Receptor `xml:"cfdi:Receptor"`
Conceptos *Conceptos `xml:"cfdi:Conceptos"` //nolint:misspell
Impuestos *Impuestos `xml:"cfdi:Impuestos,omitempty"`
}
Document is a pseudo-model for containing the XML document being created
func NewDocument ¶
NewDocument converts a GOBL envelope into a CFDI document
type Emisor ¶
type Emisor struct {
Rfc string `xml:",attr"`
Nombre string `xml:",attr"`
RegimenFiscal string `xml:",attr"`
}
Emisor stores the invoice supplier data
type Impuestos ¶
type Impuestos struct {
TotalImpuestosTrasladados string `xml:",attr,omitempty"`
Traslados *Traslados `xml:"cfdi:Traslados,omitempty"`
}
Impuestos store the invoice tax totals
type Receptor ¶
type Receptor struct {
Rfc string `xml:",attr"`
Nombre string `xml:",attr"`
DomicilioFiscalReceptor string `xml:",attr"`
RegimenFiscalReceptor string `xml:",attr"`
UsoCFDI string `xml:",attr"`
}
Receptor stores the invoice customer data
Click to show internal directories.
Click to hide internal directories.