diff --git a/qbosdk/apis/journal_entries.py b/qbosdk/apis/journal_entries.py index 0a44878..96ff041 100644 --- a/qbosdk/apis/journal_entries.py +++ b/qbosdk/apis/journal_entries.py @@ -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): """ @@ -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) diff --git a/qbosdk/apis/purchases.py b/qbosdk/apis/purchases.py index 58b885b..1208b57 100644 --- a/qbosdk/apis/purchases.py +++ b/qbosdk/apis/purchases.py @@ -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): """ @@ -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) diff --git a/setup.py b/setup.py index f9e99fa..e5101ac 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name='qbosdk', - version='0.2.1', + version='0.3.0', author='Shwetabh Kumar', author_email='shwetabh.kumar@fyle.in', description='Python SDK for accessing Quickbooks Online APIs',