Skip to main content

A simple Django app to figure out currencies in a limited number of countries

Project description

=============
Django Taxbot
=============

This application attempts to make a little bit of sense out of the mess that is the tax landscape.
It uses a saved (and regularly updated and expanding) dictionary of aggregated taxes to figure out payable taxes based on a set of passed in values.
It bears noting that I have created this for my own use and while I intend to update is regularly, the accuracy of these values must be verified by the developer prior to use.
While I wait for a suitable API for tax aggregates, I have compiled my own list and based this application on that list.

Presently, this application only handled taxes in Canada, parts of the US, in Great Britain and in Nigeria.


-----------
Quick Start
-----------

1. Install easily with pip:
.. code :: python

pip install django_taxbot



2. Add to your installed apps:
.. code :: python

INSTALLED_APPS = (

...
'taxbot',

...
)



3. Import the TaxClient object in your projects and use as shown


-----------------
Detailed Overview
-----------------

This section details the way the application can be used.

To create a new ``TaxClient``, simply import and use like so:
.. code :: python

from taxbot import TaxClient

client = TaxClient()

And just like that, we now have a new TaxClient. This client is initialized as Sales Tax client by default. To get Meal tax instead, pass in the ``M`` flag when initializing the client.
.. code :: python

client = TaxClient('M')


Now we'll go over the methods available to the client.



tax_known(self, country, [region, city])
----------------------------------------
This method returns a Boolean value which informs us if the tax for the location is known or not.
It is recommended that this method is called before any actions involving tax rates. Pass in as much information as possible to get the best results from this client.

The method expects the country to be in ISO-ALPHA-2 codes. See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2. Region codes are 2 character alphas also and cities can be spelled out.

For countries with simple tax structures (Great Britain and Nigeria for now), the region and the city may be ignored.



get_tax(self, country, [region, city])
--------------------------------------
Same as above, this method takes in 3 parameters.
It calls on the ``tax_known`` method and so it is not necessary to call to the former beforehand.

This method returns the tax as a Decimal or in instances where tax structure is more complicated, returns a dictionary of applicable taxes.

** Important ** Please check the type of return values from this method before using them.



calculate_tax(self, amount, country, [region, city])
----------------------------------------------------
In addition to the parameters above, this method accepts the value on which the tax is to be calculated and returns a dictionary of all calculated taxes.



create_tax(self, amount, country [region, city])
------------------------------------------------
In addition to the above, this method will create a ``Tax`` (and a ``CanadianTax``)object where the tax is known. Please refer to the code base in the app repository to view the fields available on the respective objects

Cheers

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_taxbot-0.0.6.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

django_taxbot-0.0.6.macosx-10.10-intel.exe (73.8 kB view details)

Uploaded Source

File details

Details for the file django_taxbot-0.0.6.tar.gz.

File metadata

File hashes

Hashes for django_taxbot-0.0.6.tar.gz
Algorithm Hash digest
SHA256 53795dad36ceb25adc59b8ffa31b5d700f5b3ae329a6ef351c6a393bdfc93d4f
MD5 190850f34ae851713eaf6974445b08fa
BLAKE2b-256 f0c7d52e4a8f723894536475be5e3047bf3be7bd6d67b2233952075a1defde99

See more details on using hashes here.

File details

Details for the file django_taxbot-0.0.6.macosx-10.10-intel.exe.

File metadata

File hashes

Hashes for django_taxbot-0.0.6.macosx-10.10-intel.exe
Algorithm Hash digest
SHA256 a599f7a3f9354ac67d2a940e1d310b57b1f22e007f6b0fa62f56818ca037e74b
MD5 d5f6a95826d4e0a459866cec711d5b5d
BLAKE2b-256 14c56c55146e32384eb21cca9e22f1253b2d31c2b785ddb375d8219aeee5e421

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page