Skip to content

Commit 7b85f42

Browse files
committed
3.29.1
1 parent 4d04ee6 commit 7b85f42

File tree

9 files changed

+48
-4
lines changed

9 files changed

+48
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 3.29.1
2+
* Improve error handling around server timeouts
3+
14
## 3.29.0
25
* Allow 'default_payment_method' option in Customer
36

braintree/resource_collection.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import braintree
2+
from braintree.exceptions.unexpected_error import UnexpectedError
3+
14
class ResourceCollection(object):
25
"""
36
A class representing results from a search. Supports the iterator protocol::
@@ -8,6 +11,8 @@ class ResourceCollection(object):
811
"""
912

1013
def __init__(self, query, results, method):
14+
if "search_results" not in results:
15+
raise UnexpectedError("Unprocessable entity due to an invalid request")
1116
self.__ids = results["search_results"]["ids"]
1217
self.__method = method
1318
self.__page_size = results["search_results"]["page_size"]

braintree/transaction.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,12 @@ def create_signature():
507507
"points",
508508
"currency_amount",
509509
"currency_iso_code"
510-
]
510+
],
511+
"venmo_merchant_data": [
512+
"venmo_merchant_public_id",
513+
"originating_transaction_id",
514+
"originating_merchant_id"
515+
],
511516
},
512517
]
513518
},

braintree/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Version = "3.29.0"
1+
Version = "3.29.1"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from distutils.core import setup
22
setup(
33
name="braintree",
4-
version="3.29.0",
4+
version="3.29.1",
55
description="Braintree Python Library",
66
author="Braintree",
77
author_email="[email protected]",

tests/integration/test_sub_merchant_account.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
class TestSubMerchantAccount(unittest.TestCase):
66
def setUp(self):
7-
raise SkipTest("The SubMerchantAccount API is not currently supported. Skipping this test for now.")
7+
if skip_sub_merchant_account_tests():
8+
raise SkipTest("The SubMerchantAccount API is not currently supported. Skipping this test for now.")
9+
810
self.old_merchant_id = Configuration.merchant_id
911
self.old_public_key = Configuration.public_key
1012
self.old_private_key = Configuration.private_key

tests/integration/test_transaction.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,24 @@ def test_sale_with_vault_customer_and_credit_card_data_and_store_in_vault(self):
220220
self.assertEquals("411111******1111", transaction.credit_card_details.masked_number)
221221
self.assertEquals("411111******1111", transaction.vault_credit_card.masked_number)
222222

223+
def test_sale_with_venmo_merchant_data(self):
224+
result = Transaction.sale({
225+
"amount": Decimal(TransactionAmounts.Authorize),
226+
"credit_card": {
227+
"number": "4111111111111111",
228+
"expiration_date": "05/2009"
229+
},
230+
"options": {
231+
"venmo_merchant_data": {
232+
"venmo_merchant_public_id": "12345",
233+
"originating_transaction_id": "abc123",
234+
"originating_merchant_id": "xyz123",
235+
}
236+
}
237+
})
238+
239+
self.assertTrue(result.is_success)
240+
223241
def test_sale_with_custom_fields(self):
224242
result = Transaction.sale({
225243
"amount": TransactionAmounts.Authorize,

tests/test_helper.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from datetime import date, datetime, timedelta
1717
from decimal import Decimal
1818
from random import randint
19+
from subprocess import Popen, PIPE
1920

2021
from nose.tools import make_decorator
2122
from nose.tools import raises
@@ -61,6 +62,11 @@ def showwarning(message, category, filename, lineno, file=None, line=None):
6162
pass
6263
warnings.showwarning = showwarning
6364

65+
def skip_sub_merchant_account_tests():
66+
output, _ = Popen(["git", "rev-parse", "--abbrev-ref", "HEAD"], stdout=PIPE).communicate()
67+
branch_supports_sub_merchant_accounts = bool(re.match(r"^marketplace_v2$|^btmkpl", output.strip(), re.IGNORECASE))
68+
return not branch_supports_sub_merchant_accounts
69+
6470
class TestHelper(object):
6571

6672
default_merchant_account_id = "sandbox_credit_card"

tests/unit/test_resource_collection.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,8 @@ def test_ids_returns_array_of_ids(self):
4444
}
4545
collection = ResourceCollection("some_query", empty_collection_data, TestResourceCollection.TestResource.fetch)
4646
self.assertEqual(collection.ids, [])
47+
48+
@raises_with_regexp(UnexpectedError, "Unprocessable entity due to an invalid request")
49+
def test_no_search_results(self):
50+
bad_collection_data = { }
51+
collection = ResourceCollection("some_query", bad_collection_data, TestResourceCollection.TestResource.fetch)

0 commit comments

Comments
 (0)