Skip to content

Commit bb7381e

Browse files
authored
Merge pull request #335 from ej2/0.9.6
0.9.6
2 parents 1f2bdb2 + 269b84e commit bb7381e

22 files changed

+476
-313
lines changed

.github/workflows/codecov.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- name: Upload coverage reports to Codecov
2+
uses: codecov/codecov-action@v3
3+
env:
4+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/pylint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: ["3.8", "3.9", "3.10"]
10+
python-version: ["3.8", "3.9", "3.10", "3.11"]
1111
steps:
1212
- uses: actions/checkout@v3
1313
- name: Set up Python ${{ matrix.python-version }}

CHANGELOG.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
Changelog
22
=========
3+
* 0.9.6 (January 2, 2024)
4+
* Replace RAuth with requests_oauthlib
5+
* Removed python 2 code from client.py
6+
* Removed unused dependencies from Pipfile
7+
* Added new fields to Employee object
8+
* Added VendorAddr to Bill object
9+
* Added new fields to Estimate object
10+
* Fix TaxInclusiveAmt and vendor setting 1099 creation
11+
* Updated readme and contributing
12+
313
* 0.9.5 (November 1, 2023)
414
* Added the ability to void all voidable QB types
515
* Added to_ref to CreditMemo object

Pipfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7+
coverage = "*"
8+
twine = "*"
9+
pytest = "*"
10+
pytest-cov = "*"
711

812
[packages]
9-
urllib3 = ">=1.26.5"
10-
bleach = ">=3.3.0"
13+
urllib3 = ">=2.1.0"
1114
intuit-oauth = "==1.2.4"
12-
rauth = ">=0.7.3"
1315
requests = ">=2.31.0"
1416
simplejson = ">=3.19.1"
15-
nose = "*"
16-
coverage = "*"
17-
twine = "*"
17+
requests_oauthlib = ">=1.3.1"

Pipfile.lock

Lines changed: 380 additions & 237 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ Then create a QuickBooks client object passing in the AuthClient, refresh token,
5454
company_id='COMPANY_ID',
5555
)
5656

