addendas

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

README

CFDI Addendas

"Addendas" add functionality to regular CFDI documents so that private companies can leverage existing infrastructure around the CFDI format and SAT to extract additional structured data.

Each of the addendas currently supported are listed below, with instructions on the mappings and key fields.

MABE

Most of the MABE Addenda fields are determined automatically from the base GOBL Invoice, with the exception of the following:

MABE Field GOBL Invoice Property GOBL Invoice Value Description
Purchase Order (Orden de Compra) ordering.identities [{"key":"mx-mabe-purchase-order", "code":"-CODE-"}] Provided by Mabe for the order
Provider Code (Código de Proveedor) supplier.identities [{"key":"mx-mabe-provider-code", "code":"-CODE-"}] Code issued by Mabe to identify the supplier
Delivery Plant (Planta de Entrega) delivery.receiver.identities [{"key":"mx-mabe-delivery-plant","code":"-CODE-"}] Delivery Plant Code
Article Code (Código de Artículo) lines[i].item.identities [{"key":"mx-mabe-article-code","code":"-CODE-"}] Article code provided by Mabe
Unit (Unidad) lines[i].item.identities [{"key":"mx-mabe-unit","code":"-CODE-"}] Item unit code provided by Mabe (falls back to CFDI/UNECE unit)
Reference 1 ordering.identities [{"key":"mx-mabe-reference1","code":"-CODE-"}] Additional code required by Mabe in certain circumstances while ordering.
Reference 2 ordering.identities [{"key":"mx-mabe-reference2","code":"-CODE-"}] Set to NA by default as not currently used by Mabe.

Documentation

Overview

Package addendas adds additional functionality for "Addendas" to the CFDI documents.

Index

Constants

View Source
const (
	MabeVersion        = "1.0"
	MabeNamespace      = "https://recepcionfe.mabempresa.com/cfd/addenda/v1"
	MabeSchemaLocation = "https://recepcionfe.mabempresa.com/cfd/addenda/v1/mabev1.xsd"
	MabeNotApplicable  = "NA"
)

Mabe schema constants

View Source
const (
	MabeTipoDocumentoFactura     = "FACTURA"
	MabeTipoDocumentoNotaCredito = "NOTA CREDITO"
	MabeTipoDocumentoNotaCargo   = "NOTA CARGO"
)

TipoDocumento valid values

View Source
const (
	MabeKeyIdentityPurchaseOrder = "mx-mabe-purchase-order"
	MabeKeyIdentityProviderCode  = "mx-mabe-provider-code"
	MabeKeyIdentityRef1          = "mx-mabe-reference1"
	MabeKeyIdentityRef2          = "mx-mabe-reference2"
	MabeKeyIdentityDeliveryPlant = "mx-mabe-delivery-plant"
	MabeKeyIdentityArticleCode   = "mx-mabe-article-code"
	MabeKeyIdentityUnit          = "mx-mabe-unit"
)

Mabe specific identity codes.

Variables

MabeTipoDocumentoMap maps GOBL invoice types to Mabe's TipoDocumento

Functions

func For

func For(inv *bill.Invoice) ([]any, error)

For returns a set of addenda objects for the given invoice.

Types

type MabeDescuentos

type MabeDescuentos struct {
	Tipo        string `xml:"tipo,attr"`
	Descripcion string `xml:"descripcion,attr"` //nolint:misspell
	Importe     string `xml:"importe,attr"`
}

MabeDescuentos carries the data about an invoice's discount

type MabeDetalle

type MabeDetalle struct {
	NoLineaArticulo int    `xml:"noLineaArticulo,attr"`
	CodigoArticulo  string `xml:"codigoArticulo,attr"`
	Descripcion     string `xml:"descripcion,attr"` //nolint:misspell
	Unidad          string `xml:"unidad,attr"`
	Cantidad        string `xml:"cantidad,attr"`
	PrecioSinIva    string `xml:"precioSinIva,attr"`
	ImporteSinIva   string `xml:"importeSinIva,attr"`
	PrecioConIva    string `xml:"precioConIva,attr,omitempty"`  // Not implemented yet
	ImporteConIva   string `xml:"importeConIva,attr,omitempty"` // Not implemented yet
}

