File tree 2 files changed +27
-2
lines changed
2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 5
5
import hashlib
6
6
import hmac
7
7
import decimal
8
+ import warnings
8
9
9
10
from . import exceptions
10
11
from requests_oauthlib import OAuth2Session
@@ -19,6 +20,7 @@ class Environments(object):
19
20
20
21
21
22
class QuickBooks (object ):
23
+ MINIMUM_MINOR_VERSION = 75
22
24
company_id = 0
23
25
session = None
24
26
auth_client = None
@@ -77,6 +79,12 @@ def __new__(cls, **kwargs):
77
79
if 'minorversion' in kwargs :
78
80
instance .minorversion = kwargs ['minorversion' ]
79
81
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
+
80
88
instance .invoice_link = kwargs .get ('invoice_link' , False )
81
89
82
90
if 'verifier_token' in kwargs :
Original file line number Diff line number Diff line change 1
1
import json
2
+ import warnings
2
3
from tests .integration .test_base import QuickbooksUnitTestCase
3
4
4
5
try :
@@ -31,12 +32,28 @@ def test_client_new(self):
31
32
self .qb_client = client .QuickBooks (
32
33
company_id = "company_id" ,
33
34
verbose = True ,
34
- minorversion = 4 ,
35
+ minorversion = 75 ,
35
36
verifier_token = TEST_VERIFIER_TOKEN ,
36
37
)
37
38
38
39
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 ))
40
57
41
58
def test_api_url (self ):
42
59
qb_client = client .QuickBooks (sandbox = False )
You can’t perform that action at this time.
0 commit comments