This commit is contained in:
Iliyan Angelov
2025-11-17 18:26:30 +02:00
parent 48353cde9c
commit 0c59fe1173
2535 changed files with 278997 additions and 2480 deletions

View File

@@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from importlib import import_module
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe.financial_connections._account import Account as Account
from stripe.financial_connections._account_owner import (
AccountOwner as AccountOwner,
)
from stripe.financial_connections._account_owner_service import (
AccountOwnerService as AccountOwnerService,
)
from stripe.financial_connections._account_ownership import (
AccountOwnership as AccountOwnership,
)
from stripe.financial_connections._account_service import (
AccountService as AccountService,
)
from stripe.financial_connections._session import Session as Session
from stripe.financial_connections._session_service import (
SessionService as SessionService,
)
from stripe.financial_connections._transaction import (
Transaction as Transaction,
)
from stripe.financial_connections._transaction_service import (
TransactionService as TransactionService,
)
# name -> (import_target, is_submodule)
_import_map = {
"Account": ("stripe.financial_connections._account", False),
"AccountOwner": ("stripe.financial_connections._account_owner", False),
"AccountOwnerService": (
"stripe.financial_connections._account_owner_service",
False,
),
"AccountOwnership": (
"stripe.financial_connections._account_ownership",
False,
),
"AccountService": ("stripe.financial_connections._account_service", False),
"Session": ("stripe.financial_connections._session", False),
"SessionService": ("stripe.financial_connections._session_service", False),
"Transaction": ("stripe.financial_connections._transaction", False),
"TransactionService": (
"stripe.financial_connections._transaction_service",
False,
),
}
if not TYPE_CHECKING:
def __getattr__(name):
try:
target, is_submodule = _import_map[name]
module = import_module(target)
if is_submodule:
return module
return getattr(
module,
name,
)
except KeyError:
raise AttributeError()

View File

