Skip to content

Commit 0a134fa

Browse files
committed
Add checkout utility url
1 parent 4782cb6 commit 0a134fa

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

Adyen/client.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,20 +132,19 @@ def _determine_checkout_url(self, platform, service, action,
132132
service (str): API service to place request through.
133133
action (str): the API action to perform.
134134
"""
135-
if action == "paymentDetails":
136-
action = "payment/details"
137-
if action == "paymentsResult":
138-
action = "payment/result"
139-
if action == "originKey":
140-
action = "v1/originKeys"
141-
142135
base_uri = settings.BASE_CHECKOUT_URL.format(platform)
143-
136+
api_version = settings.CHECKOUT_API_VERSION
144137
if live_endpoint_prefix is not None:
145138
base_uri = settings.ENDPOINT_PROTOCOL + live_endpoint_prefix \
146139
+ settings.CHECKOUT_URL_LIVE_SUFFIX
147140

148-
api_version = settings.CHECKOUT_API_VERSION
141+
if action == "paymentDetails":
142+
action = "payment/details"
143+
if action == "paymentsResult":
144+
action = "payment/result"
145+
if action == "originKeys":
146+
api_version = "v1"
147+
149148
return '/'.join([base_uri, api_version, action])
150149

151150
def _review_payout_username(self, **kwargs):

Adyen/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
BASE_HPP_URL = "https://{}.adyen.com/hpp"
55
ENDPOINT_LIVE_SUFFIX = "-pal-live.adyenpayments.com"
66
ENDPOINT_PROTOCOL = "https://"
7-
BASE_CHECKOUT_URL = "https://checkout-{}.adyen.com/"
7+
BASE_CHECKOUT_URL = "https://checkout-{}.adyen.com"
88
CHECKOUT_URL_LIVE_SUFFIX = "-checkout-live.adyenpayments.com/checkout"
99
CHECKOUT_API_VERSION = "v40"
1010
API_VERSION = "v30"

test/CheckoutTest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def test_checkout_api_url(self):
198198
url = self.ady.client._determine_checkout_url("live", "",
199199
"paymentDetails")
200200
self.assertEqual(url, "https://checkout-live.adyen.com"
201-
"//v40/payment/details")
201+
"/v40/payment/details")
202202

203203
def test_checkout_api_url_custom(self):
204204
url = self.ady.client._determine_checkout_url("live", "",

test/CheckoutUtilityTest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,9 @@ def test_origin_keys_success_mocked(self):
4545
"b1qMuMHGepxG_SlUqxAYrfY",
4646
result.message['originKeys']
4747
['https://www.your-domain2.com'])
48+
49+
def test_checkout_utility_api_url_custom(self):
50+
url = self.ady.client._determine_checkout_url("test", "",
51+
"originKeys")
52+
53+
self.assertEqual(url, "https://checkout-test.adyen.com/v1/originKeys")

0 commit comments

Comments
 (0)