Skip to content

Commit 9ef173b

Browse files
authored
Merge pull request #16 from akreisman-epam/feature/HW-48364-use-authentication-token-instead-of-client-token
HW-48364: Update SDKs to use authentication-token instead of client-token
2 parents 69b618f + 61ef0e2 commit 9ef173b

5 files changed

Lines changed: 32 additions & 32 deletions

File tree

hyperwallet/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
PrepaidCard, # noqa
2222
PaperCheck, # noqa
2323
Transfer, # noqa
24-
ClientToken, # noqa
24+
AuthenticationToken, # noqa
2525
PayPalAccount, # noqa
2626
Payment, # noqa
2727
Balance, # noqa

hyperwallet/api.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
PrepaidCard,
1515
PaperCheck,
1616
Transfer,
17-
ClientToken,
17+
AuthenticationToken,
1818
PayPalAccount,
1919
Payment,
2020
Balance,
@@ -1655,29 +1655,29 @@ def listPayPalAccounts(self,
16551655

16561656
'''
16571657
1658-
ClientToken
1658+
AuthenticationToken
16591659
16601660
'''
16611661

1662-
def getClientToken(self,
1663-
userToken=None):
1662+
def getAuthenticationToken(self,
1663+
userToken=None):
16641664
'''
1665-
Get a ClientToken.
1665+
Get a AuthenticationToken.
16661666
:param userToken:
16671667
A user token. **REQUIRED**
16681668
:returns:
1669-
A ClientToken.
1669+
An AuthenticationToken.
16701670
'''
16711671

16721672
if not userToken:
16731673
raise HyperwalletException('userToken is required')
16741674

16751675
response = self.apiClient.doPost(
1676-
os.path.join('users', userToken, 'client-token'),
1676+
os.path.join('users', userToken, 'authentication-token'),
16771677
None
16781678
)
16791679

1680-
return ClientToken(response)
1680+
return AuthenticationToken(response)
16811681

16821682
'''
16831683

hyperwallet/models.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,20 @@ def __repr__(self):
125125
)
126126

127127

128-
class ClientToken(HyperwalletModel):
128+
class AuthenticationToken(HyperwalletModel):
129129
'''
130-
The ClientToken Model.
130+
The AuthenticationToken Model.
131131
132132
:param data:
133-
A dictionary containing the attributes for the Client Token.
133+
A dictionary containing the attributes for the Authentication Token.
134134
'''
135135

136136
def __init__(self, data):
137137
'''
138-
Create a new Client Token with the provided attributes.
138+
Create a new Authentication Token with the provided attributes.
139139
'''
140140

141-
super(ClientToken, self).__init__(data)
141+
super(AuthenticationToken, self).__init__(data)
142142

143143
self.defaults = {
144144
'value': None,
@@ -148,7 +148,7 @@ def __init__(self, data):
148148
setattr(self, param, data.get(param, default))
149149

150150
def __repr__(self):
151-
return "ClientToken({value})".format(
151+
return "AuthenticationToken({value})".format(
152152
value=self.value
153153
)
154154

hyperwallet/tests/test_api.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,27 +1366,27 @@ def test_list_paypal_accounts_success(self, mock_get):
13661366

13671367
'''
13681368
1369-
ClientToken
1369+
AuthenticationToken
13701370
13711371
'''
13721372

1373-
def test_get_client_token_fail_need_user_token(self):
1373+
def test_get_authentication_token_fail_need_user_token(self):
13741374

13751375
with self.assertRaises(HyperwalletException) as exc:
1376-
self.api.getClientToken()
1376+
self.api.getAuthenticationToken()
13771377

13781378
self.assertEqual(exc.exception.message, 'userToken is required')
13791379

13801380
@mock.patch('hyperwallet.utils.ApiClient._makeRequest')
1381-
def test_get_client_token_success(self, mock_post):
1381+
def test_get_authentication_token_success(self, mock_post):
13821382

1383-
client_token_data = {
1383+
authentication_token_data = {
13841384
'value': 'test-value'
13851385
}
1386-
mock_post.return_value = client_token_data
1387-
response = self.api.getClientToken('user-token')
1386+
mock_post.return_value = authentication_token_data
1387+
response = self.api.getAuthenticationToken('user-token')
13881388

1389-
self.assertTrue(response.value, client_token_data.get('value'))
1389+
self.assertTrue(response.value, authentication_token_data.get('value'))
13901390

13911391
'''
13921392

hyperwallet/tests/test_models.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
PrepaidCard,
1313
PaperCheck,
1414
Transfer,
15-
ClientToken,
15+
AuthenticationToken,
1616
PayPalAccount,
1717
Payment,
1818
Balance,
@@ -74,8 +74,8 @@ def setUp(self):
7474
'createdOn': '2017-01-01'
7575
}
7676

77-
self.client_token_data = {
78-
'value': 'test-client-token'
77+
self.authentication_token_data = {
78+
'value': 'test-authentication-token'
7979
}
8080

8181
self.transfer_method_data = {
@@ -248,18 +248,18 @@ def test_transfer_model(self):
248248

249249
'''
250250
251-
ClientToken
251+
AuthenticationToken
252252
253253
'''
254254

255-
def test_client_token_model(self):
255+
def test_authentication_token_model(self):
256256

257-
test_client_token = ClientToken(self.client_token_data)
257+
test_authentication_token = AuthenticationToken(self.authentication_token_data)
258258

259259
self.assertEqual(
260-
test_client_token.__repr__(),
261-
'ClientToken({value})'.format(
262-
value=self.client_token_data.get('value')
260+
test_authentication_token.__repr__(),
261+
'AuthenticationToken({value})'.format(
262+
value=self.authentication_token_data.get('value')
263263
)
264264
)
265265

0 commit comments

Comments
 (0)