GithubHelp home page GithubHelp logo

pyvat's Introduction

pyvat -- VAT validation and calculation for Python

image

With EU VAT handling rules becoming ever more ridiculous and complicated, businesses within the EU are faced with the complexity of having to validate VAT numbers. pyvat was built for Iconfinder's marketplace to handle just this problem.

Validation of VAT numbers is performed in two steps: firstly, the VAT number is checked against an expression for the given country if one such is available, after which it is checked against a registry if one such is available.

Calculation of VAT rates for sales is supported within the EU for items covered by the new EU directive for VAT on telecommunications, broadcasting and electronic services.

Installation

To install requests, do yourself a favor and don't use anything other than pip:

$ pip install pyvat

Usage

pyvat exposes its functionality through three simple methods:

pyvat.check_vat_number(vat_number, country_code=None)

Test if a VAT number is valid.

If possible, the VAT number will be checked against available registries.

Parameters
  • vat_number -- VAT number to validate.
  • country_code -- Optional country code. Should be supplied if known, as there is no guarantee that naively entered VAT numbers contain the correct alpha-2 country code prefix for EU countries just as not all non-EU countries have a reliable country code prefix. Default None prompting detection.
Returns

True if the VAT number can be fully asserted as valid or False if not, otherwise None indicating that the VAT number may or may not be valid.

pyvat.is_vat_number_format_valid(vat_number, country_code=None)

Test if the format of a VAT number is valid.

Parameters
  • vat_number -- VAT number to validate.
  • country_code -- Optional country code. Should be supplied if known, as there is no guarantee that naively entered VAT numbers contain the correct alpha-2 country code prefix for EU countries just as not all non-EU countries have a reliable country code prefix. Default None prompting detection.
Returns

True if the VAT number can be fully asserted as valid or False if not, otherwise None indicating that the VAT number may or may not be valid.

pyvat.get_sale_vat_charge(date, item_type, buyer, seller)

Get the VAT charge for performing the sale of an item.

Currently only supports determination of the VAT charge for telecommunications, broadcasting and electronic services in the EU.

Parameters
  • date (datetime.date) -- Sale date.
  • item_type (pyvat.ItemType) -- Type of the item being sold.
  • buyer (pyvat.Party) -- Buyer.
  • seller (pyvat.Party) -- Seller.
Returns

The VAT charge to be applied to the sale of an item.

For more detailed documentation, see the full pyvat documentation.

pyvat's People

Contributors

aladagemre avatar evanpurkhiser avatar hiaselhans avatar janmanx avatar jbma avatar kdeldycke avatar martinleblanc avatar matiaslaurarasmussen avatar mrmebelman avatar nickbruun avatar ojarva avatar sniku avatar

Watchers

 avatar  avatar

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.