Skip to content
Merged
2 changes: 2 additions & 0 deletions Adyen/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ def _determine_api_url(self, platform, endpoint):
else:
endpoint = endpoint.replace("https://checkout-test.adyen.com/",
"https://" + self.live_endpoint_prefix + "-checkout-live.adyenpayments.com/checkout/")
elif "authe/api" in endpoint:
Comment thread
gcatanese marked this conversation as resolved.
endpoint = endpoint.replace("https://test.adyen.com", "https://authe-live.adyen.com")

endpoint = endpoint.replace("-test", "-live")

Expand Down
10 changes: 10 additions & 0 deletions test/DetermineEndpointTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class TestDetermineUrl(unittest.TestCase):
payment_version = payment_url.split('/')[-1]
binlookup_url = adyen.binlookup.bin_lookup_api.baseUrl
Comment thread
galesky-a marked this conversation as resolved.
management_url = adyen.management.account_merchant_level_api.baseUrl
sessionauth_url = adyen.sessionAuthentication.session_authentication_api.baseUrl
sessionauth_version = sessionauth_url.split('/')[-1]

def test_checkout_api_url_custom(self):
self.client.live_endpoint_prefix = "1797a841fbb37ca7-AdyenDemo"
Expand Down Expand Up @@ -133,3 +135,11 @@ def test_management_api_url_companies(self):
companyId = "YOUR_COMPANY_ID"
url = self.adyen.client._determine_api_url("test", self.management_url + f'/companies/{companyId}/users')
self.assertEqual(url, f"{self.management_url}/companies/{companyId}/users")

def test_secureauthentication_api_url(self):
url = self.adyen.client._determine_api_url("test", self.sessionauth_url)
self.assertEqual(url, self.sessionauth_url)

def test_live_secureauthentication_api_url(self):
url = self.adyen.client._determine_api_url("live", self.sessionauth_url + "/sessions")
self.assertEqual(url, f"https://authe-live.adyen.com/authe/api/{self.sessionauth_version}/sessions")