Giter VIP home page Giter VIP logo

go-vat's Introduction

Go VAT

GitHub go.mod Go version of a Go module Maintenance

Check the validity of a VAT number without any HTTP request.

This go library is based on the original jsVAT for JS/TS.

The intention of this library is to offer to all gophers the ability to validate all the VAT numbers before they are stored in a database.

โš™๏ธ Installation

Go v1.17.x or newer (RECOMMENDED)

go install github.com/ltns35/go-vat

Go v1.16.x or older

go get -u github.com/ltns35/go-vat

๐ŸŽฏ Features

  • Check the validity of VAT numbers.
  • Extendable with custom countries/rules
  • Offline

๐Ÿ“š How to use

// Check against all supported countries validators.
vatResult, err := vat.Validate("ADE000000E")
if err != nil {
// Handle error
}

// Check ONLY against Andorra validator.
countries := []countries.Calculer{
countries.Andorra,
}
vatResult, err = vat.Validate("ADE000000E", countries...)

// output: vatResult
//
//	{
//	   "value":"ADF000000F",
//	   "isValid":true,
//	   "isSupportedCountry":true,
//	   "country":{
//	      "name":"Andorra",
//	      "codes":[
//	         "AD",
//	         "AND",
//	         "020"
//	      ],
//	      "rules":{
//	         "multipliers":null,
//	         "typeFormats":null,
//	         "lookup":null,
//	         "check":"",
//	         "regex":[
//	            "^(AD)([fealecdgopuFEALECDGOPU]{1}\\d{6}[fealecdgopuFEALECDGOPU]{1})$"
//	         ],
//	         "additional":null
//	      }
//	   }
//	}
//

๐ŸŒ Supported countries

  • Albania
  • Andorra
  • Argentina
  • Austria
  • Belarus
  • Belgium
  • Bolivia
  • Brazil
  • Bulgaria
  • Canada
  • Croatia
  • Cyprus
  • Czech Republic
  • Denmark
  • Ecuador
  • Estonia
  • Europe
  • Finland
  • France
  • Germany
  • Greece
  • Guatemala
  • Hungary
  • Hong Kong
  • India
  • Indonesia
  • Ireland
  • Italy
  • Kazakhstan
  • Korea, Republic of
  • Latvia
  • Liechtenstein
  • Lithuania
  • Luxembourg
  • Malaysia
  • Malta
  • Netherlands
  • New Zealand
  • Nigeria
  • North Macedonia
  • Norway
  • Peru
  • Poland
  • Portugal
  • Romania
  • Russia
  • San Marino
  • Serbia
  • Slovakia
  • Slovenia
  • Spain
  • Sweden
  • Switzerland
  • Taiwan
  • Turkey
  • Ukraine
  • United Kingdom
  • Uruguay

๐Ÿงญ Need an unsupported country

If you need a country is not yet supported by the library open a new issue or create a pull request to be merged.

๐Ÿงช Testing

The library is tested against the 2 latest stable major versions of Go.

  • 1.17.x
  • 1.16.x

All the validators has been tested individually to ensure the correct working, if you need more tests don't hesitate to open a new issue with the values you want to be tested.

โš ๏ธ LICENSE

The library is under the MIT license, so you can use it for free for commercial products.

go-vat's People

Contributors

ltns35 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

go-vat's Issues

Refactor (BREAKING CHANGE)

Refactor of the structure project.

The new structure of the project will break the current one. Now when you are referencing a country VAT you are using countryName.VAT, the new behaviour will be countries.CountryName. This was the previous structure, but was changed due to naming collisions and to add more features (taxes) to a specific country, but some users didn't like it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.