A tax module for Cartridge.
Project description
#cartridge_tax
An implementation of sales tax for [Cartridge](http://cartridge.jupo.org/).
A flat sales or value-added tax can be applied to in-state or all sales. Tax can optionally be applied to shipping costs.
For US-based sites, [TaxCloud.net](http://taxcloud.net/)'s tax lookup web service is optional. An experimental integration of TaxCloud's tax authorization and capture exists.
## DISCLAIMER
This should work out-of-the-box for simple cases. However, your particular implementation
of Cartridge may require rewriting this or merging components into or out of other projects.
## Installation
Working in your project's [virtualenv](http://www.virtualenv.org/en/latest/index.html):
```
git clone https://github.com/kenbolton/cartridge-tax.git
cd cartridge-tax
python setup.py install
```
Add `'cartridge_tax'` to your settings.INSTALLED_APPS before
`'cartridge.shop'`.
Set up your tax information in the admin configuration settings,
/admin/conf/setting/. Note the value you put in 'Shop State'. You will
need to inject a "choices" dict into
`cartridge.shop.forms.OrderForm['fields']['shipping_detail_state']`. The
values in that dict should match the style in 'Shop State'. See the
example below in `Custom OrderForm`.
### Billing/Shipping and Order Handlers
Add the following to your settings:
```
SHOP_HANDLER_BILLING_SHIPPING = \
"cartridge_tax.checkout.tax_billship_handler"
SHOP_HANDLER_ORDER = "cartridge_tax.checkout.tax_order_handler"
```
### Extra model fields
Below is an example of settings.EXTRA_MODEL_FIELDS. Be sure to add these
tuples to your own EXTRA_MODEL_FIELDS.
```
EXTRA_MODEL_FIELDS = (
(
"cartridge.shop.models.Product.tic",
"CharField",
(u"Taxability Information Code",),
{"max_length":"5", "blank": True, "default":"00000", },
),
(
"cartridge.shop.models.Order.tax_total",
"DecimalField",
(u"Tax Total",),
{"null": True, "blank": True, "max_digits": 10,
"decimal_places": 2},
),
(
"cartridge.shop.models.Order.tax_type",
"CharField",
(u"Tax Type",),
{"blank": True, "max_length": "20", "default":"Flat sales tax"},
),
)
```
### Custom OrderForm
An example for the US.
Assuming your app is named `app`, add `SHOP_CHECKOUT_FORM_CLASS = 'app.forms.OrderForm'`
to settings. Create `app/forms.py`, and fill with:
```
class OrderForm(OrderForm):
def __init__(self, request, step, *args,**kwrds):
first = step == checkout.CHECKOUT_STEP_FIRST
super(OrderForm, self).__init__(request, step, *args, **kwrds)
if settings.SHOP_CHECKOUT_STEPS_SPLIT:
if first:
self.fields['billing_detail_state'].widget = USStateSelect()
self.fields['shipping_detail_state'].widget = USStateSelect()
```
## Registered Settings
* TAX_SHOP_ADDRESS
* TAX_SHOP_ADDRESS2
* TAX_SHOP_CITY
* TAX_SHOP_STATE
* TAX_SHOP_POSTCODE
* TAX_SHOP_POSTCODE_PLUS4
* TAX_OUT_OF_STATE
* TAX_FLAT_RATE
* TAX_SHIPPING_ADDRESS
* TAX_SHIPPING
* TAX_USE_TAXCLOUD
* TAX_USE_TAXCLOUD_AUTHORIZATION
* TAX_TAXCLOUD_API_ID
* TAX_TAXCLOUD_API_KEY
An implementation of sales tax for [Cartridge](http://cartridge.jupo.org/).
A flat sales or value-added tax can be applied to in-state or all sales. Tax can optionally be applied to shipping costs.
For US-based sites, [TaxCloud.net](http://taxcloud.net/)'s tax lookup web service is optional. An experimental integration of TaxCloud's tax authorization and capture exists.
## DISCLAIMER
This should work out-of-the-box for simple cases. However, your particular implementation
of Cartridge may require rewriting this or merging components into or out of other projects.
## Installation
Working in your project's [virtualenv](http://www.virtualenv.org/en/latest/index.html):
```
git clone https://github.com/kenbolton/cartridge-tax.git
cd cartridge-tax
python setup.py install
```
Add `'cartridge_tax'` to your settings.INSTALLED_APPS before
`'cartridge.shop'`.
Set up your tax information in the admin configuration settings,
/admin/conf/setting/. Note the value you put in 'Shop State'. You will
need to inject a "choices" dict into
`cartridge.shop.forms.OrderForm['fields']['shipping_detail_state']`. The
values in that dict should match the style in 'Shop State'. See the
example below in `Custom OrderForm`.
### Billing/Shipping and Order Handlers
Add the following to your settings:
```
SHOP_HANDLER_BILLING_SHIPPING = \
"cartridge_tax.checkout.tax_billship_handler"
SHOP_HANDLER_ORDER = "cartridge_tax.checkout.tax_order_handler"
```
### Extra model fields
Below is an example of settings.EXTRA_MODEL_FIELDS. Be sure to add these
tuples to your own EXTRA_MODEL_FIELDS.
```
EXTRA_MODEL_FIELDS = (
(
"cartridge.shop.models.Product.tic",
"CharField",
(u"Taxability Information Code",),
{"max_length":"5", "blank": True, "default":"00000", },
),
(
"cartridge.shop.models.Order.tax_total",
"DecimalField",
(u"Tax Total",),
{"null": True, "blank": True, "max_digits": 10,
"decimal_places": 2},
),
(
"cartridge.shop.models.Order.tax_type",
"CharField",
(u"Tax Type",),
{"blank": True, "max_length": "20", "default":"Flat sales tax"},
),
)
```
### Custom OrderForm
An example for the US.
Assuming your app is named `app`, add `SHOP_CHECKOUT_FORM_CLASS = 'app.forms.OrderForm'`
to settings. Create `app/forms.py`, and fill with:
```
class OrderForm(OrderForm):
def __init__(self, request, step, *args,**kwrds):
first = step == checkout.CHECKOUT_STEP_FIRST
super(OrderForm, self).__init__(request, step, *args, **kwrds)
if settings.SHOP_CHECKOUT_STEPS_SPLIT:
if first:
self.fields['billing_detail_state'].widget = USStateSelect()
self.fields['shipping_detail_state'].widget = USStateSelect()
```
## Registered Settings
* TAX_SHOP_ADDRESS
* TAX_SHOP_ADDRESS2
* TAX_SHOP_CITY
* TAX_SHOP_STATE
* TAX_SHOP_POSTCODE
* TAX_SHOP_POSTCODE_PLUS4
* TAX_OUT_OF_STATE
* TAX_FLAT_RATE
* TAX_SHIPPING_ADDRESS
* TAX_SHIPPING
* TAX_USE_TAXCLOUD
* TAX_USE_TAXCLOUD_AUTHORIZATION
* TAX_TAXCLOUD_API_ID
* TAX_TAXCLOUD_API_KEY
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cartridge-tax-0.0.1b.tar.gz
(14.0 kB
view details)
File details
Details for the file cartridge-tax-0.0.1b.tar.gz
.
File metadata
- Download URL: cartridge-tax-0.0.1b.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6da8afa29586666f0a8fa656348eecc3cfaf8a0082f49d6b862df5d1e515da4a |
|
MD5 | ad611bdd59f622cdd0bd1193caeb7f0f |
|
BLAKE2b-256 | a525f758a7487493e666a56a3425ad4588315171a561246db1b62dc8813e3387 |