Skip to content

Commit 6a40386

Browse files
Merge pull request #21 from intuit/401k
401K_Support
2 parents 85191fd + f5c49f6 commit 6a40386

File tree

6 files changed

+24
-10
lines changed

6 files changed

+24
-10
lines changed

intuitlib/client.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ def __init__(self, client_id, client_secret, redirect_uri, environment, state_to
6969
self.x_refresh_token_expires_in = None
7070
self.id_token = id_token
7171

72+
def setAuthorizeURLs(self, urlObject):
73+
"""Set authorization url using custom values passed in the data dict
74+
:param **data: data dict for custom authorizationURLS
75+
:return: self
76+
"""
77+
if urlObject is not None:
78+
self.auth_endpoint = urlObject['auth_endpoint']
79+
self.token_endpoint = urlObject['token_endpoint']
80+
self.revoke_endpoint = urlObject['revoke_endpoint']
81+
self.user_info_url = urlObject['user_info_url']
82+
return None
83+
7284
def get_authorization_url(self, scopes, state_token=None):
7385
"""Generates authorization url using scopes specified where user is redirected to
7486

intuitlib/enums.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class Scopes(Enum):
3333
PAYROLL = 'com.intuit.quickbooks.payroll'
3434
PAYROLL_TIMETRACKING = 'com.intuit.quickbooks.payroll.timetracking'
3535
PAYROLL_BENEFITS = 'com.intuit.quickbooks.payroll.benefits'
36+
PAYSLIP_READ = 'com.intuit.quickbooks.payroll.payslip.read'
3637

3738
# For migrated apps only
3839
# To not see consent page they should pass the following scopes - openid intuit_name email

intuitlib/utils.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,22 @@
3434

3535
def get_discovery_doc(environment, session=None):
3636
"""Gets discovery doc based on environment specified.
37-
3837
:param environment: App environment, accepted values: 'sandbox','production','prod','e2e'
3938
:param session: `requests.Session` object if a session is already being used, defaults to None
4039
:return: Discovery doc response
4140
:raises HTTPError: if response status != 200
4241
"""
43-
4442
if environment.lower() in ['production', 'prod']:
4543
discovery_url = DISCOVERY_URL['production']
46-
else:
44+
elif environment.lower() in ['sandbox', 'sand']:
4745
discovery_url = DISCOVERY_URL['sandbox']
48-
49-
50-
response = requests.get(url=discovery_url, headers={'User-Agent': 'Mozilla/5.0'})
46+
else:
47+
discovery_url = environment
5148

49+
if session is not None and isinstance(session, Session):
50+
response = session.get(url=discovery_url)
51+
else:
52+
response = requests.get(url=discovery_url)
5253
if response.status_code != 200:
5354
raise AuthClientError(response)
5455
return response.json()

intuitlib/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = '1.2.3'
15+
__version__ = '1.2.4'

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ future>=0.16.0
33
requests>=2.13.0
44
mock>=2.0.0
55
requests_oauthlib>=1.0.0
6-
coverage==4.0.3
6+
coverage==4.4
77
python-coveralls>=2.9.0
88
pytest>=3.8.0
99
pytest-cov==2.5.0

tests/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def test_get_discovery_doc_production(self):
5252
assert discovery_doc['issuer'] == 'https://oauth.platform.intuit.com/op/v1'
5353
assert discovery_doc['userinfo_endpoint'] == 'https://accounts.platform.intuit.com/v1/openid_connect/userinfo'
5454

55-
def test_get_discovery_doc_invalid_input(self):
56-
discovery_doc = get_discovery_doc('random')
55+
def test_get_discovery_doc_custom_url_input(self):
56+
discovery_doc = get_discovery_doc('https://developer.intuit.com/.well-known/openid_sandbox_configuration/')
5757

5858
assert discovery_doc['issuer'] =='https://oauth.platform.intuit.com/op/v1'
5959
assert discovery_doc['userinfo_endpoint'] == 'https://sandbox-accounts.platform.intuit.com/v1/openid_connect/userinfo'

0 commit comments

Comments
 (0)