Skip to content

Commit d2fb206

Browse files
committed
None high level module magic
1 parent 3826d5e commit d2fb206

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

Adyen/__init__.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@
2222

2323
from .httpclient import HTTPClient
2424

25-
username = None
26-
password = None
27-
platform = None
28-
merchant_account = None
29-
merchant_specific_url = None
30-
hmac = None
31-
3225

3326
class Adyen(AdyenBase):
3427
def __init__(self, **kwargs):

Adyen/client.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def __init__(self, username=None, password=None,
7979
self.store_payout_username = store_payout_username
8080
self.store_payout_password = store_payout_password
8181
self.platform = platform
82+
if not self.platform:
83+
self.platform = 'test'
8284
self.merchant_specific_url = merchant_specific_url
8385
self.hmac = hmac
8486
self.merchant_account = merchant_account
@@ -353,17 +355,14 @@ def call_hpp(self, message, action, hmac_key="", **kwargs):
353355

354356
def hpp_payment(self, request_data, action, hmac_key="", **kwargs):
355357

356-
from . import platform
357-
358358
if not self.http_init:
359359
self.http_client = HTTPClient(self.app_name,
360360
self.USER_AGENT_SUFFIX,
361361
self.LIB_VERSION,
362362
self.http_force)
363363
self.http_init = True
364364

365-
if self.platform:
366-
platform = self.platform
365+
platform = self.platform
367366
if platform.lower() not in ['live', 'test']:
368367
errorstring = " 'platform' must be the value of 'live' or 'test' "
369368
raise ValueError(errorstring)
@@ -476,8 +475,7 @@ def _handle_http_error(self, url, response_obj, status_code, psp_ref,
476475
"""
477476

478477
if status_code == 404:
479-
from . import merchant_specific_url
480-
if url == merchant_specific_url:
478+
if url == self.merchant_specific_url:
481479
erstr = "Received a 404 for url:'{}'. Please ensure that" \
482480
" the custom merchant specific url is correct" \
483481
.format(url)
@@ -509,7 +507,6 @@ def _handle_http_error(self, url, response_obj, status_code, psp_ref,
509507
" if the problem persists"
510508
raise AdyenAPIAuthenticationError(erstr)
511509
elif status_code == 403:
512-
from . import username
513510

514511
if response_obj.get("message") == "Invalid Merchant Account":
515512
erstr = ("You provided the merchant account:'%s' that"
@@ -527,7 +524,7 @@ def _handle_http_error(self, url, response_obj, status_code, psp_ref,
527524
" the PSP reference: %s" % (
528525
response_obj["message"], self.username, psp_ref)
529526

530-
raise AdyenAPIInvalidPermission(erstr, username, psp_ref,
527+
raise AdyenAPIInvalidPermission(erstr, self.username, psp_ref,
531528
raw_request=raw_request,
532529
raw_response=raw_response, url=url,
533530
psp=psp_ref, headers=headers)

Adyen/services.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __getattr__(self, attr):
2222

2323

2424
class AdyenServiceBase(AdyenBase):
25-
def __init__(self, client=""):
25+
def __init__(self, client=None):
2626
if client:
2727
self.client = client
2828
else:
@@ -41,7 +41,7 @@ class AdyenRecurring(AdyenServiceBase):
4141
use. If not provided, a new API client will be created.
4242
"""
4343

44-
def __init__(self, client=""):
44+
def __init__(self, client=None):
4545
super(AdyenRecurring, self).__init__(client=client)
4646
self.service = "Recurring"
4747

0 commit comments

Comments
 (0)