Skip to content

Commit

Permalink
Tax rate support (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
NileshPant1999 authored Sep 3, 2021
1 parent 88f0bee commit 75d4d3c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
4 changes: 3 additions & 1 deletion qbosdk/apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .customers import Customers
from .bill_payments import BillPayments
from .tax_codes import TaxCodes
from .tax_rates import TaxRates

__all_ = [
'Accounts',
Expand All @@ -32,5 +33,6 @@
'Attachments',
'Customers',
'BillPayments',
'TaxCodes'
'TaxCodes',
'TaxRates'
]
26 changes: 26 additions & 0 deletions qbosdk/apis/tax_rates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
Quickbooks Online TaxRates
"""
from .api_base import ApiBase


class TaxRates(ApiBase):
"""Class for TaxRates APIs."""

GET_TAX_RATES = '/query?query=select * from TaxRate STARTPOSITION {0} MAXRESULTS 1000'
GET_TAX_RATES_BY_ID = '/taxrate/{0}'

def get(self):
"""
Get all Taxrates
:return: List of Dicts in Taxrates Schema
"""
return self._query_get_all('TaxRate', TaxRates.GET_TAX_RATES)

def get_by_id(self, taxrateId: str):
"""
Get Taxrates from Quickbooks Online
:param taxrateId: Taxrate Id
:return: Dict Response
"""
return self._get_request('TaxRate', TaxRates.GET_TAX_RATES_BY_ID.format(taxrateId))
3 changes: 3 additions & 0 deletions qbosdk/qbosdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self, client_id: str, client_secret: str,
self.attachments = Attachments()
self.bill_payments = BillPayments()
self.tax_codes = TaxCodes()
self.tax_rates = TaxRates()

self.update_server_url()
self.update_access_token()
Expand All @@ -83,6 +84,7 @@ def update_server_url(self):
self.attachments.set_server_url(base_url)
self.bill_payments.set_server_url(base_url)
self.tax_codes.set_server_url(base_url)
self.tax_rates.set_server_url(base_url)

def update_access_token(self):
"""
Expand All @@ -106,6 +108,7 @@ def update_access_token(self):
self.attachments.change_access_token(access_token)
self.bill_payments.change_access_token(access_token)
self.tax_codes.change_access_token(access_token)
self.tax_rates.change_access_token(access_token)

def __get_access_token(self):
"""Get the access token using a HTTP post.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name='qbosdk',
version='0.11.0',
version='0.12.0',
author='Shwetabh Kumar',
author_email='[email protected]',
description='Python SDK for accessing Quickbooks Online APIs',
Expand Down

0 comments on commit 75d4d3c

Please sign in to comment.