Skip to content

Commit

Permalink
Delete Journal Entries and Purchases By Id (#3)
Browse files Browse the repository at this point in the history
* Delete Journal Entries and Purchases By Id

* Bumpling up the version
  • Loading branch information
Shwetabhk authored Dec 18, 2019
1 parent 63ad085 commit db0b120
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
15 changes: 14 additions & 1 deletion qbosdk/apis/journal_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class JournalEntries(ApiBase):

GET_JOURNAL_ENTRIES = '/query?query=select * from JournalEntry STARTPOSITION {0} MAXRESULTS 1000'
POST_JOURNAL_ENTRY = '/journalentry?minorversion=38'
DELETE_JOURNAL_ENTRY = '/journalentry?operation=delete'

def get(self):
"""
Expand All @@ -20,8 +21,20 @@ def get(self):

def post(self, data: Dict):
"""
Post JournalEntry (check, etc) to Quickbooks Online
Post JournalEntry to Quickbooks Online
:param data: Dict in JournalEntry schema
:return:
"""
return self._post_request(data, JournalEntries.POST_JOURNAL_ENTRY)

def delete(self, journal_entry_id: str):
"""
Delete JournalEntry from Quickbooks Online
:param journal_entry_id: Journal Entry Id to remove
:return: Dict response
"""
data = {
'Id': journal_entry_id,
'SyncToken': '1'
}
return self._post_request(data, JournalEntries.DELETE_JOURNAL_ENTRY)
13 changes: 13 additions & 0 deletions qbosdk/apis/purchases.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Purchases(ApiBase):

GET_PURCHASES = '/query?query=select * from Purchase STARTPOSITION {0} MAXRESULTS 1000'
POST_PURCHASE = '/purchase?minorversion=38'
DELETE_PURCHASE = '/purchase?operation=delete'

def get(self):
"""
Expand All @@ -25,3 +26,15 @@ def post(self, data: Dict):
:return:
"""
return self._post_request(data, Purchases.POST_PURCHASE)

def delete(self, purchase_id: str):
"""
Delete Purchase (check, etc) from Quickbooks Online
:param purchase_id: Journal Entry Id to remove
:return: Dict response
"""
data = {
'Id': purchase_id,
'SyncToken': '1'
}
return self._post_request(data, Purchases.DELETE_PURCHASE)
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.2.1',
version='0.3.0',
author='Shwetabh Kumar',
author_email='[email protected]',
description='Python SDK for accessing Quickbooks Online APIs',
Expand Down

0 comments on commit db0b120

Please sign in to comment.