diff --git a/pyproject.toml b/pyproject.toml index 415a080..1cc6d66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "blindpay" -version = "2.3.0" +version = "3.0.0" description = "Official Python SDK for the Blindpay API — Global payments infrastructure" readme = "README.md" authors = [{ name = "Blindpay", email = "alves@blindpay.com" }] diff --git a/src/blindpay/__init__.py b/src/blindpay/__init__.py index 9ee0a57..422d3ab 100644 --- a/src/blindpay/__init__.py +++ b/src/blindpay/__init__.py @@ -1,4 +1,4 @@ -__version__ = "2.3.0" +__version__ = "3.0.0" from ._internal.exceptions import BlindPayError from .client import BlindPay, BlindPaySync diff --git a/src/blindpay/client.py b/src/blindpay/client.py index 581fceb..6063bf5 100644 --- a/src/blindpay/client.py +++ b/src/blindpay/client.py @@ -1,7 +1,6 @@ import base64 import hashlib import hmac -import warnings from functools import cached_property from typing import TYPE_CHECKING, Any, Dict, Literal, Mapping, Optional, TypeVar @@ -28,7 +27,6 @@ from blindpay.resources.payins.quotes import PayinQuotesResource, PayinQuotesResourceSync from blindpay.resources.payouts.payouts import PayoutsResource, PayoutsResourceSync from blindpay.resources.quotes.quotes import QuotesResource, QuotesResourceSync - from blindpay.resources.receivers.receivers import ReceiversResource, ReceiversResourceSync from blindpay.resources.terms_of_service.terms_of_service import ( TermsOfServiceResource, TermsOfServiceResourceSync, @@ -43,12 +41,7 @@ from blindpay.resources.wallets.offramp import OfframpWalletsResource, OfframpWalletsResourceSync from blindpay.resources.webhooks.webhooks import WebhookEndpointsResource, WebhookEndpointsResourceSync -__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" -) +__version__ = "3.0.0" T = TypeVar("T") @@ -233,27 +226,6 @@ 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 - self._api = api_client - - @cached_property - def _base(self) -> "ReceiversResource": - from blindpay.resources.receivers.receivers import create_receivers_resource - - return create_receivers_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 _WalletsNamespace: def __init__(self, instance_id: str, api_client: ApiClientImpl) -> None: self._instance_id = instance_id @@ -345,11 +317,6 @@ def payouts(self) -> "PayoutsResource": 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 def virtual_accounts(self) -> "VirtualAccountsResource": from blindpay.resources.virtual_accounts import create_virtual_accounts_resource @@ -501,27 +468,6 @@ 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 - self._api = api_client - - @cached_property - def _base(self) -> "ReceiversResourceSync": - from blindpay.resources.receivers.receivers import create_receivers_resource_sync - - return create_receivers_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 _WalletsNamespaceSync: def __init__(self, instance_id: str, api_client: ApiClientImplSync) -> None: self._instance_id = instance_id @@ -613,11 +559,6 @@ def payouts(self) -> "PayoutsResourceSync": 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 def virtual_accounts(self) -> "VirtualAccountsResourceSync": from blindpay.resources.virtual_accounts import create_virtual_accounts_resource_sync diff --git a/src/blindpay/resources/__init__.py b/src/blindpay/resources/__init__.py index 120006c..106d427 100644 --- a/src/blindpay/resources/__init__.py +++ b/src/blindpay/resources/__init__.py @@ -11,7 +11,6 @@ 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, create_terms_of_service_resource_sync from .transfers import create_transfers_resource from .upload import create_upload_resource @@ -33,8 +32,8 @@ "create_payins_resource", "create_payin_quotes_resource", "create_payouts_resource", + "create_customers_resource", "create_quotes_resource", - "create_receivers_resource", "create_terms_of_service_resource", "create_terms_of_service_resource_sync", "create_transfers_resource", diff --git a/src/blindpay/resources/payins/payins.py b/src/blindpay/resources/payins/payins.py index 2fb1510..0d22087 100644 --- a/src/blindpay/resources/payins/payins.py +++ b/src/blindpay/resources/payins/payins.py @@ -6,7 +6,6 @@ BlindpayApiResponse, ManualExecutionStatus, Network, - PaginationMetadata, PaginationParams, StablecoinToken, TrackingComplete, @@ -105,9 +104,7 @@ class ListPayinsInput(PaginationParams): receiver_id: Optional[str] -class ListPayinsResponse(TypedDict): - data: List[Payin] - pagination: PaginationMetadata +ListPayinsResponse = List[Payin] class CreatePayinInput(TypedDict): diff --git a/src/blindpay/resources/payouts/payouts.py b/src/blindpay/resources/payouts/payouts.py index ee03f31..5c43a86 100644 --- a/src/blindpay/resources/payouts/payouts.py +++ b/src/blindpay/resources/payouts/payouts.py @@ -11,7 +11,6 @@ Country, Currency, Network, - PaginationMetadata, PaginationParams, Rail, SpeiProtocol, @@ -105,9 +104,7 @@ class ListPayoutsInput(PaginationParams, total=False): receiver_id: str -class ListPayoutsResponse(TypedDict): - data: List[Payout] - pagination: PaginationMetadata +ListPayoutsResponse = List[Payout] class ExportPayoutsInput(TypedDict, total=False): diff --git a/src/blindpay/resources/receivers/__init__.py b/src/blindpay/resources/receivers/__init__.py deleted file mode 100644 index b297bdf..0000000 --- a/src/blindpay/resources/receivers/__init__.py +++ /dev/null @@ -1,104 +0,0 @@ -from .receivers import ( - AccountPurpose, - AmlHits, - AmlStatus, - BusinessIndustry, - BusinessType, - BusinessWithStandardKYB, - CreateBusinessWithStandardKYBInput, - CreateBusinessWithStandardKYBResponse, - CreateIndividualWithEnhancedKYCInput, - CreateIndividualWithEnhancedKYCResponse, - CreateIndividualWithStandardKYCInput, - CreateIndividualWithStandardKYCResponse, - EnhancedKycType, - EstimatedAnnualRevenue, - FraudWarning, - GetLimitIncreaseRequestsResponse, - GetReceiverLimitsResponse, - GetReceiverResponse, - IdentificationDocument, - IndividualType, - IndividualWithEnhancedKYC, - IndividualWithStandardKYC, - KycType, - KycWarning, - LimitIncreaseRequest, - LimitIncreaseRequestStatus, - LimitIncreaseRequestSupportingDocumentType, - ListReceiversInput, - ListReceiversPaginatedResponse, - ListReceiversResponse, - Owner, - OwnerRole, - OwnerUpdate, - ProofOfAddressDocType, - PurposeOfTransactions, - ReceiverBusinessType, - ReceiversResource, - ReceiversResourceSync, - ReceiverStatus, - RequestLimitIncreaseInput, - RequestLimitIncreaseResponse, - SoleProprietorDocType, - SourceOfFundsDocType, - SourceOfWealth, - TaxType, - TransactionLimit, - UpdateReceiverInput, - create_receivers_resource, - create_receivers_resource_sync, -) - -__all__ = [ - "create_receivers_resource", - "create_receivers_resource_sync", - "ReceiversResource", - "ReceiversResourceSync", - "IndividualWithStandardKYC", - "IndividualWithEnhancedKYC", - "BusinessWithStandardKYB", - "CreateIndividualWithStandardKYCInput", - "CreateIndividualWithEnhancedKYCInput", - "CreateBusinessWithStandardKYBInput", - "UpdateReceiverInput", - "GetReceiverLimitsResponse", - "KycType", - "BusinessType", - "IndividualType", - "EnhancedKycType", - "ProofOfAddressDocType", - "PurposeOfTransactions", - "SourceOfFundsDocType", - "IdentificationDocument", - "OwnerRole", - "KycWarning", - "TransactionLimit", - "Owner", - "CreateBusinessWithStandardKYBResponse", - "CreateIndividualWithEnhancedKYCResponse", - "CreateIndividualWithStandardKYCResponse", - "ListReceiversResponse", - "GetReceiverResponse", - "OwnerUpdate", - "UpdateReceiverInput", - "LimitIncreaseRequest", - "LimitIncreaseRequestStatus", - "LimitIncreaseRequestSupportingDocumentType", - "GetLimitIncreaseRequestsResponse", - "RequestLimitIncreaseInput", - "RequestLimitIncreaseResponse", - "ReceiverStatus", - "AccountPurpose", - "ReceiverBusinessType", - "BusinessIndustry", - "EstimatedAnnualRevenue", - "SoleProprietorDocType", - "SourceOfWealth", - "TaxType", - "AmlStatus", - "FraudWarning", - "AmlHits", - "ListReceiversInput", - "ListReceiversPaginatedResponse", -] diff --git a/src/blindpay/resources/receivers/receivers.py b/src/blindpay/resources/receivers/receivers.py deleted file mode 100644 index 77c420e..0000000 --- a/src/blindpay/resources/receivers/receivers.py +++ /dev/null @@ -1,859 +0,0 @@ -from typing import List, Optional, Union -from urllib.parse import urlencode - -from typing_extensions import Literal, TypedDict - -from ..._internal.api_client import InternalApiClient, InternalApiClientSync -from ...types import ( - BlindpayApiResponse, - Country, - PaginationMetadata, - PaginationParams, -) - -IndividualType = Literal["individual"] -BusinessType = Literal["business"] -StandardKycType = Literal["standard"] -EnhancedKycType = Literal["enhanced"] -KycType = Literal["light", "standard", "enhanced"] -KycStatus = Literal["awaiting_contract", "compliance_request"] - -ProofOfAddressDocType = Literal[ - "UTILITY_BILL", "BANK_STATEMENT", "RENTAL_AGREEMENT", "TAX_DOCUMENT", "GOVERNMENT_CORRESPONDENCE" -] - -PurposeOfTransactions = Literal[ - "business_transactions", - "charitable_donations", - "investment_purposes", - "payments_to_friends_or_family_abroad", - "personal_or_living_expenses", - "protect_wealth", - "purchase_good_and_services", - "receive_payment_for_freelancing", - "receive_salary", - "other", -] - -SourceOfFundsDocType = Literal[ - "business_income", - "gambling_proceeds", - "gifts", - "government_benefits", - "inheritance", - "investment_loans", - "pension_retirement", - "salary", - "sale_of_assets_real_estate", - "savings", - "esops", - "investment_proceeds", - "someone_else_funds", -] - -SoleProprietorDocType = Literal["bank_statement", "master_service_agreement", "salary_slip"] - -IdentificationDocument = Literal["PASSPORT", "ID_CARD", "DRIVERS"] - -OwnerRole = Literal["beneficial_controlling", "beneficial_owner", "controlling_person"] - -LimitIncreaseRequestStatus = Literal["in_review", "approved", "rejected"] - -LimitIncreaseRequestSupportingDocumentType = Literal[ - "individual_bank_statement", - "individual_tax_return", - "individual_proof_of_income", - "business_bank_statement", - "business_financial_statements", - "business_tax_return", -] - -ReceiverStatus = Literal["verifying", "approved", "rejected", "deprecated", "pending_review"] - -AccountPurpose = Literal[ - "charitable_donations", - "ecommerce_retail_payments", - "investment_purposes", - "business_expenses", - "payments_to_friends_or_family_abroad", - "personal_or_living_expenses", - "protect_wealth", - "purchase_goods_and_services", - "receive_payments_for_goods_and_services", - "tax_optimization", - "third_party_money_transmission", - "payroll", - "treasury_management", - "other", -] - -ReceiverBusinessType = Literal["corporation", "llc", "partnership", "sole_proprietorship", "trust", "non_profit"] - -BusinessIndustry = Literal[ - "111998", - "112120", - "113310", - "115114", - "541211", - "541810", - "541430", - "541715", - "541930", - "561422", - "561311", - "561612", - "561740", - "561730", - "236115", - "236220", - "237310", - "238210", - "811111", - "812111", - "812112", - "532111", - "624410", - "541922", - "811210", - "812199", - "611110", - "611310", - "611410", - "611710", - "211120", - "212114", - "221310", - "562111", - "562920", - "213112", - "522110", - "522210", - "522320", - "523150", - "523940", - "523999", - "524113", - "813110", - "813211", - "813219", - "551112", - "721110", - "722511", - "722513", - "561510", - "713110", - "713210", - "712110", - "711110", - "711211", - "621111", - "621210", - "622110", - "623110", - "621511", - "623220", - "541940", - "621399", - "621910", - "541110", - "311421", - "337121", - "322220", - "339920", - "334210", - "339930", - "312130", - "334111", - "334118", - "325412", - "339112", - "336110", - "336390", - "315990", - "313110", - "339910", - "516120", - "513130", - "512250", - "519130", - "711410", - "711510", - "531110", - "531120", - "531130", - "531190", - "531210", - "531311", - "531312", - "531320", - "531390", - "454110", - "445110", - "455110", - "457110", - "449210", - "444110", - "459210", - "459120", - "445320", - "458110", - "458210", - "458310", - "455219", - "424210", - "456110", - "541511", - "541512", - "541519", - "518210", - "511210", - "517111", - "517112", - "517410", - "481111", - "483111", - "485210", - "488510", - "484121", - "493110", - "423430", - "423690", - "423110", - "423830", - "423840", - "423510", - "424690", - "424990", - "424410", - "424480", - "423940", - "541611", - "541618", - "541330", - "541990", - "541214", - "561499", - "dapp", - "exchange", - "gambling", - "gaming", - "infra", - "marketplace", - "neo_bank", - "other", - "saas", - "social", - "wallet", -] - -EstimatedAnnualRevenue = Literal[ - "0_99999", - "100000_999999", - "1000000_9999999", - "10000000_49999999", - "50000000_249999999", - "2500000000_plus", -] - -SourceOfWealth = Literal[ - "business_dividends_or_profits", - "investments", - "asset_sales", - "client_investor_contributions", - "gambling", - "charitable_contributions", - "inheritance", - "affiliate_or_royalty_income", -] - -TaxType = Literal["SSN", "ITIN"] - -AmlStatus = Literal["clear", "hit", "error"] - - -class FraudWarning(TypedDict): - id: Optional[str] - name: Optional[str] - operation: Optional[str] - score: Optional[float] - - -class AmlHits(TypedDict): - has_sanction_match: bool - has_pep_match: bool - has_watchlist_match: bool - has_crimelist_match: bool - has_adversemedia_match: bool - - -class KycWarning(TypedDict): - code: Optional[str] - message: Optional[str] - resolution_status: Optional[str] - warning_id: Optional[str] - - -class TransactionLimit(TypedDict): - per_transaction: float - daily: float - monthly: float - - -class Owner(TypedDict): - id: str - instance_id: str - receiver_id: str - role: OwnerRole - first_name: str - last_name: str - date_of_birth: str - tax_id: str - address_line_1: str - address_line_2: Optional[str] - city: str - state_province_region: str - country: Country - postal_code: str - id_doc_country: Country - id_doc_type: IdentificationDocument - id_doc_front_file: str - id_doc_back_file: Optional[str] - proof_of_address_doc_type: ProofOfAddressDocType - proof_of_address_doc_file: str - ownership_percentage: Optional[int] - title: Optional[str] - tax_type: Optional[TaxType] - - -class IndividualWithStandardKYC(TypedDict): - id: str - type: IndividualType - kyc_type: StandardKycType - kyc_status: KycStatus - kyc_warnings: Optional[List[KycWarning]] - email: str - tax_id: str - address_line_1: str - address_line_2: Optional[str] - city: str - state_province_region: str - country: Country - postal_code: str - ip_address: Optional[str] - image_url: Optional[str] - phone_number: str - proof_of_address_doc_type: ProofOfAddressDocType - proof_of_address_doc_file: str - first_name: str - last_name: str - date_of_birth: str - id_doc_country: Country - id_doc_type: IdentificationDocument - id_doc_front_file: str - id_doc_back_file: str - aiprise_validation_key: str - instance_id: str - tos_id: Optional[str] - created_at: str - updated_at: str - limit: TransactionLimit - fraud_warnings: Optional[List[FraudWarning]] - selfie_file: Optional[str] - is_fbo: Optional[bool] - account_purpose: Optional[AccountPurpose] - account_purpose_other: Optional[str] - business_type: Optional[ReceiverBusinessType] - business_description: Optional[str] - business_industry: Optional[BusinessIndustry] - estimated_annual_revenue: Optional[EstimatedAnnualRevenue] - source_of_wealth: Optional[SourceOfWealth] - publicly_traded: Optional[bool] - occupation: Optional[str] - external_id: Optional[str] - aml_status: Optional[AmlStatus] - aml_hits: Optional[AmlHits] - is_tos_accepted: Optional[bool] - - -class IndividualWithEnhancedKYC(TypedDict): - id: str - type: IndividualType - kyc_type: EnhancedKycType - kyc_status: KycStatus - kyc_warnings: Optional[List[KycWarning]] - email: str - tax_id: str - address_line_1: str - address_line_2: Optional[str] - city: str - state_province_region: str - country: Country - postal_code: str - ip_address: Optional[str] - image_url: Optional[str] - phone_number: Optional[str] - proof_of_address_doc_type: ProofOfAddressDocType - proof_of_address_doc_file: str - first_name: str - last_name: str - date_of_birth: str - id_doc_country: Country - id_doc_type: IdentificationDocument - id_doc_front_file: str - id_doc_back_file: Optional[str] - aiprise_validation_key: str - instance_id: str - source_of_funds_doc_type: str - source_of_funds_doc_file: str - individual_holding_doc_front_file: str - purpose_of_transactions: PurposeOfTransactions - purpose_of_transactions_explanation: Optional[str] - tos_id: Optional[str] - created_at: str - updated_at: str - limit: TransactionLimit - fraud_warnings: Optional[List[FraudWarning]] - selfie_file: Optional[str] - is_fbo: Optional[bool] - account_purpose: Optional[AccountPurpose] - account_purpose_other: Optional[str] - business_type: Optional[ReceiverBusinessType] - business_description: Optional[str] - business_industry: Optional[BusinessIndustry] - estimated_annual_revenue: Optional[EstimatedAnnualRevenue] - source_of_wealth: Optional[SourceOfWealth] - publicly_traded: Optional[bool] - occupation: Optional[str] - external_id: Optional[str] - aml_status: Optional[AmlStatus] - aml_hits: Optional[AmlHits] - is_tos_accepted: Optional[bool] - - -class BusinessWithStandardKYB(TypedDict): - id: str - type: BusinessType - kyc_type: StandardKycType - kyc_status: KycStatus - kyc_warnings: Optional[List[KycWarning]] - email: str - tax_id: str - address_line_1: str - address_line_2: Optional[str] - city: str - state_province_region: str - country: Country - postal_code: str - ip_address: Optional[str] - image_url: Optional[str] - phone_number: Optional[str] - proof_of_address_doc_type: ProofOfAddressDocType - proof_of_address_doc_file: str - legal_name: str - alternate_name: Optional[str] - formation_date: str - website: Optional[str] - owners: List[Owner] - incorporation_doc_file: str - proof_of_ownership_doc_file: str - external_id: Optional[str] - instance_id: str - tos_id: Optional[str] - aiprise_validation_key: str - created_at: str - updated_at: str - limit: TransactionLimit - fraud_warnings: Optional[List[FraudWarning]] - selfie_file: Optional[str] - is_fbo: Optional[bool] - account_purpose: Optional[AccountPurpose] - account_purpose_other: Optional[str] - business_type: Optional[ReceiverBusinessType] - business_description: Optional[str] - business_industry: Optional[BusinessIndustry] - estimated_annual_revenue: Optional[EstimatedAnnualRevenue] - source_of_wealth: Optional[SourceOfWealth] - publicly_traded: Optional[bool] - occupation: Optional[str] - aml_status: Optional[AmlStatus] - aml_hits: Optional[AmlHits] - is_tos_accepted: Optional[bool] - - -class CreateIndividualWithStandardKYCInput(TypedDict): - external_id: Optional[str] - address_line_1: str - address_line_2: Optional[str] - city: str - country: Country - date_of_birth: str - email: str - first_name: str - phone_number: Optional[str] - id_doc_country: Country - id_doc_front_file: str - id_doc_type: IdentificationDocument - id_doc_back_file: Optional[str] - last_name: str - postal_code: str - proof_of_address_doc_file: str - proof_of_address_doc_type: ProofOfAddressDocType - state_province_region: str - tax_id: str - tos_id: str - ip_address: Optional[str] - image_url: Optional[str] - selfie_file: Optional[str] - account_purpose: Optional[AccountPurpose] - account_purpose_other: Optional[str] - occupation: Optional[str] - - -class CreateIndividualWithStandardKYCResponse(TypedDict): - id: str - - -class CreateIndividualWithEnhancedKYCInput(TypedDict): - external_id: Optional[str] - address_line_1: str - address_line_2: Optional[str] - city: str - country: Country - date_of_birth: str - email: str - first_name: str - id_doc_country: Country - id_doc_front_file: str - id_doc_type: IdentificationDocument - id_doc_back_file: Optional[str] - individual_holding_doc_front_file: str - last_name: str - postal_code: str - phone_number: Optional[str] - proof_of_address_doc_file: str - proof_of_address_doc_type: ProofOfAddressDocType - purpose_of_transactions: PurposeOfTransactions - source_of_funds_doc_file: str - source_of_funds_doc_type: SourceOfFundsDocType - purpose_of_transactions_explanation: Optional[str] - state_province_region: str - tax_id: str - tos_id: str - ip_address: Optional[str] - image_url: Optional[str] - selfie_file: Optional[str] - is_fbo: Optional[bool] - account_purpose: Optional[AccountPurpose] - account_purpose_other: Optional[str] - occupation: Optional[str] - - -class CreateIndividualWithEnhancedKYCResponse(TypedDict): - id: str - - -class CreateBusinessWithStandardKYBInput(TypedDict): - external_id: Optional[str] - address_line_1: str - address_line_2: Optional[str] - alternate_name: str - city: str - country: Country - email: str - formation_date: str - incorporation_doc_file: str - legal_name: str - owners: List[Owner] - postal_code: str - proof_of_address_doc_file: str - proof_of_address_doc_type: ProofOfAddressDocType - proof_of_ownership_doc_file: str - state_province_region: str - tax_id: str - tos_id: str - website: Optional[str] - ip_address: Optional[str] - image_url: Optional[str] - phone_number: Optional[str] - selfie_file: Optional[str] - account_purpose: Optional[AccountPurpose] - account_purpose_other: Optional[str] - business_type: Optional[ReceiverBusinessType] - business_description: Optional[str] - business_industry: Optional[BusinessIndustry] - estimated_annual_revenue: Optional[EstimatedAnnualRevenue] - source_of_wealth: Optional[SourceOfWealth] - publicly_traded: Optional[bool] - occupation: Optional[str] - - -class CreateBusinessWithStandardKYBResponse(TypedDict): - id: str - - -ListReceiversResponse = List[Union[IndividualWithStandardKYC, IndividualWithEnhancedKYC, BusinessWithStandardKYB]] - - -class ListReceiversPaginatedResponse(TypedDict): - data: List[Union[IndividualWithStandardKYC, IndividualWithEnhancedKYC, BusinessWithStandardKYB]] - pagination: PaginationMetadata - - -class ListReceiversInput(PaginationParams, total=False): - full_name: str - receiver_name: str - status: ReceiverStatus - receiver_id: str - bank_account_id: str - country: str - - -GetReceiverResponse = Union[IndividualWithStandardKYC, IndividualWithEnhancedKYC, BusinessWithStandardKYB] - - -class OwnerUpdate(TypedDict): - id: str - first_name: str - last_name: str - role: OwnerRole - date_of_birth: str - tax_id: str - address_line_1: str - address_line_2: Optional[str] - city: str - state_province_region: str - country: Country - postal_code: str - id_doc_country: Country - id_doc_type: IdentificationDocument - id_doc_front_file: str - id_doc_back_file: Optional[str] - ownership_percentage: Optional[int] - title: Optional[str] - tax_type: Optional[TaxType] - proof_of_address_doc_type: Optional[ProofOfAddressDocType] - proof_of_address_doc_file: Optional[str] - - -class UpdateReceiverInput(TypedDict): - receiver_id: str - email: Optional[str] - tax_id: Optional[str] - address_line_1: Optional[str] - address_line_2: Optional[str] - city: Optional[str] - state_province_region: Optional[str] - country: Optional[Country] - postal_code: Optional[str] - ip_address: Optional[str] - image_url: Optional[str] - phone_number: Optional[str] - proof_of_address_doc_type: Optional[ProofOfAddressDocType] - proof_of_address_doc_file: Optional[str] - first_name: Optional[str] - last_name: Optional[str] - date_of_birth: Optional[str] - id_doc_country: Optional[Country] - id_doc_type: Optional[IdentificationDocument] - id_doc_front_file: Optional[str] - id_doc_back_file: Optional[str] - legal_name: Optional[str] - alternate_name: Optional[str] - formation_date: Optional[str] - website: Optional[str] - owners: Optional[List[OwnerUpdate]] - incorporation_doc_file: Optional[str] - proof_of_ownership_doc_file: Optional[str] - source_of_funds_doc_type: Optional[SourceOfFundsDocType] - source_of_funds_doc_file: Optional[str] - individual_holding_doc_front_file: Optional[str] - purpose_of_transactions: Optional[PurposeOfTransactions] - purpose_of_transactions_explanation: Optional[str] - external_id: Optional[str] - tos_id: Optional[str] - selfie_file: Optional[str] - account_purpose: Optional[AccountPurpose] - account_purpose_other: Optional[str] - business_type: Optional[ReceiverBusinessType] - business_description: Optional[str] - business_industry: Optional[BusinessIndustry] - estimated_annual_revenue: Optional[EstimatedAnnualRevenue] - source_of_wealth: Optional[SourceOfWealth] - publicly_traded: Optional[bool] - occupation: Optional[str] - - -class PayinLimit(TypedDict): - daily: float - monthly: float - - -class PayoutLimit(TypedDict): - daily: float - monthly: float - - -class Limits(TypedDict): - payin: PayinLimit - payout: PayoutLimit - - -class GetReceiverLimitsResponse(TypedDict): - limits: Limits - - -class LimitIncreaseRequest(TypedDict): - id: str - receiver_id: str - status: LimitIncreaseRequestStatus - daily: float - monthly: float - per_transaction: float - supporting_document_file: str - supporting_document_type: LimitIncreaseRequestSupportingDocumentType - created_at: str - updated_at: str - - -GetLimitIncreaseRequestsResponse = List[LimitIncreaseRequest] - - -class RequestLimitIncreaseInput(TypedDict): - receiver_id: str - daily: float - monthly: float - per_transaction: float - supporting_document_file: str - supporting_document_type: LimitIncreaseRequestSupportingDocumentType - - -class RequestLimitIncreaseResponse(TypedDict): - id: str - - -class ReceiversResource: - def __init__(self, instance_id: str, client: InternalApiClient): - self._instance_id = instance_id - self._client = client - - async def list( - self, params: Optional[ListReceiversInput] = None - ) -> BlindpayApiResponse[Union[ListReceiversResponse, ListReceiversPaginatedResponse]]: - query_string = "" - if params: - filtered_params = {k: v for k, v in params.items() if v is not None} - if filtered_params: - query_string = f"?{urlencode(filtered_params)}" - return await self._client.get(f"/instances/{self._instance_id}/receivers{query_string}") - - async def create_individual_with_standard_kyc( - self, data: CreateIndividualWithStandardKYCInput - ) -> BlindpayApiResponse[CreateIndividualWithStandardKYCResponse]: - payload = {"kyc_type": "standard", "type": "individual", **data} - return await self._client.post(f"/instances/{self._instance_id}/receivers", payload) - - async def create_individual_with_enhanced_kyc( - self, data: CreateIndividualWithEnhancedKYCInput - ) -> BlindpayApiResponse[CreateIndividualWithEnhancedKYCResponse]: - payload = {"kyc_type": "enhanced", "type": "individual", **data} - return await self._client.post(f"/instances/{self._instance_id}/receivers", payload) - - async def create_business_with_standard_kyb( - self, data: CreateBusinessWithStandardKYBInput - ) -> BlindpayApiResponse[CreateBusinessWithStandardKYBResponse]: - payload = {"kyc_type": "standard", "type": "business", **data} - return await self._client.post(f"/instances/{self._instance_id}/receivers", payload) - - async def get(self, receiver_id: str) -> BlindpayApiResponse[GetReceiverResponse]: - return await self._client.get(f"/instances/{self._instance_id}/receivers/{receiver_id}") - - async def update(self, data: UpdateReceiverInput) -> BlindpayApiResponse[None]: - receiver_id = data["receiver_id"] - payload = {k: v for k, v in data.items() if k != "receiver_id"} - return await self._client.put(f"/instances/{self._instance_id}/receivers/{receiver_id}", payload) - - async def delete(self, receiver_id: str) -> BlindpayApiResponse[None]: - return await self._client.delete(f"/instances/{self._instance_id}/receivers/{receiver_id}") - - async def get_limits(self, receiver_id: str) -> BlindpayApiResponse[GetReceiverLimitsResponse]: - return await self._client.get(f"/instances/{self._instance_id}/limits/receivers/{receiver_id}") - - async def get_limit_increase_requests( - self, receiver_id: str - ) -> BlindpayApiResponse[GetLimitIncreaseRequestsResponse]: - return await self._client.get(f"/instances/{self._instance_id}/receivers/{receiver_id}/limit-increase") - - async def request_limit_increase( - self, data: RequestLimitIncreaseInput - ) -> BlindpayApiResponse[RequestLimitIncreaseResponse]: - receiver_id = data["receiver_id"] - payload = {k: v for k, v in data.items() if k != "receiver_id"} - return await self._client.post( - f"/instances/{self._instance_id}/receivers/{receiver_id}/limit-increase", payload - ) - - -class ReceiversResourceSync: - def __init__(self, instance_id: str, client: InternalApiClientSync): - self._instance_id = instance_id - self._client = client - - def list( - self, params: Optional[ListReceiversInput] = None - ) -> BlindpayApiResponse[Union[ListReceiversResponse, ListReceiversPaginatedResponse]]: - query_string = "" - if params: - filtered_params = {k: v for k, v in params.items() if v is not None} - if filtered_params: - query_string = f"?{urlencode(filtered_params)}" - return self._client.get(f"/instances/{self._instance_id}/receivers{query_string}") - - def create_individual_with_standard_kyc( - self, data: CreateIndividualWithStandardKYCInput - ) -> BlindpayApiResponse[CreateIndividualWithStandardKYCResponse]: - payload = {"kyc_type": "standard", "type": "individual", **data} - return self._client.post(f"/instances/{self._instance_id}/receivers", payload) - - def create_individual_with_enhanced_kyc( - self, data: CreateIndividualWithEnhancedKYCInput - ) -> BlindpayApiResponse[CreateIndividualWithEnhancedKYCResponse]: - payload = {"kyc_type": "enhanced", "type": "individual", **data} - return self._client.post(f"/instances/{self._instance_id}/receivers", payload) - - def create_business_with_standard_kyb( - self, data: CreateBusinessWithStandardKYBInput - ) -> BlindpayApiResponse[CreateBusinessWithStandardKYBResponse]: - payload = {"kyc_type": "standard", "type": "business", **data} - return self._client.post(f"/instances/{self._instance_id}/receivers", payload) - - def get(self, receiver_id: str) -> BlindpayApiResponse[GetReceiverResponse]: - return self._client.get(f"/instances/{self._instance_id}/receivers/{receiver_id}") - - def update(self, data: UpdateReceiverInput) -> BlindpayApiResponse[None]: - receiver_id = data["receiver_id"] - payload = {k: v for k, v in data.items() if k != "receiver_id"} - return self._client.put(f"/instances/{self._instance_id}/receivers/{receiver_id}", payload) - - def delete(self, receiver_id: str) -> BlindpayApiResponse[None]: - return self._client.delete(f"/instances/{self._instance_id}/receivers/{receiver_id}") - - def get_limits(self, receiver_id: str) -> BlindpayApiResponse[GetReceiverLimitsResponse]: - return self._client.get(f"/instances/{self._instance_id}/limits/receivers/{receiver_id}") - - def get_limit_increase_requests(self, receiver_id: str) -> BlindpayApiResponse[GetLimitIncreaseRequestsResponse]: - return self._client.get(f"/instances/{self._instance_id}/receivers/{receiver_id}/limit-increase") - - def request_limit_increase( - self, data: RequestLimitIncreaseInput - ) -> BlindpayApiResponse[RequestLimitIncreaseResponse]: - receiver_id = data["receiver_id"] - payload = {k: v for k, v in data.items() if k != "receiver_id"} - return self._client.post(f"/instances/{self._instance_id}/receivers/{receiver_id}/limit-increase", payload) - - -def create_receivers_resource(instance_id: str, client: InternalApiClient) -> ReceiversResource: - return ReceiversResource(instance_id, client) - - -def create_receivers_resource_sync(instance_id: str, client: InternalApiClientSync) -> ReceiversResourceSync: - return ReceiversResourceSync(instance_id, client) diff --git a/tests/resources/test_bank_accounts.py b/tests/resources/test_bank_accounts.py index 25420e5..2378c80 100644 --- a/tests/resources/test_bank_accounts.py +++ b/tests/resources/test_bank_accounts.py @@ -23,7 +23,7 @@ async def test_create_pix_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_pix_account, "error": None} - response = await self.blindpay.receivers.bank_accounts.create_pix( + response = await self.blindpay.customers.bank_accounts.create_pix( { "customer_id": "re_000000000000", "name": "PIX Account", @@ -49,7 +49,7 @@ async def test_create_argentina_transfers_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_argentina_transfers_account, "error": None} - response = await self.blindpay.receivers.bank_accounts.create_argentina_transfers( + response = await self.blindpay.customers.bank_accounts.create_argentina_transfers( { "customer_id": "re_000000000000", "name": "Argentina Transfers Account", @@ -78,7 +78,7 @@ async def test_create_spei_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_spei_account, "error": None} - response = await self.blindpay.receivers.bank_accounts.create_spei( + response = await self.blindpay.customers.bank_accounts.create_spei( { "customer_id": "re_000000000000", "name": "SPEI Account", @@ -112,7 +112,7 @@ async def test_create_colombia_ach_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_colombia_ach_account, "error": None} - response = await self.blindpay.receivers.bank_accounts.create_colombia_ach( + response = await self.blindpay.customers.bank_accounts.create_colombia_ach( { "customer_id": "re_000000000000", "name": "Colombia ACH Account", @@ -160,7 +160,7 @@ async def test_create_ach_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_ach_account, "error": None} - response = await self.blindpay.receivers.bank_accounts.create_ach( + response = await self.blindpay.customers.bank_accounts.create_ach( { "customer_id": "re_000000000000", "name": "ACH Account", @@ -196,7 +196,7 @@ async def test_create_wire_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_wire_account, "error": None} - response = await self.blindpay.receivers.bank_accounts.create_wire( + response = await self.blindpay.customers.bank_accounts.create_wire( { "customer_id": "re_000000000000", "name": "Wire Account", @@ -254,7 +254,7 @@ async def test_create_international_swift_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_international_swift_account, "error": None} - response = await self.blindpay.receivers.bank_accounts.create_international_swift( + response = await self.blindpay.customers.bank_accounts.create_international_swift( { "customer_id": "re_000000000000", "name": "International Swift Account", @@ -307,7 +307,7 @@ async def test_create_rtp_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_rtp_account, "error": None} - response = await self.blindpay.receivers.bank_accounts.create_rtp( + response = await self.blindpay.customers.bank_accounts.create_rtp( { "customer_id": "re_000000000000", "name": "John Doe RTP", @@ -346,7 +346,7 @@ async def test_get_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_bank_account, "error": None} - response = await self.blindpay.receivers.bank_accounts.get("re_000000000000", "ba_000000000000") + response = await self.blindpay.customers.bank_accounts.get("re_000000000000", "ba_000000000000") assert response["error"] is None assert response["data"] == mocked_bank_account @@ -424,7 +424,7 @@ async def test_list_bank_accounts(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_bank_accounts, "error": None} - response = await self.blindpay.receivers.bank_accounts.list("re_000000000000") + response = await self.blindpay.customers.bank_accounts.list("re_000000000000") assert response["error"] is None assert response["data"] == mocked_bank_accounts @@ -434,7 +434,7 @@ async def test_delete_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": {"data": None}, "error": None} - response = await self.blindpay.receivers.bank_accounts.delete("re_000000000000", "ba_000000000000") + response = await self.blindpay.customers.bank_accounts.delete("re_000000000000", "ba_000000000000") assert response["error"] is None assert response["data"] == {"data": None} @@ -457,7 +457,7 @@ def test_create_pix_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_pix_account, "error": None} - response = self.blindpay.receivers.bank_accounts.create_pix( + response = self.blindpay.customers.bank_accounts.create_pix( { "customer_id": "re_000000000000", "name": "PIX Account", @@ -482,7 +482,7 @@ def test_create_argentina_transfers_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_argentina_transfers_account, "error": None} - response = self.blindpay.receivers.bank_accounts.create_argentina_transfers( + response = self.blindpay.customers.bank_accounts.create_argentina_transfers( { "customer_id": "re_000000000000", "name": "Argentina Transfers Account", @@ -510,7 +510,7 @@ def test_create_spei_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_spei_account, "error": None} - response = self.blindpay.receivers.bank_accounts.create_spei( + response = self.blindpay.customers.bank_accounts.create_spei( { "customer_id": "re_000000000000", "name": "SPEI Account", @@ -543,7 +543,7 @@ def test_create_colombia_ach_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_colombia_ach_account, "error": None} - response = self.blindpay.receivers.bank_accounts.create_colombia_ach( + response = self.blindpay.customers.bank_accounts.create_colombia_ach( { "customer_id": "re_000000000000", "name": "Colombia ACH Account", @@ -590,7 +590,7 @@ def test_create_ach_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_ach_account, "error": None} - response = self.blindpay.receivers.bank_accounts.create_ach( + response = self.blindpay.customers.bank_accounts.create_ach( { "customer_id": "re_000000000000", "name": "ACH Account", @@ -625,7 +625,7 @@ def test_create_wire_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_wire_account, "error": None} - response = self.blindpay.receivers.bank_accounts.create_wire( + response = self.blindpay.customers.bank_accounts.create_wire( { "customer_id": "re_000000000000", "name": "Wire Account", @@ -682,7 +682,7 @@ def test_create_international_swift_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_international_swift_account, "error": None} - response = self.blindpay.receivers.bank_accounts.create_international_swift( + response = self.blindpay.customers.bank_accounts.create_international_swift( { "customer_id": "re_000000000000", "name": "International Swift Account", @@ -734,7 +734,7 @@ def test_create_rtp_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_rtp_account, "error": None} - response = self.blindpay.receivers.bank_accounts.create_rtp( + response = self.blindpay.customers.bank_accounts.create_rtp( { "customer_id": "re_000000000000", "name": "John Doe RTP", @@ -772,7 +772,7 @@ def test_get_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_bank_account, "error": None} - response = self.blindpay.receivers.bank_accounts.get("re_000000000000", "ba_000000000000") + response = self.blindpay.customers.bank_accounts.get("re_000000000000", "ba_000000000000") assert response["error"] is None assert response["data"] == mocked_bank_account @@ -849,7 +849,7 @@ def test_list_bank_accounts(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_bank_accounts, "error": None} - response = self.blindpay.receivers.bank_accounts.list("re_000000000000") + response = self.blindpay.customers.bank_accounts.list("re_000000000000") assert response["error"] is None assert response["data"] == mocked_bank_accounts @@ -858,7 +858,7 @@ def test_delete_bank_account(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": {"data": None}, "error": None} - response = self.blindpay.receivers.bank_accounts.delete("re_000000000000", "ba_000000000000") + response = self.blindpay.customers.bank_accounts.delete("re_000000000000", "ba_000000000000") assert response["error"] is None assert response["data"] == {"data": None} diff --git a/tests/resources/test_receivers.py b/tests/resources/test_customers.py similarity index 93% rename from tests/resources/test_receivers.py rename to tests/resources/test_customers.py index 175dda4..01a4b58 100644 --- a/tests/resources/test_receivers.py +++ b/tests/resources/test_customers.py @@ -5,13 +5,13 @@ from blindpay import BlindPay, BlindPaySync -class TestReceivers: +class TestCustomers: @pytest.fixture(autouse=True) def setup(self): self.blindpay = BlindPay(api_key="test-key", instance_id="in_000000000000") @pytest.mark.asyncio - async def test_list_receivers(self): + async def test_list_customers(self): mocked_receivers = [ { "id": "re_Euw7HN4OdxPn", @@ -143,7 +143,7 @@ async def test_list_receivers(self): "proof_of_address_doc_file": "https://example.com/image.png", "id": "ub_000000000000", "instance_id": "in_000000000000", - "receiver_id": "re_IOxAUL24LG7P", + "customer_id": "re_IOxAUL24LG7P", }, ], "incorporation_doc_file": "https://example.com/image.png", @@ -165,14 +165,14 @@ async def test_list_receivers(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_receivers, "error": None} - response = await self.blindpay.receivers.list() + response = await self.blindpay.customers.list() assert response["error"] is None assert response["data"] == mocked_receivers - mock_request.assert_called_once_with("GET", "/instances/in_000000000000/receivers") + mock_request.assert_called_once_with("GET", "/instances/in_000000000000/customers") @pytest.mark.asyncio - async def test_list_receivers_with_params(self): + async def test_list_customers_with_params(self): mocked_data = { "data": [{"id": "re_Euw7HN4OdxPn"}], "pagination": {"has_more": False, "next_page": None, "prev_page": None}, @@ -181,11 +181,11 @@ async def test_list_receivers_with_params(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_data, "error": None} - response = await self.blindpay.receivers.list({"status": "approved", "limit": "10"}) + response = await self.blindpay.customers.list({"status": "approved", "limit": "10"}) assert response["error"] is None assert response["data"] == mocked_data - mock_request.assert_called_once_with("GET", "/instances/in_000000000000/receivers?status=approved&limit=10") + mock_request.assert_called_once_with("GET", "/instances/in_000000000000/customers?status=approved&limit=10") @pytest.mark.asyncio async def test_create_individual_with_standard_kyc(self): @@ -196,7 +196,7 @@ async def test_create_individual_with_standard_kyc(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_receiver, "error": None} - response = await self.blindpay.receivers.create_individual_with_standard_kyc( + response = await self.blindpay.customers.create_individual_with_standard_kyc( { "email": "bernardo.simonassi@gmail.com", "tax_id": "12345678900", @@ -232,7 +232,7 @@ async def test_create_individual_with_enhanced_kyc(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_receiver, "error": None} - response = await self.blindpay.receivers.create_individual_with_enhanced_kyc( + response = await self.blindpay.customers.create_individual_with_enhanced_kyc( { "email": "bernardo.simonassi@gmail.com", "tax_id": "12345678900", @@ -273,7 +273,7 @@ async def test_create_business_with_standard_kyb(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_receiver, "error": None} - response = await self.blindpay.receivers.create_business_with_standard_kyb( + response = await self.blindpay.customers.create_business_with_standard_kyb( { "email": "contato@empresa.com.br", "tax_id": "20096178000195", @@ -313,7 +313,7 @@ async def test_create_business_with_standard_kyb(self): "proof_of_address_doc_file": "https://example.com/image.png", "id": "ub_000000000000", "instance_id": "in_000000000000", - "receiver_id": "re_IOxAUL24LG7P", + "customer_id": "re_IOxAUL24LG7P", }, ], } @@ -323,7 +323,7 @@ async def test_create_business_with_standard_kyb(self): assert response["data"] == {"id": "re_IOxAUL24LG7P"} @pytest.mark.asyncio - async def test_get_receiver(self): + async def test_get_customer(self): mocked_receiver = { "id": "re_YuaMcI2B8zbQ", "type": "individual", @@ -377,20 +377,20 @@ async def test_get_receiver(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_receiver, "error": None} - response = await self.blindpay.receivers.get("re_YuaMcI2B8zbQ") + response = await self.blindpay.customers.get("re_YuaMcI2B8zbQ") assert response["error"] is None assert response["data"] == mocked_receiver - mock_request.assert_called_once_with("GET", "/instances/in_000000000000/receivers/re_YuaMcI2B8zbQ") + mock_request.assert_called_once_with("GET", "/instances/in_000000000000/customers/re_YuaMcI2B8zbQ") @pytest.mark.asyncio - async def test_update_receiver(self): + async def test_update_customer(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": {"data": None}, "error": None} - response = await self.blindpay.receivers.update( + response = await self.blindpay.customers.update( { - "receiver_id": "re_YuaMcI2B8zbQ", + "customer_id": "re_YuaMcI2B8zbQ", "email": "bernardo.simonassi@gmail.com", "tax_id": "12345678900", "address_line_1": "Av. Paulista, 1000", @@ -450,18 +450,18 @@ async def test_update_receiver(self): assert response["data"] == {"data": None} @pytest.mark.asyncio - async def test_delete_receiver(self): + async def test_delete_customer(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": {"data": None}, "error": None} - response = await self.blindpay.receivers.delete("re_YuaMcI2B8zbQ") + response = await self.blindpay.customers.delete("re_YuaMcI2B8zbQ") assert response["error"] is None assert response["data"] == {"data": None} - mock_request.assert_called_once_with("DELETE", "/instances/in_000000000000/receivers/re_YuaMcI2B8zbQ", None) + mock_request.assert_called_once_with("DELETE", "/instances/in_000000000000/customers/re_YuaMcI2B8zbQ", None) @pytest.mark.asyncio - async def test_get_receiver_limits(self): + async def test_get_customer_limits(self): mocked_receiver_limits = { "limits": { "payin": { @@ -478,18 +478,18 @@ async def test_get_receiver_limits(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_receiver_limits, "error": None} - response = await self.blindpay.receivers.get_limits("re_YuaMcI2B8zbQ") + response = await self.blindpay.customers.get_limits("re_YuaMcI2B8zbQ") assert response["error"] is None assert response["data"] == mocked_receiver_limits - mock_request.assert_called_once_with("GET", "/instances/in_000000000000/limits/receivers/re_YuaMcI2B8zbQ") + mock_request.assert_called_once_with("GET", "/instances/in_000000000000/limits/customers/re_YuaMcI2B8zbQ") @pytest.mark.asyncio async def test_get_limit_increase_requests(self): mocked_limit_increase_requests = [ { "id": "rl_000000000000", - "receiver_id": "re_YuaMcI2B8zbQ", + "customer_id": "re_YuaMcI2B8zbQ", "status": "in_review", "daily": 50000, "monthly": 250000, @@ -501,7 +501,7 @@ async def test_get_limit_increase_requests(self): }, { "id": "rl_000000000000", - "receiver_id": "re_YuaMcI2B8zbQ", + "customer_id": "re_YuaMcI2B8zbQ", "status": "approved", "daily": 30000, "monthly": 150000, @@ -516,12 +516,12 @@ async def test_get_limit_increase_requests(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_limit_increase_requests, "error": None} - response = await self.blindpay.receivers.get_limit_increase_requests("re_YuaMcI2B8zbQ") + response = await self.blindpay.customers.get_limit_increase_requests("re_YuaMcI2B8zbQ") assert response["error"] is None assert response["data"] == mocked_limit_increase_requests mock_request.assert_called_once_with( - "GET", "/instances/in_000000000000/receivers/re_YuaMcI2B8zbQ/limit-increase" + "GET", "/instances/in_000000000000/customers/re_YuaMcI2B8zbQ/limit-increase" ) @pytest.mark.asyncio @@ -533,9 +533,9 @@ async def test_request_limit_increase(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_response, "error": None} - response = await self.blindpay.receivers.request_limit_increase( + response = await self.blindpay.customers.request_limit_increase( { - "receiver_id": "re_YuaMcI2B8zbQ", + "customer_id": "re_YuaMcI2B8zbQ", "daily": 100000, "monthly": 500000, "per_transaction": 50000, @@ -548,7 +548,7 @@ async def test_request_limit_increase(self): assert response["data"] == mocked_response mock_request.assert_called_once_with( "POST", - "/instances/in_000000000000/receivers/re_YuaMcI2B8zbQ/limit-increase", + "/instances/in_000000000000/customers/re_YuaMcI2B8zbQ/limit-increase", { "daily": 100000, "monthly": 500000, @@ -559,12 +559,12 @@ async def test_request_limit_increase(self): ) -class TestReceiversSync: +class TestCustomersSync: @pytest.fixture(autouse=True) def setup(self): self.blindpay = BlindPaySync(api_key="test-key", instance_id="in_000000000000") - def test_list_receivers(self): + def test_list_customers(self): mocked_receivers = [ { "id": "re_Euw7HN4OdxPn", @@ -696,7 +696,7 @@ def test_list_receivers(self): "proof_of_address_doc_file": "https://example.com/image.png", "id": "ub_000000000000", "instance_id": "in_000000000000", - "receiver_id": "re_IOxAUL24LG7P", + "customer_id": "re_IOxAUL24LG7P", }, ], "incorporation_doc_file": "https://example.com/image.png", @@ -718,13 +718,13 @@ def test_list_receivers(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_receivers, "error": None} - response = self.blindpay.receivers.list() + response = self.blindpay.customers.list() assert response["error"] is None assert response["data"] == mocked_receivers - mock_request.assert_called_once_with("GET", "/instances/in_000000000000/receivers") + mock_request.assert_called_once_with("GET", "/instances/in_000000000000/customers") - def test_list_receivers_with_params(self): + def test_list_customers_with_params(self): mocked_data = { "data": [{"id": "re_Euw7HN4OdxPn"}], "pagination": {"has_more": False, "next_page": None, "prev_page": None}, @@ -733,11 +733,11 @@ def test_list_receivers_with_params(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_data, "error": None} - response = self.blindpay.receivers.list({"status": "approved", "limit": "10"}) + response = self.blindpay.customers.list({"status": "approved", "limit": "10"}) assert response["error"] is None assert response["data"] == mocked_data - mock_request.assert_called_once_with("GET", "/instances/in_000000000000/receivers?status=approved&limit=10") + mock_request.assert_called_once_with("GET", "/instances/in_000000000000/customers?status=approved&limit=10") def test_create_individual_with_standard_kyc(self): mocked_receiver = { @@ -747,7 +747,7 @@ def test_create_individual_with_standard_kyc(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_receiver, "error": None} - response = self.blindpay.receivers.create_individual_with_standard_kyc( + response = self.blindpay.customers.create_individual_with_standard_kyc( { "email": "bernardo.simonassi@gmail.com", "tax_id": "12345678900", @@ -782,7 +782,7 @@ def test_create_individual_with_enhanced_kyc(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_receiver, "error": None} - response = self.blindpay.receivers.create_individual_with_enhanced_kyc( + response = self.blindpay.customers.create_individual_with_enhanced_kyc( { "email": "bernardo.simonassi@gmail.com", "tax_id": "12345678900", @@ -822,7 +822,7 @@ def test_create_business_with_standard_kyb(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_receiver, "error": None} - response = self.blindpay.receivers.create_business_with_standard_kyb( + response = self.blindpay.customers.create_business_with_standard_kyb( { "email": "contato@empresa.com.br", "tax_id": "20096178000195", @@ -862,7 +862,7 @@ def test_create_business_with_standard_kyb(self): "proof_of_address_doc_file": "https://example.com/image.png", "id": "ub_000000000000", "instance_id": "in_000000000000", - "receiver_id": "re_IOxAUL24LG7P", + "customer_id": "re_IOxAUL24LG7P", }, ], } @@ -871,7 +871,7 @@ def test_create_business_with_standard_kyb(self): assert response["error"] is None assert response["data"] == {"id": "re_IOxAUL24LG7P"} - def test_get_receiver(self): + def test_get_customer(self): mocked_receiver = { "id": "re_YuaMcI2B8zbQ", "type": "individual", @@ -925,19 +925,19 @@ def test_get_receiver(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_receiver, "error": None} - response = self.blindpay.receivers.get("re_YuaMcI2B8zbQ") + response = self.blindpay.customers.get("re_YuaMcI2B8zbQ") assert response["error"] is None assert response["data"] == mocked_receiver - mock_request.assert_called_once_with("GET", "/instances/in_000000000000/receivers/re_YuaMcI2B8zbQ") + mock_request.assert_called_once_with("GET", "/instances/in_000000000000/customers/re_YuaMcI2B8zbQ") - def test_update_receiver(self): + def test_update_customer(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": {"data": None}, "error": None} - response = self.blindpay.receivers.update( + response = self.blindpay.customers.update( { - "receiver_id": "re_YuaMcI2B8zbQ", + "customer_id": "re_YuaMcI2B8zbQ", "email": "bernardo.simonassi@gmail.com", "tax_id": "12345678900", "address_line_1": "Av. Paulista, 1000", @@ -996,17 +996,17 @@ def test_update_receiver(self): assert response["error"] is None assert response["data"] == {"data": None} - def test_delete_receiver(self): + def test_delete_customer(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": {"data": None}, "error": None} - response = self.blindpay.receivers.delete("re_YuaMcI2B8zbQ") + response = self.blindpay.customers.delete("re_YuaMcI2B8zbQ") assert response["error"] is None assert response["data"] == {"data": None} - mock_request.assert_called_once_with("DELETE", "/instances/in_000000000000/receivers/re_YuaMcI2B8zbQ", None) + mock_request.assert_called_once_with("DELETE", "/instances/in_000000000000/customers/re_YuaMcI2B8zbQ", None) - def test_get_receiver_limits(self): + def test_get_customer_limits(self): mocked_receiver_limits = { "limits": { "payin": { @@ -1023,17 +1023,17 @@ def test_get_receiver_limits(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_receiver_limits, "error": None} - response = self.blindpay.receivers.get_limits("re_YuaMcI2B8zbQ") + response = self.blindpay.customers.get_limits("re_YuaMcI2B8zbQ") assert response["error"] is None assert response["data"] == mocked_receiver_limits - mock_request.assert_called_once_with("GET", "/instances/in_000000000000/limits/receivers/re_YuaMcI2B8zbQ") + mock_request.assert_called_once_with("GET", "/instances/in_000000000000/limits/customers/re_YuaMcI2B8zbQ") def test_get_limit_increase_requests(self): mocked_limit_increase_requests = [ { "id": "rl_000000000000", - "receiver_id": "re_YuaMcI2B8zbQ", + "customer_id": "re_YuaMcI2B8zbQ", "status": "in_review", "daily": 50000, "monthly": 250000, @@ -1045,7 +1045,7 @@ def test_get_limit_increase_requests(self): }, { "id": "rl_000000000000", - "receiver_id": "re_YuaMcI2B8zbQ", + "customer_id": "re_YuaMcI2B8zbQ", "status": "approved", "daily": 30000, "monthly": 150000, @@ -1060,12 +1060,12 @@ def test_get_limit_increase_requests(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_limit_increase_requests, "error": None} - response = self.blindpay.receivers.get_limit_increase_requests("re_YuaMcI2B8zbQ") + response = self.blindpay.customers.get_limit_increase_requests("re_YuaMcI2B8zbQ") assert response["error"] is None assert response["data"] == mocked_limit_increase_requests mock_request.assert_called_once_with( - "GET", "/instances/in_000000000000/receivers/re_YuaMcI2B8zbQ/limit-increase" + "GET", "/instances/in_000000000000/customers/re_YuaMcI2B8zbQ/limit-increase" ) def test_request_limit_increase(self): @@ -1076,9 +1076,9 @@ def test_request_limit_increase(self): with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_response, "error": None} - response = self.blindpay.receivers.request_limit_increase( + response = self.blindpay.customers.request_limit_increase( { - "receiver_id": "re_YuaMcI2B8zbQ", + "customer_id": "re_YuaMcI2B8zbQ", "daily": 100000, "monthly": 500000, "per_transaction": 50000, @@ -1091,7 +1091,7 @@ def test_request_limit_increase(self): assert response["data"] == mocked_response mock_request.assert_called_once_with( "POST", - "/instances/in_000000000000/receivers/re_YuaMcI2B8zbQ/limit-increase", + "/instances/in_000000000000/customers/re_YuaMcI2B8zbQ/limit-increase", { "daily": 100000, "monthly": 500000, diff --git a/tests/resources/test_payins.py b/tests/resources/test_payins.py index ad4df57..c958f5f 100644 --- a/tests/resources/test_payins.py +++ b/tests/resources/test_payins.py @@ -12,102 +12,95 @@ def setup(self): @pytest.mark.asyncio async def test_list_payins(self): - mocked_payins = { - "data": [ - { - "receiver_id": "re_000000000000", - "id": "re_000000000000", - "pix_code": ( - "00020101021226790014br.gov.bcb.pix2557brcode.starkinfra.com/v2/" - "bcf07f6c4110454e9fd6f120bab13e835204000053039865802BR5915Blind Pay, Inc." - "6010Vila Velha62070503***6304BCAB" - ), - "memo_code": "8K45GHBNT6BQ6462", - "clabe": "014027000000000008", - "status": "processing", - "payin_quote_id": "pq_000000000000", - "instance_id": "in_000000000000", - "tracking_transaction": { - "step": "processing", - "status": "failed", - "transaction_hash": "0x123...890", - "completed_at": "2011-10-05T14:48:00.000Z", + mocked_payins = [ + { + "receiver_id": "re_000000000000", + "id": "re_000000000000", + "pix_code": ( + "00020101021226790014br.gov.bcb.pix2557brcode.starkinfra.com/v2/" + "bcf07f6c4110454e9fd6f120bab13e835204000053039865802BR5915Blind Pay, Inc." + "6010Vila Velha62070503***6304BCAB" + ), + "memo_code": "8K45GHBNT6BQ6462", + "clabe": "014027000000000008", + "status": "processing", + "payin_quote_id": "pq_000000000000", + "instance_id": "in_000000000000", + "tracking_transaction": { + "step": "processing", + "status": "failed", + "transaction_hash": "0x123...890", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "tracking_payment": { + "step": "on_hold", + "provider_name": "blockchain", + "provider_transaction_id": "tx_123456789", + "provider_status": "confirmed", + "estimated_time_of_arrival": "2011-10-05T15:00:00.000Z", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "tracking_complete": { + "step": "on_hold", + "status": "completed", + "transaction_hash": "0x123...890", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "tracking_partner_fee": { + "step": "on_hold", + "transaction_hash": "0x123...890", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "created_at": "2021-01-01T00:00:00Z", + "updated_at": "2021-01-01T00:00:00Z", + "image_url": "https://example.com/image.png", + "first_name": "John", + "last_name": "Doe", + "legal_name": "Company Name Inc.", + "type": "individual", + "payment_method": "pix", + "sender_amount": 5240, + "receiver_amount": 1010, + "token": "USDC", + "partner_fee_amount": 150, + "total_fee_amount": 1.53, + "commercial_quotation": 495, + "blindpay_quotation": 505, + "currency": "BRL", + "billing_fee": 100, + "name": "Wallet Display Name", + "address": "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C", + "network": "polygon", + "blindpay_bank_details": { + "routing_number": "121145349", + "account_number": "621327727210181", + "account_type": "Business checking", + "swift_bic_code": "CHASUS33", + "ach": { + "routing_number": "123456789", + "account_number": "123456789", }, - "tracking_payment": { - "step": "on_hold", - "provider_name": "blockchain", - "provider_transaction_id": "tx_123456789", - "provider_status": "confirmed", - "estimated_time_of_arrival": "2011-10-05T15:00:00.000Z", - "completed_at": "2011-10-05T14:48:00.000Z", + "wire": { + "routing_number": "123456789", + "account_number": "123456789", }, - "tracking_complete": { - "step": "on_hold", - "status": "completed", - "transaction_hash": "0x123...890", - "completed_at": "2011-10-05T14:48:00.000Z", + "rtp": { + "routing_number": "123456789", + "account_number": "123456789", }, - "tracking_partner_fee": { - "step": "on_hold", - "transaction_hash": "0x123...890", - "completed_at": "2011-10-05T14:48:00.000Z", + "beneficiary": { + "name": "BlindPay, Inc.", + "address_line_1": "8 The Green", + "address_line_2": "Dover, DE 19901", }, - "created_at": "2021-01-01T00:00:00Z", - "updated_at": "2021-01-01T00:00:00Z", - "image_url": "https://example.com/image.png", - "first_name": "John", - "last_name": "Doe", - "legal_name": "Company Name Inc.", - "type": "individual", - "payment_method": "pix", - "sender_amount": 5240, - "receiver_amount": 1010, - "token": "USDC", - "partner_fee_amount": 150, - "total_fee_amount": 1.53, - "commercial_quotation": 495, - "blindpay_quotation": 505, - "currency": "BRL", - "billing_fee": 100, - "name": "Wallet Display Name", - "address": "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C", - "network": "polygon", - "blindpay_bank_details": { - "routing_number": "121145349", - "account_number": "621327727210181", - "account_type": "Business checking", - "swift_bic_code": "CHASUS33", - "ach": { - "routing_number": "123456789", - "account_number": "123456789", - }, - "wire": { - "routing_number": "123456789", - "account_number": "123456789", - }, - "rtp": { - "routing_number": "123456789", - "account_number": "123456789", - }, - "beneficiary": { - "name": "BlindPay, Inc.", - "address_line_1": "8 The Green", - "address_line_2": "Dover, DE 19901", - }, - "receiving_bank": { - "name": "Column NA - Brex", - "address_line_1": "1 Letterman Drive, Building A, Suite A4-700", - "address_line_2": "San Francisco, CA 94129", - }, + "receiving_bank": { + "name": "Column NA - Brex", + "address_line_1": "1 Letterman Drive, Building A, Suite A4-700", + "address_line_2": "San Francisco, CA 94129", }, }, - ], - "pagination": { - "has_more": True, - "next_page": 3, - "prev_page": 1, }, - } + ] with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_payins, "error": None} @@ -409,102 +402,95 @@ def setup(self): self.blindpay = BlindPaySync(api_key="test-key", instance_id="in_000000000000") def test_list_payins(self): - mocked_payins = { - "data": [ - { - "receiver_id": "re_000000000000", - "id": "re_000000000000", - "pix_code": ( - "00020101021226790014br.gov.bcb.pix2557brcode.starkinfra.com/v2/" - "bcf07f6c4110454e9fd6f120bab13e835204000053039865802BR5915Blind Pay, Inc." - "6010Vila Velha62070503***6304BCAB" - ), - "memo_code": "8K45GHBNT6BQ6462", - "clabe": "014027000000000008", - "status": "processing", - "payin_quote_id": "pq_000000000000", - "instance_id": "in_000000000000", - "tracking_transaction": { - "step": "processing", - "status": "failed", - "transaction_hash": "0x123...890", - "completed_at": "2011-10-05T14:48:00.000Z", + mocked_payins = [ + { + "receiver_id": "re_000000000000", + "id": "re_000000000000", + "pix_code": ( + "00020101021226790014br.gov.bcb.pix2557brcode.starkinfra.com/v2/" + "bcf07f6c4110454e9fd6f120bab13e835204000053039865802BR5915Blind Pay, Inc." + "6010Vila Velha62070503***6304BCAB" + ), + "memo_code": "8K45GHBNT6BQ6462", + "clabe": "014027000000000008", + "status": "processing", + "payin_quote_id": "pq_000000000000", + "instance_id": "in_000000000000", + "tracking_transaction": { + "step": "processing", + "status": "failed", + "transaction_hash": "0x123...890", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "tracking_payment": { + "step": "on_hold", + "provider_name": "blockchain", + "provider_transaction_id": "tx_123456789", + "provider_status": "confirmed", + "estimated_time_of_arrival": "2011-10-05T15:00:00.000Z", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "tracking_complete": { + "step": "on_hold", + "status": "completed", + "transaction_hash": "0x123...890", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "tracking_partner_fee": { + "step": "on_hold", + "transaction_hash": "0x123...890", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "created_at": "2021-01-01T00:00:00Z", + "updated_at": "2021-01-01T00:00:00Z", + "image_url": "https://example.com/image.png", + "first_name": "John", + "last_name": "Doe", + "legal_name": "Company Name Inc.", + "type": "individual", + "payment_method": "pix", + "sender_amount": 5240, + "receiver_amount": 1010, + "token": "USDC", + "partner_fee_amount": 150, + "total_fee_amount": 1.53, + "commercial_quotation": 495, + "blindpay_quotation": 505, + "currency": "BRL", + "billing_fee": 100, + "name": "Wallet Display Name", + "address": "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C", + "network": "polygon", + "blindpay_bank_details": { + "routing_number": "121145349", + "account_number": "621327727210181", + "account_type": "Business checking", + "swift_bic_code": "CHASUS33", + "ach": { + "routing_number": "123456789", + "account_number": "123456789", }, - "tracking_payment": { - "step": "on_hold", - "provider_name": "blockchain", - "provider_transaction_id": "tx_123456789", - "provider_status": "confirmed", - "estimated_time_of_arrival": "2011-10-05T15:00:00.000Z", - "completed_at": "2011-10-05T14:48:00.000Z", + "wire": { + "routing_number": "123456789", + "account_number": "123456789", }, - "tracking_complete": { - "step": "on_hold", - "status": "completed", - "transaction_hash": "0x123...890", - "completed_at": "2011-10-05T14:48:00.000Z", + "rtp": { + "routing_number": "123456789", + "account_number": "123456789", }, - "tracking_partner_fee": { - "step": "on_hold", - "transaction_hash": "0x123...890", - "completed_at": "2011-10-05T14:48:00.000Z", + "beneficiary": { + "name": "BlindPay, Inc.", + "address_line_1": "8 The Green", + "address_line_2": "Dover, DE 19901", }, - "created_at": "2021-01-01T00:00:00Z", - "updated_at": "2021-01-01T00:00:00Z", - "image_url": "https://example.com/image.png", - "first_name": "John", - "last_name": "Doe", - "legal_name": "Company Name Inc.", - "type": "individual", - "payment_method": "pix", - "sender_amount": 5240, - "receiver_amount": 1010, - "token": "USDC", - "partner_fee_amount": 150, - "total_fee_amount": 1.53, - "commercial_quotation": 495, - "blindpay_quotation": 505, - "currency": "BRL", - "billing_fee": 100, - "name": "Wallet Display Name", - "address": "0xDD6a3aD0949396e57C7738ba8FC1A46A5a1C372C", - "network": "polygon", - "blindpay_bank_details": { - "routing_number": "121145349", - "account_number": "621327727210181", - "account_type": "Business checking", - "swift_bic_code": "CHASUS33", - "ach": { - "routing_number": "123456789", - "account_number": "123456789", - }, - "wire": { - "routing_number": "123456789", - "account_number": "123456789", - }, - "rtp": { - "routing_number": "123456789", - "account_number": "123456789", - }, - "beneficiary": { - "name": "BlindPay, Inc.", - "address_line_1": "8 The Green", - "address_line_2": "Dover, DE 19901", - }, - "receiving_bank": { - "name": "Column NA - Brex", - "address_line_1": "1 Letterman Drive, Building A, Suite A4-700", - "address_line_2": "San Francisco, CA 94129", - }, + "receiving_bank": { + "name": "Column NA - Brex", + "address_line_1": "1 Letterman Drive, Building A, Suite A4-700", + "address_line_2": "San Francisco, CA 94129", }, }, - ], - "pagination": { - "has_more": True, - "next_page": 3, - "prev_page": 1, }, - } + ] with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_payins, "error": None} diff --git a/tests/resources/test_payouts.py b/tests/resources/test_payouts.py index a39bcd2..0880b2a 100644 --- a/tests/resources/test_payouts.py +++ b/tests/resources/test_payouts.py @@ -12,107 +12,100 @@ def setup(self): @pytest.mark.asyncio async def test_list_payouts(self): - mocked_payouts = { - "data": [ - { - "receiver_id": "re_000000000000", - "id": "pa_000000000000", - "status": "processing", - "sender_wallet_address": "0x123...890", - "signed_transaction": "AAA...Zey8y0A", - "quote_id": "qu_000000000000", - "instance_id": "in_000000000000", - "tracking_transaction": { - "step": "processing", - "status": "failed", - "transaction_hash": "0x123...890", - "completed_at": "2011-10-05T14:48:00.000Z", - }, - "tracking_payment": { - "step": "on_hold", - "provider_name": "blockchain", - "provider_transaction_id": "0x123...890", - "provider_status": "canceled", - "estimated_time_of_arrival": "5_min", - "completed_at": "2011-10-05T14:48:00.000Z", - }, - "tracking_liquidity": { - "step": "processing", - "provider_transaction_id": "0x123...890", - "provider_status": "deposited", - "estimated_time_of_arrival": "1_business_day", - "completed_at": "2011-10-05T14:48:00.000Z", - }, - "tracking_complete": { - "step": "on_hold", - "status": "tokens_refunded", - "transaction_hash": "0x123...890", - "completed_at": "2011-10-05T14:48:00.000Z", - }, - "tracking_partner_fee": { - "step": "on_hold", - "transaction_hash": "0x123...890", - "completed_at": "2011-10-05T14:48:00.000Z", - }, - "created_at": "2021-01-01T00:00:00Z", - "updated_at": "2021-01-01T00:00:00Z", - "image_url": "https://example.com/image.png", - "first_name": "John", - "last_name": "Doe", - "legal_name": "Company Name Inc.", - "network": "sepolia", - "token": "USDC", - "description": "Memo code or description, only works with USD and BRL", - "sender_amount": 1010, - "receiver_amount": 5240, - "partner_fee_amount": 150, - "commercial_quotation": 495, - "blindpay_quotation": 485, - "total_fee_amount": 1.5, - "receiver_local_amount": 1000, - "currency": "BRL", - "transaction_document_file": "https://example.com/image.png", - "transaction_document_type": "invoice", - "transaction_document_id": "1234567890", - "name": "Bank Account Name", - "type": "wire", - "pix_key": "14947677768", - "account_number": "1001001234", - "routing_number": "012345678", - "country": "US", - "account_class": "individual", - "address_line_1": "Address line 1", - "address_line_2": "Address line 2", - "city": "City", - "state_province_region": "State/Province/Region", - "postal_code": "Postal code", - "account_type": "checking", - "ach_cop_beneficiary_first_name": "Fernando", - "ach_cop_bank_account": "12345678", - "ach_cop_bank_code": "051", - "ach_cop_beneficiary_last_name": "Guzman Alarcón", - "ach_cop_document_id": "1661105408", - "ach_cop_document_type": "CC", - "ach_cop_email": "fernando.guzman@gmail.com", - "beneficiary_name": "Individual full name or business name", - "spei_clabe": "5482347403740546", - "spei_protocol": "clabe", - "spei_institution_code": "40002", - "swift_beneficiary_country": "MX", - "swift_code_bic": "123456789", - "swift_account_holder_name": "John Doe", - "swift_account_number_iban": "123456789", - "transfers_account": "BM123123123123", - "transfers_type": "CVU", - "has_virtual_account": True, + mocked_payouts = [ + { + "receiver_id": "re_000000000000", + "id": "pa_000000000000", + "status": "processing", + "sender_wallet_address": "0x123...890", + "signed_transaction": "AAA...Zey8y0A", + "quote_id": "qu_000000000000", + "instance_id": "in_000000000000", + "tracking_transaction": { + "step": "processing", + "status": "failed", + "transaction_hash": "0x123...890", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "tracking_payment": { + "step": "on_hold", + "provider_name": "blockchain", + "provider_transaction_id": "0x123...890", + "provider_status": "canceled", + "estimated_time_of_arrival": "5_min", + "completed_at": "2011-10-05T14:48:00.000Z", }, - ], - "pagination": { - "has_more": True, - "next_page": 3, - "prev_page": 1, + "tracking_liquidity": { + "step": "processing", + "provider_transaction_id": "0x123...890", + "provider_status": "deposited", + "estimated_time_of_arrival": "1_business_day", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "tracking_complete": { + "step": "on_hold", + "status": "tokens_refunded", + "transaction_hash": "0x123...890", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "tracking_partner_fee": { + "step": "on_hold", + "transaction_hash": "0x123...890", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "created_at": "2021-01-01T00:00:00Z", + "updated_at": "2021-01-01T00:00:00Z", + "image_url": "https://example.com/image.png", + "first_name": "John", + "last_name": "Doe", + "legal_name": "Company Name Inc.", + "network": "sepolia", + "token": "USDC", + "description": "Memo code or description, only works with USD and BRL", + "sender_amount": 1010, + "receiver_amount": 5240, + "partner_fee_amount": 150, + "commercial_quotation": 495, + "blindpay_quotation": 485, + "total_fee_amount": 1.5, + "receiver_local_amount": 1000, + "currency": "BRL", + "transaction_document_file": "https://example.com/image.png", + "transaction_document_type": "invoice", + "transaction_document_id": "1234567890", + "name": "Bank Account Name", + "type": "wire", + "pix_key": "14947677768", + "account_number": "1001001234", + "routing_number": "012345678", + "country": "US", + "account_class": "individual", + "address_line_1": "Address line 1", + "address_line_2": "Address line 2", + "city": "City", + "state_province_region": "State/Province/Region", + "postal_code": "Postal code", + "account_type": "checking", + "ach_cop_beneficiary_first_name": "Fernando", + "ach_cop_bank_account": "12345678", + "ach_cop_bank_code": "051", + "ach_cop_beneficiary_last_name": "Guzman Alarcón", + "ach_cop_document_id": "1661105408", + "ach_cop_document_type": "CC", + "ach_cop_email": "fernando.guzman@gmail.com", + "beneficiary_name": "Individual full name or business name", + "spei_clabe": "5482347403740546", + "spei_protocol": "clabe", + "spei_institution_code": "40002", + "swift_beneficiary_country": "MX", + "swift_code_bic": "123456789", + "swift_account_holder_name": "John Doe", + "swift_account_number_iban": "123456789", + "transfers_account": "BM123123123123", + "transfers_type": "CVU", + "has_virtual_account": True, }, - } + ] with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_payouts, "error": None} @@ -597,107 +590,100 @@ def setup(self): self.blindpay = BlindPaySync(api_key="test-key", instance_id="in_000000000000") def test_list_payouts(self): - mocked_payouts = { - "data": [ - { - "receiver_id": "re_000000000000", - "id": "pa_000000000000", - "status": "processing", - "sender_wallet_address": "0x123...890", - "signed_transaction": "AAA...Zey8y0A", - "quote_id": "qu_000000000000", - "instance_id": "in_000000000000", - "tracking_transaction": { - "step": "processing", - "status": "failed", - "transaction_hash": "0x123...890", - "completed_at": "2011-10-05T14:48:00.000Z", - }, - "tracking_payment": { - "step": "on_hold", - "provider_name": "blockchain", - "provider_transaction_id": "0x123...890", - "provider_status": "canceled", - "estimated_time_of_arrival": "5_min", - "completed_at": "2011-10-05T14:48:00.000Z", - }, - "tracking_liquidity": { - "step": "processing", - "provider_transaction_id": "0x123...890", - "provider_status": "deposited", - "estimated_time_of_arrival": "1_business_day", - "completed_at": "2011-10-05T14:48:00.000Z", - }, - "tracking_complete": { - "step": "on_hold", - "status": "tokens_refunded", - "transaction_hash": "0x123...890", - "completed_at": "2011-10-05T14:48:00.000Z", - }, - "tracking_partner_fee": { - "step": "on_hold", - "transaction_hash": "0x123...890", - "completed_at": "2011-10-05T14:48:00.000Z", - }, - "created_at": "2021-01-01T00:00:00Z", - "updated_at": "2021-01-01T00:00:00Z", - "image_url": "https://example.com/image.png", - "first_name": "John", - "last_name": "Doe", - "legal_name": "Company Name Inc.", - "network": "sepolia", - "token": "USDC", - "description": "Memo code or description, only works with USD and BRL", - "sender_amount": 1010, - "receiver_amount": 5240, - "partner_fee_amount": 150, - "commercial_quotation": 495, - "blindpay_quotation": 485, - "total_fee_amount": 1.5, - "receiver_local_amount": 1000, - "currency": "BRL", - "transaction_document_file": "https://example.com/image.png", - "transaction_document_type": "invoice", - "transaction_document_id": "1234567890", - "name": "Bank Account Name", - "type": "wire", - "pix_key": "14947677768", - "account_number": "1001001234", - "routing_number": "012345678", - "country": "US", - "account_class": "individual", - "address_line_1": "Address line 1", - "address_line_2": "Address line 2", - "city": "City", - "state_province_region": "State/Province/Region", - "postal_code": "Postal code", - "account_type": "checking", - "ach_cop_beneficiary_first_name": "Fernando", - "ach_cop_bank_account": "12345678", - "ach_cop_bank_code": "051", - "ach_cop_beneficiary_last_name": "Guzman Alarcón", - "ach_cop_document_id": "1661105408", - "ach_cop_document_type": "CC", - "ach_cop_email": "fernando.guzman@gmail.com", - "beneficiary_name": "Individual full name or business name", - "spei_clabe": "5482347403740546", - "spei_protocol": "clabe", - "spei_institution_code": "40002", - "swift_beneficiary_country": "MX", - "swift_code_bic": "123456789", - "swift_account_holder_name": "John Doe", - "swift_account_number_iban": "123456789", - "transfers_account": "BM123123123123", - "transfers_type": "CVU", - "has_virtual_account": True, + mocked_payouts = [ + { + "receiver_id": "re_000000000000", + "id": "pa_000000000000", + "status": "processing", + "sender_wallet_address": "0x123...890", + "signed_transaction": "AAA...Zey8y0A", + "quote_id": "qu_000000000000", + "instance_id": "in_000000000000", + "tracking_transaction": { + "step": "processing", + "status": "failed", + "transaction_hash": "0x123...890", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "tracking_payment": { + "step": "on_hold", + "provider_name": "blockchain", + "provider_transaction_id": "0x123...890", + "provider_status": "canceled", + "estimated_time_of_arrival": "5_min", + "completed_at": "2011-10-05T14:48:00.000Z", }, - ], - "pagination": { - "has_more": True, - "next_page": 3, - "prev_page": 1, + "tracking_liquidity": { + "step": "processing", + "provider_transaction_id": "0x123...890", + "provider_status": "deposited", + "estimated_time_of_arrival": "1_business_day", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "tracking_complete": { + "step": "on_hold", + "status": "tokens_refunded", + "transaction_hash": "0x123...890", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "tracking_partner_fee": { + "step": "on_hold", + "transaction_hash": "0x123...890", + "completed_at": "2011-10-05T14:48:00.000Z", + }, + "created_at": "2021-01-01T00:00:00Z", + "updated_at": "2021-01-01T00:00:00Z", + "image_url": "https://example.com/image.png", + "first_name": "John", + "last_name": "Doe", + "legal_name": "Company Name Inc.", + "network": "sepolia", + "token": "USDC", + "description": "Memo code or description, only works with USD and BRL", + "sender_amount": 1010, + "receiver_amount": 5240, + "partner_fee_amount": 150, + "commercial_quotation": 495, + "blindpay_quotation": 485, + "total_fee_amount": 1.5, + "receiver_local_amount": 1000, + "currency": "BRL", + "transaction_document_file": "https://example.com/image.png", + "transaction_document_type": "invoice", + "transaction_document_id": "1234567890", + "name": "Bank Account Name", + "type": "wire", + "pix_key": "14947677768", + "account_number": "1001001234", + "routing_number": "012345678", + "country": "US", + "account_class": "individual", + "address_line_1": "Address line 1", + "address_line_2": "Address line 2", + "city": "City", + "state_province_region": "State/Province/Region", + "postal_code": "Postal code", + "account_type": "checking", + "ach_cop_beneficiary_first_name": "Fernando", + "ach_cop_bank_account": "12345678", + "ach_cop_bank_code": "051", + "ach_cop_beneficiary_last_name": "Guzman Alarcón", + "ach_cop_document_id": "1661105408", + "ach_cop_document_type": "CC", + "ach_cop_email": "fernando.guzman@gmail.com", + "beneficiary_name": "Individual full name or business name", + "spei_clabe": "5482347403740546", + "spei_protocol": "clabe", + "spei_institution_code": "40002", + "swift_beneficiary_country": "MX", + "swift_code_bic": "123456789", + "swift_account_holder_name": "John Doe", + "swift_account_number_iban": "123456789", + "transfers_account": "BM123123123123", + "transfers_type": "CVU", + "has_virtual_account": True, }, - } + ] with patch.object(self.blindpay._api, "_request") as mock_request: mock_request.return_value = {"data": mocked_payouts, "error": None} diff --git a/uv.lock b/uv.lock index 52335b6..7a8c709 100644 --- a/uv.lock +++ b/uv.lock @@ -27,7 +27,7 @@ wheels = [ [[package]] name = "blindpay" -version = "2.1.0" +version = "3.0.0" source = { editable = "." } dependencies = [ { name = "httpx" },