API Reference

PNP Installations

class oscarcch.calculator.CCHTaxCalculator[source]

Simple interface between Python and the CCH Sales Tax Office SOAP API.

apply_taxes(basket, shipping_address, ignore_cch_fail=False)[source]

Apply taxes to a Basket instance using the given shipping address.

Pass return value of this method to OrderTaxation.save_details to persist the taxation details, CCH transaction ID, etc in the database.

Parameters
  • basketBasket instance

  • shipping_addressShippingAddress instance

  • ignore_cch_fail – When True, allows CCH to fail silently

Returns

SOAP Response.

client

Lazy constructor for SOAP client

estimate_taxes(basket, shipping_address)[source]

DEPRECATED. Use CCHTaxCalculator.apply_taxes instead.

Models

class oscarcch.models.OrderTaxation(*args, **kwargs)[source]

Persist top-level taxation data related to an Order.

exception DoesNotExist
exception MultipleObjectsReturned
messages

Message text returned by CCH

order

One-to-one foreign key to order.Order.

classmethod save_details(order, taxes)[source]

Given an order and a SOAP response, persist the details.

Parameters
total_tax_applied

Total Tax applied to the order

transaction_id

Transaction ID returned by CCH

transaction_status

Transaction Status returned by CCH

class oscarcch.models.LineItemTaxation(*args, **kwargs)[source]

Persist taxation details related to a single order line.

exception DoesNotExist
exception MultipleObjectsReturned
country_code

Country code used to calculate taxes

line_item

One-to-one foreign key to order.Line

state_code

State code used to calculate taxes

total_tax_applied

Total tax applied to the line

class oscarcch.models.LineItemTaxationDetail(*args, **kwargs)[source]

Represents a single type tax applied to a line.

exception DoesNotExist
exception MultipleObjectsReturned
data

HStore of data about the applied tax

taxation

Many-to-one foreign key to LineItemTaxation