MabeDetalle carries the data about one invoice's line

type MabeDetalles

type MabeDetalles struct {
	Detalle []*MabeDetalle `xml:"mabe:Detalle"`
}

MabeDetalles carries the data about an invoice's lines

type MabeEntrega

type MabeEntrega struct {
	PlantaEntrega string `xml:"plantaEntrega,attr"`
	Calle         string `xml:"calle,attr,omitempty"`
	NoExterior    string `xml:"noExterior,attr,omitempty"`
	NoInterior    string `xml:"noInterior,attr,omitempty"`
	CodigoPostal  string `xml:"codigoPostal,attr,omitempty"`
}

MabeEntrega carries the data about the invoice's delivery

type MabeFactura

type MabeFactura struct {
	XMLName        xml.Name `xml:"mabe:Factura"`
	Namespace      string   `xml:"xmlns:mabe,attr"`
	SchemaLocation string   `xml:"xsi:schemaLocation,attr"`

	Version       string `xml:"version,attr"`
	TipoDocumento string `xml:"tipoDocumento,attr"`
	Folio         string `xml:"folio,attr"`
	Fecha         string `xml:"fecha,attr"`
	OrdenCompra   string `xml:"ordenCompra,attr"`
	Referencia1   string `xml:"referencia1,attr"`
	Referencia2   string `xml:"referencia2,attr,omitempty"`

	Moneda    *MabeMoneda    `xml:"mabe:Moneda"`
	Proveedor *MabeProveedor `xml:"mabe:Proveedor"`
	Entrega   *MabeEntrega   `xml:"mabe:Entrega"`
	Detalles  *MabeDetalles  `xml:"mabe:Detalles"`

	Descuentos  *MabeDescuentos  `xml:"mabe:Descuentos,omitempty"`
	Subtotal    *MabeImporte     `xml:"mabe:Subtotal"`
	Traslados   *MabeTraslados   `xml:"mabe:Traslados"`
	Retenciones *MabeRetenciones `xml:"mabe:Retenciones"`
	Total       *MabeImporte     `xml:"mabe:Total"`
}

MabeFactura is the root element of the Mabe addendum

type MabeImporte

type MabeImporte struct {
	Importe string `xml:"importe,attr"`
}

MabeImporte carries the data about an invoice's total

type MabeImpuesto

type MabeImpuesto struct {
	Tipo    string `xml:"tipo,attr"`
	Tasa    string `xml:"tasa,attr"`
	Importe string `xml:"importe,attr"`
}

MabeImpuesto carries the data about an invoice's tax

type MabeMoneda

type MabeMoneda struct {
	TipoMoneda      string `xml:"tipoMoneda,attr"`
	TipoCambio      string `xml:"tipoCambio,attr,omitempty"`      // Not implemented yet
	ImporteConLetra string `xml:"importeConLetra,attr,omitempty"` // Not implemented yet
}

MabeMoneda carries the data about the invoice's currency

type MabeProveedor

type MabeProveedor struct {
	Codigo string `xml:"codigo,attr"`
}

MabeProveedor carries the data about the invoice's supplier

type MabeRetenciones

type MabeRetenciones struct {
	Retencion []*MabeImpuesto `xml:"mabe:Retencion"`
}

MabeRetenciones carries the data about an invoice's retained taxes

type MabeTraslados

type MabeTraslados struct {
	Traslado []*MabeImpuesto `xml:"mabe:Traslado"`
}

MabeTraslados carries the data about an invoice's taxes (expect retained ones)

Jump to

Keyboard shortcuts

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