Skip to content

Commit fa05645

Browse files
DTPAYWONE-564:
- Changed minimum supported Python version in README to 3.5, due to RSA library constraint. - Fixed pycodestyle complaints.
1 parent 83b1f96 commit fa05645

4 files changed

Lines changed: 23 additions & 20 deletions

File tree

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A library to manage users, transfer methods and payments through the Hyperwallet
1212
Prerequisites
1313
-------------
1414

15-
Hyperwallet's Python server SDK requires at minimum Python 2.7 and above.
15+
Hyperwallet's Python server SDK requires at minimum Python 3.5 and above.
1616

1717
Installation
1818
------------

hyperwallet/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2765,7 +2765,7 @@ def __buildUrl(self, *paths):
27652765
return '/'.join(s.strip('/') for s in paths)
27662766

27672767
def setDocumentAndReasonFromResponseHelper(self,
2768-
data=None):
2768+
data=None):
27692769
'''
27702770
Helper to modify dictionary with Document and Reason classes
27712771
@@ -3131,7 +3131,7 @@ def listTransferMethods(self,
31313131

31323132
if not userToken:
31333133
raise HyperwalletException('userToken is required')
3134-
3134+
31353135
if params and not set(list(params)).issubset(TransferMethod.filters_array):
31363136
raise HyperwalletException('Invalid filter')
31373137

hyperwallet/models.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import json
44
from enum import Enum
55

6+
67
class HyperwalletModel(object):
78
'''
89
The base Hyperwallet Model from which all other models will inherit.
@@ -70,7 +71,7 @@ class User(HyperwalletModel):
7071
A dictionary containing the attributes for the User.
7172
'''
7273

73-
filters_array = {'clientUserId','email','programToken','status','verificationStatus', 'taxVerificationStatus', 'createdBefore', 'createdAfter', 'sortBy', 'offset', 'limit'}
74+
filters_array = {'clientUserId', 'email', 'programToken', 'status', 'verificationStatus', 'taxVerificationStatus', 'createdBefore', 'createdAfter', 'sortBy', 'offset', 'limit'}
7475

7576
def __init__(self, data):
7677
'''
@@ -130,6 +131,7 @@ def __repr__(self):
130131
token=self.token
131132
)
132133

134+
133135
class HyperwalletVerificationDocument(HyperwalletModel):
134136
'''
135137
The HyperwalletVerificationDocument Model.
@@ -163,6 +165,7 @@ def __repr__(self):
163165
createdOn=self.createdOn, category=self.category
164166
)
165167

168+
166169
class HyperwalletVerificationDocumentReason(HyperwalletModel):
167170
'''
168171
The HyperwalletVerificationDocumentReason Model.
@@ -191,6 +194,7 @@ def __repr__(self):
191194
name=self.name, description=self.description
192195
)
193196

197+
194198
class RejectReason(Enum):
195199
DOCUMENT_EXPIRED = 0
196200
DOCUMENT_NOT_RELATED_TO_PROFILE = 1
@@ -201,6 +205,7 @@ class RejectReason(Enum):
201205
DOCUMENT_NOT_VALID_WITH_NOTES = 6
202206
DOCUMENT_TYPE_NOT_VALID = 7
203207

208+
204209
class AuthenticationToken(HyperwalletModel):
205210
'''
206211
The AuthenticationToken Model.
@@ -274,7 +279,7 @@ class BankAccount(TransferMethod):
274279
A dictionary containing the attributes for the Bank Account.
275280
'''
276281

277-
filters_array = {'type','status', 'createdBefore', 'createdAfter', 'sortBy', 'offset', 'limit'}
282+
filters_array = {'type', 'status', 'createdBefore', 'createdAfter', 'sortBy', 'offset', 'limit'}
278283

279284
def __init__(self, data):
280285
'''
@@ -487,7 +492,7 @@ class Transfer(HyperwalletModel):
487492
A dictionary containing the attributes for the Transfer.
488493
'''
489494

490-
filters_array = {'clientTransferId','sourceToken','destinationToken', 'createdBefore', 'createdAfter', 'offset', 'limit'}
495+
filters_array = {'clientTransferId', 'sourceToken', 'destinationToken', 'createdBefore', 'createdAfter', 'offset', 'limit'}
491496

492497
def __init__(self, data):
493498
'''
@@ -533,7 +538,7 @@ class PayPalAccount(TransferMethod):
533538
A dictionary containing the attributes for the PayPal Account.
534539
'''
535540

536-
filters_array = {'status', 'type', 'createdOn' , 'createdBefore', 'createdAfter', 'sortBy', 'offset', 'limit'}
541+
filters_array = {'status', 'type', 'createdOn', 'createdBefore', 'createdAfter', 'sortBy', 'offset', 'limit'}
537542

