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
70 changes: 58 additions & 12 deletions src/blindpay/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import base64
import hashlib
import hmac
import warnings
from functools import cached_property
from typing import TYPE_CHECKING, Any, Dict, Literal, Mapping, Optional, TypeVar

Expand Down Expand Up @@ -44,6 +45,11 @@

__version__ = "2.3.0"

_RECEIVERS_DEPRECATION_MESSAGE = (
"Use 'customers' instead. 'receivers' is deprecated and will be removed in "
"v3.0.0. See https://www.blindpay.com/changelog/2026-06-04-customers-rename"
)

T = TypeVar("T")


Expand Down Expand Up @@ -206,6 +212,27 @@ def __getattr__(self, name: str) -> Any:
return getattr(self._base, name)


class _CustomersNamespace:
def __init__(self, instance_id: str, api_client: ApiClientImpl) -> None:
self._instance_id = instance_id
self._api = api_client

@cached_property
def _base(self) -> "CustomersResource":
from blindpay.resources.customers.customers import create_customers_resource

return create_customers_resource(self._instance_id, self._api)

@cached_property
def bank_accounts(self) -> "BankAccountsResource":
from blindpay.resources.bank_accounts.bank_accounts import create_bank_accounts_resource

return create_bank_accounts_resource(self._instance_id, self._api)

def __getattr__(self, name: str) -> Any:
return getattr(self._base, name)


class _ReceiversNamespace:
def __init__(self, instance_id: str, api_client: ApiClientImpl) -> None:
self._instance_id = instance_id
Expand Down Expand Up @@ -314,8 +341,13 @@ def payouts(self) -> "PayoutsResource":

return create_payouts_resource(self._instance_id, self._api)

@cached_property
def customers(self) -> _CustomersNamespace:
return _CustomersNamespace(self._instance_id, self._api)

@cached_property
def receivers(self) -> _ReceiversNamespace:
warnings.warn(_RECEIVERS_DEPRECATION_MESSAGE, DeprecationWarning, stacklevel=2)
return _ReceiversNamespace(self._instance_id, self._api)

@cached_property
Expand All @@ -334,12 +366,6 @@ def transfers(self) -> "TransfersResource":

return create_transfers_resource(self._instance_id, self._api)

@cached_property
def customers(self) -> "CustomersResource":
from blindpay.resources.customers import create_customers_resource

return create_customers_resource(self._instance_id, self._api)

@cached_property
def fees(self) -> "FeesResource":
from blindpay.resources.fees import create_fees_resource
Expand Down Expand Up @@ -454,6 +480,27 @@ def __getattr__(self, name: str) -> Any:
return getattr(self._base, name)


class _CustomersNamespaceSync:
def __init__(self, instance_id: str, api_client: ApiClientImplSync) -> None:
self._instance_id = instance_id
self._api = api_client

@cached_property
def _base(self) -> "CustomersResourceSync":
from blindpay.resources.customers.customers import create_customers_resource_sync

return create_customers_resource_sync(self._instance_id, self._api)

@cached_property
def bank_accounts(self) -> "BankAccountsResourceSync":
from blindpay.resources.bank_accounts.bank_accounts import create_bank_accounts_resource_sync

return create_bank_accounts_resource_sync(self._instance_id, self._api)

def __getattr__(self, name: str) -> Any:
return getattr(self._base, name)


class _ReceiversNamespaceSync:
def __init__(self, instance_id: str, api_client: ApiClientImplSync) -> None:
self._instance_id = instance_id
Expand Down Expand Up @@ -562,8 +609,13 @@ def payouts(self) -> "PayoutsResourceSync":

return create_payouts_resource_sync(self._instance_id, self._api)

@cached_property
def customers(self) -> _CustomersNamespaceSync:
return _CustomersNamespaceSync(self._instance_id, self._api)

@cached_property
def receivers(self) -> _ReceiversNamespaceSync:
warnings.warn(_RECEIVERS_DEPRECATION_MESSAGE, DeprecationWarning, stacklevel=2)
return _ReceiversNamespaceSync(self._instance_id, self._api)

@cached_property
Expand All @@ -582,12 +634,6 @@ def transfers(self) -> "TransfersResourceSync":

return create_transfers_resource_sync(self._instance_id, self._api)

@cached_property
def customers(self) -> "CustomersResourceSync":
from blindpay.resources.customers import create_customers_resource_sync

return create_customers_resource_sync(self._instance_id, self._api)

@cached_property
def fees(self) -> "FeesResourceSync":
from blindpay.resources.fees import create_fees_resource_sync
Expand Down
6 changes: 4 additions & 2 deletions src/blindpay/resources/bank_accounts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
CreatePixSafeResponse,
CreateRtpInput,
CreateRtpResponse,
CreateSepaInput,
CreateSepaResponse,
CreateSpeiInput,
CreateSpeiResponse,
CreateTedInput,
Expand All @@ -27,7 +29,6 @@
CreateWireResponse,
GetBankAccountResponse,
ListBankAccountsResponse,
OfframpNetwork,
PixSafeType,
PixType,
RtpType,
Expand All @@ -53,12 +54,12 @@
"CreateWireInput",
"CreateInternationalSwiftInput",
"CreateRtpInput",
"CreateSepaInput",
"CreateTedInput",
"AchCopBitsoType",
"AchCopDocument",
"AchType",
"ArgentinaTransfers",
"OfframpNetwork",
"PixType",
"PixSafeType",
"TransfersBitsoType",
Expand All @@ -75,6 +76,7 @@
"CreatePixResponse",
"CreatePixSafeResponse",
"CreateRtpResponse",
"CreateSepaResponse",
"CreateSpeiResponse",
"CreateTedResponse",
"CreateWireResponse",
Expand Down
Loading
Loading