Skip to content

Commit 16ab0d4

Browse files
authored
Merge branch 'develop' into feat/terminal-api
2 parents 4fcd02a + 9361510 commit 16ab0d4

File tree

11 files changed

+299
-13
lines changed

11 files changed

+299
-13
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @Aleffio @AlexandrosMor @martinsrenato @rikterbeek @acampos1916 @cyattilakiss
1+
* @AlexandrosMor @martinsrenato @rikterbeek @acampos1916 @candemiralp

Adyen/client.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,14 @@ def _determine_hpp_url(platform, action):
162162
result = '/'.join([base_uri, service])
163163
return result
164164

165-
def _determine_checkout_url(self, platform, action):
165+
def _determine_checkout_url(self, platform, action, path_param=None):
166166
"""This returns the Adyen API endpoint based on the provided platform,
167167
service and action.
168168
169169
Args:
170170
platform (str): Adyen platform, ie 'live' or 'test'.
171171
action (str): the API action to perform.
172+
path_param Optional[(str)]: a generic id that can be used to modify a payment e.g. paymentPspReference.
172173
"""
173174
api_version = self.api_checkout_version
174175
if platform == "test":
@@ -188,6 +189,16 @@ def _determine_checkout_url(self, platform, action):
188189
action = "payments/details"
189190
if action == "paymentsResult":
190191
action = "payments/result"
192+
if action == "cancels":
193+
action = "/cancels"
194+
if action == "paymentsCancelsWithReference":
195+
action = f"payments/{path_param}/cancels"
196+
if action == "paymentsCapture":
197+
action = f"/payments/{path_param}/captures"
198+
if action == "paymentsReversals":
199+
action = f"payments/{path_param}/reversals"
200+
if action == "payments/Refunds":
201+
action = f"payments/{path_param}/refunds"
191202
if action == "originKeys":
192203
api_version = self.api_checkout_utility_version
193204
if action == "paymentMethodsBalance":
@@ -454,7 +465,7 @@ class instance.
454465
status_code, headers, message)
455466
return adyen_result
456467

