2020logger = logging .getLogger (logname ())
2121
2222
23+ HMAC_TEST_url = "https://ca-test.adyen.com/ca/ca/skin/checkhmac.shtml"
24+
2325BASE_PAL_url = "https://pal-{}.adyen.com/pal/servlet"
2426BASE_HPP_url = "https://{}.adyen.com/hpp"
2527API_VERSION = "v18"
@@ -46,16 +48,6 @@ def __init__(self,message=None,status_code=200,psp="",raw_request="",raw_respons
4648 self .raw_request = raw_request
4749 self .raw_response = raw_response
4850 self .details = {}
49- """
50- def __setattr__(self, attr, value):
51- super(AdyenResult, self).__setattr__(attr, value)
52-
53- def __getattr__(self, attr):
54- if attr in self.message:
55- return self.message[attr]
56- else:
57- raise AttributeError
58- """
5951
6052
6153 def __str__ (self ):
@@ -296,7 +288,7 @@ def call_api(self, request_data, service, action, idempotency=False,
296288
297289 return adyen_result
298290
299- def call_hpp (self , request_data , action , hmac_key = "" , ** kwargs ):
291+ def call_hpp (self , message , action , hmac_key = "" , ** kwargs ):
300292 """This will call the adyen hpp. hmac_key and platform are pulled from
301293 root module level and or self object. AdyenResult will be returned on 200 response.
302294 Otherwise, an exception is raised.
@@ -316,6 +308,10 @@ def call_hpp(self, request_data, action, hmac_key="", **kwargs):
316308 """
317309 from Adyen import hmac , platform
318310
311+ if self .http_init == False :
312+ self .http_client = HTTPClient (self .app_name ,self .LIB_VERSION ,self .USER_AGENT_SUFFIX )
313+ self .http_init = True
314+
319315 #hmac provided in function has highest priority. fallback to self then
320316 #root module and ensure that it is set.
321317 if hmac_key :
@@ -344,7 +340,8 @@ def call_hpp(self, request_data, action, hmac_key="", **kwargs):
344340 # logger.error(errorstring)
345341 raise TypeError (errorstring )
346342
347- message = request_data
343+ if 'skinCode' not in message :
344+ message ['skinCode' ] = self .skin_code
348345
349346 if 'merchantAccount' not in message :
350347 message ['merchantAccount' ] = self .merchant_account
@@ -367,6 +364,10 @@ def hpp_payment(self,request_data, action, hmac_key="", **kwargs):
367364
368365 from Adyen import hmac , platform
369366
367+ if self .http_init == False :
368+ self .http_client = HTTPClient (self .app_name ,self .LIB_VERSION ,self .USER_AGENT_SUFFIX )
369+ self .http_init = True
370+
370371 if self .platform :
371372 platform = self .platform
372373 if platform .lower () not in ['live' ,'test' ]:
@@ -378,6 +379,9 @@ def hpp_payment(self,request_data, action, hmac_key="", **kwargs):
378379 # logger.error(errorstring)
379380 raise TypeError (errorstring )
380381
382+ if 'skinCode' not in request_data :
383+ request_data ['skinCode' ] = self .skin_code
384+
381385 hmac = self .hmac
382386
383387 if 'merchantAccount' not in request_data :
@@ -529,7 +533,6 @@ def _handle_http_error(self, url, response_obj, status_code, psp_ref,
529533 raise AdyenAPIInvalidAmount (
530534 "Invalid amount specified"
531535 "Amount may be improperly formatted, too small or too big."
532- "Print your input amount to console or log to verify"
533536 "If the issue persists, contact support@adyen.com"
534537 )
535538
0 commit comments