Documentation
¶
Index ¶
- Variables
- func Countries() []string
- func GetApplicableTax(countryCode, vatNumber string) (taxRate float64, reverseCharge bool, err error)
- func GetApplicableTaxAtDate(countryCode, vatNumber string, date time.Time) (taxRate float64, reverseCharge bool, err error)
- func IsEUCountry(countryCode string) bool
- func IsValidVAT(vatNumber string) (bool, error)
- func StandardRate(countryCode string) (rate float64, ok bool)
- func StandardRateAtDate(countryCode string, date time.Time) (rate float64, ok bool)
- type Rates
- type VATresponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrVATnumberNotValid = errors.New("VAT number is not valid.") ErrVATserviceUnreachable = errors.New("VAT number validation service is offline.") ErrVATserviceError = "VAT number validation service returns an error : " )
View Source
var Timeout = 10 // seconds
Functions ¶
func GetApplicableTax ¶
func GetApplicableTax(countryCode, vatNumber string) (taxRate float64, reverseCharge bool, err error)
GetApplicableTax is a convenience func for GetApplicableTaxAtDate(...)
func GetApplicableTaxAtDate ¶
func GetApplicableTaxAtDate(countryCode, vatNumber string, date time.Time) (taxRate float64, reverseCharge bool, err error)
GetApplicableTaxAtDate returns taxRate and if reverseCharge is applicable You should check the vatNumber with IsValidVAT(vatNumber) before passing a vatNumber to this function.
func IsEUCountry ¶
IsEUCountry returns true if countryCode is EU country
func IsValidVAT ¶
IsValid returns true if vat number is correct
func StandardRate ¶
StandardRate returns VAT rate in EU country at time.Now()
Types ¶
Click to show internal directories.
Click to hide internal directories.