Skip to content

Commit 9781f61

Browse files
Merge pull request #58 from Adyen/feature/applicationInfo
Feature/application info
2 parents 1d94500 + 5180c4f commit 9781f61

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

Adyen/client.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def __init__(self, username=None, password=None, xapikey=None,
8787
self.skin_code = skin_code
8888
self.psp_list = []
8989
self.app_name = app_name
90-
self.LIB_VERSION = "1.4.0"
91-
self.USER_AGENT_SUFFIX = "adyen-python-api-library/"
90+
self.LIB_VERSION = settings.LIB_VERSION
91+
self.USER_AGENT_SUFFIX = settings.LIB_NAME + "/"
9292
self.http_init = False
9393
self.http_force = http_force
9494
self.live_endpoint_prefix = live_endpoint_prefix
@@ -282,7 +282,13 @@ def call_api(self, request_data, service, action, idempotency=False,
282282

283283
if not message.get('merchantAccount'):
284284
message['merchantAccount'] = self.merchant_account
285-
285+
# Add application info
286+
request_data['applicationInfo'] = {
287+
"adyenLibrary": {
288+
"name": settings.LIB_NAME,
289+
"version": settings.LIB_VERSION
290+
}
291+
}
286292
# Adyen requires this header to be set and uses the combination of
287293
# merchant account and merchant reference to determine uniqueness.
288294
headers = {}
@@ -424,6 +430,12 @@ def call_checkout_api(self, request_data, action, **kwargs):
424430
if not request_data.get('merchantAccount'):
425431
request_data['merchantAccount'] = self.merchant_account
426432

433+
request_data['applicationInfo'] = {
434+
"adyenLibrary": {
435+
"name": settings.LIB_NAME,
436+
"version": settings.LIB_VERSION
437+
}
438+
}
427439
# Adyen requires this header to be set and uses the combination of
428440
# merchant account and merchant reference to determine uniqueness.
429441
headers = {}

Adyen/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
API_RECURRING_VERSION = "v25"
1010
API_PAYMENT_VERSION = "v40"
1111
API_PAYOUT_VERSION = "v30"
12+
LIB_VERSION = "1.4.0"
13+
LIB_NAME = "adyen-python-api-library"

0 commit comments

Comments
 (0)