File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 55import hashlib
66import hmac
77import decimal
8+ import warnings
89
910from . import exceptions
1011from requests_oauthlib import OAuth2Session
@@ -19,6 +20,7 @@ class Environments(object):
1920
2021
2122class QuickBooks (object ):
23+ MINIMUM_MINOR_VERSION = 75
2224 company_id = 0
2325 session = None
2426 auth_client = None
@@ -77,6 +79,12 @@ def __new__(cls, **kwargs):
7779 if 'minorversion' in kwargs :
7880 instance .minorversion = kwargs ['minorversion' ]
7981
82+ if instance .minorversion < instance .MINIMUM_MINOR_VERSION :
83+ warnings .warn (
84+ 'Minor Version no longer supported.'
85+ 'See: https://blogs.intuit.com/2025/01/21/changes-to-our-accounting-api-that-may-impact-your-application/' ,
86+ DeprecationWarning )
87+
8088 instance .invoice_link = kwargs .get ('invoice_link' , False )
8189
8290 if 'verifier_token' in kwargs :
Original file line number Diff line number Diff line change 11import json
2+ import warnings
23from tests .integration .test_base import QuickbooksUnitTestCase
34
45try :
@@ -31,12 +32,28 @@ def test_client_new(self):
3132 self .qb_client = client .QuickBooks (
3233 company_id = "company_id" ,
3334 verbose = True ,
34- minorversion = 4 ,
35+ minorversion = 75 ,
3536 verifier_token = TEST_VERIFIER_TOKEN ,
3637 )
3738
3839 self .assertEqual (self .qb_client .company_id , "company_id" )
39- self .assertEqual (self .qb_client .minorversion , 4 )
40+ self .assertEqual (self .qb_client .minorversion , 75 )
41+
42+ def test_client_with_deprecated_minor_version (self ):
43+ with warnings .catch_warnings (record = True ) as w :
44+ self .qb_client = client .QuickBooks (
45+ company_id = "company_id" ,
46+ verbose = True ,
47+ minorversion = 74 ,
48+ verifier_token = TEST_VERIFIER_TOKEN ,
49+ )
50+
51+ warnings .simplefilter ("always" )
52+ self .assertEqual (self .qb_client .company_id , "company_id" )
53+ self .assertEqual (self .qb_client .minorversion , 74 )
54+ self .assertEqual (len (w ), 1 )
55+ self .assertTrue (issubclass (w [- 1 ].category , DeprecationWarning ))
56+ self .assertTrue ("Minor Version no longer supported." in str (w [- 1 ].message ))
4057
4158 def test_api_url (self ):
4259 qb_client = client .QuickBooks (sandbox = False )
You can’t perform that action at this time.
0 commit comments