Open
Description
Description
Using AdyenPosMobileApi.create_communication_session gives a "Resource not found error" in the live environment
Steps to reproduce
Take the following script:
import os
from Adyen import AdyenClient
from Adyen.services.posMobile import AdyenPosMobileApi
if __name__ == '__main__':
client = AdyenClient(
xapikey=os.environ['API_KEY'],
platform='live',
live_endpoint_prefix=os.environ['LIVE_PREFIX'],
)
api = AdyenPosMobileApi(client=client)
payload = {
'merchantAccount': 'foo',
'store': 'ST123',
'setupToken': 'foobar',
}
print(api.create_communication_session(payload).message)
In test, this works. In live, this throws an error:
Traceback (most recent call last):
File "/Users/luhn/Code/revenue/sandbox/adyen_python_nyc1.py", line 18, in <module>
print(api.create_communication_session(payload).message)
File "/Users/luhn/Code/revenue/.venv/lib/python3.10/site-packages/Adyen/services/posMobile.py", line 22, in create_communication_session
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)
File "/Users/luhn/Code/revenue/.venv/lib/python3.10/site-packages/Adyen/client.py", line 374, in call_adyen_api
adyen_result = self._handle_response(url, raw_response, raw_request,
File "/Users/luhn/Code/revenue/.venv/lib/python3.10/site-packages/Adyen/client.py", line 410, in _handle_response
self._raise_http_error(url, response, status_code,
File "/Users/luhn/Code/revenue/.venv/lib/python3.10/site-packages/Adyen/client.py", line 451, in _raise_http_error
raise AdyenAPIValidationError(message, raw_request, raw_response, url, psp_ref, headers, status_code,
Adyen.exceptions.AdyenAPIValidationError: AdyenAPIValidationError:000 Resource not found
I believe this is because following adds an extra /checkout
to the live URL, so the request path ends up being /checkout/checkout/possdk/v68/sessions
adyen-python-api-library/Adyen/client.py
Lines 148 to 149 in a65c270
However, I'm using the checkout APIs elsewhere in my project, so I don't know why its only rearing its head on this one
Actual behavior
Traceback (most recent call last):
File "/Users/luhn/Code/revenue/sandbox/adyen_python_nyc1.py", line 18, in <module>
print(api.create_communication_session(payload).message)
File "/Users/luhn/Code/revenue/.venv/lib/python3.10/site-packages/Adyen/services/posMobile.py", line 22, in create_communication_session
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)
File "/Users/luhn/Code/revenue/.venv/lib/python3.10/site-packages/Adyen/client.py", line 374, in call_adyen_api
adyen_result = self._handle_response(url, raw_response, raw_request,
File "/Users/luhn/Code/revenue/.venv/lib/python3.10/site-packages/Adyen/client.py", line 410, in _handle_response
self._raise_http_error(url, response, status_code,
File "/Users/luhn/Code/revenue/.venv/lib/python3.10/site-packages/Adyen/client.py", line 451, in _raise_http_error
raise AdyenAPIValidationError(message, raw_request, raw_response, url, psp_ref, headers, status_code,
Adyen.exceptions.AdyenAPIValidationError: AdyenAPIValidationError:000 Resource not found
Expected behavior
It should not return a "resource not found" error.
Code snippet or screenshots (if applicable)
import os
from Adyen import AdyenClient
from Adyen.services.posMobile import AdyenPosMobileApi
if __name__ == '__main__':
client = AdyenClient(
xapikey=os.environ['API_KEY'],
platform='live',
live_endpoint_prefix=os.environ['LIVE_PREFIX'],
)
api = AdyenPosMobileApi(client=client)
payload = {
'merchantAccount': 'foo',
'store': 'ST123',
'setupToken': 'foobar',
}
print(api.create_communication_session(payload).message)
Adyen Python API Library version
13.4.0
Python Language version
3.10
Operating System
macOS
Additional context
I also tested against 13.5.0 (not available on PyPI yet) with the same results.