mx

package
v0.309.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Overview

Package mx provides the Mexican tax regime.

Index

Constants

View Source
const (
	StampSATSignature   cbc.Key = "sat-sig"          // Signature - Sello Digital del SAT (optional)
	StampSATSerial      cbc.Key = "sat-serial"       // Cert Serial - Número de Certificado SAT
	StampSATTimestamp   cbc.Key = "sat-timestamp"    // Timestamp - Fecha y hora de certificación del SAT
	StampSATUUID        cbc.Key = "sat-uuid"         // Folio Fiscal
	StampSATURL         cbc.Key = "sat-url"          // URL QR Code
	StampSATProviderRFC cbc.Key = "sat-provider-rfc" // Provider RFC - RFC del Proveedor de Certificación
	StampSATChain       cbc.Key = "sat-chain"        // Cadena original del complemento de certificación digital del SAT
)

Official SAT codes to include in stamps.

View Source
const (
	KeyFormaPago    cbc.Key = "sat-forma-pago"    // for mapping to c_FormaPago’s codes
	KeyTipoRelacion cbc.Key = "sat-tipo-relacion" // for mapping to c_TipoRelacion’s codes
	KeyImpuesto     cbc.Key = "sat-impuesto"      // for mapping to c_Impuesto’s codes
)

Custom keys used typically in meta or codes information.

View Source
const (
	TaxCategoryRVAT  cbc.Code = "RVAT"  // IVA (Retenido)
	TaxCategoryIEPS  cbc.Code = "IEPS"  // Impuesto Especial sobre Producción y Servicios
	TaxCategoryRIEPS cbc.Code = "RIEPS" // Impuesto Especial sobre Producción y Servicios (Retenido)
	TaxCategoryISR   cbc.Code = "ISR"   // Impuesto Sobre la Renta
)

Local tax categories

View Source
const (
	TaxIdentityCodeGeneric cbc.Code = "XAXX010101000"
	TaxIdentityCodeForeign cbc.Code = "XEXX010101000"
)

Constants used to specific tax identity codes.

View Source
const (
	TaxIdentityTypePerson  cbc.Key = "person"
	TaxIdentityTypeCompany cbc.Key = "company"
)

Tax Identity Type

View Source
const (
	TaxIdentityPatternPerson  = `^([A-ZÑ\&]{4})([0-9]{6})([A-Z0-9]{3})$`
	TaxIdentityPatternCompany = `^([A-ZÑ\&]{3})([0-9]{6})([A-Z0-9]{3})$`
)

Tax Identity Patterns

View Source
const (
	TaxRateExempt cbc.Key = "exempt"
)

Local tax rates

Variables

View Source
var (
	TaxIdentityRegexpPerson  = regexp.MustCompile(TaxIdentityPatternPerson)
	TaxIdentityRegexpCompany = regexp.MustCompile(TaxIdentityPatternCompany)
	TaxCodeBadCharsRegexp    = regexp.MustCompile(`[^A-ZÑ\&0-9]+`)
)

Tax Identity Regexp

Functions

func DetermineTaxCodeType

func DetermineTaxCodeType(code cbc.Code) cbc.Key

DetermineTaxCodeType determines the type of tax code or provides an empty key if it looks invalid.

func New

func New() *tax.RegimeDef

New provides the tax region definition

func Normalize added in v0.200.0

func Normalize(doc any)

Normalize performs regime specific calculations.

func NormalizeTaxCode added in v0.204.0

func NormalizeTaxCode(code cbc.Code) cbc.Code

NormalizeTaxCode normalizes a tax code according to SAT rules. It handles special cases where company tax codes (RFC) may include an "MX" prefix. For example, a valid company code could be "MXG70123123Z". The function attempts to validate both with and without the "MX" prefix.

func NormalizeTaxIdentity added in v0.204.0

func NormalizeTaxIdentity(tID *tax.Identity)

NormalizeTaxIdentity ensures the tax code is good for mexico

func Validate

func Validate(doc any) error

Validate validates a document against the tax regime.

func ValidateTaxCode added in v0.200.0

func ValidateTaxCode(value interface{}) error

ValidateTaxCode validates a tax code according to the rules defined by the Mexican SAT.

func ValidateTaxIdentity added in v0.200.0

func ValidateTaxIdentity(tID *tax.Identity) error

ValidateTaxIdentity validates a tax identity for SAT.

Types

This section is empty.

Jump to

Keyboard shortcuts

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