diff --git a/.github/workflows/services.yml b/.github/workflows/services.yml index 76378a68..91aed06f 100644 --- a/.github/workflows/services.yml +++ b/.github/workflows/services.yml @@ -12,6 +12,7 @@ jobs: - name: Set PR variables id: vars run: | + cd build/spec echo ::set-output name=pr_title::"Update services" echo ::set-output name=pr_body::"OpenAPI spec or templates produced new services on $(date +%d-%m-%Y) \ by [commit](https://github.com/Adyen/adyen-openapi/commit/$(git rev-parse HEAD))." diff --git a/Adyen/services/checkout/classic_checkout_sdk_api.py b/Adyen/services/checkout/classic_checkout_sdk_api.py index 9246c3b3..f33eacc9 100644 --- a/Adyen/services/checkout/classic_checkout_sdk_api.py +++ b/Adyen/services/checkout/classic_checkout_sdk_api.py @@ -11,7 +11,7 @@ class ClassicCheckoutSDKApi(AdyenServiceBase): def __init__(self, client=None): super(ClassicCheckoutSDKApi, self).__init__(client=client) self.service = "checkout" - self.baseUrl = "https://checkout-test.adyen.com/v70" + self.baseUrl = "https://checkout-test.adyen.com/v71" def payment_session(self, request, idempotency_key=None, **kwargs): """ diff --git a/Adyen/services/checkout/modifications_api.py b/Adyen/services/checkout/modifications_api.py index 37212812..ef229ade 100644 --- a/Adyen/services/checkout/modifications_api.py +++ b/Adyen/services/checkout/modifications_api.py @@ -11,7 +11,7 @@ class ModificationsApi(AdyenServiceBase): def __init__(self, client=None): super(ModificationsApi, self).__init__(client=client) self.service = "checkout" - self.baseUrl = "https://checkout-test.adyen.com/v70" + self.baseUrl = "https://checkout-test.adyen.com/v71" def cancel_authorised_payment(self, request, idempotency_key=None, **kwargs): """ diff --git a/Adyen/services/checkout/orders_api.py b/Adyen/services/checkout/orders_api.py index cc932c56..c4f00dfc 100644 --- a/Adyen/services/checkout/orders_api.py +++ b/Adyen/services/checkout/orders_api.py @@ -11,7 +11,7 @@ class OrdersApi(AdyenServiceBase): def __init__(self, client=None): super(OrdersApi, self).__init__(client=client) self.service = "checkout" - self.baseUrl = "https://checkout-test.adyen.com/v70" + self.baseUrl = "https://checkout-test.adyen.com/v71" def orders(self, request, idempotency_key=None, **kwargs): """ diff --git a/Adyen/services/checkout/payment_links_api.py b/Adyen/services/checkout/payment_links_api.py index 77c0801d..1c8ebf55 100644 --- a/Adyen/services/checkout/payment_links_api.py +++ b/Adyen/services/checkout/payment_links_api.py @@ -11,7 +11,7 @@ class PaymentLinksApi(AdyenServiceBase): def __init__(self, client=None): super(PaymentLinksApi, self).__init__(client=client) self.service = "checkout" - self.baseUrl = "https://checkout-test.adyen.com/v70" + self.baseUrl = "https://checkout-test.adyen.com/v71" def get_payment_link(self, linkId, idempotency_key=None, **kwargs): """ diff --git a/Adyen/services/checkout/payments_api.py b/Adyen/services/checkout/payments_api.py index 43955ec4..d589cedf 100644 --- a/Adyen/services/checkout/payments_api.py +++ b/Adyen/services/checkout/payments_api.py @@ -11,7 +11,7 @@ class PaymentsApi(AdyenServiceBase): def __init__(self, client=None): super(PaymentsApi, self).__init__(client=client) self.service = "checkout" - self.baseUrl = "https://checkout-test.adyen.com/v70" + self.baseUrl = "https://checkout-test.adyen.com/v71" def get_result_of_payment_session(self, sessionId, idempotency_key=None, **kwargs): """ diff --git a/Adyen/services/checkout/recurring_api.py b/Adyen/services/checkout/recurring_api.py index 10d419cd..dd75c2a8 100644 --- a/Adyen/services/checkout/recurring_api.py +++ b/Adyen/services/checkout/recurring_api.py @@ -11,7 +11,7 @@ class RecurringApi(AdyenServiceBase): def __init__(self, client=None): super(RecurringApi, self).__init__(client=client) self.service = "checkout" - self.baseUrl = "https://checkout-test.adyen.com/v70" + self.baseUrl = "https://checkout-test.adyen.com/v71" def delete_token_for_stored_payment_details(self, storedPaymentMethodId, idempotency_key=None, **kwargs): """ diff --git a/Adyen/services/checkout/utility_api.py b/Adyen/services/checkout/utility_api.py index eb1af7ce..a7cfa620 100644 --- a/Adyen/services/checkout/utility_api.py +++ b/Adyen/services/checkout/utility_api.py @@ -11,7 +11,7 @@ class UtilityApi(AdyenServiceBase): def __init__(self, client=None): super(UtilityApi, self).__init__(client=client) self.service = "checkout" - self.baseUrl = "https://checkout-test.adyen.com/v70" + self.baseUrl = "https://checkout-test.adyen.com/v71" def get_apple_pay_session(self, request, idempotency_key=None, **kwargs): """ diff --git a/Adyen/services/disputes.py b/Adyen/services/disputes.py index c2884f5a..977b750e 100644 --- a/Adyen/services/disputes.py +++ b/Adyen/services/disputes.py @@ -37,14 +37,6 @@ def delete_dispute_defense_document(self, request, idempotency_key=None, **kwarg method = "POST" return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs) - def download_dispute_defense_document(self, request, idempotency_key=None, **kwargs): - """ - Download a defense document - """ - endpoint = self.baseUrl + f"/downloadDisputeDefenseDocument" - method = "POST" - return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs) - def retrieve_applicable_defense_reasons(self, request, idempotency_key=None, **kwargs): """ Get applicable defense reasons diff --git a/Adyen/services/management/my_api_credential_api.py b/Adyen/services/management/my_api_credential_api.py index 2f9687c2..60eb0954 100644 --- a/Adyen/services/management/my_api_credential_api.py +++ b/Adyen/services/management/my_api_credential_api.py @@ -53,9 +53,9 @@ def add_allowed_origin(self, request, idempotency_key=None, **kwargs): method = "POST" return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs) - def generate_new_client_key_for_self(self, idempotency_key=None, **kwargs): + def generate_client_key(self, idempotency_key=None, **kwargs): """ - Generate new client key for self + Generate a client key """ endpoint = self.baseUrl + f"/me/generateClientKey" method = "POST" diff --git a/Adyen/settings.py b/Adyen/settings.py index 89a8bd27..caf2f123 100644 --- a/Adyen/settings.py +++ b/Adyen/settings.py @@ -1,2 +1,2 @@ LIB_NAME = "adyen-python-api-library" -LIB_VERSION = "10.0.0-beta" +LIB_VERSION = "10.0.0" diff --git a/Makefile b/Makefile index d2709a8c..3cff06c5 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ smallServices:=binlookup dataProtection recurring storedValue terminal disputes all: $(services) $(smallServices) binlookup: spec=BinLookupService-v52 -checkout: spec=CheckoutService-v70 +checkout: spec=CheckoutService-v71 dataProtection: spec=DataProtectionService-v1 storedValue: spec=StoredValueService-v46 terminal: spec=TfmAPIService-v1 diff --git a/README.md b/README.md index 863f3eb6..c8b37e8f 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,12 @@ This is the officially supported Python library for using Adyen's APIs. ## Supported API versions + | API | Description | Service Name | Supported version | |-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------|-------------------| | [BIN lookup API](https://docs.adyen.com/api-explorer/BinLookup/52/overview) | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | binLookup | **v52** | | [Balance Platform API](https://docs.adyen.com/api-explorer/balanceplatform/2/overview) | The Balance Platform API enables you to create a platform where you can onboard your users as account holders and create balance accounts, cards, and business accounts. | balancePlatform | **v2** | -| [Checkout API](https://docs.adyen.com/api-explorer/Checkout/70/overview) | Our latest integration for accepting online payments. | checkout | **v70** | +| [Checkout API](https://docs.adyen.com/api-explorer/Checkout/71/overview) | Our latest integration for accepting online payments. | checkout | **v71** | | [Data Protection API](https://docs.adyen.com/development-resources/data-protection-api) | Endpoint for requesting data erasure. | dataProtection | **v1** | | [Legal Entity Management API](https://docs.adyen.com/api-explorer/legalentity/3/overview) | Endpoint to manage legal entities | legalEntityManagement | **v3** | | [Management API](https://docs.adyen.com/api-explorer/Management/3/overview) | Configure and manage your Adyen company and merchant accounts, stores, and payment terminals. | management | **v3** | @@ -25,37 +26,33 @@ This is the officially supported Python library for using Adyen's APIs. For more information, refer to our [documentation](https://docs.adyen.com/) or the [API Explorer](https://docs.adyen.com/api-explorer/). - - - - ## Prerequisites -- [Adyen test account](https://docs.adyen.com/get-started-with-adyen) -- [API key](https://docs.adyen.com/development-resources/api-credentials#generate-api-key). For testing, your API credential needs to have the [API PCI Payments role](https://docs.adyen.com/development-resources/api-credentials#roles). +- [Adyen test account](https://docs.adyen.com/get-started-with-adyen) +- [API key](https://docs.adyen.com/development-resources/api-credentials#generate-api-key). For testing, your API credential needs to have the [API PCI Payments role](https://docs.adyen.com/development-resources/api-credentials#roles). - Python 3.6 or higher - Packages (optional): requests or pycurl - - ## Installation +## Installation -### For development purposes +### For development purpose Clone this repository and run + ~~~~ bash make install ~~~~ -### For usage propose +### For usage purpose Use pip command: + ~~~~ bash pip install Adyen ~~~~ ## Using the library - ### General use with API key ~~~~ python @@ -67,84 +64,104 @@ adyen.payment.client.xapikey = "YourXapikey" adyen.payment.client.hmac = "YourHMACkey" adyen.payment.client.platform = "test" # Environment to use the library in. ~~~~ + ### Consuming Services + Every API the library supports is represented by a service object. The name of the service matching the corresponding API is listed in the [Integrations](#supported-api-versions) section of this document. + #### Using all services + ~~~~python import Adyen + adyen = Adyen.Adyen() adyen.payment.client.xapikey = "YourXapikey" adyen.payment.client.platform = "test" # change to live for production request = { - "amount": { + "amount": { "currency": "USD", - "value": 1000 # value in minor units - }, - "reference": "Your order number", - "paymentMethod": { + "value": 1000 # value in minor units + }, + "reference": "Your order number", + "paymentMethod": { "type": "visa", "encryptedCardNumber": "test_4111111111111111", "encryptedExpiryMonth": "test_03", "encryptedExpiryYear": "test_2030", "encryptedSecurityCode": "test_737" - }, - "shopperReference": "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", - "returnUrl": "https://your-company.com/...", - "merchantAccount": "YOUR_MERCHANT_ACCOUNT" - } + }, + "shopperReference": "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", + "returnUrl": "https://your-company.com/...", + "merchantAccount": "YOUR_MERCHANT_ACCOUNT" +} result = adyen.checkout.payments_api.payments(request) ~~~~ + #### Using one of the services + ~~~~python from Adyen import checkout + checkout.client.xapikey = "YourXapikey" checkout.client.platform = "test" # change to live for production request = { - "amount": { + "amount": { "currency": "USD", - "value": 1000 # value in minor units - }, - "reference": "Your order number", - "paymentMethod": { + "value": 1000 # value in minor units + }, + "reference": "Your order number", + "paymentMethod": { "type": "visa", "encryptedCardNumber": "test_4111111111111111", "encryptedExpiryMonth": "test_03", "encryptedExpiryYear": "test_2030", "encryptedSecurityCode": "test_737" - }, - "shopperReference": "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", - "returnUrl": "https://your-company.com/...", - "merchantAccount": "YOUR_MERCHANT_ACCOUNT" - } + }, + "shopperReference": "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", + "returnUrl": "https://your-company.com/...", + "merchantAccount": "YOUR_MERCHANT_ACCOUNT" +} result = checkout.payments_api.payments(request) ~~~~ + #### Force HTTP library + ~~~~python import Adyen + adyen = Adyen.Adyen() adyen.client.http_force = 'requests' # or 'pycurl' ~~~~ + ### Using query parameters (management API only) + Define a dictionary with query parameters that you want to use. + ~~~~ python query_parameters = { - 'pageSize':10, - 'pageNumber':3 - } + 'pageSize': 10, + 'pageNumber': 3 +} ~~~~ + pass the dictionary to the method as an additional argument. + ~~~~ python adyen.management.account_company_level_api.get_companies(query_parameters=query_parameters) ~~~~ + ### Handling exceptions + Adyen service exceptions extend the AdyenError class. After you catch this exception, you can access the class arguments for the specifics around this error or use the debug method which prints all the arguments. + ~~~~python try: - adyen.checkout.payments(request) -except Adyen.exceptions.AdyenErorr as error: - error.debug() + adyen.checkout.payments_api.payments(request) +except Adyen.exceptions.AdyenError as error: + print(error.debug()) ~~~~ +
List of exceptions

AdyenInvalidRequestError

AdyenAPIResponseError

@@ -162,27 +179,27 @@ except Adyen.exceptions.AdyenErorr as error: For a closer look at how our Python library works, clone our [example integration](https://github.com/adyen-examples/adyen-python-online-payments). This includes commented code, highlighting key features and concepts, and examples of API calls that can be made using the library. ## Feedback + We value your input! Help us enhance our API Libraries and improve the integration experience by providing your feedback. Please take a moment to fill out [our feedback form](https://forms.gle/A4EERrR6CWgKWe5r9) to share your thoughts, suggestions or ideas. ## Contributing We encourage you to contribute to this repository, so everyone can benefit from new features, bug fixes, and any other improvements. - Have a look at our [contributing guidelines](https://github.com/Adyen/adyen-python-api-library/blob/develop/CONTRIBUTING.md) to find out how to raise a pull request. - ## Support + If you have a feature request, or spotted a bug or a technical problem, [create an issue here](https://github.com/Adyen/adyen-web/issues/new/choose). For other questions, [contact our Support Team](https://www.adyen.help/hc/en-us/requests/new?ticket_form_id=360000705420). - ## Licence + This repository is available under the [MIT license](https://github.com/Adyen/adyen-python-api-library/blob/main/LICENSE.md). - ## See also + * [Example integration](https://github.com/adyen-examples/adyen-python-online-payments) * [Adyen docs](https://docs.adyen.com/) * [API Explorer](https://docs.adyen.com/api-explorer/) diff --git a/setup.py b/setup.py index d2b8b3a4..c4a0688d 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='Adyen', packages=find_packages(include="Adyen*"), - version='10.0.0-beta', + version='10.0.0', maintainer='Adyen', maintainer_email='support@adyen.com', description='Adyen Python Api',