@@ -0,0 +1,870 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._expandable_field import ExpandableField
from stripe._list_object import ListObject
from stripe._listable_api_resource import ListableAPIResource
from stripe._stripe_object import StripeObject
from stripe._util import class_method_variant, sanitize_id
from typing import ClassVar, Dict, List, Optional, cast, overload
from typing_extensions import Literal, Unpack, TYPE_CHECKING
if TYPE_CHECKING:
from stripe._account import Account as AccountResource
from stripe._customer import Customer
from stripe.financial_connections._account_owner import AccountOwner
from stripe.financial_connections._account_ownership import (
AccountOwnership,
)
from stripe.params.financial_connections._account_disconnect_params import (
AccountDisconnectParams,
)
from stripe.params.financial_connections._account_list_owners_params import (
AccountListOwnersParams,
)
from stripe.params.financial_connections._account_list_params import (
AccountListParams,
)
from stripe.params.financial_connections._account_refresh_account_params import (
AccountRefreshAccountParams,
)
from stripe.params.financial_connections._account_retrieve_params import (
AccountRetrieveParams,
)
from stripe.params.financial_connections._account_subscribe_params import (
AccountSubscribeParams,
)
from stripe.params.financial_connections._account_unsubscribe_params import (
AccountUnsubscribeParams,
)
class Account(ListableAPIResource["Account"]):
"""
A Financial Connections Account represents an account that exists outside of Stripe, to which you have been granted some degree of access.
"""
OBJECT_NAME: ClassVar[Literal["financial_connections.account"]] = (
"financial_connections.account"
)
class AccountHolder(StripeObject):
account: Optional[ExpandableField["AccountResource"]]
"""
The ID of the Stripe account this account belongs to. Should only be present if `account_holder.type` is `account`.
"""
customer: Optional[ExpandableField["Customer"]]
"""
ID of the Stripe customer this account belongs to. Present if and only if `account_holder.type` is `customer`.
"""
type: Literal["account", "customer"]
"""
Type of account holder that this account belongs to.
"""
class Balance(StripeObject):
class Cash(StripeObject):
available: Optional[Dict[str, int]]
"""
The funds available to the account holder. Typically this is the current balance after subtracting any outbound pending transactions and adding any inbound pending transactions.
Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
Each value is a integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder.
"""
class Credit(StripeObject):
used: Optional[Dict[str, int]]
"""
The credit that has been used by the account holder.
Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
Each value is a integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder.
"""
as_of: int
"""
The time that the external institution calculated this balance. Measured in seconds since the Unix epoch.
"""
cash: Optional[Cash]
credit: Optional[Credit]
current: Dict[str, int]
"""
The balances owed to (or by) the account holder, before subtracting any outbound pending transactions or adding any inbound pending transactions.
Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
Each value is a integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder.
"""
type: Literal["cash", "credit"]
"""
The `type` of the balance. An additional hash is included on the balance with a name matching this value.
"""
_inner_class_types = {"cash": Cash, "credit": Credit}
class BalanceRefresh(StripeObject):
last_attempted_at: int
"""
The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch.
"""
next_refresh_available_at: Optional[int]
"""
Time at which the next balance refresh can be initiated. This value will be `null` when `status` is `pending`. Measured in seconds since the Unix epoch.
"""
status: Literal["failed", "pending", "succeeded"]
"""
The status of the last refresh attempt.
"""
class OwnershipRefresh(StripeObject):
last_attempted_at: int
"""
The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch.
"""
next_refresh_available_at: Optional[int]
"""
Time at which the next ownership refresh can be initiated. This value will be `null` when `status` is `pending`. Measured in seconds since the Unix epoch.
"""
status: Literal["failed", "pending", "succeeded"]
"""
The status of the last refresh attempt.
"""
class TransactionRefresh(StripeObject):
id: str
"""
Unique identifier for the object.
"""
last_attempted_at: int
"""
The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch.
"""
next_refresh_available_at: Optional[int]
"""
Time at which the next transaction refresh can be initiated. This value will be `null` when `status` is `pending`. Measured in seconds since the Unix epoch.
"""
status: Literal["failed", "pending", "succeeded"]
"""
The status of the last refresh attempt.
"""
account_holder: Optional[AccountHolder]
"""
The account holder that this account belongs to.
"""
balance: Optional[Balance]
"""
The most recent information about the account's balance.
"""
balance_refresh: Optional[BalanceRefresh]
"""
The state of the most recent attempt to refresh the account balance.
"""
category: Literal["cash", "credit", "investment", "other"]
"""
The type of the account. Account category is further divided in `subcategory`.
"""
created: int
"""
Time at which the object was created. Measured in seconds since the Unix epoch.
"""
display_name: Optional[str]
"""
A human-readable name that has been assigned to this account, either by the account holder or by the institution.
"""
id: str
"""
Unique identifier for the object.
"""
institution_name: str
"""
The name of the institution that holds this account.
"""
last4: Optional[str]
"""
The last 4 digits of the account number. If present, this will be 4 numeric characters.
"""
livemode: bool
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""
object: Literal["financial_connections.account"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
ownership: Optional[ExpandableField["AccountOwnership"]]
"""
The most recent information about the account's owners.
"""
ownership_refresh: Optional[OwnershipRefresh]
"""
The state of the most recent attempt to refresh the account owners.
"""
permissions: Optional[
List[
Literal["balances", "ownership", "payment_method", "transactions"]
]
]
"""
The list of permissions granted by this account.
"""
status: Literal["active", "disconnected", "inactive"]
"""
The status of the link to the account.
"""
subcategory: Literal[
"checking",
"credit_card",
"line_of_credit",
"mortgage",
"other",
"savings",
]
"""
If `category` is `cash`, one of:
- `checking`
- `savings`
- `other`
If `category` is `credit`, one of:
- `mortgage`
- `line_of_credit`
- `credit_card`
- `other`
If `category` is `investment` or `other`, this will be `other`.
"""
subscriptions: Optional[List[Literal["transactions"]]]
"""
The list of data refresh subscriptions requested on this account.
"""
supported_payment_method_types: List[Literal["link", "us_bank_account"]]
"""
The [PaymentMethod type](https://stripe.com/docs/api/payment_methods/object#payment_method_object-type)(s) that can be created from this account.
"""
transaction_refresh: Optional[TransactionRefresh]
"""
The state of the most recent attempt to refresh the account transactions.
"""
@classmethod
def _cls_disconnect(
cls, account: str, **params: Unpack["AccountDisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
return cast(
"Account",
cls._static_request(
"post",
"/v1/financial_connections/accounts/{account}/disconnect".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
def disconnect(
account: str, **params: Unpack["AccountDisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
...
@overload
def disconnect(
self, **params: Unpack["AccountDisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
...
@class_method_variant("_cls_disconnect")
def disconnect( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["AccountDisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
return cast(
"Account",
self._request(
"post",
"/v1/financial_connections/accounts/{account}/disconnect".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
async def _cls_disconnect_async(
cls, account: str, **params: Unpack["AccountDisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
return cast(
"Account",
await cls._static_request_async(
"post",
"/v1/financial_connections/accounts/{account}/disconnect".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
async def disconnect_async(
account: str, **params: Unpack["AccountDisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
...
@overload
async def disconnect_async(
self, **params: Unpack["AccountDisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
...
@class_method_variant("_cls_disconnect_async")
async def disconnect_async( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["AccountDisconnectParams"]
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
return cast(
"Account",
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/disconnect".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
def list(
cls, **params: Unpack["AccountListParams"]
) -> ListObject["Account"]:
"""
Returns a list of Financial Connections Account objects.
"""
result = cls._static_request(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):
raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)
return result
@classmethod
async def list_async(
cls, **params: Unpack["AccountListParams"]
) -> ListObject["Account"]:
"""
Returns a list of Financial Connections Account objects.
"""
result = await cls._static_request_async(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):
raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)
return result
@classmethod
def _cls_list_owners(
cls, account: str, **params: Unpack["AccountListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
return cast(
ListObject["AccountOwner"],
cls._static_request(
"get",
"/v1/financial_connections/accounts/{account}/owners".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
def list_owners(
account: str, **params: Unpack["AccountListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
...
@overload
def list_owners(
self, **params: Unpack["AccountListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
...
@class_method_variant("_cls_list_owners")
def list_owners( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["AccountListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
return cast(
ListObject["AccountOwner"],
self._request(
"get",
"/v1/financial_connections/accounts/{account}/owners".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
async def _cls_list_owners_async(
cls, account: str, **params: Unpack["AccountListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
return cast(
ListObject["AccountOwner"],
await cls._static_request_async(
"get",
"/v1/financial_connections/accounts/{account}/owners".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
async def list_owners_async(
account: str, **params: Unpack["AccountListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
...
@overload
async def list_owners_async(
self, **params: Unpack["AccountListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
...
@class_method_variant("_cls_list_owners_async")
async def list_owners_async( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["AccountListOwnersParams"]
) -> ListObject["AccountOwner"]:
"""
Lists all owners for a given Account
"""
return cast(
ListObject["AccountOwner"],
await self._request_async(
"get",
"/v1/financial_connections/accounts/{account}/owners".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
def _cls_refresh_account(
cls, account: str, **params: Unpack["AccountRefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
return cast(
"Account",
cls._static_request(
"post",
"/v1/financial_connections/accounts/{account}/refresh".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
def refresh_account(
account: str, **params: Unpack["AccountRefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
...
@overload
def refresh_account(
self, **params: Unpack["AccountRefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
...
@class_method_variant("_cls_refresh_account")
def refresh_account( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["AccountRefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
return cast(
"Account",
self._request(
"post",
"/v1/financial_connections/accounts/{account}/refresh".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
async def _cls_refresh_account_async(
cls, account: str, **params: Unpack["AccountRefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
return cast(
"Account",
await cls._static_request_async(
"post",
"/v1/financial_connections/accounts/{account}/refresh".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
async def refresh_account_async(
account: str, **params: Unpack["AccountRefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
...
@overload
async def refresh_account_async(
self, **params: Unpack["AccountRefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
...
@class_method_variant("_cls_refresh_account_async")
async def refresh_account_async( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["AccountRefreshAccountParams"]
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
return cast(
"Account",
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/refresh".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
def retrieve(
cls, id: str, **params: Unpack["AccountRetrieveParams"]
) -> "Account":
"""
Retrieves the details of an Financial Connections Account.
"""
instance = cls(id, **params)
instance.refresh()
return instance
@classmethod
async def retrieve_async(
cls, id: str, **params: Unpack["AccountRetrieveParams"]
) -> "Account":
"""
Retrieves the details of an Financial Connections Account.
"""
instance = cls(id, **params)
await instance.refresh_async()
return instance
@classmethod
def _cls_subscribe(
cls, account: str, **params: Unpack["AccountSubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account. When the account status is active, data is typically refreshed once a day.
"""
return cast(
"Account",
cls._static_request(
"post",
"/v1/financial_connections/accounts/{account}/subscribe".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
def subscribe(
account: str, **params: Unpack["AccountSubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account. When the account status is active, data is typically refreshed once a day.
"""
...
@overload
def subscribe(
self, **params: Unpack["AccountSubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account. When the account status is active, data is typically refreshed once a day.
"""
...
@class_method_variant("_cls_subscribe")
def subscribe( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["AccountSubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account. When the account status is active, data is typically refreshed once a day.
"""
return cast(
"Account",
self._request(
"post",
"/v1/financial_connections/accounts/{account}/subscribe".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
async def _cls_subscribe_async(
cls, account: str, **params: Unpack["AccountSubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account. When the account status is active, data is typically refreshed once a day.
"""
return cast(
"Account",
await cls._static_request_async(
"post",
"/v1/financial_connections/accounts/{account}/subscribe".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
async def subscribe_async(
account: str, **params: Unpack["AccountSubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account. When the account status is active, data is typically refreshed once a day.
"""
...
@overload
async def subscribe_async(
self, **params: Unpack["AccountSubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account. When the account status is active, data is typically refreshed once a day.
"""
...
@class_method_variant("_cls_subscribe_async")
async def subscribe_async( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["AccountSubscribeParams"]
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account. When the account status is active, data is typically refreshed once a day.
"""
return cast(
"Account",
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/subscribe".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
def _cls_unsubscribe(
cls, account: str, **params: Unpack["AccountUnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
cls._static_request(
"post",
"/v1/financial_connections/accounts/{account}/unsubscribe".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
def unsubscribe(
account: str, **params: Unpack["AccountUnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
...
@overload
def unsubscribe(
self, **params: Unpack["AccountUnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
...
@class_method_variant("_cls_unsubscribe")
def unsubscribe( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["AccountUnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
self._request(
"post",
"/v1/financial_connections/accounts/{account}/unsubscribe".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
async def _cls_unsubscribe_async(
cls, account: str, **params: Unpack["AccountUnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
await cls._static_request_async(
"post",
"/v1/financial_connections/accounts/{account}/unsubscribe".format(
account=sanitize_id(account)
),
params=params,
),
)
@overload
@staticmethod
async def unsubscribe_async(
account: str, **params: Unpack["AccountUnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
...
@overload
async def unsubscribe_async(
self, **params: Unpack["AccountUnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
...
@class_method_variant("_cls_unsubscribe_async")
async def unsubscribe_async( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["AccountUnsubscribeParams"]
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/unsubscribe".format(
account=sanitize_id(self.get("id"))
),
params=params,
),
)
_inner_class_types = {
"account_holder": AccountHolder,
"balance": Balance,
"balance_refresh": BalanceRefresh,
"ownership_refresh": OwnershipRefresh,
"transaction_refresh": TransactionRefresh,
}

View File

@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_object import StripeObject
from typing import ClassVar, Optional
from typing_extensions import Literal
class AccountOwner(StripeObject):
"""
Describes an owner of an account.
"""
OBJECT_NAME: ClassVar[Literal["financial_connections.account_owner"]] = (
"financial_connections.account_owner"
)
email: Optional[str]
"""
The email address of the owner.
"""
id: str
"""
Unique identifier for the object.
"""
name: str
"""
The full name of the owner.
"""
object: Literal["financial_connections.account_owner"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
ownership: str
"""
The ownership object that this owner belongs to.
"""
phone: Optional[str]
"""
The raw phone number of the owner.
"""
raw_address: Optional[str]
"""
The raw physical address of the owner.
"""
refreshed_at: Optional[int]
"""
The timestamp of the refresh that updated this owner.
"""

View File

@@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from stripe._util import sanitize_id
from typing import Optional, cast
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe._list_object import ListObject
from stripe._request_options import RequestOptions
from stripe.financial_connections._account_owner import AccountOwner
from stripe.params.financial_connections._account_owner_list_params import (
AccountOwnerListParams,
)
class AccountOwnerService(StripeService):
def list(
self,
account: str,
params: "AccountOwnerListParams",
options: Optional["RequestOptions"] = None,
) -> "ListObject[AccountOwner]":
"""
Lists all owners for a given Account
"""
return cast(
"ListObject[AccountOwner]",
self._request(
"get",
"/v1/financial_connections/accounts/{account}/owners".format(
account=sanitize_id(account),
),
base_address="api",
params=params,
options=options,
),
)
async def list_async(
self,
account: str,
params: "AccountOwnerListParams",
options: Optional["RequestOptions"] = None,
) -> "ListObject[AccountOwner]":
"""
Lists all owners for a given Account
"""
return cast(
"ListObject[AccountOwner]",
await self._request_async(
"get",
"/v1/financial_connections/accounts/{account}/owners".format(
account=sanitize_id(account),
),
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._list_object import ListObject
from stripe._stripe_object import StripeObject
from typing import ClassVar
from typing_extensions import Literal, TYPE_CHECKING
if TYPE_CHECKING:
from stripe.financial_connections._account_owner import AccountOwner
class AccountOwnership(StripeObject):
"""
Describes a snapshot of the owners of an account at a particular point in time.
"""
OBJECT_NAME: ClassVar[
Literal["financial_connections.account_ownership"]
] = "financial_connections.account_ownership"
created: int
"""
Time at which the object was created. Measured in seconds since the Unix epoch.
"""
id: str
"""
Unique identifier for the object.
"""
object: Literal["financial_connections.account_ownership"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
owners: ListObject["AccountOwner"]
"""
A paginated list of owners for this account.
"""

View File

@@ -0,0 +1,321 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from stripe._util import sanitize_id
from typing import Optional, cast
from importlib import import_module
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe._list_object import ListObject
from stripe._request_options import RequestOptions
from stripe.financial_connections._account import Account
from stripe.financial_connections._account_owner_service import (
AccountOwnerService,
)
from stripe.params.financial_connections._account_disconnect_params import (
AccountDisconnectParams,
)
from stripe.params.financial_connections._account_list_params import (
AccountListParams,
)
from stripe.params.financial_connections._account_refresh_params import (
AccountRefreshParams,
)
from stripe.params.financial_connections._account_retrieve_params import (
AccountRetrieveParams,
)
from stripe.params.financial_connections._account_subscribe_params import (
AccountSubscribeParams,
)
from stripe.params.financial_connections._account_unsubscribe_params import (
AccountUnsubscribeParams,
)
_subservices = {
"owners": [
"stripe.financial_connections._account_owner_service",
"AccountOwnerService",
],
}
class AccountService(StripeService):
owners: "AccountOwnerService"
def __init__(self, requestor):
super().__init__(requestor)
def __getattr__(self, name):
try:
import_from, service = _subservices[name]
service_class = getattr(
import_module(import_from),
service,
)
setattr(
self,
name,
service_class(self._requestor),
)
return getattr(self, name)
except KeyError:
raise AttributeError()
def list(
self,
params: Optional["AccountListParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "ListObject[Account]":
"""
Returns a list of Financial Connections Account objects.
"""
return cast(
"ListObject[Account]",
self._request(
"get",
"/v1/financial_connections/accounts",
base_address="api",
params=params,
options=options,
),
)
async def list_async(
self,
params: Optional["AccountListParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "ListObject[Account]":
"""
Returns a list of Financial Connections Account objects.
"""
return cast(
"ListObject[Account]",
await self._request_async(
"get",
"/v1/financial_connections/accounts",
base_address="api",
params=params,
options=options,
),
)
def retrieve(
self,
account: str,
params: Optional["AccountRetrieveParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Account":
"""
Retrieves the details of an Financial Connections Account.
"""
return cast(
"Account",
self._request(
"get",
"/v1/financial_connections/accounts/{account}".format(
account=sanitize_id(account),
),
base_address="api",
params=params,
options=options,
),
)
async def retrieve_async(
self,
account: str,
params: Optional["AccountRetrieveParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Account":
"""
Retrieves the details of an Financial Connections Account.
"""
return cast(
"Account",
await self._request_async(
"get",
"/v1/financial_connections/accounts/{account}".format(
account=sanitize_id(account),
),
base_address="api",
params=params,
options=options,
),
)
def disconnect(
self,
account: str,
params: Optional["AccountDisconnectParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
return cast(
"Account",
self._request(
"post",
"/v1/financial_connections/accounts/{account}/disconnect".format(
account=sanitize_id(account),
),
base_address="api",
params=params,
options=options,
),
)
async def disconnect_async(
self,
account: str,
params: Optional["AccountDisconnectParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Account":
"""
Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
"""
return cast(
"Account",
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/disconnect".format(
account=sanitize_id(account),
),
base_address="api",
params=params,
options=options,
),
)
def refresh(
self,
account: str,
params: "AccountRefreshParams",
options: Optional["RequestOptions"] = None,
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
return cast(
"Account",
self._request(
"post",
"/v1/financial_connections/accounts/{account}/refresh".format(
account=sanitize_id(account),
),
base_address="api",
params=params,
options=options,
),
)
async def refresh_async(
self,
account: str,
params: "AccountRefreshParams",
options: Optional["RequestOptions"] = None,
) -> "Account":
"""
Refreshes the data associated with a Financial Connections Account.
"""
return cast(
"Account",
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/refresh".format(
account=sanitize_id(account),
),
base_address="api",
params=params,
options=options,
),
)
def subscribe(
self,
account: str,
params: "AccountSubscribeParams",
options: Optional["RequestOptions"] = None,
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account. When the account status is active, data is typically refreshed once a day.
"""
return cast(
"Account",
self._request(
"post",
"/v1/financial_connections/accounts/{account}/subscribe".format(
account=sanitize_id(account),
),
base_address="api",
params=params,
options=options,
),
)
async def subscribe_async(
self,
account: str,
params: "AccountSubscribeParams",
options: Optional["RequestOptions"] = None,
) -> "Account":
"""
Subscribes to periodic refreshes of data associated with a Financial Connections Account. When the account status is active, data is typically refreshed once a day.
"""
return cast(
"Account",
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/subscribe".format(
account=sanitize_id(account),
),
base_address="api",
params=params,
options=options,
),
)
def unsubscribe(
self,
account: str,
params: "AccountUnsubscribeParams",
options: Optional["RequestOptions"] = None,
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
self._request(
"post",
"/v1/financial_connections/accounts/{account}/unsubscribe".format(
account=sanitize_id(account),
),
base_address="api",
params=params,
options=options,
),
)
async def unsubscribe_async(
self,
account: str,
params: "AccountUnsubscribeParams",
options: Optional["RequestOptions"] = None,
) -> "Account":
"""
Unsubscribes from periodic refreshes of data associated with a Financial Connections Account.
"""
return cast(
"Account",
await self._request_async(
"post",
"/v1/financial_connections/accounts/{account}/unsubscribe".format(
account=sanitize_id(account),
),
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,159 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._createable_api_resource import CreateableAPIResource
from stripe._expandable_field import ExpandableField
from stripe._list_object import ListObject
from stripe._stripe_object import StripeObject
from typing import ClassVar, List, Optional, cast
from typing_extensions import Literal, Unpack, TYPE_CHECKING
if TYPE_CHECKING:
from stripe._account import Account as AccountResource
from stripe._customer import Customer
from stripe.financial_connections._account import (
Account as FinancialConnectionsAccountResource,
)
from stripe.params.financial_connections._session_create_params import (
SessionCreateParams,
)
from stripe.params.financial_connections._session_retrieve_params import (
SessionRetrieveParams,
)
class Session(CreateableAPIResource["Session"]):
"""
A Financial Connections Session is the secure way to programmatically launch the client-side Stripe.js modal that lets your users link their accounts.
"""
OBJECT_NAME: ClassVar[Literal["financial_connections.session"]] = (
"financial_connections.session"
)
class AccountHolder(StripeObject):
account: Optional[ExpandableField["AccountResource"]]
"""
The ID of the Stripe account this account belongs to. Should only be present if `account_holder.type` is `account`.
"""
customer: Optional[ExpandableField["Customer"]]
"""
ID of the Stripe customer this account belongs to. Present if and only if `account_holder.type` is `customer`.
"""
type: Literal["account", "customer"]
"""
Type of account holder that this account belongs to.
"""
class Filters(StripeObject):
account_subcategories: Optional[
List[
Literal[
"checking",
"credit_card",
"line_of_credit",
"mortgage",
"savings",
]
]
]
"""
Restricts the Session to subcategories of accounts that can be linked. Valid subcategories are: `checking`, `savings`, `mortgage`, `line_of_credit`, `credit_card`.
"""
countries: Optional[List[str]]
"""
List of countries from which to filter accounts.
"""
account_holder: Optional[AccountHolder]
"""
The account holder for whom accounts are collected in this session.
"""
accounts: ListObject["FinancialConnectionsAccountResource"]
"""
The accounts that were collected as part of this Session.
"""
client_secret: str
"""
A value that will be passed to the client to launch the authentication flow.
"""
filters: Optional[Filters]
id: str
"""
Unique identifier for the object.
"""
livemode: bool
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""
object: Literal["financial_connections.session"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
permissions: List[
Literal["balances", "ownership", "payment_method", "transactions"]
]
"""
Permissions requested for accounts collected during this session.
"""
prefetch: Optional[List[Literal["balances", "ownership", "transactions"]]]
"""
Data features requested to be retrieved upon account creation.
"""
return_url: Optional[str]
"""
For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
"""
@classmethod
def create(cls, **params: Unpack["SessionCreateParams"]) -> "Session":
"""
To launch the Financial Connections authorization flow, create a Session. The session's client_secret can be used to launch the flow using Stripe.js.
"""
return cast(
"Session",
cls._static_request(
"post",
cls.class_url(),
params=params,
),
)
@classmethod
async def create_async(
cls, **params: Unpack["SessionCreateParams"]
) -> "Session":
"""
To launch the Financial Connections authorization flow, create a Session. The session's client_secret can be used to launch the flow using Stripe.js.
"""
return cast(
"Session",
await cls._static_request_async(
"post",
cls.class_url(),
params=params,
),
)
@classmethod
def retrieve(
cls, id: str, **params: Unpack["SessionRetrieveParams"]
) -> "Session":
"""
Retrieves the details of a Financial Connections Session
"""
instance = cls(id, **params)
instance.refresh()
return instance
@classmethod
async def retrieve_async(
cls, id: str, **params: Unpack["SessionRetrieveParams"]
) -> "Session":
"""
Retrieves the details of a Financial Connections Session
"""
instance = cls(id, **params)
await instance.refresh_async()
return instance
_inner_class_types = {"account_holder": AccountHolder, "filters": Filters}

View File

@@ -0,0 +1,100 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from stripe._util import sanitize_id
from typing import Optional, cast
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe._request_options import RequestOptions
from stripe.financial_connections._session import Session
from stripe.params.financial_connections._session_create_params import (
SessionCreateParams,
)
from stripe.params.financial_connections._session_retrieve_params import (
SessionRetrieveParams,
)
class SessionService(StripeService):
def retrieve(
self,
session: str,
params: Optional["SessionRetrieveParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Session":
"""
Retrieves the details of a Financial Connections Session
"""
return cast(
"Session",
self._request(
"get",
"/v1/financial_connections/sessions/{session}".format(
session=sanitize_id(session),
),
base_address="api",
params=params,
options=options,
),
)
async def retrieve_async(
self,
session: str,
params: Optional["SessionRetrieveParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Session":
"""
Retrieves the details of a Financial Connections Session
"""
return cast(
"Session",
await self._request_async(
"get",
"/v1/financial_connections/sessions/{session}".format(
session=sanitize_id(session),
),
base_address="api",
params=params,
options=options,
),
)
def create(
self,
params: "SessionCreateParams",
options: Optional["RequestOptions"] = None,
) -> "Session":
"""
To launch the Financial Connections authorization flow, create a Session. The session's client_secret can be used to launch the flow using Stripe.js.
"""
return cast(
"Session",
self._request(
"post",
"/v1/financial_connections/sessions",
base_address="api",
params=params,
options=options,
),
)
async def create_async(
self,
params: "SessionCreateParams",
options: Optional["RequestOptions"] = None,
) -> "Session":
"""
To launch the Financial Connections authorization flow, create a Session. The session's client_secret can be used to launch the flow using Stripe.js.
"""
return cast(
"Session",
await self._request_async(
"post",
"/v1/financial_connections/sessions",
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,145 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._list_object import ListObject
from stripe._listable_api_resource import ListableAPIResource
from stripe._stripe_object import StripeObject
from typing import ClassVar, Optional
from typing_extensions import Literal, Unpack, TYPE_CHECKING
if TYPE_CHECKING:
from stripe.params.financial_connections._transaction_list_params import (
TransactionListParams,
)
from stripe.params.financial_connections._transaction_retrieve_params import (
TransactionRetrieveParams,
)
class Transaction(ListableAPIResource["Transaction"]):
"""
A Transaction represents a real transaction that affects a Financial Connections Account balance.
"""
OBJECT_NAME: ClassVar[Literal["financial_connections.transaction"]] = (
"financial_connections.transaction"
)
class StatusTransitions(StripeObject):
posted_at: Optional[int]
"""
Time at which this transaction posted. Measured in seconds since the Unix epoch.
"""
void_at: Optional[int]
"""
Time at which this transaction was voided. Measured in seconds since the Unix epoch.
"""
account: str
"""
The ID of the Financial Connections Account this transaction belongs to.
"""
amount: int
"""
The amount of this transaction, in cents (or local equivalent).
"""
currency: str
"""
Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
"""
description: str
"""
The description of this transaction.
"""
id: str
"""
Unique identifier for the object.
"""
livemode: bool
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""
object: Literal["financial_connections.transaction"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
status: Literal["pending", "posted", "void"]
"""
The status of the transaction.
"""
status_transitions: StatusTransitions
transacted_at: int
"""
Time at which the transaction was transacted. Measured in seconds since the Unix epoch.
"""
transaction_refresh: str
"""
The token of the transaction refresh that last updated or created this transaction.
"""
updated: int
"""
Time at which the object was last updated. Measured in seconds since the Unix epoch.
"""
@classmethod
def list(
cls, **params: Unpack["TransactionListParams"]
) -> ListObject["Transaction"]:
"""
Returns a list of Financial Connections Transaction objects.
"""
result = cls._static_request(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):
raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)
return result
@classmethod
async def list_async(
cls, **params: Unpack["TransactionListParams"]
) -> ListObject["Transaction"]:
"""
Returns a list of Financial Connections Transaction objects.
"""
result = await cls._static_request_async(
"get",
cls.class_url(),
params=params,
)
if not isinstance(result, ListObject):
raise TypeError(
"Expected list object from API, got %s"
% (type(result).__name__)
)
return result
@classmethod
def retrieve(
cls, id: str, **params: Unpack["TransactionRetrieveParams"]
) -> "Transaction":
"""
Retrieves the details of a Financial Connections Transaction
"""
instance = cls(id, **params)
instance.refresh()
return instance
@classmethod
async def retrieve_async(
cls, id: str, **params: Unpack["TransactionRetrieveParams"]
) -> "Transaction":
"""
Retrieves the details of a Financial Connections Transaction
"""
instance = cls(id, **params)
await instance.refresh_async()
return instance
_inner_class_types = {"status_transitions": StatusTransitions}

View File

@@ -0,0 +1,101 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from stripe._util import sanitize_id
from typing import Optional, cast
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe._list_object import ListObject
from stripe._request_options import RequestOptions
from stripe.financial_connections._transaction import Transaction
from stripe.params.financial_connections._transaction_list_params import (
TransactionListParams,
)
from stripe.params.financial_connections._transaction_retrieve_params import (
TransactionRetrieveParams,
)
class TransactionService(StripeService):
def list(
self,
params: "TransactionListParams",
options: Optional["RequestOptions"] = None,
) -> "ListObject[Transaction]":
"""
Returns a list of Financial Connections Transaction objects.
"""
return cast(
"ListObject[Transaction]",
self._request(
"get",
"/v1/financial_connections/transactions",
base_address="api",
params=params,
options=options,
),
)
async def list_async(
self,
params: "TransactionListParams",
options: Optional["RequestOptions"] = None,
) -> "ListObject[Transaction]":
"""
Returns a list of Financial Connections Transaction objects.
"""
return cast(
"ListObject[Transaction]",
await self._request_async(
"get",
"/v1/financial_connections/transactions",
base_address="api",
params=params,
options=options,
),
)
def retrieve(
self,
transaction: str,
params: Optional["TransactionRetrieveParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Transaction":
"""
Retrieves the details of a Financial Connections Transaction
"""
return cast(
"Transaction",
self._request(
"get",
"/v1/financial_connections/transactions/{transaction}".format(
transaction=sanitize_id(transaction),
),
base_address="api",
params=params,
options=options,
),
)
async def retrieve_async(
self,
transaction: str,
params: Optional["TransactionRetrieveParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Transaction":
"""
Retrieves the details of a Financial Connections Transaction
"""
return cast(
"Transaction",
await self._request_async(
"get",
"/v1/financial_connections/transactions/{transaction}".format(
transaction=sanitize_id(transaction),
),
base_address="api",
params=params,
options=options,
),
)