Skip to content

Commit e522cc3

Browse files
committed
Updates to creditcardpayment and invoice
1 parent 885fcfa commit e522cc3

File tree

6 files changed

+31
-7
lines changed

6 files changed

+31
-7
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4+
* 0.8.4 (October 11, 2020)
5+
* Added support for the CreditCardPayment entity
6+
* Updated readme
7+
* Added missing property InvoiceLink and AllowOnlineACHPayment to Invoice object
8+
49
* 0.8.3 (August 24, 2020)
510
* Fixed issue with CompanyCurrency object
611
* Added to_ref method to the Term object

quickbooks/mixins.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,19 @@ def to_dict(self):
9393

9494
class ReadMixin(object):
9595
qbo_object_name = ""
96+
qbo_json_object_name = ""
9697

9798
@classmethod
9899
def get(cls, id, qb=None):
99100
if not qb:
100101
qb = QuickBooks()
101102

102103
json_data = qb.get_single_object(cls.qbo_object_name, pk=id)
103-
return cls.from_json(json_data[cls.qbo_object_name])
104+
105+
if cls.qbo_json_object_name != '':
106+
return cls.from_json(json_data[cls.qbo_json_object_name])
107+
else:
108+
return cls.from_json(json_data[cls.qbo_object_name])
104109

105110

106111
class SendMixin(object):
@@ -141,6 +146,7 @@ def void(self, qb=None):
141146

142147
class UpdateMixin(object):
143148
qbo_object_name = ""
149+
qbo_json_object_name = ""
144150

145151
def save(self, qb=None):
146152
if not qb:
@@ -151,9 +157,12 @@ def save(self, qb=None):
151157
else:
152158
json_data = qb.create_object(self.qbo_object_name, self.to_json())
153159

154-
obj = type(self).from_json(json_data[self.qbo_object_name])
155-
self.Id = obj.Id
160+
if self.qbo_json_object_name != '':
161+
obj = type(self).from_json(json_data[self.qbo_json_object_name])
162+
else:
163+
obj = type(self).from_json(json_data[self.qbo_object_name])
156164

165+
self.Id = obj.Id
157166
return obj
158167

159168

@@ -176,6 +185,7 @@ def delete(self, qb=None):
176185

177186
class ListMixin(object):
178187
qbo_object_name = ""
188+
qbo_json_object_name = ""
179189

180190
@classmethod
181191
def all(cls, order_by="", start_position="", max_results=100, qb=None):
@@ -253,8 +263,13 @@ def query(cls, select, qb=None):
253263

254264
obj_list = []
255265

256-
if cls.qbo_object_name in json_data["QueryResponse"]:
257-
for item_json in json_data["QueryResponse"][cls.qbo_object_name]:
266+
if cls.qbo_json_object_name != '':
267+
object_name = cls.qbo_json_object_name
268+
else:
269+
object_name = cls.qbo_object_name
270+
271+
if object_name in json_data["QueryResponse"]:
272+
for item_json in json_data["QueryResponse"][object_name]:
258273
obj_list.append(cls.from_json(item_json))
259274

260275
return obj_list

quickbooks/objects/creditcardpayment_entity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class CreditCardPayment(DeleteMixin, QuickbooksManagedObject, QuickbooksTransact
2020
}
2121

2222
qbo_object_name = "CreditCardPayment"
23+
qbo_json_object_name = "CreditCardPaymentTxn" # JSON object name doesn't match the endpoint name - Thanks Intuit!
2324

2425
def __init__(self):
2526
super(CreditCardPayment, self).__init__()

quickbooks/objects/invoice.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ def __init__(self):
5959
self.Balance = 0
6060
self.AllowIPNPayment = True
6161
self.AllowOnlineCreditCardPayment = False
62+
self.AllowOnlineACHPayment = False
6263
self.DocNumber = None
64+
6365
self.PrivateNote = ""
6466
self.DueDate = ""
6567
self.ShipDate = ""
@@ -70,6 +72,7 @@ def __init__(self):
7072
self.EmailStatus = "NotSet"
7173
self.ExchangeRate = 1
7274
self.GlobalTaxCalculation = "TaxExcluded"
75+
self.InvoiceLink = ""
7376

7477
self.EInvoiceStatus = None
7578

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def read(*parts):
1010
return fp.read()
1111

1212

13-
VERSION = (0, 8, 3)
13+
VERSION = (0, 8, 4)
1414
version = '.'.join(map(str, VERSION))
1515

1616
setup(

tests/integration/test_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def setUp(self):
1717
)
1818

1919
self.qb_client = QuickBooks(
20-
minorversion=53,
20+
minorversion=54,
2121
auth_client=self.auth_client,
2222
refresh_token=os.environ.get('REFRESH_TOKEN'),
2323
company_id=os.environ.get('COMPANY_ID'),

0 commit comments

Comments
 (0)