es

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

README

Spanish GOBL Tax Definitions

Documentation

Index

Constants

View Source
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.

View Source
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

View Source
var (
	ErrTaxCodeNoMatch      = errors.New("no match")
	ErrTaxCodeUnknownType  = errors.New("unknown type")
	ErrTaxCodeInvalidCheck = errors.New("check letter is invalid")
)

Standard simplified errors messages

View Source
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

func CleanTaxCode(code string) string

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 New

func New() region.Region

New provides the Spanish region definition

func VerifyTaxCode

func VerifyTaxCode(code string) error

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.

Jump to

Keyboard shortcuts

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