538543
def __init__(self, data):
539544
'''

hyperwallet/tests/test_api.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def setUp(self):
6464
'currencies': ['USD'],
6565
'type': 'INDIVIDUAL'
6666
}
67-
67+
6868
self.uploadSuccessData = {
6969
'token': 'tkn-12345',
7070
"documents": [{
@@ -84,12 +84,12 @@ def setUp(self):
8484
"status": "INVALID",
8585
"reasons": [
8686
{
87-
"name": "DOCUMENT_CORRECTION_REQUIRED",
88-
"description": "Document requires correction"
87+
"name": "DOCUMENT_CORRECTION_REQUIRED",
88+
"description": "Document requires correction"
8989
},
9090
{
91-
"name": "DOCUMENT_NOT_DECISIVE",
92-
"description": "Decision cannot be made based on document. Alternative document required"
91+
"name": "DOCUMENT_NOT_DECISIVE",
92+
"description": "Decision cannot be made based on document. Alternative document required"
9393
}
9494
],
9595
"createdOn": "2020-11-24T19:05:02"
@@ -220,7 +220,7 @@ def test_list_user_status_transitions_fail_need_params_invalid(self):
220220

221221
@mock.patch('hyperwallet.utils.ApiClient._makeRequest')
222222
def test_list_user_status_transitions_params_valid(self, mock_get):
223-
223+
224224
options = {'transition': 'test'}
225225
mock_get.return_value = {'data': [self.data]}
226226
response = self.api.listUserStatusTransitions('token', options)
@@ -810,7 +810,7 @@ def test_list_prepaid_cards_fail_need_params_invalid(self):
810810
self.api.listPrepaidCards('token', options)
811811

812812
self.assertEqual(exc.exception.message, 'Invalid filter')
813-
813+
814814
@mock.patch('hyperwallet.utils.ApiClient._makeRequest')
815815
def test_list_prepaid_cards_params_valid(self, mock_get):
816816

@@ -1892,7 +1892,7 @@ def test_list_venmo_accounts_fail_need_params_invalid(self):
18921892
self.api.listVenmoAccounts('token', options)
18931893

18941894
self.assertEqual(exc.exception.message, 'Invalid filter')
1895-
1895+
18961896
@mock.patch('hyperwallet.utils.ApiClient._makeRequest')
18971897
def test_list_venmo_accounts_params_valid(self, mock_get):
18981898

@@ -2101,7 +2101,7 @@ def test_get_payment_success(self, mock_get):
21012101
self.assertTrue(response.token, self.data.get('token'))
21022102

21032103
def test_list_payments_fail_need_params_invalid(self):
2104-
2104+
21052105
options = {'currency': 'test', 'email': 'test'}
21062106
with self.assertRaises(HyperwalletException) as exc:
21072107
self.api.listPayments(options)
@@ -2585,7 +2585,6 @@ def test_list_transfer_method_configurations_params_valid(self, mock_get):
25852585

25862586
self.assertTrue(response[0].type, self.configuration.get('type'))
25872587

2588-
25892588
@mock.patch('hyperwallet.utils.ApiClient._makeRequest')
25902589
def test_list_transfer_method_configurations_success(self, mock_get):
25912590

@@ -2677,7 +2676,6 @@ def test_uploadDocumentsForUserAndParse_success(self, mock_put):
26772676
self.assertEqual(response.token, self.uploadSuccessData.get('token'))
26782677
self.assertEqual(response.documents[0].type, self.uploadSuccessData.get("documents")[0].type)
26792678

2680-
26812679
@mock.patch('hyperwallet.utils.ApiClient._makeRequest')
26822680
def test_uploadDocumentsForUserAndParseRejection_success(self, mock_put):
26832681

@@ -2869,7 +2867,7 @@ def test_list_transfer_status_transitions_fail_need_params_invalid(self):
28692867

28702868
options = {'transition': 'test', 'token': 'test'}
28712869
with self.assertRaises(HyperwalletException) as exc:
2872-
self.api.listTransferStatusTransitions('token',options)
2870+
self.api.listTransferStatusTransitions('token', options)
28732871

28742872
self.assertEqual(exc.exception.message, 'Invalid filter')
28752873

@@ -2957,7 +2955,7 @@ def test_list_transfer_methods_fail_need_params_invalid(self):
29572955

29582956
options = {'type': 'test', 'token': 'test'}
29592957
with self.assertRaises(HyperwalletException) as exc:
2960-
self.api.listTransferMethods('token',options)
2958+
self.api.listTransferMethods('token', options)
29612959

29622960
self.assertEqual(exc.exception.message, 'Invalid filter')
29632961

0 commit comments

Comments
 (0)