Skip to content

Commit e623957

Browse files
authored
Merge pull request routablehq#163 from EquityZen/master
Update Invoice and SendMixin Classes
2 parents 0b3b9ec + 0ecd773 commit e623957

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

quickbooks/mixins.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from future.moves.urllib.parse import quote
2+
13
import simplejson as json
24
import six
35
from .utils import build_where_clause, build_choose_clause
@@ -107,6 +109,7 @@ def send(self, qb=None, send_to=None):
107109
end_point = "{0}/{1}/send".format(self.qbo_object_name.lower(), self.Id)
108110

109111
if send_to:
112+
send_to = quote(send_to, safe='')
110113
end_point = "{0}?sendTo={1}".format(end_point, send_to)
111114

112115
results = qb.misc_operation(end_point, None, 'application/octet-stream')

quickbooks/objects/invoice.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def __init__(self):
5858
self.Deposit = 0
5959
self.Balance = 0
6060
self.AllowIPNPayment = True
61+
self.AllowOnlineCreditCardPayment = False
6162
self.DocNumber = None
6263
self.PrivateNote = ""
6364
self.DueDate = ""

tests/unit/test_mixins.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
12
import os
3+
24
import unittest
5+
from future.moves.urllib.parse import quote
36

47
from quickbooks.objects import Bill, Invoice
58

@@ -353,9 +356,12 @@ def test_send(self, mock_misc_op):
353356
def test_send_with_send_to_email(self, mock_misc_op):
354357
invoice = Invoice()
355358
invoice.Id = 2
356-
invoice.send(qb=self.qb_client, send_to="test@email.com")
359+
email = "test@email.com"
360+
send_to_email = quote(email, safe='')
361+
362+
invoice.send(qb=self.qb_client, send_to=email)
357363

358-
mock_misc_op.assert_called_with("invoice/2/send?sendTo=test@email.com", None, 'application/octet-stream')
364+
mock_misc_op.assert_called_with("invoice/2/send?sendTo={}".format(send_to_email), None, 'application/octet-stream')
359365

360366

361367
class VoidMixinTest(QuickbooksUnitTestCase):

0 commit comments

Comments
 (0)