Documentation
¶
Index ¶
Constants ¶
const ( TaxCategoryVATEqualizationSurcharge tax.Code = "VATEQS" TaxCategoryIRPF tax.Code = "IRPF" TaxCategoryIGIC tax.Code = "IGIC" TaxCategoryIPSI tax.Code = "IPSI" )
Local tax category definitions which are not considered standard.
const ( // VAT non-standard Rates TaxRateVATTobacco tax.Code = "TOB" // IRPF "Autonomo" Rates TaxRateIRPFStandard tax.Code = "STD" // Professional or artistic TaxRateIRPFFirst tax.Code = "1ST" // First 2 years TaxRateIRPFModules tax.Code = "MOD" // Module system TaxRateIRPFAgriculture tax.Code = "AGR" // Agricultural TaxRateIRPFAgriculture2 tax.Code = "AG2" // Agricultural special )
Specific tax rate codes.
Variables ¶
var ( ErrTaxCodeNoMatch = errors.New("no match") ErrTaxCodeUnknownType = errors.New("unknown type") ErrTaxCodeInvalidCheck = errors.New("check letter is invalid") )
Standard simplified errors messages
var ValidTaxID = new(validTaxID)
ValidTaxID complies with the ozzo validation Rule definition to be able to confirm that the Tax ID is indeed spanish and valid.
Functions ¶
func CleanTaxCode ¶
CleanTaxCode removes any whitespace or separation characters and ensures all letters are uppercase. It'll also remove the "ES" part at beginning if present such as required for EU VIES system which is redundant and not used in the validation process.
func VerifyTaxCode ¶
VerifyTaxCode looks at the provided code, determines the type, and performs the calculations required to determine if it is valid. These methods assume the code has already been cleaned and only contains upper-case letters and numbers.
Types ¶
type TaxCodeType ¶
type TaxCodeType string
TaxCodeType represents the types of tax code which are issued in Spain. The same general format with variations is used for national individuals, foreigners, and legal organizations.
const ( NationalTaxCode TaxCodeType = "N" ForeignTaxCode TaxCodeType = "X" OrganizationTaxCode TaxCodeType = "B" OtherTaxCode TaxCodeType = "O" UnknownTaxCode TaxCodeType = "NA" )
Supported tax code types.
func DetermineTaxCodeType ¶
func DetermineTaxCodeType(code string) (TaxCodeType, error)
DetermineTaxCodeType takes a valid code and determines the type. If the code is not valid, the `UnknownTaxCode` type will be returned.