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
2 changes: 1 addition & 1 deletion .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ['3.7', '3.8']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']

steps:
- name: Checkout
Expand Down
2 changes: 0 additions & 2 deletions Adyen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, unicode_literals

from . import util
from .exceptions import (
AdyenAPICommunicationError,
Expand Down
86 changes: 47 additions & 39 deletions Adyen/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import absolute_import, division, unicode_literals
from __future__ import annotations

import json as json_lib

Expand All @@ -15,9 +15,10 @@
AdyenEndpointInvalidFormat)
from . import settings
import re
from typing import Any


class AdyenResult(object):
class AdyenResult:
"""
Args:
message (dict, optional): Parsed message returned from API client.
Expand All @@ -29,20 +30,26 @@ class AdyenResult(object):

"""

def __init__(self, message=None, status_code=200,
psp="", raw_request="", raw_response=""):
def __init__(
self,
message: dict[str, Any] | None = None,
status_code: int = 200,
psp: str = "",
raw_request: str = "",
raw_response: str = ""
) -> None:
self.message = message
self.status_code = status_code
self.psp = psp
self.raw_request = raw_request
self.raw_response = raw_response
self.details = {}
self.details: dict[str, Any] = {}

def __str__(self):
def __str__(self) -> str:
return repr(self.message)


class AdyenClient(object):
class AdyenClient:
IDEMPOTENCY_HEADER_NAME = 'Idempotency-Key'
APPLICATION_INFO_HEADER_NAME = 'adyen-library-name'
APPLICATION_VERSION_HEADER_NAME = 'adyen-library-version'
Expand All @@ -68,37 +75,38 @@ class AdyenClient(object):
"""

def __init__(
self,
username=None,
password=None,
xapikey=None,
application_name=None,
review_payout_username=None,
review_payout_password=None,
store_payout_username=None, store_payout_password=None,
platform="test", merchant_account=None,
merchant_specific_url=None,
hmac=None,
http_force=None,
live_endpoint_prefix=None,
http_timeout=30,
api_bin_lookup_version=None,
api_checkout_version=None,
api_management_version=None,
api_payment_version=None,
api_payout_version=None,
api_recurring_version=None,
api_terminal_version=None,
api_legal_entity_management_version=None,
api_data_protection_version=None,
api_transfers_version=None,
api_stored_value_version=None,
api_balance_platform_version=None,
api_disputes_version=None,
api_session_authentication_version=None,
api_capital_version=None

):
self,
username: str | None = None,
password: str | None = None,
xapikey: str | None = None,
application_name: str | None = None,
review_payout_username: str | None = None,
review_payout_password: str | None = None,
store_payout_username: str | None = None,
store_payout_password: str | None = None,
platform: str = "test",
merchant_account: str | None = None,
merchant_specific_url: str | None = None,
hmac: str | None = None,
http_force: str | None = None,
live_endpoint_prefix: str | None = None,
http_timeout: int = 30,
api_bin_lookup_version: str | int | None = None,
api_checkout_version: str | int | None = None,
api_management_version: str | int | None = None,
api_payment_version: str | int | None = None,
api_payout_version: str | int | None = None,
api_recurring_version: str | int | None = None,
api_terminal_version: str | int | None = None,
api_legal_entity_management_version: str | int | None = None,
api_data_protection_version: str | int | None = None,
api_transfers_version: str | int | None = None,
api_stored_value_version: str | int | None = None,
api_balance_platform_version: str | int | None = None,
api_disputes_version: str | int | None = None,
api_session_authentication_version: str | int | None = None,
api_capital_version: str | int | None = None
) -> None:
self.username = username
self.password = password
self.xapikey = xapikey
Expand All @@ -111,7 +119,7 @@ def __init__(
self.merchant_specific_url = merchant_specific_url
self.hmac = hmac
self.merchant_account = merchant_account
self.psp_list = []
self.psp_list: list[str] = []
self.LIB_VERSION = settings.LIB_VERSION
self.USER_AGENT_SUFFIX = settings.LIB_NAME + "/"
self.http_init = False
Expand Down
2 changes: 1 addition & 1 deletion Adyen/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self,
message,
*args,
**kwargs):
super(AdyenAPIResponseError, self).__init__(message, *args, **kwargs)
super().__init__(message, *args, **kwargs)


class AdyenAPIAuthenticationError(AdyenAPIResponseError):
Expand Down
4 changes: 1 addition & 3 deletions Adyen/httpclient.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, unicode_literals

try:
import requests
except ImportError:
Expand All @@ -20,7 +18,7 @@
import base64


class HTTPClient(object):
class HTTPClient:
def __init__(
self,
user_agent_suffix,
Expand Down
4 changes: 2 additions & 2 deletions Adyen/services/base.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from Adyen import AdyenClient


class AdyenBase(object):
class AdyenBase:
def __setattr__(self, attr, value):
client_attr = ["username", "password", "platform"]
if attr in client_attr:
if value:
self.client[attr] = value
else:
super(AdyenBase, self).__setattr__(attr, value)
super().__setattr__(attr, value)

def __getattr__(self, attr):
client_attr = ["username", "password", "platform"]
Expand Down
2 changes: 0 additions & 2 deletions Adyen/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import, division, unicode_literals

import base64
import hmac
import hashlib
Expand Down
22 changes: 20 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,30 @@
author_email='support@adyen.com',
url='https://github.com/Adyen/adyen-python-api-library',
keywords=['payments', 'adyen', 'fintech'],
python_requires='>=3.8',
install_requires=[], # Core is standard library only, plus optional clients below
extras_require={
"requests": ["requests>=2.25.0"],
"pycurl": ["pycurl>=7.43.0"],
"test": [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"mock>=4.0.0",
"requests>=2.25.0",
],
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6'
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
]
)
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{36,37,38}-{pycurl,requests,urlib}
envlist = py{38,39,310,311,312,313,314}-{pycurl,requests,urllib}
skip_missing_interpreters=true

[testenv]
Expand Down