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
27 changes: 0 additions & 27 deletions Adyen/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions Adyen/services/balancePlatform/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
40 changes: 40 additions & 0 deletions Adyen/services/balancePlatform/balance_accounts_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)

46 changes: 0 additions & 46 deletions Adyen/services/balancePlatform/documents_api.py

This file was deleted.

38 changes: 0 additions & 38 deletions Adyen/services/balancePlatform/legal_entities_api.py

This file was deleted.

46 changes: 0 additions & 46 deletions Adyen/services/balancePlatform/transfer_instruments_api.py

This file was deleted.

4 changes: 2 additions & 2 deletions Adyen/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

# 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.

## Supported API versions
| 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** |
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 2 additions & 4 deletions test/CheckoutTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
Expand Down Expand Up @@ -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},
)
Expand Down