diff --git a/Adyen/client.py b/Adyen/client.py index 61325a13..2c885f3e 100644 --- a/Adyen/client.py +++ b/Adyen/client.py @@ -388,33 +388,6 @@ def call_adyen_api( platform = self._set_platform(**kwargs) message = request_data - with_app_info = [ - "/authorise", - "/authorise3d", - "/authorise3ds2", - "/payments", - "/paymentSession", - "/paymentLinks", - "/paymentMethods/balance", - "/sessions" - ] - - if endpoint in with_app_info and (method == 'POST' or method == 'PATCH'): - if 'applicationInfo' in request_data: - request_data['applicationInfo'].update({ - "adyenLibrary": { - "name": settings.LIB_NAME, - "version": settings.LIB_VERSION - } - }) - else: - request_data['applicationInfo'] = { - "adyenLibrary": { - "name": settings.LIB_NAME, - "version": settings.LIB_VERSION - } - } - headers = { self.APPLICATION_INFO_HEADER_NAME: settings.LIB_NAME, self.APPLICATION_VERSION_HEADER_NAME: settings.LIB_VERSION diff --git a/Adyen/services/balancePlatform/__init__.py b/Adyen/services/balancePlatform/__init__.py index df8b8042..46e88cbe 100644 --- a/Adyen/services/balancePlatform/__init__.py +++ b/Adyen/services/balancePlatform/__init__.py @@ -2,13 +2,10 @@ from .account_holders_api import AccountHoldersApi from .balance_accounts_api import BalanceAccountsApi from .bank_account_validation_api import BankAccountValidationApi -from .documents_api import DocumentsApi -from .legal_entities_api import LegalEntitiesApi from .payment_instrument_groups_api import PaymentInstrumentGroupsApi from .payment_instruments_api import PaymentInstrumentsApi from .platform_api import PlatformApi from .transaction_rules_api import TransactionRulesApi -from .transfer_instruments_api import TransferInstrumentsApi class AdyenBalancePlatformApi(AdyenServiceBase): @@ -23,10 +20,7 @@ def __init__(self, client=None): self.account_holders_api = AccountHoldersApi(client=client) self.balance_accounts_api = BalanceAccountsApi(client=client) self.bank_account_validation_api = BankAccountValidationApi(client=client) - self.documents_api = DocumentsApi(client=client) - self.legal_entities_api = LegalEntitiesApi(client=client) self.payment_instrument_groups_api = PaymentInstrumentGroupsApi(client=client) self.payment_instruments_api = PaymentInstrumentsApi(client=client) self.platform_api = PlatformApi(client=client) self.transaction_rules_api = TransactionRulesApi(client=client) - self.transfer_instruments_api = TransferInstrumentsApi(client=client) diff --git a/Adyen/services/balancePlatform/balance_accounts_api.py b/Adyen/services/balancePlatform/balance_accounts_api.py index 044dad05..40882f7d 100644 --- a/Adyen/services/balancePlatform/balance_accounts_api.py +++ b/Adyen/services/balancePlatform/balance_accounts_api.py @@ -12,6 +12,30 @@ def __init__(self, client=None): super(BalanceAccountsApi, self).__init__(client=client) self.service = "balancePlatform" + def delete_sweep(self, balanceAccountId, sweepId, idempotency_key=None, **kwargs): + """ + Delete a sweep + """ + endpoint = f"/balanceAccounts/{balanceAccountId}/sweeps/{sweepId}" + method = "DELETE" + return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs) + + def get_all_sweeps_for_balance_account(self, balanceAccountId, idempotency_key=None, **kwargs): + """ + Get all sweeps for a balance account + """ + endpoint = f"/balanceAccounts/{balanceAccountId}/sweeps" + method = "GET" + return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs) + + def get_sweep(self, balanceAccountId, sweepId, idempotency_key=None, **kwargs): + """ + Get a sweep + """ + endpoint = f"/balanceAccounts/{balanceAccountId}/sweeps/{sweepId}" + method = "GET" + return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs) + def get_balance_account(self, id, idempotency_key=None, **kwargs): """ Get a balance account @@ -28,6 +52,14 @@ def get_all_payment_instruments_for_balance_account(self, id, idempotency_key=No method = "GET" return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs) + def update_sweep(self, request, balanceAccountId, sweepId, idempotency_key=None, **kwargs): + """ + Update a sweep + """ + endpoint = f"/balanceAccounts/{balanceAccountId}/sweeps/{sweepId}" + method = "PATCH" + return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs) + def update_balance_account(self, request, id, idempotency_key=None, **kwargs): """ Update a balance account @@ -44,3 +76,11 @@ def create_balance_account(self, request, idempotency_key=None, **kwargs): method = "POST" return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs) + def create_sweep(self, request, balanceAccountId, idempotency_key=None, **kwargs): + """ + Create a sweep + """ + endpoint = f"/balanceAccounts/{balanceAccountId}/sweeps" + method = "POST" + return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs) + diff --git a/Adyen/services/balancePlatform/documents_api.py b/Adyen/services/balancePlatform/documents_api.py deleted file mode 100644 index b66dd3fc..00000000 --- a/Adyen/services/balancePlatform/documents_api.py +++ /dev/null @@ -1,46 +0,0 @@ -from ..base import AdyenServiceBase - - -class DocumentsApi(AdyenServiceBase): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, client=None): - super(DocumentsApi, self).__init__(client=client) - self.service = "balancePlatform" - - def delete_document(self, id, idempotency_key=None, **kwargs): - """ - Delete a document - """ - endpoint = f"/documents/{id}" - method = "DELETE" - return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs) - - def get_document(self, id, idempotency_key=None, **kwargs): - """ - Get a document - """ - endpoint = f"/documents/{id}" - method = "GET" - return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs) - - def update_document(self, request, id, idempotency_key=None, **kwargs): - """ - Update a document - """ - endpoint = f"/documents/{id}" - method = "PATCH" - return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs) - - def upload_document_for_verification_checks(self, request, idempotency_key=None, **kwargs): - """ - Upload a document for verification checks - """ - endpoint = f"/documents" - method = "POST" - return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs) - diff --git a/Adyen/services/balancePlatform/legal_entities_api.py b/Adyen/services/balancePlatform/legal_entities_api.py deleted file mode 100644 index 76d9f87c..00000000 --- a/Adyen/services/balancePlatform/legal_entities_api.py +++ /dev/null @@ -1,38 +0,0 @@ -from ..base import AdyenServiceBase - - -class LegalEntitiesApi(AdyenServiceBase): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, client=None): - super(LegalEntitiesApi, self).__init__(client=client) - self.service = "balancePlatform" - - def get_legal_entity(self, id, idempotency_key=None, **kwargs): - """ - Get a legal entity - """ - endpoint = f"/legalEntities/{id}" - method = "GET" - return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs) - - def update_legal_entity(self, request, id, idempotency_key=None, **kwargs): - """ - Update a legal entity - """ - endpoint = f"/legalEntities/{id}" - method = "PATCH" - return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs) - - def create_legal_entity(self, request, idempotency_key=None, **kwargs): - """ - Create a legal entity - """ - endpoint = f"/legalEntities" - method = "POST" - return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs) - diff --git a/Adyen/services/balancePlatform/transfer_instruments_api.py b/Adyen/services/balancePlatform/transfer_instruments_api.py deleted file mode 100644 index d1383359..00000000 --- a/Adyen/services/balancePlatform/transfer_instruments_api.py +++ /dev/null @@ -1,46 +0,0 @@ -from ..base import AdyenServiceBase - - -class TransferInstrumentsApi(AdyenServiceBase): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, client=None): - super(TransferInstrumentsApi, self).__init__(client=client) - self.service = "balancePlatform" - - def delete_transfer_instrument(self, id, idempotency_key=None, **kwargs): - """ - Delete a transfer instrument - """ - endpoint = f"/transferInstruments/{id}" - method = "DELETE" - return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs) - - def get_transfer_instrument(self, id, idempotency_key=None, **kwargs): - """ - Get a transfer instrument - """ - endpoint = f"/transferInstruments/{id}" - method = "GET" - return self.client.call_adyen_api(None, self.service, method, endpoint, idempotency_key, **kwargs) - - def update_transfer_instrument(self, request, id, idempotency_key=None, **kwargs): - """ - Update a transfer instrument - """ - endpoint = f"/transferInstruments/{id}" - method = "PATCH" - return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs) - - def create_transfer_instrument(self, request, idempotency_key=None, **kwargs): - """ - Create a transfer instrument - """ - endpoint = f"/transferInstruments" - method = "POST" - return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs) - diff --git a/Adyen/settings.py b/Adyen/settings.py index 6b98f497..e036496a 100644 --- a/Adyen/settings.py +++ b/Adyen/settings.py @@ -12,7 +12,7 @@ ENDPOINT_CHECKOUT_LIVE_SUFFIX = "https://{live_prefix}-checkout-live" \ ".adyenpayments.com/checkout" BASE_STORED_VALUE_URL = "https://pal-{}.adyen.com/pal/servlet/StoredValue" -API_BALANCE_PLATFORM_VERSION = "v1" +API_BALANCE_PLATFORM_VERSION = "v2" API_BIN_LOOKUP_VERSION = "v52" API_CHECKOUT_VERSION = "v70" API_CHECKOUT_UTILITY_VERSION = "v1" @@ -22,7 +22,7 @@ API_PAYMENT_VERSION = "v68" API_PAYOUT_VERSION = "v68" API_TERMINAL_VERSION = "v1" -LIB_VERSION = "7.1.2" +LIB_VERSION = "8.0.0" API_TRANSFERS_VERSION = "v3" API_LEGAL_ENTITY_MANAGEMENT_VERSION = "v2" API_STORED_VALUE_VERSION = "v46" diff --git a/Makefile b/Makefile index f9455c98..ad38790d 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ recurring: spec=RecurringService-v68 payouts: spec=PayoutService-v68 management: spec=ManagementService-v1 legalEntityManagement: spec=LegalEntityService-v2 -balancePlatform: spec=BalancePlatformService-v1 +balancePlatform: spec=BalancePlatformService-v2 platformsAccount: spec=AccountService-v6 platformsFund: spec=FundService-v6 platformsNotificationConfiguration: spec=NotificationConfigurationService-v6 diff --git a/README.md b/README.md index 9dc05e4a..bfff90d3 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # Adyen APIs Library for Python -[![version](https://img.shields.io/badge/version-7.1.1-blue.svg)](https://docs.adyen.com/development-resources/libraries) +[![version](https://img.shields.io/badge/version-8.0.0-blue.svg)](https://docs.adyen.com/development-resources/libraries) This is the officially supported Python library for using Adyen's APIs. @@ -10,7 +10,7 @@ This is the officially supported Python library for using Adyen's APIs. | API | Description | Service Name | Supported version | | --- | ----------- | ------------ | ----------------- | |[BIN lookup API](https://docs.adyen.com/api-explorer/#/BinLookup/v52/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/1/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 | **v1** | +| [Balance Platform API](https://docs.adyen.com/api-explorer/balanceplatform/1/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/#/CheckoutService/v69/overview)| Our latest integration for accepting online payments. | checkout | **v70** | | [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/latest/overview) | Endpoint to manage legal entities | legalEntityManagement | **v2** | diff --git a/setup.py b/setup.py index 4b4bf90d..897a7a7d 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='Adyen', packages=find_packages(include="Adyen*"), - version='7.1.2', + version='8.0.0', maintainer='Adyen', maintainer_email='support@adyen.com', description='Adyen Python Api', diff --git a/test/CheckoutTest.py b/test/CheckoutTest.py index 435a9f1e..728d356a 100644 --- a/test/CheckoutTest.py +++ b/test/CheckoutTest.py @@ -109,8 +109,7 @@ def test_payments_error_mocked(self): 'expiryMonth': '08', 'type': 'scheme', 'cvc': '737' - }, - 'applicationInfo': {'adyenLibrary': {'name': 'adyen-python-api-library', 'version': settings.LIB_VERSION}} + } }, xapikey='YourXapikey' ) @@ -510,8 +509,7 @@ def test_sessions_error(self): self.adyen.client.http_client.request.assert_called_once_with( 'POST', f'https://checkout-test.adyen.com/{self.checkout_version}/sessions', - json={'merchantAccount': 'YourMerchantAccount', - 'applicationInfo': {'adyenLibrary': {'name': 'adyen-python-api-library', 'version': settings.LIB_VERSION}}}, + json={'merchantAccount': 'YourMerchantAccount'}, xapikey='YourXapikey', headers={'adyen-library-name': 'adyen-python-api-library', 'adyen-library-version': settings.LIB_VERSION}, )