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
5 changes: 4 additions & 1 deletion Adyen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
AdyenPayment,
AdyenThirdPartyPayout,
AdyenHPP,
AdyenCheckoutApi
AdyenCheckoutApi,
AdyenTerminal
)

from .httpclient import HTTPClient
Expand All @@ -35,6 +36,7 @@ def __init__(self, **kwargs):
self.hpp = AdyenHPP(client=self.client)
self.recurring = AdyenRecurring(client=self.client)
self.checkout = AdyenCheckoutApi(client=self.client)
self.terminal = AdyenTerminal(client=self.client)


_base_adyen_obj = Adyen()
Expand All @@ -44,3 +46,4 @@ def __init__(self, **kwargs):
payout = _base_adyen_obj.payout
checkout = _base_adyen_obj.checkout
binlookup = _base_adyen_obj.binlookup
terminal = _base_adyen_obj.terminal
5 changes: 5 additions & 0 deletions Adyen/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def __init__(
api_payment_version=None,
api_payout_version=None,
api_recurring_version=None,
api_terminal_version=None,
):
self.username = username
self.password = password
Expand All @@ -115,6 +116,7 @@ def __init__(
self.api_payment_version = api_payment_version or settings.API_PAYMENT_VERSION
self.api_payout_version = api_payout_version or settings.API_PAYOUT_VERSION
self.api_recurring_version = api_recurring_version or settings.API_RECURRING_VERSION
self.api_terminal_version = api_terminal_version or settings.API_TERMINAL_VERSION

def _determine_api_url(self, platform, service, action):
"""This returns the Adyen API endpoint based on the provided platform,
Expand All @@ -138,6 +140,9 @@ def _determine_api_url(self, platform, service, action):
api_version = self.api_payout_version
elif service == "BinLookup":
api_version = self.api_bin_lookup_version
elif service == "terminal":
base_uri = settings.BASE_TERMINAL_URL.format(platform)
api_version = self.api_terminal_version
else:
api_version = self.api_payment_version
return '/'.join([base_uri, service, api_version, action])
Expand Down
37 changes: 37 additions & 0 deletions Adyen/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,3 +410,40 @@ def get_cost_estimate(self, request="", **kwargs):
action = "getCostEstimate"

return self.client.call_api(request, self.service, action, **kwargs)


class AdyenTerminal(AdyenServiceBase):
"""This represents the Adyen API Terminal service.

API call currently implemented:
- assignTerminals
- findTerminal
- getStoreUnderAccount
- getTerminalDetails
- getTerminalsUnderAccount
Please refer to the Terminal Manual for specifics around the API.
https://docs.adyen.com/api-explorer/#/postfmapi/

Args:
client (AdyenAPIClient, optional): An API client for the service to
use. If not provided, a new API client will be created.
"""

def __init__(self, client=None):
super(AdyenTerminal, self).__init__(client=client)
self.service = "terminal"

def assign_terminals(self, request="", **kwargs):
return self.client.call_api(request, self.service, "assignTerminals", **kwargs)

def find_terminal(self, request="", **kwargs):
return self.client.call_api(request, self.service, "findTerminal", **kwargs)

def get_stores_under_account(self, request="", **kwargs):
return self.client.call_api(request, self.service, "getStoresUnderAccount", **kwargs)

def get_terminal_details(self, request="", **kwargs):
return self.client.call_api(request, self.service, "getTerminalDetails", **kwargs)

def get_terminals_under_account(self, request="", **kwargs):
return self.client.call_api(request, self.service, "getTerminalsUnderAccount", **kwargs)
2 changes: 2 additions & 0 deletions Adyen/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Those constants are used from the library only
BASE_PAL_URL = "https://pal-{}.adyen.com/pal/servlet"
BASE_TERMINAL_URL = "https://postfmapi-{}.adyen.com/postfmapi"
PAL_LIVE_ENDPOINT_URL_TEMPLATE = "https://{}-pal-live" \
".adyenpayments.com/pal/servlet"
BASE_HPP_URL = "https://{}.adyen.com/hpp"
Expand All @@ -12,5 +13,6 @@
API_RECURRING_VERSION = "v49"
API_PAYMENT_VERSION = "v64"
API_PAYOUT_VERSION = "v64"
API_TERMINAL_VERSION = "v1"
LIB_VERSION = "7.0.0"
LIB_NAME = "adyen-python-api-library"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The library supports all APIs under the following services:
* [Payouts API](https://docs.adyen.com/api-explorer/#/Payout/v64/overview): Endpoints for sending funds to your customers. Current supported version: **v64**
* [Orders API](https://docs.adyen.com/api-explorer/#/CheckoutService/v67/post/orders): Endpoints for creating and canceling orders. Current supported version: **v67**
* [Utility API](https://docs.adyen.com/api-explorer/#/CheckoutService/v67/post/originKeys): This operation takes the origin domains and returns a JSON object containing the corresponding origin keys for the domains. Current supported version: **v67**
* [Terminal API](https://docs.adyen.com/api-explorer/#/postfmapi/v1/overview): Endpoints for interacting with POS terminals. **v1**

For more information, refer to our [documentation](https://docs.adyen.com/) or the [API Explorer](https://docs.adyen.com/api-explorer/).

Expand Down
Loading