Skip to content

Commit b69ff6b

Browse files
authored
Merge pull request #45 from Adyen/pw-321
Improvements
2 parents 57dd5a3 + 35299dd commit b69ff6b

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

Adyen/client.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,7 @@
1515
AdyenInvalidRequestError,
1616
AdyenAPIInvalidFormat,
1717
AdyenAPIInvalidAmount)
18-
19-
HMAC_TEST_url = "https://ca-test.adyen.com/ca/ca/skin/checkhmac.shtml"
20-
21-
BASE_PAL_url = "https://pal-{}.adyen.com/pal/servlet"
22-
BASE_HPP_url = "https://{}.adyen.com/hpp"
23-
API_VERSION = "v30"
24-
API_RECURRING_VERSION = "v25"
25-
API_CLIENT_ATTR = ["username", "password", "review_payout_user",
26-
"review_payout_password", "confirm_payout_user",
27-
"confirm_payout_password", "platform",
28-
"merchant_account", "merchant_specific_url",
29-
"hmac"]
18+
from . import settings
3019

3120

3221
class AdyenResult(object):
@@ -110,11 +99,11 @@ def _determine_api_url(self, platform, service, action):
11099
service (str): API service to place request through.
111100
action (str): the API action to perform.
112101
"""
113-
base_uri = BASE_PAL_url.format(platform)
102+
base_uri = settings.BASE_PAL_URL.format(platform)
114103
if service == "Recurring":
115-
api_version = API_RECURRING_VERSION
104+
api_version = settings.API_RECURRING_VERSION
116105
else:
117-
api_version = API_VERSION
106+
api_version = settings.API_VERSION
118107
return '/'.join([base_uri, service, api_version, action])
119108

120109
def _determine_hpp_url(self, platform, action):
@@ -126,7 +115,7 @@ def _determine_hpp_url(self, platform, action):
126115
action (str): the HPP action to perform.
127116
possible actions: select, pay, skipDetails, directory
128117
"""
129-
base_uri = BASE_HPP_url.format(platform)
118+
base_uri = settings.BASE_HPP_URL.format(platform)
130119
service = action + '.shtml'
131120
result = '/'.join([base_uri, service])
132121
return result
@@ -438,8 +427,8 @@ def _handle_response(self, url, raw_response, raw_request,
438427
if response['errorCode']:
439428
return raw_response
440429
except KeyError:
441-
errstr = 'KeyError: errorCode'
442-
pass
430+
erstr = 'KeyError: errorCode'
431+
raise AdyenAPICommunicationError(erstr)
443432
else:
444433
try:
445434
response = json_lib.loads(raw_response)

Adyen/settings.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/python
2+
3+
BASE_PAL_URL = "https://pal-{}.adyen.com/pal/servlet"
4+
BASE_HPP_URL = "https://{}.adyen.com/hpp"
5+
API_VERSION = "v30"
6+
API_RECURRING_VERSION = "v25"

0 commit comments

Comments
 (0)