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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "blindpay"
version = "1.2.0"
version = "1.3.0"
description = "Official Python SDK for the Blindpay API — Global payments infrastructure"
readme = "README.md"
authors = [{ name = "Blindpay", email = "alves@blindpay.com" }]
Expand Down
6 changes: 5 additions & 1 deletion src/blindpay/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.2.0"
__version__ = "1.3.0"

from ._internal.exceptions import BlindPayError
from .client import BlindPay, BlindPaySync
Expand All @@ -15,7 +15,9 @@
Network,
PaginationMetadata,
PaginationParams,
PaymentMethod,
Rail,
RecipientRelationship,
StablecoinToken,
TrackingComplete,
TrackingLiquidity,
Expand All @@ -36,7 +38,9 @@
"Currency",
"CurrencyType",
"Network",
"PaymentMethod",
"Rail",
"RecipientRelationship",
"StablecoinToken",
"TransactionDocumentType",
"TransactionStatus",
Expand Down
44 changes: 43 additions & 1 deletion src/blindpay/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
from blindpay.resources.api_keys.api_keys import ApiKeysResource, ApiKeysResourceSync
from blindpay.resources.available.available import AvailableResource, AvailableResourceSync
from blindpay.resources.bank_accounts.bank_accounts import BankAccountsResource, BankAccountsResourceSync
from blindpay.resources.custodial_wallets.custodial_wallets import (
CustodialWalletsResource,
CustodialWalletsResourceSync,
)
from blindpay.resources.fees.fees import FeesResource, FeesResourceSync
from blindpay.resources.instances.instances import InstancesResource, InstancesResourceSync
from blindpay.resources.partner_fees.partner_fees import PartnerFeesResource, PartnerFeesResourceSync
from blindpay.resources.payins.payins import PayinsResource, PayinsResourceSync
Expand All @@ -24,6 +29,7 @@
TermsOfServiceResource,
TermsOfServiceResourceSync,
)
from blindpay.resources.transfers.transfers import TransfersResource, TransfersResourceSync
from blindpay.resources.virtual_accounts.virtual_accounts import (
VirtualAccountsResource,
VirtualAccountsResourceSync,
Expand All @@ -32,7 +38,7 @@
from blindpay.resources.wallets.offramp import OfframpWalletsResource, OfframpWalletsResourceSync
from blindpay.resources.webhooks.webhooks import WebhookEndpointsResource, WebhookEndpointsResourceSync

__version__ = "1.1.0"
__version__ = "1.3.0"

T = TypeVar("T")

Expand Down Expand Up @@ -234,6 +240,12 @@ def offramp(self) -> "OfframpWalletsResource":

return create_offramp_wallets_resource(self._instance_id, self._api)

@cached_property
def custodial(self) -> "CustodialWalletsResource":
from blindpay.resources.custodial_wallets.custodial_wallets import create_custodial_wallets_resource

return create_custodial_wallets_resource(self._instance_id, self._api)


class BlindPay:
_api_key: str
Expand Down Expand Up @@ -306,6 +318,18 @@ def virtual_accounts(self) -> "VirtualAccountsResource":
def wallets(self) -> _WalletsNamespace:
return _WalletsNamespace(self._instance_id, self._api)

@cached_property
def transfers(self) -> "TransfersResource":
from blindpay.resources.transfers import create_transfers_resource

return create_transfers_resource(self._instance_id, self._api)

@cached_property
def fees(self) -> "FeesResource":
from blindpay.resources.fees import create_fees_resource

return create_fees_resource(self._instance_id, self._api)

def verify_webhook_signature(
self, *, secret: str, id: str, timestamp: str, payload: str, svix_signature: str
) -> bool:
Expand Down Expand Up @@ -434,6 +458,12 @@ def offramp(self) -> "OfframpWalletsResourceSync":

return create_offramp_wallets_resource_sync(self._instance_id, self._api)

@cached_property
def custodial(self) -> "CustodialWalletsResourceSync":
from blindpay.resources.custodial_wallets.custodial_wallets import create_custodial_wallets_resource_sync

return create_custodial_wallets_resource_sync(self._instance_id, self._api)


class BlindPaySync:
_api_key: str
Expand Down Expand Up @@ -506,6 +536,18 @@ def virtual_accounts(self) -> "VirtualAccountsResourceSync":
def wallets(self) -> _WalletsNamespaceSync:
return _WalletsNamespaceSync(self._instance_id, self._api)

@cached_property
def transfers(self) -> "TransfersResourceSync":
from blindpay.resources.transfers import create_transfers_resource_sync

return create_transfers_resource_sync(self._instance_id, self._api)

@cached_property
def fees(self) -> "FeesResourceSync":
from blindpay.resources.fees import create_fees_resource_sync

return create_fees_resource_sync(self._instance_id, self._api)

def verify_webhook_signature(
self, *, secret: str, id: str, timestamp: str, payload: str, svix_signature: str
) -> bool:
Expand Down
6 changes: 6 additions & 0 deletions src/blindpay/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
from .api_keys import create_api_keys_resource
from .available import create_available_resource
from .bank_accounts import create_bank_accounts_resource
from .custodial_wallets import create_custodial_wallets_resource
from .fees import create_fees_resource
from .instances import create_instances_resource
from .partner_fees import create_partner_fees_resource
from .payins import create_payin_quotes_resource, create_payins_resource
from .payouts import create_payouts_resource
from .quotes import create_quotes_resource
from .receivers import create_receivers_resource
from .terms_of_service import create_terms_of_service_resource
from .transfers import create_transfers_resource
from .virtual_accounts import create_virtual_accounts_resource
from .wallets import create_blockchain_wallets_resource, create_offramp_wallets_resource
from .webhooks import create_webhook_endpoints_resource
Expand All @@ -16,6 +19,8 @@
"create_api_keys_resource",
"create_available_resource",
"create_bank_accounts_resource",
"create_custodial_wallets_resource",
"create_fees_resource",
"create_instances_resource",
"create_partner_fees_resource",
"create_payins_resource",
Expand All @@ -24,6 +29,7 @@
"create_quotes_resource",
"create_receivers_resource",
"create_terms_of_service_resource",
"create_transfers_resource",
"create_virtual_accounts_resource",
"create_blockchain_wallets_resource",
"create_offramp_wallets_resource",
Expand Down
14 changes: 14 additions & 0 deletions src/blindpay/resources/available/available.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ class SwiftCodeBankDetail(TypedDict):
GetSwiftCodeBankDetailsResponse = List[SwiftCodeBankDetail]


class NaicsCode(TypedDict):
code: str
title: str


GetNaicsCodesResponse = List[NaicsCode]


class AvailableResource:
def __init__(self, client: InternalApiClient):
self._client = client
Expand All @@ -108,6 +116,9 @@ async def get_rails(self) -> BlindpayApiResponse[GetRailsResponse]:
async def get_swift_code_bank_details(self, swift: str) -> BlindpayApiResponse[GetSwiftCodeBankDetailsResponse]:
return await self._client.get(f"/available/swift/{swift}")

async def get_naics_codes(self) -> BlindpayApiResponse[GetNaicsCodesResponse]:
return await self._client.get("/available/naics")


class AvailableResourceSync:
"""Synchronous version of AvailableResource"""
Expand All @@ -124,6 +135,9 @@ def get_rails(self) -> BlindpayApiResponse[GetRailsResponse]:
def get_swift_code_bank_details(self, swift: str) -> BlindpayApiResponse[GetSwiftCodeBankDetailsResponse]:
return self._client.get(f"/available/swift/{swift}")

def get_naics_codes(self) -> BlindpayApiResponse[GetNaicsCodesResponse]:
return self._client.get("/available/naics")


def create_available_resource(client: InternalApiClient) -> AvailableResource:
return AvailableResource(client)
Expand Down
95 changes: 90 additions & 5 deletions src/blindpay/resources/bank_accounts/bank_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
from typing_extensions import TypedDict

from ..._internal.api_client import InternalApiClient, InternalApiClientSync
from ...types import AccountClass, BankAccountType, BlindpayApiResponse, Country, Rail, SpeiProtocol
from ...types import (
AccountClass,
BankAccountType,
BlindpayApiResponse,
Country,
Rail,
RecipientRelationship,
SpeiProtocol,
)

ArgentinaTransfers = Literal["CVU", "CBU", "ALIAS"]
AchCopDocument = Literal["CC", "CE", "NIT", "PASS", "PEP"]
Expand All @@ -16,6 +24,7 @@
WireType = Literal["wire"]
InternationalSwiftType = Literal["international_swift"]
RtpType = Literal["rtp"]
PixSafeType = Literal["pix_safe"]


class OfframpWallet(TypedDict):
Expand Down Expand Up @@ -177,14 +186,28 @@ class CreateColombiaAchResponse(TypedDict):
created_at: str


class CreateAchInput(TypedDict):
class _CreateAchInputRequired(TypedDict):
receiver_id: str


class CreateAchInput(_CreateAchInputRequired, total=False):
name: str
account_class: AccountClass
account_number: str
account_type: BankAccountType
beneficiary_name: str
routing_number: str
recipient_relationship: RecipientRelationship
address_line_1: str
city: str
state_province_region: str
country: Country
postal_code: str
address_line_2: Optional[str]
business_industry: Optional[str]
phone_number: Optional[str]
tax_id: Optional[str]
date_of_birth: Optional[str]


class CreateAchResponse(TypedDict):
Expand Down Expand Up @@ -212,18 +235,27 @@ class CreateAchResponse(TypedDict):
created_at: str


class CreateWireInput(TypedDict):
class _CreateWireInputRequired(TypedDict):
receiver_id: str


class CreateWireInput(_CreateWireInputRequired, total=False):
name: str
account_number: str
account_class: AccountClass
beneficiary_name: str
routing_number: str
recipient_relationship: RecipientRelationship
address_line_1: str
address_line_2: Optional[str]
city: str
state_province_region: str
country: Country
postal_code: str
business_industry: Optional[str]
phone_number: Optional[str]
tax_id: Optional[str]
date_of_birth: Optional[str]


class CreateWireResponse(TypedDict):
Expand All @@ -242,9 +274,14 @@ class CreateWireResponse(TypedDict):
created_at: str


class CreateInternationalSwiftInput(TypedDict):
class _CreateInternationalSwiftInputRequired(TypedDict):
receiver_id: str


class CreateInternationalSwiftInput(_CreateInternationalSwiftInputRequired, total=False):
name: str
account_class: AccountClass
recipient_relationship: RecipientRelationship
swift_account_holder_name: str
swift_account_number_iban: str
swift_bank_address_line_1: str
Expand All @@ -265,6 +302,11 @@ class CreateInternationalSwiftInput(TypedDict):
swift_intermediary_bank_country: Optional[Country]
swift_intermediary_bank_name: Optional[str]
swift_intermediary_bank_swift_code_bic: Optional[str]
swift_payment_code: Optional[str]
business_industry: Optional[str]
phone_number: Optional[str]
tax_id: Optional[str]
date_of_birth: Optional[str]


class CreateInternationalSwiftResponse(TypedDict):
Expand Down Expand Up @@ -301,18 +343,27 @@ class CreateInternationalSwiftResponse(TypedDict):
created_at: str


class CreateRtpInput(TypedDict):
class _CreateRtpInputRequired(TypedDict):
receiver_id: str


class CreateRtpInput(_CreateRtpInputRequired, total=False):
name: str
account_class: AccountClass
beneficiary_name: str
routing_number: str
account_number: str
recipient_relationship: RecipientRelationship
address_line_1: str
address_line_2: Optional[str]
city: str
state_province_region: str
country: Country
postal_code: str
business_industry: Optional[str]
phone_number: Optional[str]
tax_id: Optional[str]
date_of_birth: Optional[str]


class CreateRtpResponse(TypedDict):
Expand All @@ -331,6 +382,28 @@ class CreateRtpResponse(TypedDict):
created_at: str


class CreatePixSafeInput(TypedDict):
receiver_id: str
name: str
account_number: str
account_type: BankAccountType
pix_safe_bank_code: str
pix_safe_branch_code: str
pix_safe_cpf_cnpj: str


class CreatePixSafeResponse(TypedDict):
id: str
type: PixSafeType
name: str
account_number: str
account_type: BankAccountType
pix_safe_bank_code: str
pix_safe_branch_code: str
pix_safe_cpf_cnpj: str
created_at: str


class BankAccountsResource:
def __init__(self, instance_id: str, client: InternalApiClient):
self._instance_id = instance_id
Expand Down Expand Up @@ -397,6 +470,12 @@ async def create_rtp(self, data: CreateRtpInput) -> BlindpayApiResponse[CreateRt
payload["type"] = "rtp"
return await self._client.post(f"/instances/{self._instance_id}/receivers/{receiver_id}/bank-accounts", payload)

async def create_pix_safe(self, data: CreatePixSafeInput) -> BlindpayApiResponse[CreatePixSafeResponse]:
receiver_id = data["receiver_id"]
payload = {k: v for k, v in data.items() if k != "receiver_id"}
payload["type"] = "pix_safe"
return await self._client.post(f"/instances/{self._instance_id}/receivers/{receiver_id}/bank-accounts", payload)


class BankAccountsResourceSync:
def __init__(self, instance_id: str, client: InternalApiClientSync):
Expand Down Expand Up @@ -464,6 +543,12 @@ def create_rtp(self, data: CreateRtpInput) -> BlindpayApiResponse[CreateRtpRespo
payload["type"] = "rtp"
return self._client.post(f"/instances/{self._instance_id}/receivers/{receiver_id}/bank-accounts", payload)

def create_pix_safe(self, data: CreatePixSafeInput) -> BlindpayApiResponse[CreatePixSafeResponse]:
receiver_id = data["receiver_id"]
payload = {k: v for k, v in data.items() if k != "receiver_id"}
payload["type"] = "pix_safe"
return self._client.post(f"/instances/{self._instance_id}/receivers/{receiver_id}/bank-accounts", payload)


def create_bank_accounts_resource(instance_id: str, client: InternalApiClient) -> BankAccountsResource:
return BankAccountsResource(instance_id, client)
Expand Down
Loading
Loading