Skip to content

Commit 71b837d

Browse files
[PW-2394] Remove the app_name (#110)
* Remove the app_name * Update Adyen/httpclient.py Co-authored-by: Alessio Zampatti <alessio.zampatti@adyen.com> * Update Adyen/httpclient.py Co-authored-by: Alessio Zampatti <alessio.zampatti@adyen.com> * Update Adyen/httpclient.py Co-authored-by: Alessio Zampatti <alessio.zampatti@adyen.com> * remove app_name from test Co-authored-by: Alessio Zampatti <alessio.zampatti@adyen.com>
1 parent 18f4bf7 commit 71b837d

13 files changed

+9
-27
lines changed

Adyen/client.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __init__(self, username=None, password=None, xapikey=None,
7171
store_payout_username=None, store_payout_password=None,
7272
platform="test", merchant_account=None,
7373
merchant_specific_url=None, skin_code=None,
74-
hmac=None, app_name="",
74+
hmac=None,
7575
http_force=None, live_endpoint_prefix=None):
7676
self.username = username
7777
self.password = password
@@ -86,7 +86,6 @@ def __init__(self, username=None, password=None, xapikey=None,
8686
self.merchant_account = merchant_account
8787
self.skin_code = skin_code
8888
self.psp_list = []
89-
self.app_name = app_name
9089
self.LIB_VERSION = settings.LIB_VERSION
9190
self.USER_AGENT_SUFFIX = settings.LIB_NAME + "/"
9291
self.http_init = False
@@ -221,8 +220,7 @@ def call_api(self, request_data, service, action, idempotency=False,
221220
succesful.
222221
"""
223222
if not self.http_init:
224-
self.http_client = HTTPClient(self.app_name,
225-
self.USER_AGENT_SUFFIX,
223+
self.http_client = HTTPClient(self.USER_AGENT_SUFFIX,
226224
self.LIB_VERSION,
227225
self.http_force)
228226
self.http_init = True
@@ -360,8 +358,7 @@ def call_hpp(self, message, action, hmac_key="", **kwargs):
360358
:param hmac_key:
361359
"""
362360
if not self.http_init:
363-
self.http_client = HTTPClient(self.app_name,
364-
self.USER_AGENT_SUFFIX,
361+
self.http_client = HTTPClient(self.USER_AGENT_SUFFIX,
365362
self.LIB_VERSION,
366363
self.http_force)
367364
self.http_init = True
@@ -425,8 +422,7 @@ def call_checkout_api(self, request_data, action, **kwargs):
425422
action (str): The specific action of the API service to be called
426423
"""
427424
if not self.http_init:
428-
self.http_client = HTTPClient(self.app_name,
429-
self.USER_AGENT_SUFFIX,
425+
self.http_client = HTTPClient(self.USER_AGENT_SUFFIX,
430426
self.LIB_VERSION,
431427
self.http_force)
432428
self.http_init = True
@@ -497,8 +493,7 @@ def call_checkout_api(self, request_data, action, **kwargs):
497493
def hpp_payment(self, request_data, action, hmac_key="", **kwargs):
498494

499495
if not self.http_init:
500-
self.http_client = HTTPClient(self.app_name,
501-
self.USER_AGENT_SUFFIX,
496+
self.http_client = HTTPClient(self.USER_AGENT_SUFFIX,
502497
self.LIB_VERSION,
503498
self.http_force)
504499
self.http_init = True

Adyen/httpclient.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,9 @@
3535

3636

3737
class HTTPClient(object):
38-
def __init__(self, app_name, user_agent_suffix,
39-
lib_version, force_request=None):
38+
def __init__(self, user_agent_suffix, lib_version, force_request=None):
4039
# Check if requests already available, default to urllib
41-
self.user_agent = app_name + " " + user_agent_suffix + lib_version
42-
# In case the app_name is empty
43-
self.user_agent = self.user_agent.strip()
40+
self.user_agent = user_agent_suffix + lib_version
4441
if not force_request:
4542
if requests:
4643
self.request = self._requests_post

Adyen/services.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class AdyenBase(object):
99
def __setattr__(self, attr, value):
10-
client_attr = ["username", "password", "platform", "app_name"]
10+
client_attr = ["username", "password", "platform"]
1111
if attr in client_attr:
1212
if value:
1313
self.client[attr] = value

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ ady.payment.client.hmac = "HMAC key for skin code"
4747
ady.payment.client.platform = "test" # Environment to use the library in.
4848
ady.payment.client.merchant_account = "merchant account name from CA"
4949
ady.payment.client.password = "webservice user password"
50-
ady.payment.client.app_name = "your app name"
5150
```
5251

5352
## Documentation

test/CheckoutTest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class TestCheckout(unittest.TestCase):
1414
test = BaseTest(adyen)
1515
client.xapikey = "YourXapikey"
1616
client.platform = "test"
17-
client.app_name = "appname"
1817

1918
def test_payment_methods_success_mocked(self):
2019
request = {'merchantAccount': "YourMerchantAccount"}

test/CheckoutUtilityTest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class TestCheckoutUtility(unittest.TestCase):
1515
test = BaseTest(ady)
1616
client.xapikey = "YourXapikey"
1717
client.platform = "test"
18-
client.app_name = "appname"
1918

2019
def test_origin_keys_success_mocked(self):
2120
request = {

test/DetermineEndpointTest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class TestDetermineUrl(unittest.TestCase):
1515
client = adyen.client
1616
test = BaseTest(adyen)
1717
client.xapikey = "YourXapikey"
18-
client.app_name = "appname"
1918

2019
def test_checkout_api_url_custom(self):
2120
self.client.live_endpoint_prefix = "1797a841fbb37ca7-AdyenDemo"
@@ -50,6 +49,7 @@ def test_payments_invalid_platform(self):
5049

5150
self.client.platform = "live"
5251
self.client.live_endpoint_prefix = None
52+
5353
try:
5454
self.adyen.checkout.payments(request)
5555
except AdyenEndpointInvalidFormat as error:

test/DirectoryLookupTest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class TestDirectoryLookup(unittest.TestCase):
2020
client.platform = "test"
2121
client.hmac = "DFB1EB5485895CFA84146406857104A" \
2222
"BB4CBCABDC8AAF103A624C8F6A3EAAB00"
23-
client.app_name = "appname"
2423

2524
def test_get_post_parameters(self):
2625
request = {

test/ModificationTest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class TestModifications(unittest.TestCase):
1414
client.username = "YourWSUser"
1515
client.password = "YourWSPassword"
1616
client.platform = "test"
17-
client.app_name = "appname"
1817

1918
def test_capture_success(self):
2019
request = {}

test/PaymentTest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class TestPayments(unittest.TestCase):
1515
client.username = "YourWSUser"
1616
client.password = "YourWSPassword"
1717
client.platform = "test"
18-
client.app_name = "appname"
1918
client.xapikey = ""
2019

2120
def test_authorise_success_mocked(self):
@@ -208,7 +207,6 @@ class TestPaymentsWithXapiKey(unittest.TestCase):
208207
client = adyen.client
209208
test = BaseTest(adyen)
210209
client.platform = "test"
211-
client.app_name = "appname"
212210
client.username = "YourWSUser"
213211
client.password = "YourWSPassword"
214212
client.xapikey = ""

0 commit comments

Comments
 (0)