57-
If you need to access a minor version (See [Minor versions](https://developer.intuit.com/docs/0100_quickbooks_online/0200_dev_guides/accounting/minor_versions) for
57+
If you need to access a minor version (See [Minor versions](https://developer.intuit.com/app/developer/qbo/docs/learn/explore-the-quickbooks-online-api/minor-versions#working-with-minor-versions) for
5858
details) pass in minorversion when setting up the client:
5959

6060
client = QuickBooks(
6161
auth_client=auth_client,
6262
refresh_token='REFRESH_TOKEN',
6363
company_id='COMPANY_ID',
64-
minorversion=59
64+
minorversion=69
6565
)
6666

6767
Object Operations
@@ -74,7 +74,9 @@ List of objects:
7474

7575
**Note:** The maximum number of entities that can be returned in a
7676
response is 1000. If the result size is not specified, the default
77-
number is 100. (See [Intuit developer guide](https://developer.intuit.com/docs/0100_accounting/0300_developer_guides/querying_data) for details)
77+
number is 100. (See [Query operations and syntax](https://developer.intuit.com/app/developer/qbo/docs/learn/explore-the-quickbooks-online-api/data-queries) for details)
78+
79+
**Warning:** You should never allow user input to pass into a query without sanitizing it first! This library DOES NOT sanitize user input!
7880

7981
Filtered list of objects:
8082

@@ -104,6 +106,8 @@ List with custom Where Clause (do not include the `"WHERE"`):
104106

105107
customers = Customer.where("Active = True AND CompanyName LIKE 'S%'", qb=client)
106108

109+
110+
107111
List with custom Where and ordering
108112

109113
customers = Customer.where("Active = True AND CompanyName LIKE 'S%'", order_by='DisplayName', qb=client)
@@ -112,7 +116,7 @@ List with custom Where Clause and paging:
112116

113117
customers = Customer.where("CompanyName LIKE 'S%'", start_position=1, max_results=25, qb=client)
114118

115-
Filtering a list with a custom query (See [Intuit developer guide](https://developer.intuit.com/docs/0100_accounting/0300_developer_guides/querying_data) for
119+
Filtering a list with a custom query (See [Query operations and syntax](https://developer.intuit.com/app/developer/qbo/docs/learn/explore-the-quickbooks-online-api/data-queries) for
116120
supported SQL statements):
117121

118122
customers = Customer.query("SELECT * FROM Customer WHERE Active = True", qb=client)

contributing.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
11
# Contributing
22

3-
I am accepting pull requests. Sometimes life gets busy and it takes me a little while to get everything merged in. To help speed up the process, please write tests to cover your changes. I will review/merge them as soon as possible.
3+
I am accepting pull requests. Sometimes life gets busy and it takes me a little while to get everything reviewed and merged in. To help speed up the process, please write tests to cover your changes. I will review/merge them as soon as possible.
44

55
# Testing
66

7-
I use [nose](https://nose.readthedocs.io/en/latest/index.html) and [Coverage](https://coverage.readthedocs.io/en/latest/) to run the test suite.
7+
I use [pytest](https://docs.pytest.org/en/7.4.x/contents.html), [Coverage](https://coverage.readthedocs.io/en/latest/), and [pytest-cov](https://pytest-cov.readthedocs.io/en/latest/) to run the test suite.
88

99
*WARNING*: The Tests connect to the QBO API and create/modify/delete data. DO NOT USE A PRODUCTION ACCOUNT!
1010

1111
## Testing setup:
1212

1313
1. Create/login into your [Intuit Developer account](https://developer.intuit.com).
1414
2. On your Intuit Developer account, create a Sandbox company and an App.
15-
3. Go to the Intuit Developer OAuth 2.0 Playground and fill out the form to get an **access token** and **refresh token**. You will need to copy the following values into your enviroment variables:
15+
3. Go to the Intuit Developer OAuth 2.0 Playground and fill out the form to get a **refresh token**. You will need to copy the following values into your enviroment variables:
1616
```
1717
export CLIENT_ID="<Client ID>"
1818
export CLIENT_SECRET="<Client Secret>"
19-
export COMPANY_ID="<Realm ID>"
20-
export ACCESS_TOKEN="<Access token>"
19+
export COMPANY_ID="<Realm ID>"
2120
export REFRESH_TOKEN="<Refresh token>"
2221
```
2322

24-
*Note*: You will need to update the access token when it expires.
23+
*Note*: You will need to update the refresh token when it expires.
2524

26-
5. Install *nose* and *coverage*. Using Pip:
27-
`pip install nose coverage`
25+
5. Install *pytest*, *coverage*, and *pytest-cov*. Using Pip (or whatever):
26+
`pip install pytest coverage pytest-cov`
2827

29-
6. Run `nosetests . --with-coverage --cover-package=quickbooks`
28+
6. Run all tests: ```pytest --cov```
29+
Run only unit tests: ```pytest tests/unit --cov```
30+
Run only integration tests: ```pytest tests/intergration --cov```
31+
32+
3033

3134
## Creating new tests
3235
Normal Unit tests that do not connect to the QBO API should be located under `test/unit` Test that connect to QBO API should go under `tests/integration`. Inheriting from `QuickbooksTestCase` will automatically setup `self.qb_client` to use when connecting to QBO.

quickbooks/client.py

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
1-
import warnings
2-
3-
try: # Python 3
4-
import http.client as httplib
5-
from urllib.parse import parse_qsl
6-
from functools import partial
7-
to_bytes = lambda value, *args, **kwargs: bytes(value, "utf-8", *args, **kwargs)
8-
except ImportError: # Python 2
9-
import httplib
10-
from urlparse import parse_qsl
11-
to_bytes = str
12-
1+
import http.client as httplib
132
import textwrap
14-
import codecs
153
import json
16-
17-
from . import exceptions
184
import base64
195
import hashlib
206
import hmac
217

22-
try:
23-
from rauth import OAuth1Session, OAuth1Service, OAuth2Session
24-
except ImportError:
25-
print("Please import Rauth:\n\n")
26-
print("http://rauth.readthedocs.org/en/latest/\n")
27-
raise
8+
from . import exceptions
9+
from requests_oauthlib import OAuth2Session
10+
11+
to_bytes = lambda value, *args, **kwargs: bytes(value, "utf-8", *args, **kwargs)
2812

2913

3014
class Environments(object):
@@ -102,10 +86,13 @@ def _start_session(self):
10286
self.auth_client.refresh(refresh_token=self.refresh_token)
10387

10488
self.session = OAuth2Session(
105-
client_id=self.auth_client.client_id,
106-
client_secret=self.auth_client.client_secret,
107-
access_token=self.auth_client.access_token,
89+
self.auth_client.client_id,
90+
token={
91+
'access_token': self.auth_client.access_token,
92+
'refresh_token': self.auth_client.refresh_token,
93+
}
10894
)
95+
10996
return self.auth_client.refresh_token
11097

11198
def _drop(self):

quickbooks/objects/bill.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from quickbooks.objects.detailline import DetailLine, ItemBasedExpenseLine, AccountBasedExpenseLine, \
22
TDSLine
33
from .base import Ref, LinkedTxn, QuickbooksManagedObject, QuickbooksTransactionEntity, \
4-
LinkedTxnMixin
4+
LinkedTxnMixin, Address
55
from .tax import TxnTaxDetail
66
from ..mixins import DeleteMixin
77

@@ -20,6 +20,7 @@ class Bill(DeleteMixin, QuickbooksManagedObject, QuickbooksTransactionEntity, Li
2020
"AttachableRef": Ref,
2121
"DepartmentRef": Ref,
2222
"TxnTaxDetail": TxnTaxDetail,
23+
"VendorAddr": Address,
2324
}
2425

2526
list_dict = {
@@ -53,6 +54,7 @@ def __init__(self):
5354
self.VendorRef = None
5455
self.DepartmentRef = None
5556
self.APAccountRef = None
57+
self.VendorAddr = None
5658

5759
self.LinkedTxn = []
5860
self.Line = []

quickbooks/objects/detailline.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ class AccountBasedExpenseLineDetail(QuickbooksBaseObject):
174174
def __init__(self):
175175
super(AccountBasedExpenseLineDetail, self).__init__()
176176
self.BillableStatus = None
177-
self.TaxAmount = 0
178177
self.TaxInclusiveAmt = 0
179178

180179
self.CustomerRef = None
@@ -234,8 +233,8 @@ def __init__(self):
234233
super(ItemBasedExpenseLineDetail, self).__init__()
235234
self.BillableStatus = None
236235
self.UnitPrice = 0
237-
self.TaxInclusiveAmt = 0
238236
self.Qty = 0
237+
self.TaxInclusiveAmt = 0
239238
self.ItemRef = None
240239
self.ClassRef = None
241240
self.PriceLevelRef = None

0 commit comments

Comments
 (0)