-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvat.go
31 lines (21 loc) · 925 Bytes
/
vat.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
Package vat helps you deal with European VAT in Go.
It offers VAT number validation using the VIES VAT validation API & VAT rates retrieval using jsonvat.com
It also offers UK VAT number validation using a UK VAT API.
Validate a VAT number
err := vat.Validate("NL123456789B01")
Get VAT rate that is currently in effect for a given country
c, _ := vat.GetCountryRates("NL")
r, _ := c.GetRate("standard")
*/
package vat
import "time"
// ViesLookupService is the interface for the VIES VAT number validation service
var ViesLookupService LookupServiceInterface = &viesService{}
// UKVATLookupService is the interface for the UK VAT number validation service
var UKVATLookupService LookupServiceInterface = &ukVATService{}
var serviceTimeout = time.Second * 60
// SetServiceTimeout sets the timeout for the external VAT lookup services.
func SetServiceTimeout(timeout time.Duration) {
serviceTimeout = timeout
}