0.0
No commit activity in last 3 years
No release in over 3 years
Helper to calculate the VAT rate
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Description

Use this plugin to calculate the VAT rate depending on the country of the buyer.

Configuration

First set the country of the seller in your config/application.rb file

config.vat_calculator_base_country = 'FR' # or 'BE', etc....

Note: by default, the value of the vat_calculator_base_country option is set to 'FR'

Basic usage

Let's review the different cases for a seller in France:

  1. the buyer is outside Europe

     VatCalculator.get('US') # returns 0.0
    
  2. the buyer is in France

     VatCalculator.get('FR') # returns 19.6
    
  3. the buyer is in Europe without a vat number

     VatCalculator.get('BE') # returns 19.6
    
  4. the buyer is in Europe with an almost correct vat number

     VatCalculator.get('BE', { vat_number: 'a_valid_vat_number' }) # returns 0.0
    
  5. the buyer is in Europe with an almost correct vat number

     VatCalculator.get('BE', { vat_number: 'bla bla', validation: :simple }) # returns 19.6
    
  6. the buyer is in Europe with an almost correct vat number

     VatCalculator.get('BE', { vat_number: 'BE00000000000', validation: :full }) # returns 0.0
    
  7. the buyer is in Martinique, Guadeloupe or la RĂ©union

     VatCalculator.get('MQ') # returns 8.5
    
  8. the buyer is in French Guyana

     VatCalculator.get('GF') # returns 0.0
    

Installation

In your project's Gemfile :

gem 'vat_calculator', git: 'git://github.com/did/vat_calculator.git'

Tests

If you want to run the specs :

bundle exec rake spec

Credits

This plugin in released under MIT license by Didier Lafforgue (see MIT-LICENSE file).

(c) http://www.nocoffee.fr