Skip to content

Commit

Permalink
Support For Tax Codes API (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
NileshPant1999 authored Aug 10, 2021
1 parent aa6faf2 commit 88f0bee
Show file tree
Hide file tree
Showing 4 changed files with 25 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 @@ -15,6 +15,7 @@
from .attachments import Attachments
from .customers import Customers
from .bill_payments import BillPayments
from .tax_codes import TaxCodes

__all_ = [
'Accounts',
Expand All @@ -30,5 +31,6 @@
'JournalEntries',
'Attachments',
'Customers',
'BillPayments'
'BillPayments',
'TaxCodes'
]
18 changes: 18 additions & 0 deletions qbosdk/apis/tax_codes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
Quickbooks Online Tax Codes
"""
from .api_base import ApiBase


class TaxCodes(ApiBase):
"""Class for TaxCode APIs."""

GET_TAX_CODES = '/query?query=select * from TaxCode STARTPOSITION {0} MAXRESULTS 1000'

def get(self):
"""Get a list of the existing Tax Code in the Organization.
Returns:
Dict in TaxCode schema.
"""
return self._query_get_all('TaxCode', TaxCodes.GET_TAX_CODES)
3 changes: 3 additions & 0 deletions qbosdk/qbosdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(self, client_id: str, client_secret: str,
self.journal_entries = JournalEntries()
self.attachments = Attachments()
self.bill_payments = BillPayments()
self.tax_codes = TaxCodes()

self.update_server_url()
self.update_access_token()
Expand All @@ -81,6 +82,7 @@ def update_server_url(self):
self.customers.set_server_url(base_url)
self.attachments.set_server_url(base_url)
self.bill_payments.set_server_url(base_url)
self.tax_codes.set_server_url(base_url)

def update_access_token(self):
"""
Expand All @@ -103,6 +105,7 @@ def update_access_token(self):
self.customers.change_access_token(access_token)
self.attachments.change_access_token(access_token)
self.bill_payments.change_access_token(access_token)
self.tax_codes.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.10.0',
version='0.11.0',
author='Shwetabh Kumar',
author_email='[email protected]',
description='Python SDK for accessing Quickbooks Online APIs',
Expand Down

0 comments on commit 88f0bee

Please sign in to comment.