vatlayer.com support for Django
Project description
django-prices-vatlayer: Vatlayer API support for prices
from prices import Money, TaxedMoney
from django_prices_vatlayer.utils import (
get_tax_for_rate, get_tax_rates_for_country)
de_tax_rates = get_tax_rates_for_country('DE')
books_tax = get_tax_for_rate(de_tax_rates, 'books')
price_with_vat = books_tax(Money(10, 'EUR'))
print(price_with_vat)
# TaxedMoney(net=Money('10', 'EUR'), gross=Money('11', 'EUR'))
price_with_vat = books_tax(
TaxedMoney(net=Money(10, 'EUR'), gross=Money(10, 'EUR')))
print(price_with_vat)
# TaxedMoney(net=Money('10', 'EUR'), gross=Money('11', 'EUR'))
Installation
The package can easily be installed via pip:
pip install django-prices-vatlayer
After installation, you'll also need to setup your site to use it. To do that, open your settings.py and do the following:
- Add
'django_prices_vatlayer',to yourINSTALLED_APPS - Add
VATLAYER_ACCESS_KEY = 'YOUR_API_KEY_HERE'line - Replace
YOUR_API_KEY_HEREwith the API key that you have obtained from vatlayer API
Lastly, run manage.py migrate to create new tables in your database and manage.py get_vat_rates to populate them with initial data.
Forcing secure API connection in production
Because HTTPS is unavailable in the free vatlayer plan, django-prices-vatlayer uses the unsafe HTTP connection by default.
If you are using a paid plan, you can force the secure HTTP on your site by adding following line to your settings.py:
VATLAYER_USE_HTTPS = True
Remember that not using HTTPS may expose you to DNS poisoning and man-in-the-middle attacks; we recommend enabling VATLAYER_USE_HTTPS in production sites.
Updating VAT rates
To get current VAT rates from the API run the get_vat_rates management command.
You may also set cron job for running this task daily to always be up to date with current tax rates.
Crafted with ❤️ by Mirumee Software
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_prices_vatlayer-1.2.0.tar.gz.
File metadata
- Download URL: django_prices_vatlayer-1.2.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cfda20da69c2c27a747019010ac53e1a83e444f5fbbf9e41120084468ac0436
|
|
| MD5 |
f3108ca95daa2930f945022cbe128bce
|
|
| BLAKE2b-256 |
43d9e52874c9887c406b4fd4e59d4dcd55b5dd9db01d31251891b20bba042aa5
|
Provenance
The following attestation bundles were made for django_prices_vatlayer-1.2.0.tar.gz:
Publisher:
publish.yml on mirumee/django-prices-vatlayer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_prices_vatlayer-1.2.0.tar.gz -
Subject digest:
1cfda20da69c2c27a747019010ac53e1a83e444f5fbbf9e41120084468ac0436 - Sigstore transparency entry: 653851759
- Sigstore integration time:
-
Permalink:
mirumee/django-prices-vatlayer@3b3747be05e2a95c4a80dd3fc296f1799a087b3f -
Branch / Tag:
refs/tags/1.2.0 - Owner: https://github.com/mirumee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3b3747be05e2a95c4a80dd3fc296f1799a087b3f -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_prices_vatlayer-1.2.0-py3-none-any.whl.
File metadata
- Download URL: django_prices_vatlayer-1.2.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5396ccb094e49e4fb083d7d88ec6de2c9e871dce32e458bc15e4590aa0958d26
|
|
| MD5 |
eed5182c565651ebdb556ef4ee037bcc
|
|
| BLAKE2b-256 |
f2c6763d41275c60ecb6faa8b772dd720ff083d1ad1762dbb2ca2b217312e39d
|
Provenance
The following attestation bundles were made for django_prices_vatlayer-1.2.0-py3-none-any.whl:
Publisher:
publish.yml on mirumee/django-prices-vatlayer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_prices_vatlayer-1.2.0-py3-none-any.whl -
Subject digest:
5396ccb094e49e4fb083d7d88ec6de2c9e871dce32e458bc15e4590aa0958d26 - Sigstore transparency entry: 653851762
- Sigstore integration time:
-
Permalink:
mirumee/django-prices-vatlayer@3b3747be05e2a95c4a80dd3fc296f1799a087b3f -
Branch / Tag:
refs/tags/1.2.0 - Owner: https://github.com/mirumee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3b3747be05e2a95c4a80dd3fc296f1799a087b3f -
Trigger Event:
release
-
Statement type: