Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions Adyen/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,6 @@ def _determine_api_url(self, platform, endpoint):
"https://pal-test.adyen.com/pal/servlet/",
f"https://{live_endpoint_prefix}-pal-live.adyenpayments.com/pal/servlet/",
)
elif "paltokenization-" in endpoint:
live_endpoint_prefix = self._require_live_endpoint_prefix()
endpoint = endpoint.replace(
"https://paltokenization-test.adyen.com/paltokenization/servlet/",
f"https://{live_endpoint_prefix}-paltokenization-live.adyenpayments.com/paltokenization/servlet/",
)
elif "checkout-" in endpoint:
live_endpoint_prefix = self._require_live_endpoint_prefix()

Expand Down
4 changes: 1 addition & 3 deletions Adyen/services/recurring/recurring_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ class RecurringApi(AdyenServiceBase):
def __init__(self, client=None):
super().__init__(client=client)
self.service = "recurring"
self.baseUrl = (
"https://paltokenization-test.adyen.com/paltokenization/servlet/Recurring/v68"
)
self.baseUrl = "https://pal-test.adyen.com/pal/servlet/Recurring/v68"

def create_permit(self, request, idempotency_key=None, **kwargs):
"""
Expand Down
8 changes: 3 additions & 5 deletions test/DetermineEndpointTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ def test_live_capital_api_url(self):

def test_recurring_api_base_url(self):
self.assertTrue(
self.recurring_url.startswith(
"https://paltokenization-test.adyen.com/paltokenization/servlet/Recurring/"
)
self.recurring_url.startswith("https://pal-test.adyen.com/pal/servlet/Recurring/")
)

def test_recurring_api_url_test_platform(self):
Expand All @@ -175,8 +173,8 @@ def test_recurring_api_url_live_with_prefix(self):
url = self.adyen.client._determine_api_url("live", self.recurring_url + RECURRING_DETAILS)
self.assertEqual(
url,
"https://1797a841fbb37ca7-AdyenDemo-paltokenization-live.adyenpayments.com"
f"/paltokenization/servlet/Recurring/{self.recurring_version}{RECURRING_DETAILS}",
"https://1797a841fbb37ca7-AdyenDemo-pal-live.adyenpayments.com"
f"/pal/servlet/Recurring/{self.recurring_version}{RECURRING_DETAILS}",
)

def test_recurring_api_url_live_no_prefix_raises(self):
Expand Down
26 changes: 26 additions & 0 deletions test/RecurringTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import Adyen
from Adyen import settings
from Adyen.exceptions import AdyenEndpointInvalidFormat

try:
from BaseTest import BaseTest
Expand All @@ -18,6 +19,31 @@ class TestRecurring(unittest.TestCase):
client.platform = "test"
baseUrl = adyen.recurring.recurring_api.baseUrl

def test_base_url_test_environment(self):
url = self.adyen.client._determine_api_url("test", self.baseUrl)
self.assertEqual(url, self.baseUrl)
self.assertTrue(url.startswith("https://pal-test.adyen.com/pal/servlet/Recurring/"))

def test_base_url_live_environment(self):
self.adyen.client.live_endpoint_prefix = "1797a841fbb37ca7-AdyenDemo"
recurring_version = self.baseUrl.split("/")[-1]
url = self.adyen.client._determine_api_url("live", self.baseUrl)
self.assertEqual(
url,
f"https://1797a841fbb37ca7-AdyenDemo-pal-live.adyenpayments.com"
f"/pal/servlet/Recurring/{recurring_version}",
)
self.adyen.client.live_endpoint_prefix = None

def test_base_url_live_environment_no_prefix_raises(self):
self.adyen.client.live_endpoint_prefix = None
self.assertRaises(
AdyenEndpointInvalidFormat,
self.adyen.client._determine_api_url,
"live",
self.baseUrl,
)

def test_list_recurring_details(self):
request = {}
request["merchantAccount"] = "YourMerchantAccount"
Expand Down
Loading