Documentation
¶
Overview ¶
Package cfdi implements the conversion from GOBL to CFDI XML
Index ¶
Constants ¶
const ( CFDINamespace = "http://www.sat.gob.mx/cfd/4" CFDISchemaLocation = "http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv40.xsd" XSINamespace = "http://www.w3.org/2001/XMLSchema-instance" CFDIVersion = "4.0" )
CFDI schema constants
const ( FakeNoCertificado = "00000000000000000000" ExportacionNoAplica = "01" MetodoPagoUnaExhibicion = "PUE" ObjetoImpSi = "02" ImpuestoIVA = "002" TipoFactorTasa = "Tasa" )
Hard-coded values for (yet) unsupported mappings
const ( VDVersion = "1.0" VDTipoOperacion = "monedero electrónico" VDNamespace = "http://www.sat.gob.mx/valesdedespensa" VDSchemaLocation = "http://www.sat.gob.mx/sitio_internet/cfd/valesdedespensa/valesdedespensa.xsd" )
VD Schema constants
const ( ECCVersion = "1.2" ECCTipoOperacion = "Tarjeta" ECCNamespace = "http://www.sat.gob.mx/EstadoDeCuentaCombustible12" ECCSchemaLocation = "http://www.sat.gob.mx/sitio_internet/cfd/EstadoDeCuentaCombustible/ecc12.xsd" )
ECC Schema constants
const (
DefaultClaveUnidad = "ZZ" // Mutuamente definida
)
Default keys
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CFDIRelacionado ¶ added in v0.12.0
type CFDIRelacionado struct {
UUID string `xml:",attr"`
}
CFDIRelacionado stores the data of a preceding CFDI document
type CFDIRelacionados ¶ added in v0.12.0
type CFDIRelacionados struct {
TipoRelacion string `xml:",attr"`
CfdiRelacionado []CFDIRelacionado `xml:"cfdi:CfdiRelacionado"`
}
CFDIRelacionados list the preceding CFDI documents (e.g., the preceding invoices of a credit note)
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"`
Descuento string `xml:",attr,omitempty"`
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"`
ECCNamespace string `xml:"xmlns:ecc12,attr,omitempty"`
VDNamespace string `xml:"xmlns:valesdedespensa,attr,omitempty"`
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"`
Descuento string `xml:",attr,omitempty"`
Total string `xml:",attr"`
Moneda string `xml:",attr"`
Exportacion string `xml:",attr"`
MetodoPago string `xml:",attr,omitempty"`
FormaPago string `xml:",attr,omitempty"`
CondicionesDePago string `xml:",attr,omitempty"`
Sello string `xml:",attr"`
NoCertificado string `xml:",attr"`
Certificado string `xml:",attr"`
CFDIRelacionados *CFDIRelacionados `xml:"cfdi:CfdiRelacionados,omitempty"`
Emisor *Emisor `xml:"cfdi:Emisor"`
Receptor *Receptor `xml:"cfdi:Receptor"`
Conceptos *Conceptos `xml:"cfdi:Conceptos"` //nolint:misspell
Impuestos *Impuestos `xml:"cfdi:Impuestos,omitempty"`
Complementos []interface{} `xml:"cfdi:Complemento>*,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 ECCConcepto ¶ added in v0.20.0
type ECCConcepto struct {
Identificador string `xml:",attr"`
Fecha string `xml:",attr"`
Rfc string `xml:",attr"`
ClaveEstacion string `xml:",attr"`
Cantidad string `xml:",attr"`
TipoCombustible string `xml:",attr"`
Unidad string `xml:",attr,omitempty"`
NombreCombustible string `xml:",attr"`
FolioOperacion string `xml:",attr"`
ValorUnitario string `xml:",attr"`
Importe string `xml:",attr"`
Traslados []*ECCTraslado `xml:"ecc12:Traslados>ecc12:Traslado"`
}
ECCConcepto stores the data of a fuel purchase
type ECCTraslado ¶ added in v0.20.0
type ECCTraslado struct {
Impuesto string `xml:",attr"`
TasaOCuota string `xml:",attr"`
Importe string `xml:",attr"`
}
ECCTraslado stores the tax data of a fuel purchase
type Emisor ¶
type Emisor struct {
Rfc string `xml:",attr"`
Nombre string `xml:",attr"`
RegimenFiscal string `xml:",attr"`
}
Emisor stores the invoice supplier data
type EstadoDeCuentaCombustible ¶ added in v0.20.0
type EstadoDeCuentaCombustible struct {
XMLName xml.Name `xml:"ecc12:EstadoDeCuentaCombustible"`
Version string `xml:",attr"`
TipoOperacion string `xml:",attr"`
NumeroDeCuenta string `xml:",attr"`
SubTotal string `xml:",attr"`
Total string `xml:",attr"`
Conceptos []*ECCConcepto `xml:"ecc12:Conceptos>ecc12:ConceptoEstadoDeCuentaCombustible"` // nolint:misspell
}
EstadoDeCuentaCombustible stores the fuel account balance 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
type Traslado ¶
type Traslado struct {
Base string `xml:",attr"`
Importe string `xml:",attr,omitempty"`
Impuesto string `xml:",attr"`
TasaOCuota string `xml:",attr,omitempty"`
TipoFactor string `xml:",attr"`
}
Traslado stores the tax data of the invoice or a line
type Traslados ¶
type Traslados struct {
Traslado []*Traslado `xml:"cfdi:Traslado"`
}
Traslados list the applicable taxes of the invoice or a line
type VDConcepto ¶ added in v0.21.0
type VDConcepto struct {
Identificador string `xml:"identificador,attr"`
Fecha string `xml:"fecha,attr"`
Rfc string `xml:"rfc,attr"`
Curp string `xml:"curp,attr"`
Nombre string `xml:"nombre,attr"`
NumSeguridadSocial string `xml:"numSeguridadSocial,attr,omitempty"`
Importe string `xml:"importe,attr"`
}
VDConcepto stores the data of a single food voucher
type ValesDeDespensa ¶ added in v0.21.0
type ValesDeDespensa struct {
XMLName xml.Name `xml:"valesdedespensa:ValesDeDespensa"`
Version string `xml:"version,attr"`
TipoOperacion string `xml:"tipoOperacion,attr"`
RegistroPatronal string `xml:"registroPatronal,attr,omitempty"`
NumeroDeCuenta string `xml:"numeroDeCuenta,attr"`
Total string `xml:"total,attr"`
Conceptos []*VDConcepto `xml:"valesdedespensa:Conceptos>valesdedespensa:Concepto"` // nolint:misspell
}
ValesDeDespensa stores the food vouchers data