vat

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRates = NewRates("Netherlands", 21.0, true)

DefaultRates defines the rates for a business located in the Netherlands.

View Source
var (
	ErrNumberTooShort = errors.Code("invalid_number_too_short").StatusError("number is too short", http.StatusBadRequest)
)

Errors

Functions

func IsEU

func IsEU(country string) bool

IsEU returns true when European VAT regulations apply to a given country.

func IsErrInvalidNumber

func IsErrInvalidNumber(err error) bool

IsErrInvalidNumber returns true when a given error is of type invalid_number. TODO: make this work nicely.

Types

type Number

type Number string

Number defines a VAT number.

func (Number) Country

func (n Number) Country() string

Country returns the name of the country associated with the VAT number.

func (Number) CountryCode

func (n Number) CountryCode() string

CountryCode returns the country code of a VAT number.

func (Number) String

func (n Number) String() string

func (Number) Validate

func (n Number) Validate() error

Validate validates a VAT number, returning nil for numbers with an unknown country code.

type Rates

type Rates interface {
	GetTaxRate(country string) (float64, bool)
}

Rates helps dealing with tax rates in different countries.

func NewRates

func NewRates(sellerCountry string, rate float64, isEU bool) Rates

NewRates returns the rates for a business selling goods

Jump to

Keyboard shortcuts

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