457-
def call_checkout_api(self, request_data, action, idempotency_key=None,
468+
def call_checkout_api(self, request_data, action, idempotency_key=None, path_param=None,
458469
**kwargs):
459470
"""This will call the checkout adyen api. xapi key merchant_account,
460471
and platform are pulled from root module level and or self object.
@@ -469,6 +480,7 @@ def call_checkout_api(self, request_data, action, idempotency_key=None,
469480
https://docs.adyen.com/api-explorer/#/CheckoutService
470481
service (str): This is the API service to be called.
471482
action (str): The specific action of the API service to be called
483+
path_param (str): This is used to pass the id or referenceID to the API sercie
472484
"""
473485
if not self.http_init:
474486
self._init_http_client()
@@ -535,7 +547,7 @@ def call_checkout_api(self, request_data, action, idempotency_key=None,
535547
headers = {}
536548
if idempotency_key:
537549
headers[self.IDEMPOTENCY_HEADER_NAME] = idempotency_key
538-
url = self._determine_checkout_url(platform, action)
550+
url = self._determine_checkout_url(platform, action, path_param)
539551

540552
raw_response, raw_request, status_code, headers = \
541553
self.http_client.request(url, json=request_data,

Adyen/services.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,13 @@ class AdyenCheckoutApi(AdyenServiceBase):
279279
payments/details
280280
originKeys
281281
282+
Modifications:
283+
capture
284+
refunds
285+
cancels
286+
reversals
287+
288+
282289
Please refer to the checkout documentation for specifics around the API.
283290
https://docs.adyen.com/online-payments
284291
@@ -321,6 +328,42 @@ def payment_result(self, request=None, **kwargs):
321328
action = "paymentsResult"
322329
return self.client.call_checkout_api(request, action, **kwargs)
323330

331+
def payments_captures(self, request, idempotency_key=None, path_param=None, **kwargs):
332+
if path_param == "":
333+
raise ValueError(
334+
'must contain a pspReference in the path_param, path_param cannot be empty'
335+
)
336+
action = "paymentsCapture"
337+
return self.client.call_checkout_api(request, action, idempotency_key, path_param, **kwargs)
338+
339+
def payments_cancels_without_reference(self, request, idempotency_key=None, **kwargs):
340+
action = "cancels"
341+
return self.client.call_checkout_api(request, action, idempotency_key, **kwargs)
342+
343+
def payments_cancels_with_reference(self, request, idempotency_key=None, path_param=None, **kwargs):
344+
if path_param == "":
345+
raise ValueError(
346+
'must contain a pspReference in the path_param, path_param cannot be empty'
347+
)
348+
action = "paymentsCancelsWithReference"
349+
return self.client.call_checkout_api(request, action, idempotency_key, path_param, **kwargs)
350+
351+
def payments_reversals(self, request, idempotency_key=None, path_param=None, **kwargs):
352+
if path_param == "":
353+
raise ValueError(
354+
'must contain a pspReference in the path_param, path_param cannot be empty'
355+
)
356+
action = "paymentsReversals"
357+
return self.client.call_checkout_api(request, action, idempotency_key, path_param, **kwargs)
358+
359+
def payments_refunds(self, request, idempotency_key=None, path_param=None, **kwargs):
360+
if path_param == "":
361+
raise ValueError(
362+
'must contain a pspReference in the path_param, path_param cannot be empty'
363+
)
364+
action = "paymentsRefunds"
365+
return self.client.call_checkout_api(request, action, idempotency_key, path_param, **kwargs)
366+
324367
def origin_keys(self, request=None, **kwargs):
325368
action = "originKeys"
326369
return self.client.call_checkout_api(request, action, **kwargs)

Adyen/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
ENDPOINT_CHECKOUT_LIVE_SUFFIX = "https://{}-checkout-live" \
99
".adyenpayments.com/checkout"
1010
API_BIN_LOOKUP_VERSION = "v50"
11-
API_CHECKOUT_VERSION = "v68"
11+
API_CHECKOUT_VERSION = "v69"
1212
API_CHECKOUT_UTILITY_VERSION = "v1"
1313
API_RECURRING_VERSION = "v49"
1414
API_PAYMENT_VERSION = "v64"
1515
API_PAYOUT_VERSION = "v64"
1616
API_TERMINAL_VERSION = "v1"
17-
LIB_VERSION = "6.0.0"
17+
LIB_VERSION = "7.0.0"
1818
LIB_NAME = "adyen-python-api-library"

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
[![Build Status](https://travis-ci.org/Adyen/adyen-python-api-library.svg?branch=master)](https://travis-ci.org/Adyen/adyen-python-api-library)
2-
[![Coverage Status](https://coveralls.io/repos/github/Adyen/adyen-python-api-library/badge.svg?branch=master)](https://coveralls.io/github/Adyen/adyen-python-api-library?branch=master)
1+
# Adyen APIs Library for Python
2+
3+
[![version](https://img.shields.io/badge/version-7.0.0-blue.svg)](https://docs.adyen.com/development-resources/libraries)
34

45
This is the officially supported Python library for using Adyen's APIs.
6+
57
## Integration
68
The library supports all APIs under the following services:
79

8-
* [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v68/overview): Our latest integration for accepting online payments. Current supported version: **v68**
10+
* [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v69/overview): Our latest integration for accepting online payments. Current supported version: **v69**
911
* [Payments API](https://docs.adyen.com/api-explorer/#/Payment/v64/overview): Our classic integration for online payments. Current supported version: **v64**
1012
* [Recurring API](https://docs.adyen.com/api-explorer/#/Recurring/v49/overview): Endpoints for managing saved payment details. Current supported version: **v49**
1113
* [Payouts API](https://docs.adyen.com/api-explorer/#/Payout/v64/overview): Endpoints for sending funds to your customers. Current supported version: **v64**
@@ -77,7 +79,7 @@ For other questions, [contact our Support Team](https://www.adyen.help/hc/en-us/
7779

7880

7981
## Licence
80-
This repository is available under the [MIT license](https://github.com/Adyen/adyen-python-api-library/blob/master/LICENSE.md).
82+
This repository is available under the [MIT license](https://github.com/Adyen/adyen-python-api-library/blob/main/LICENSE.md).
8183

8284

8385
## See also

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(
44
name='Adyen',
55
packages=['Adyen'],
6-
version='6.0.0',
6+
version='7.0.0',
77
maintainer='Adyen',
88
maintainer_email='support@adyen.com',
99
description='Adyen Python Api',

0 commit comments

Comments
 (0)