diff --git a/Adyen/client.py b/Adyen/client.py index 2c885f3e..97cebf5a 100644 --- a/Adyen/client.py +++ b/Adyen/client.py @@ -331,7 +331,7 @@ def _set_credentials(self, service, endpoint, **kwargs): # fallback to root module # and ensure that it is set. - return xapikey, username, password + return xapikey, username, password, kwargs def _set_platform(self, **kwargs): # platform at self object has highest priority. fallback to root module @@ -383,7 +383,7 @@ def call_adyen_api( self._init_http_client() # Set credentials - xapikey, username, password = self._set_credentials(service, endpoint, **kwargs) + xapikey, username, password, kwargs= self._set_credentials(service, endpoint, **kwargs) # Set platform platform = self._set_platform(**kwargs) message = request_data diff --git a/test/CheckoutTest.py b/test/CheckoutTest.py index 728d356a..ca3e1a1f 100644 --- a/test/CheckoutTest.py +++ b/test/CheckoutTest.py @@ -597,3 +597,4 @@ def test_update_payment_link(self): json=request ) self.assertEqual("expired",result.message["status"]) + diff --git a/test/UtilTest.py b/test/UtilTest.py index 0efc8101..07bd9e56 100644 --- a/test/UtilTest.py +++ b/test/UtilTest.py @@ -6,6 +6,10 @@ is_valid_hmac_notification, get_query ) +try: + from BaseTest import BaseTest +except ImportError: + from .BaseTest import BaseTest class UtilTest(unittest.TestCase): @@ -67,4 +71,20 @@ def test_query_string_creation(self): "pageNumber":3 } query_string = get_query(query_parameters) - self.assertEqual(query_string,'?pageSize=7&pageNumber=3') \ No newline at end of file + self.assertEqual(query_string,'?pageSize=7&pageNumber=3') + + def test_passing_xapikey_in_method(self): + request = {'merchantAccount': "YourMerchantAccount"} + self.test = BaseTest(self.ady) + self.client.platform = "test" + self.ady.client = self.test.create_client_from_file(200, request, + "test/mocks/" + "checkout/" + "paymentmethods" + "-success.json") + result = self.ady.checkout.payments_api.payment_methods(request, xapikey="YourXapikey") + self.assertEqual("AliPay", result.message['paymentMethods'][0]['name']) + self.assertEqual("Credit Card", + result.message['paymentMethods'][2]['name']) + self.assertEqual("Credit Card via AsiaPay", + result.message['paymentMethods'][3]['name']) \ No newline at end of file