updates
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
# -*- 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.treasury._credit_reversal import (
|
||||
CreditReversal as CreditReversal,
|
||||
)
|
||||
from stripe.treasury._credit_reversal_service import (
|
||||
CreditReversalService as CreditReversalService,
|
||||
)
|
||||
from stripe.treasury._debit_reversal import DebitReversal as DebitReversal
|
||||
from stripe.treasury._debit_reversal_service import (
|
||||
DebitReversalService as DebitReversalService,
|
||||
)
|
||||
from stripe.treasury._financial_account import (
|
||||
FinancialAccount as FinancialAccount,
|
||||
)
|
||||
from stripe.treasury._financial_account_features import (
|
||||
FinancialAccountFeatures as FinancialAccountFeatures,
|
||||
)
|
||||
from stripe.treasury._financial_account_features_service import (
|
||||
FinancialAccountFeaturesService as FinancialAccountFeaturesService,
|
||||
)
|
||||
from stripe.treasury._financial_account_service import (
|
||||
FinancialAccountService as FinancialAccountService,
|
||||
)
|
||||
from stripe.treasury._inbound_transfer import (
|
||||
InboundTransfer as InboundTransfer,
|
||||
)
|
||||
from stripe.treasury._inbound_transfer_service import (
|
||||
InboundTransferService as InboundTransferService,
|
||||
)
|
||||
from stripe.treasury._outbound_payment import (
|
||||
OutboundPayment as OutboundPayment,
|
||||
)
|
||||
from stripe.treasury._outbound_payment_service import (
|
||||
OutboundPaymentService as OutboundPaymentService,
|
||||
)
|
||||
from stripe.treasury._outbound_transfer import (
|
||||
OutboundTransfer as OutboundTransfer,
|
||||
)
|
||||
from stripe.treasury._outbound_transfer_service import (
|
||||
OutboundTransferService as OutboundTransferService,
|
||||
)
|
||||
from stripe.treasury._received_credit import (
|
||||
ReceivedCredit as ReceivedCredit,
|
||||
)
|
||||
from stripe.treasury._received_credit_service import (
|
||||
ReceivedCreditService as ReceivedCreditService,
|
||||
)
|
||||
from stripe.treasury._received_debit import ReceivedDebit as ReceivedDebit
|
||||
from stripe.treasury._received_debit_service import (
|
||||
ReceivedDebitService as ReceivedDebitService,
|
||||
)
|
||||
from stripe.treasury._transaction import Transaction as Transaction
|
||||
from stripe.treasury._transaction_entry import (
|
||||
TransactionEntry as TransactionEntry,
|
||||
)
|
||||
from stripe.treasury._transaction_entry_service import (
|
||||
TransactionEntryService as TransactionEntryService,
|
||||
)
|
||||
from stripe.treasury._transaction_service import (
|
||||
TransactionService as TransactionService,
|
||||
)
|
||||
|
||||
# name -> (import_target, is_submodule)
|
||||
_import_map = {
|
||||
"CreditReversal": ("stripe.treasury._credit_reversal", False),
|
||||
"CreditReversalService": (
|
||||
"stripe.treasury._credit_reversal_service",
|
||||
False,
|
||||
),
|
||||
"DebitReversal": ("stripe.treasury._debit_reversal", False),
|
||||
"DebitReversalService": ("stripe.treasury._debit_reversal_service", False),
|
||||
"FinancialAccount": ("stripe.treasury._financial_account", False),
|
||||
"FinancialAccountFeatures": (
|
||||
"stripe.treasury._financial_account_features",
|
||||
False,
|
||||
),
|
||||
"FinancialAccountFeaturesService": (
|
||||
"stripe.treasury._financial_account_features_service",
|
||||
False,
|
||||
),
|
||||
"FinancialAccountService": (
|
||||
"stripe.treasury._financial_account_service",
|
||||
False,
|
||||
),
|
||||
"InboundTransfer": ("stripe.treasury._inbound_transfer", False),
|
||||
"InboundTransferService": (
|
||||
"stripe.treasury._inbound_transfer_service",
|
||||
False,
|
||||
),
|
||||
"OutboundPayment": ("stripe.treasury._outbound_payment", False),
|
||||
"OutboundPaymentService": (
|
||||
"stripe.treasury._outbound_payment_service",
|
||||
False,
|
||||
),
|
||||
"OutboundTransfer": ("stripe.treasury._outbound_transfer", False),
|
||||
"OutboundTransferService": (
|
||||
"stripe.treasury._outbound_transfer_service",
|
||||
False,
|
||||
),
|
||||
"ReceivedCredit": ("stripe.treasury._received_credit", False),
|
||||
"ReceivedCreditService": (
|
||||
"stripe.treasury._received_credit_service",
|
||||
False,
|
||||
),
|
||||
"ReceivedDebit": ("stripe.treasury._received_debit", False),
|
||||
"ReceivedDebitService": ("stripe.treasury._received_debit_service", False),
|
||||
"Transaction": ("stripe.treasury._transaction", False),
|
||||
"TransactionEntry": ("stripe.treasury._transaction_entry", False),
|
||||
"TransactionEntryService": (
|
||||
"stripe.treasury._transaction_entry_service",
|
||||
False,
|
||||
),
|
||||
"TransactionService": ("stripe.treasury._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()
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,190 @@
|
||||
# -*- 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._listable_api_resource import ListableAPIResource
|
||||
from stripe._stripe_object import StripeObject
|
||||
from typing import ClassVar, Dict, Optional, cast
|
||||
from typing_extensions import Literal, Unpack, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe.params.treasury._credit_reversal_create_params import (
|
||||
CreditReversalCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._credit_reversal_list_params import (
|
||||
CreditReversalListParams,
|
||||
)
|
||||
from stripe.params.treasury._credit_reversal_retrieve_params import (
|
||||
CreditReversalRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._transaction import Transaction
|
||||
|
||||
|
||||
class CreditReversal(
|
||||
CreateableAPIResource["CreditReversal"],
|
||||
ListableAPIResource["CreditReversal"],
|
||||
):
|
||||
"""
|
||||
You can reverse some [ReceivedCredits](https://stripe.com/docs/api#received_credits) depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a new object known as a CreditReversal.
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["treasury.credit_reversal"]] = (
|
||||
"treasury.credit_reversal"
|
||||
)
|
||||
|
||||
class StatusTransitions(StripeObject):
|
||||
posted_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when the CreditReversal changed status to `posted`
|
||||
"""
|
||||
|
||||
amount: int
|
||||
"""
|
||||
Amount (in cents) transferred.
|
||||
"""
|
||||
created: int
|
||||
"""
|
||||
Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
"""
|
||||
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).
|
||||
"""
|
||||
financial_account: str
|
||||
"""
|
||||
The FinancialAccount to reverse funds from.
|
||||
"""
|
||||
hosted_regulatory_receipt_url: Optional[str]
|
||||
"""
|
||||
A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
metadata: Dict[str, str]
|
||||
"""
|
||||
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
"""
|
||||
network: Literal["ach", "stripe"]
|
||||
"""
|
||||
The rails used to reverse the funds.
|
||||
"""
|
||||
object: Literal["treasury.credit_reversal"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
received_credit: str
|
||||
"""
|
||||
The ReceivedCredit being reversed.
|
||||
"""
|
||||
status: Literal["canceled", "posted", "processing"]
|
||||
"""
|
||||
Status of the CreditReversal
|
||||
"""
|
||||
status_transitions: StatusTransitions
|
||||
transaction: Optional[ExpandableField["Transaction"]]
|
||||
"""
|
||||
The Transaction associated with this object.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def create(
|
||||
cls, **params: Unpack["CreditReversalCreateParams"]
|
||||
) -> "CreditReversal":
|
||||
"""
|
||||
Reverses a ReceivedCredit and creates a CreditReversal object.
|
||||
"""
|
||||
return cast(
|
||||
"CreditReversal",
|
||||
cls._static_request(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def create_async(
|
||||
cls, **params: Unpack["CreditReversalCreateParams"]
|
||||
) -> "CreditReversal":
|
||||
"""
|
||||
Reverses a ReceivedCredit and creates a CreditReversal object.
|
||||
"""
|
||||
return cast(
|
||||
"CreditReversal",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def list(
|
||||
cls, **params: Unpack["CreditReversalListParams"]
|
||||
) -> ListObject["CreditReversal"]:
|
||||
"""
|
||||
Returns a list of CreditReversals.
|
||||
"""
|
||||
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["CreditReversalListParams"]
|
||||
) -> ListObject["CreditReversal"]:
|
||||
"""
|
||||
Returns a list of CreditReversals.
|
||||
"""
|
||||
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["CreditReversalRetrieveParams"]
|
||||
) -> "CreditReversal":
|
||||
"""
|
||||
Retrieves the details of an existing CreditReversal by passing the unique CreditReversal ID from either the CreditReversal creation request or CreditReversal list
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
instance.refresh()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
async def retrieve_async(
|
||||
cls, id: str, **params: Unpack["CreditReversalRetrieveParams"]
|
||||
) -> "CreditReversal":
|
||||
"""
|
||||
Retrieves the details of an existing CreditReversal by passing the unique CreditReversal ID from either the CreditReversal creation request or CreditReversal list
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
await instance.refresh_async()
|
||||
return instance
|
||||
|
||||
_inner_class_types = {"status_transitions": StatusTransitions}
|
||||
@@ -0,0 +1,142 @@
|
||||
# -*- 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.params.treasury._credit_reversal_create_params import (
|
||||
CreditReversalCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._credit_reversal_list_params import (
|
||||
CreditReversalListParams,
|
||||
)
|
||||
from stripe.params.treasury._credit_reversal_retrieve_params import (
|
||||
CreditReversalRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._credit_reversal import CreditReversal
|
||||
|
||||
|
||||
class CreditReversalService(StripeService):
|
||||
def list(
|
||||
self,
|
||||
params: "CreditReversalListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[CreditReversal]":
|
||||
"""
|
||||
Returns a list of CreditReversals.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[CreditReversal]",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/credit_reversals",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
params: "CreditReversalListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[CreditReversal]":
|
||||
"""
|
||||
Returns a list of CreditReversals.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[CreditReversal]",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/credit_reversals",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def create(
|
||||
self,
|
||||
params: "CreditReversalCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "CreditReversal":
|
||||
"""
|
||||
Reverses a ReceivedCredit and creates a CreditReversal object.
|
||||
"""
|
||||
return cast(
|
||||
"CreditReversal",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/credit_reversals",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
params: "CreditReversalCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "CreditReversal":
|
||||
"""
|
||||
Reverses a ReceivedCredit and creates a CreditReversal object.
|
||||
"""
|
||||
return cast(
|
||||
"CreditReversal",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/credit_reversals",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
credit_reversal: str,
|
||||
params: Optional["CreditReversalRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "CreditReversal":
|
||||
"""
|
||||
Retrieves the details of an existing CreditReversal by passing the unique CreditReversal ID from either the CreditReversal creation request or CreditReversal list
|
||||
"""
|
||||
return cast(
|
||||
"CreditReversal",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/credit_reversals/{credit_reversal}".format(
|
||||
credit_reversal=sanitize_id(credit_reversal),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
credit_reversal: str,
|
||||
params: Optional["CreditReversalRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "CreditReversal":
|
||||
"""
|
||||
Retrieves the details of an existing CreditReversal by passing the unique CreditReversal ID from either the CreditReversal creation request or CreditReversal list
|
||||
"""
|
||||
return cast(
|
||||
"CreditReversal",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/credit_reversals/{credit_reversal}".format(
|
||||
credit_reversal=sanitize_id(credit_reversal),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,203 @@
|
||||
# -*- 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._listable_api_resource import ListableAPIResource
|
||||
from stripe._stripe_object import StripeObject
|
||||
from typing import ClassVar, Dict, Optional, cast
|
||||
from typing_extensions import Literal, Unpack, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe.params.treasury._debit_reversal_create_params import (
|
||||
DebitReversalCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._debit_reversal_list_params import (
|
||||
DebitReversalListParams,
|
||||
)
|
||||
from stripe.params.treasury._debit_reversal_retrieve_params import (
|
||||
DebitReversalRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._transaction import Transaction
|
||||
|
||||
|
||||
class DebitReversal(
|
||||
CreateableAPIResource["DebitReversal"],
|
||||
ListableAPIResource["DebitReversal"],
|
||||
):
|
||||
"""
|
||||
You can reverse some [ReceivedDebits](https://stripe.com/docs/api#received_debits) depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal.
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["treasury.debit_reversal"]] = (
|
||||
"treasury.debit_reversal"
|
||||
)
|
||||
|
||||
class LinkedFlows(StripeObject):
|
||||
issuing_dispute: Optional[str]
|
||||
"""
|
||||
Set if there is an Issuing dispute associated with the DebitReversal.
|
||||
"""
|
||||
|
||||
class StatusTransitions(StripeObject):
|
||||
completed_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when the DebitReversal changed status to `completed`.
|
||||
"""
|
||||
|
||||
amount: int
|
||||
"""
|
||||
Amount (in cents) transferred.
|
||||
"""
|
||||
created: int
|
||||
"""
|
||||
Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
"""
|
||||
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).
|
||||
"""
|
||||
financial_account: Optional[str]
|
||||
"""
|
||||
The FinancialAccount to reverse funds from.
|
||||
"""
|
||||
hosted_regulatory_receipt_url: Optional[str]
|
||||
"""
|
||||
A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
|
||||
"""
|
||||
id: str
|
||||
"""
|
||||
Unique identifier for the object.
|
||||
"""
|
||||
linked_flows: Optional[LinkedFlows]
|
||||
"""
|
||||
Other flows linked to a DebitReversal.
|
||||
"""
|
||||
livemode: bool
|
||||
"""
|
||||
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
"""
|
||||
metadata: Dict[str, str]
|
||||
"""
|
||||
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
"""
|
||||
network: Literal["ach", "card"]
|
||||
"""
|
||||
The rails used to reverse the funds.
|
||||
"""
|
||||
object: Literal["treasury.debit_reversal"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
received_debit: str
|
||||
"""
|
||||
The ReceivedDebit being reversed.
|
||||
"""
|
||||
status: Literal["failed", "processing", "succeeded"]
|
||||
"""
|
||||
Status of the DebitReversal
|
||||
"""
|
||||
status_transitions: StatusTransitions
|
||||
transaction: Optional[ExpandableField["Transaction"]]
|
||||
"""
|
||||
The Transaction associated with this object.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def create(
|
||||
cls, **params: Unpack["DebitReversalCreateParams"]
|
||||
) -> "DebitReversal":
|
||||
"""
|
||||
Reverses a ReceivedDebit and creates a DebitReversal object.
|
||||
"""
|
||||
return cast(
|
||||
"DebitReversal",
|
||||
cls._static_request(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def create_async(
|
||||
cls, **params: Unpack["DebitReversalCreateParams"]
|
||||
) -> "DebitReversal":
|
||||
"""
|
||||
Reverses a ReceivedDebit and creates a DebitReversal object.
|
||||
"""
|
||||
return cast(
|
||||
"DebitReversal",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def list(
|
||||
cls, **params: Unpack["DebitReversalListParams"]
|
||||
) -> ListObject["DebitReversal"]:
|
||||
"""
|
||||
Returns a list of DebitReversals.
|
||||
"""
|
||||
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["DebitReversalListParams"]
|
||||
) -> ListObject["DebitReversal"]:
|
||||
"""
|
||||
Returns a list of DebitReversals.
|
||||
"""
|
||||
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["DebitReversalRetrieveParams"]
|
||||
) -> "DebitReversal":
|
||||
"""
|
||||
Retrieves a DebitReversal object.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
instance.refresh()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
async def retrieve_async(
|
||||
cls, id: str, **params: Unpack["DebitReversalRetrieveParams"]
|
||||
) -> "DebitReversal":
|
||||
"""
|
||||
Retrieves a DebitReversal object.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
await instance.refresh_async()
|
||||
return instance
|
||||
|
||||
_inner_class_types = {
|
||||
"linked_flows": LinkedFlows,
|
||||
"status_transitions": StatusTransitions,
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
# -*- 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.params.treasury._debit_reversal_create_params import (
|
||||
DebitReversalCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._debit_reversal_list_params import (
|
||||
DebitReversalListParams,
|
||||
)
|
||||
from stripe.params.treasury._debit_reversal_retrieve_params import (
|
||||
DebitReversalRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._debit_reversal import DebitReversal
|
||||
|
||||
|
||||
class DebitReversalService(StripeService):
|
||||
def list(
|
||||
self,
|
||||
params: "DebitReversalListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[DebitReversal]":
|
||||
"""
|
||||
Returns a list of DebitReversals.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[DebitReversal]",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/debit_reversals",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
params: "DebitReversalListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[DebitReversal]":
|
||||
"""
|
||||
Returns a list of DebitReversals.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[DebitReversal]",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/debit_reversals",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def create(
|
||||
self,
|
||||
params: "DebitReversalCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "DebitReversal":
|
||||
"""
|
||||
Reverses a ReceivedDebit and creates a DebitReversal object.
|
||||
"""
|
||||
return cast(
|
||||
"DebitReversal",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/debit_reversals",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
params: "DebitReversalCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "DebitReversal":
|
||||
"""
|
||||
Reverses a ReceivedDebit and creates a DebitReversal object.
|
||||
"""
|
||||
return cast(
|
||||
"DebitReversal",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/debit_reversals",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
debit_reversal: str,
|
||||
params: Optional["DebitReversalRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "DebitReversal":
|
||||
"""
|
||||
Retrieves a DebitReversal object.
|
||||
"""
|
||||
return cast(
|
||||
"DebitReversal",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/debit_reversals/{debit_reversal}".format(
|
||||
debit_reversal=sanitize_id(debit_reversal),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
debit_reversal: str,
|
||||
params: Optional["DebitReversalRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "DebitReversal":
|
||||
"""
|
||||
Retrieves a DebitReversal object.
|
||||
"""
|
||||
return cast(
|
||||
"DebitReversal",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/debit_reversals/{debit_reversal}".format(
|
||||
debit_reversal=sanitize_id(debit_reversal),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,724 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# File generated from our OpenAPI spec
|
||||
from stripe._createable_api_resource import CreateableAPIResource
|
||||
from stripe._list_object import ListObject
|
||||
from stripe._listable_api_resource import ListableAPIResource
|
||||
from stripe._stripe_object import StripeObject
|
||||
from stripe._updateable_api_resource import UpdateableAPIResource
|
||||
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.params.treasury._financial_account_close_params import (
|
||||
FinancialAccountCloseParams,
|
||||
)
|
||||
from stripe.params.treasury._financial_account_create_params import (
|
||||
FinancialAccountCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._financial_account_list_params import (
|
||||
FinancialAccountListParams,
|
||||
)
|
||||
from stripe.params.treasury._financial_account_modify_params import (
|
||||
FinancialAccountModifyParams,
|
||||
)
|
||||
from stripe.params.treasury._financial_account_retrieve_features_params import (
|
||||
FinancialAccountRetrieveFeaturesParams,
|
||||
)
|
||||
from stripe.params.treasury._financial_account_retrieve_params import (
|
||||
FinancialAccountRetrieveParams,
|
||||
)
|
||||
from stripe.params.treasury._financial_account_update_features_params import (
|
||||
FinancialAccountUpdateFeaturesParams,
|
||||
)
|
||||
from stripe.treasury._financial_account_features import (
|
||||
FinancialAccountFeatures,
|
||||
)
|
||||
|
||||
|
||||
class FinancialAccount(
|
||||
CreateableAPIResource["FinancialAccount"],
|
||||
ListableAPIResource["FinancialAccount"],
|
||||
UpdateableAPIResource["FinancialAccount"],
|
||||
):
|
||||
"""
|
||||
Stripe Treasury provides users with a container for money called a FinancialAccount that is separate from their Payments balance.
|
||||
FinancialAccounts serve as the source and destination of Treasury's money movement APIs.
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["treasury.financial_account"]] = (
|
||||
"treasury.financial_account"
|
||||
)
|
||||
|
||||
class Balance(StripeObject):
|
||||
cash: Dict[str, int]
|
||||
"""
|
||||
Funds the user can spend right now.
|
||||
"""
|
||||
inbound_pending: Dict[str, int]
|
||||
"""
|
||||
Funds not spendable yet, but will become available at a later time.
|
||||
"""
|
||||
outbound_pending: Dict[str, int]
|
||||
"""
|
||||
Funds in the account, but not spendable because they are being held for pending outbound flows.
|
||||
"""
|
||||
|
||||
class FinancialAddress(StripeObject):
|
||||
class Aba(StripeObject):
|
||||
account_holder_name: str
|
||||
"""
|
||||
The name of the person or business that owns the bank account.
|
||||
"""
|
||||
account_number: Optional[str]
|
||||
"""
|
||||
The account number.
|
||||
"""
|
||||
account_number_last4: str
|
||||
"""
|
||||
The last four characters of the account number.
|
||||
"""
|
||||
bank_name: str
|
||||
"""
|
||||
Name of the bank.
|
||||
"""
|
||||
routing_number: str
|
||||
"""
|
||||
Routing number for the account.
|
||||
"""
|
||||
|
||||
aba: Optional[Aba]
|
||||
"""
|
||||
ABA Records contain U.S. bank account details per the ABA format.
|
||||
"""
|
||||
supported_networks: Optional[List[Literal["ach", "us_domestic_wire"]]]
|
||||
"""
|
||||
The list of networks that the address supports
|
||||
"""
|
||||
type: Literal["aba"]
|
||||
"""
|
||||
The type of financial address
|
||||
"""
|
||||
_inner_class_types = {"aba": Aba}
|
||||
|
||||
class PlatformRestrictions(StripeObject):
|
||||
inbound_flows: Optional[Literal["restricted", "unrestricted"]]
|
||||
"""
|
||||
Restricts all inbound money movement.
|
||||
"""
|
||||
outbound_flows: Optional[Literal["restricted", "unrestricted"]]
|
||||
"""
|
||||
Restricts all outbound money movement.
|
||||
"""
|
||||
|
||||
class StatusDetails(StripeObject):
|
||||
class Closed(StripeObject):
|
||||
reasons: List[
|
||||
Literal["account_rejected", "closed_by_platform", "other"]
|
||||
]
|
||||
"""
|
||||
The array that contains reasons for a FinancialAccount closure.
|
||||
"""
|
||||
|
||||
closed: Optional[Closed]
|
||||
"""
|
||||
Details related to the closure of this FinancialAccount
|
||||
"""
|
||||
_inner_class_types = {"closed": Closed}
|
||||
|
||||
active_features: Optional[
|
||||
List[
|
||||
Literal[
|
||||
"card_issuing",
|
||||
"deposit_insurance",
|
||||
"financial_addresses.aba",
|
||||
"financial_addresses.aba.forwarding",
|
||||
"inbound_transfers.ach",
|
||||
"intra_stripe_flows",
|
||||
"outbound_payments.ach",
|
||||
"outbound_payments.us_domestic_wire",
|
||||
"outbound_transfers.ach",
|
||||
"outbound_transfers.us_domestic_wire",
|
||||
"remote_deposit_capture",
|
||||
]
|
||||
]
|
||||
]
|
||||
"""
|
||||
The array of paths to active Features in the Features hash.
|
||||
"""
|
||||
balance: Balance
|
||||
"""
|
||||
Balance information for the FinancialAccount
|
||||
"""
|
||||
country: str
|
||||
"""
|
||||
Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
|
||||
"""
|
||||
created: int
|
||||
"""
|
||||
Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
"""
|
||||
features: Optional["FinancialAccountFeatures"]
|
||||
"""
|
||||
Encodes whether a FinancialAccount has access to a particular Feature, with a `status` enum and associated `status_details`.
|
||||
Stripe or the platform can control Features via the requested field.
|
||||
"""
|
||||
financial_addresses: List[FinancialAddress]
|
||||
"""
|
||||
The set of credentials that resolve to a FinancialAccount.
|
||||
"""
|
||||
id: str
|
||||
"""
|
||||
Unique identifier for the object.
|
||||
"""
|
||||
is_default: Optional[bool]
|
||||
livemode: bool
|
||||
"""
|
||||
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
"""
|
||||
metadata: Optional[Dict[str, str]]
|
||||
"""
|
||||
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
"""
|
||||
nickname: Optional[str]
|
||||
"""
|
||||
The nickname for the FinancialAccount.
|
||||
"""
|
||||
object: Literal["treasury.financial_account"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
pending_features: Optional[
|
||||
List[
|
||||
Literal[
|
||||
"card_issuing",
|
||||
"deposit_insurance",
|
||||
"financial_addresses.aba",
|
||||
"financial_addresses.aba.forwarding",
|
||||
"inbound_transfers.ach",
|
||||
"intra_stripe_flows",
|
||||
"outbound_payments.ach",
|
||||
"outbound_payments.us_domestic_wire",
|
||||
"outbound_transfers.ach",
|
||||
"outbound_transfers.us_domestic_wire",
|
||||
"remote_deposit_capture",
|
||||
]
|
||||
]
|
||||
]
|
||||
"""
|
||||
The array of paths to pending Features in the Features hash.
|
||||
"""
|
||||
platform_restrictions: Optional[PlatformRestrictions]
|
||||
"""
|
||||
The set of functionalities that the platform can restrict on the FinancialAccount.
|
||||
"""
|
||||
restricted_features: Optional[
|
||||
List[
|
||||
Literal[
|
||||
"card_issuing",
|
||||
"deposit_insurance",
|
||||
"financial_addresses.aba",
|
||||
"financial_addresses.aba.forwarding",
|
||||
"inbound_transfers.ach",
|
||||
"intra_stripe_flows",
|
||||
"outbound_payments.ach",
|
||||
"outbound_payments.us_domestic_wire",
|
||||
"outbound_transfers.ach",
|
||||
"outbound_transfers.us_domestic_wire",
|
||||
"remote_deposit_capture",
|
||||
]
|
||||
]
|
||||
]
|
||||
"""
|
||||
The array of paths to restricted Features in the Features hash.
|
||||
"""
|
||||
status: Literal["closed", "open"]
|
||||
"""
|
||||
Status of this FinancialAccount.
|
||||
"""
|
||||
status_details: StatusDetails
|
||||
supported_currencies: List[str]
|
||||
"""
|
||||
The currencies the FinancialAccount can hold a balance in. Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def _cls_close(
|
||||
cls,
|
||||
financial_account: str,
|
||||
**params: Unpack["FinancialAccountCloseParams"],
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/close".format(
|
||||
financial_account=sanitize_id(financial_account)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def close(
|
||||
financial_account: str, **params: Unpack["FinancialAccountCloseParams"]
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def close(
|
||||
self, **params: Unpack["FinancialAccountCloseParams"]
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_close")
|
||||
def close( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["FinancialAccountCloseParams"]
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/close".format(
|
||||
financial_account=sanitize_id(self.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_close_async(
|
||||
cls,
|
||||
financial_account: str,
|
||||
**params: Unpack["FinancialAccountCloseParams"],
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/close".format(
|
||||
financial_account=sanitize_id(financial_account)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def close_async(
|
||||
financial_account: str, **params: Unpack["FinancialAccountCloseParams"]
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def close_async(
|
||||
self, **params: Unpack["FinancialAccountCloseParams"]
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_close_async")
|
||||
async def close_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["FinancialAccountCloseParams"]
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/close".format(
|
||||
financial_account=sanitize_id(self.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def create(
|
||||
cls, **params: Unpack["FinancialAccountCreateParams"]
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Creates a new FinancialAccount. Each connected account can have up to three FinancialAccounts by default.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
cls._static_request(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def create_async(
|
||||
cls, **params: Unpack["FinancialAccountCreateParams"]
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Creates a new FinancialAccount. Each connected account can have up to three FinancialAccounts by default.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def list(
|
||||
cls, **params: Unpack["FinancialAccountListParams"]
|
||||
) -> ListObject["FinancialAccount"]:
|
||||
"""
|
||||
Returns a list of FinancialAccounts.
|
||||
"""
|
||||
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["FinancialAccountListParams"]
|
||||
) -> ListObject["FinancialAccount"]:
|
||||
"""
|
||||
Returns a list of FinancialAccounts.
|
||||
"""
|
||||
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 modify(
|
||||
cls, id: str, **params: Unpack["FinancialAccountModifyParams"]
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Updates the details of a FinancialAccount.
|
||||
"""
|
||||
url = "%s/%s" % (cls.class_url(), sanitize_id(id))
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
cls._static_request(
|
||||
"post",
|
||||
url,
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def modify_async(
|
||||
cls, id: str, **params: Unpack["FinancialAccountModifyParams"]
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Updates the details of a FinancialAccount.
|
||||
"""
|
||||
url = "%s/%s" % (cls.class_url(), sanitize_id(id))
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
url,
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def retrieve(
|
||||
cls, id: str, **params: Unpack["FinancialAccountRetrieveParams"]
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Retrieves the details of a FinancialAccount.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
instance.refresh()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
async def retrieve_async(
|
||||
cls, id: str, **params: Unpack["FinancialAccountRetrieveParams"]
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Retrieves the details of a FinancialAccount.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
await instance.refresh_async()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
def _cls_retrieve_features(
|
||||
cls,
|
||||
financial_account: str,
|
||||
**params: Unpack["FinancialAccountRetrieveFeaturesParams"],
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Retrieves Features information associated with the FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccountFeatures",
|
||||
cls._static_request(
|
||||
"get",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/features".format(
|
||||
financial_account=sanitize_id(financial_account)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def retrieve_features(
|
||||
financial_account: str,
|
||||
**params: Unpack["FinancialAccountRetrieveFeaturesParams"],
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Retrieves Features information associated with the FinancialAccount.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def retrieve_features(
|
||||
self, **params: Unpack["FinancialAccountRetrieveFeaturesParams"]
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Retrieves Features information associated with the FinancialAccount.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_retrieve_features")
|
||||
def retrieve_features( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["FinancialAccountRetrieveFeaturesParams"]
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Retrieves Features information associated with the FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccountFeatures",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/features".format(
|
||||
financial_account=sanitize_id(self.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_retrieve_features_async(
|
||||
cls,
|
||||
financial_account: str,
|
||||
**params: Unpack["FinancialAccountRetrieveFeaturesParams"],
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Retrieves Features information associated with the FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccountFeatures",
|
||||
await cls._static_request_async(
|
||||
"get",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/features".format(
|
||||
financial_account=sanitize_id(financial_account)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def retrieve_features_async(
|
||||
financial_account: str,
|
||||
**params: Unpack["FinancialAccountRetrieveFeaturesParams"],
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Retrieves Features information associated with the FinancialAccount.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def retrieve_features_async(
|
||||
self, **params: Unpack["FinancialAccountRetrieveFeaturesParams"]
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Retrieves Features information associated with the FinancialAccount.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_retrieve_features_async")
|
||||
async def retrieve_features_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["FinancialAccountRetrieveFeaturesParams"]
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Retrieves Features information associated with the FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccountFeatures",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/features".format(
|
||||
financial_account=sanitize_id(self.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _cls_update_features(
|
||||
cls,
|
||||
financial_account: str,
|
||||
**params: Unpack["FinancialAccountUpdateFeaturesParams"],
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Updates the Features associated with a FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccountFeatures",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/features".format(
|
||||
financial_account=sanitize_id(financial_account)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def update_features(
|
||||
financial_account: str,
|
||||
**params: Unpack["FinancialAccountUpdateFeaturesParams"],
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Updates the Features associated with a FinancialAccount.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def update_features(
|
||||
self, **params: Unpack["FinancialAccountUpdateFeaturesParams"]
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Updates the Features associated with a FinancialAccount.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_update_features")
|
||||
def update_features( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["FinancialAccountUpdateFeaturesParams"]
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Updates the Features associated with a FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccountFeatures",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/features".format(
|
||||
financial_account=sanitize_id(self.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_update_features_async(
|
||||
cls,
|
||||
financial_account: str,
|
||||
**params: Unpack["FinancialAccountUpdateFeaturesParams"],
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Updates the Features associated with a FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccountFeatures",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/features".format(
|
||||
financial_account=sanitize_id(financial_account)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def update_features_async(
|
||||
financial_account: str,
|
||||
**params: Unpack["FinancialAccountUpdateFeaturesParams"],
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Updates the Features associated with a FinancialAccount.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def update_features_async(
|
||||
self, **params: Unpack["FinancialAccountUpdateFeaturesParams"]
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Updates the Features associated with a FinancialAccount.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_update_features_async")
|
||||
async def update_features_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["FinancialAccountUpdateFeaturesParams"]
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Updates the Features associated with a FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccountFeatures",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/features".format(
|
||||
financial_account=sanitize_id(self.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
_inner_class_types = {
|
||||
"balance": Balance,
|
||||
"financial_addresses": FinancialAddress,
|
||||
"platform_restrictions": PlatformRestrictions,
|
||||
"status_details": StatusDetails,
|
||||
}
|
||||
@@ -0,0 +1,511 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# File generated from our OpenAPI spec
|
||||
from stripe._stripe_object import StripeObject
|
||||
from typing import ClassVar, List, Optional
|
||||
from typing_extensions import Literal
|
||||
|
||||
|
||||
class FinancialAccountFeatures(StripeObject):
|
||||
"""
|
||||
Encodes whether a FinancialAccount has access to a particular Feature, with a `status` enum and associated `status_details`.
|
||||
Stripe or the platform can control Features via the requested field.
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["treasury.financial_account_features"]] = (
|
||||
"treasury.financial_account_features"
|
||||
)
|
||||
|
||||
class CardIssuing(StripeObject):
|
||||
class StatusDetail(StripeObject):
|
||||
code: Literal[
|
||||
"activating",
|
||||
"capability_not_requested",
|
||||
"financial_account_closed",
|
||||
"rejected_other",
|
||||
"rejected_unsupported_business",
|
||||
"requirements_past_due",
|
||||
"requirements_pending_verification",
|
||||
"restricted_by_platform",
|
||||
"restricted_other",
|
||||
]
|
||||
"""
|
||||
Represents the reason why the status is `pending` or `restricted`.
|
||||
"""
|
||||
resolution: Optional[
|
||||
Literal[
|
||||
"contact_stripe",
|
||||
"provide_information",
|
||||
"remove_restriction",
|
||||
]
|
||||
]
|
||||
"""
|
||||
Represents what the user should do, if anything, to activate the Feature.
|
||||
"""
|
||||
restriction: Optional[Literal["inbound_flows", "outbound_flows"]]
|
||||
"""
|
||||
The `platform_restrictions` that are restricting this Feature.
|
||||
"""
|
||||
|
||||
requested: bool
|
||||
"""
|
||||
Whether the FinancialAccount should have the Feature.
|
||||
"""
|
||||
status: Literal["active", "pending", "restricted"]
|
||||
"""
|
||||
Whether the Feature is operational.
|
||||
"""
|
||||
status_details: List[StatusDetail]
|
||||
"""
|
||||
Additional details; includes at least one entry when the status is not `active`.
|
||||
"""
|
||||
_inner_class_types = {"status_details": StatusDetail}
|
||||
|
||||
class DepositInsurance(StripeObject):
|
||||
class StatusDetail(StripeObject):
|
||||
code: Literal[
|
||||
"activating",
|
||||
"capability_not_requested",
|
||||
"financial_account_closed",
|
||||
"rejected_other",
|
||||
"rejected_unsupported_business",
|
||||
"requirements_past_due",
|
||||
"requirements_pending_verification",
|
||||
"restricted_by_platform",
|
||||
"restricted_other",
|
||||
]
|
||||
"""
|
||||
Represents the reason why the status is `pending` or `restricted`.
|
||||
"""
|
||||
resolution: Optional[
|
||||
Literal[
|
||||
"contact_stripe",
|
||||
"provide_information",
|
||||
"remove_restriction",
|
||||
]
|
||||
]
|
||||
"""
|
||||
Represents what the user should do, if anything, to activate the Feature.
|
||||
"""
|
||||
restriction: Optional[Literal["inbound_flows", "outbound_flows"]]
|
||||
"""
|
||||
The `platform_restrictions` that are restricting this Feature.
|
||||
"""
|
||||
|
||||
requested: bool
|
||||
"""
|
||||
Whether the FinancialAccount should have the Feature.
|
||||
"""
|
||||
status: Literal["active", "pending", "restricted"]
|
||||
"""
|
||||
Whether the Feature is operational.
|
||||
"""
|
||||
status_details: List[StatusDetail]
|
||||
"""
|
||||
Additional details; includes at least one entry when the status is not `active`.
|
||||
"""
|
||||
_inner_class_types = {"status_details": StatusDetail}
|
||||
|
||||
class FinancialAddresses(StripeObject):
|
||||
class Aba(StripeObject):
|
||||
class StatusDetail(StripeObject):
|
||||
code: Literal[
|
||||
"activating",
|
||||
"capability_not_requested",
|
||||
"financial_account_closed",
|
||||
"rejected_other",
|
||||
"rejected_unsupported_business",
|
||||
"requirements_past_due",
|
||||
"requirements_pending_verification",
|
||||
"restricted_by_platform",
|
||||
"restricted_other",
|
||||
]
|
||||
"""
|
||||
Represents the reason why the status is `pending` or `restricted`.
|
||||
"""
|
||||
resolution: Optional[
|
||||
Literal[
|
||||
"contact_stripe",
|
||||
"provide_information",
|
||||
"remove_restriction",
|
||||
]
|
||||
]
|
||||
"""
|
||||
Represents what the user should do, if anything, to activate the Feature.
|
||||
"""
|
||||
restriction: Optional[
|
||||
Literal["inbound_flows", "outbound_flows"]
|
||||
]
|
||||
"""
|
||||
The `platform_restrictions` that are restricting this Feature.
|
||||
"""
|
||||
|
||||
requested: bool
|
||||
"""
|
||||
Whether the FinancialAccount should have the Feature.
|
||||
"""
|
||||
status: Literal["active", "pending", "restricted"]
|
||||
"""
|
||||
Whether the Feature is operational.
|
||||
"""
|
||||
status_details: List[StatusDetail]
|
||||
"""
|
||||
Additional details; includes at least one entry when the status is not `active`.
|
||||
"""
|
||||
_inner_class_types = {"status_details": StatusDetail}
|
||||
|
||||
aba: Optional[Aba]
|
||||
"""
|
||||
Toggle settings for enabling/disabling the ABA address feature
|
||||
"""
|
||||
_inner_class_types = {"aba": Aba}
|
||||
|
||||
class InboundTransfers(StripeObject):
|
||||
class Ach(StripeObject):
|
||||
class StatusDetail(StripeObject):
|
||||
code: Literal[
|
||||
"activating",
|
||||
"capability_not_requested",
|
||||
"financial_account_closed",
|
||||
"rejected_other",
|
||||
"rejected_unsupported_business",
|
||||
"requirements_past_due",
|
||||
"requirements_pending_verification",
|
||||
"restricted_by_platform",
|
||||
"restricted_other",
|
||||
]
|
||||
"""
|
||||
Represents the reason why the status is `pending` or `restricted`.
|
||||
"""
|
||||
resolution: Optional[
|
||||
Literal[
|
||||
"contact_stripe",
|
||||
"provide_information",
|
||||
"remove_restriction",
|
||||
]
|
||||
]
|
||||
"""
|
||||
Represents what the user should do, if anything, to activate the Feature.
|
||||
"""
|
||||
restriction: Optional[
|
||||
Literal["inbound_flows", "outbound_flows"]
|
||||
]
|
||||
"""
|
||||
The `platform_restrictions` that are restricting this Feature.
|
||||
"""
|
||||
|
||||
requested: bool
|
||||
"""
|
||||
Whether the FinancialAccount should have the Feature.
|
||||
"""
|
||||
status: Literal["active", "pending", "restricted"]
|
||||
"""
|
||||
Whether the Feature is operational.
|
||||
"""
|
||||
status_details: List[StatusDetail]
|
||||
"""
|
||||
Additional details; includes at least one entry when the status is not `active`.
|
||||
"""
|
||||
_inner_class_types = {"status_details": StatusDetail}
|
||||
|
||||
ach: Optional[Ach]
|
||||
"""
|
||||
Toggle settings for enabling/disabling an inbound ACH specific feature
|
||||
"""
|
||||
_inner_class_types = {"ach": Ach}
|
||||
|
||||
class IntraStripeFlows(StripeObject):
|
||||
class StatusDetail(StripeObject):
|
||||
code: Literal[
|
||||
"activating",
|
||||
"capability_not_requested",
|
||||
"financial_account_closed",
|
||||
"rejected_other",
|
||||
"rejected_unsupported_business",
|
||||
"requirements_past_due",
|
||||
"requirements_pending_verification",
|
||||
"restricted_by_platform",
|
||||
"restricted_other",
|
||||
]
|
||||
"""
|
||||
Represents the reason why the status is `pending` or `restricted`.
|
||||
"""
|
||||
resolution: Optional[
|
||||
Literal[
|
||||
"contact_stripe",
|
||||
"provide_information",
|
||||
"remove_restriction",
|
||||
]
|
||||
]
|
||||
"""
|
||||
Represents what the user should do, if anything, to activate the Feature.
|
||||
"""
|
||||
restriction: Optional[Literal["inbound_flows", "outbound_flows"]]
|
||||
"""
|
||||
The `platform_restrictions` that are restricting this Feature.
|
||||
"""
|
||||
|
||||
requested: bool
|
||||
"""
|
||||
Whether the FinancialAccount should have the Feature.
|
||||
"""
|
||||
status: Literal["active", "pending", "restricted"]
|
||||
"""
|
||||
Whether the Feature is operational.
|
||||
"""
|
||||
status_details: List[StatusDetail]
|
||||
"""
|
||||
Additional details; includes at least one entry when the status is not `active`.
|
||||
"""
|
||||
_inner_class_types = {"status_details": StatusDetail}
|
||||
|
||||
class OutboundPayments(StripeObject):
|
||||
class Ach(StripeObject):
|
||||
class StatusDetail(StripeObject):
|
||||
code: Literal[
|
||||
"activating",
|
||||
"capability_not_requested",
|
||||
"financial_account_closed",
|
||||
"rejected_other",
|
||||
"rejected_unsupported_business",
|
||||
"requirements_past_due",
|
||||
"requirements_pending_verification",
|
||||
"restricted_by_platform",
|
||||
"restricted_other",
|
||||
]
|
||||
"""
|
||||
Represents the reason why the status is `pending` or `restricted`.
|
||||
"""
|
||||
resolution: Optional[
|
||||
Literal[
|
||||
"contact_stripe",
|
||||
"provide_information",
|
||||
"remove_restriction",
|
||||
]
|
||||
]
|
||||
"""
|
||||
Represents what the user should do, if anything, to activate the Feature.
|
||||
"""
|
||||
restriction: Optional[
|
||||
Literal["inbound_flows", "outbound_flows"]
|
||||
]
|
||||
"""
|
||||
The `platform_restrictions` that are restricting this Feature.
|
||||
"""
|
||||
|
||||
requested: bool
|
||||
"""
|
||||
Whether the FinancialAccount should have the Feature.
|
||||
"""
|
||||
status: Literal["active", "pending", "restricted"]
|
||||
"""
|
||||
Whether the Feature is operational.
|
||||
"""
|
||||
status_details: List[StatusDetail]
|
||||
"""
|
||||
Additional details; includes at least one entry when the status is not `active`.
|
||||
"""
|
||||
_inner_class_types = {"status_details": StatusDetail}
|
||||
|
||||
class UsDomesticWire(StripeObject):
|
||||
class StatusDetail(StripeObject):
|
||||
code: Literal[
|
||||
"activating",
|
||||
"capability_not_requested",
|
||||
"financial_account_closed",
|
||||
"rejected_other",
|
||||
"rejected_unsupported_business",
|
||||
"requirements_past_due",
|
||||
"requirements_pending_verification",
|
||||
"restricted_by_platform",
|
||||
"restricted_other",
|
||||
]
|
||||
"""
|
||||
Represents the reason why the status is `pending` or `restricted`.
|
||||
"""
|
||||
resolution: Optional[
|
||||
Literal[
|
||||
"contact_stripe",
|
||||
"provide_information",
|
||||
"remove_restriction",
|
||||
]
|
||||
]
|
||||
"""
|
||||
Represents what the user should do, if anything, to activate the Feature.
|
||||
"""
|
||||
restriction: Optional[
|
||||
Literal["inbound_flows", "outbound_flows"]
|
||||
]
|
||||
"""
|
||||
The `platform_restrictions` that are restricting this Feature.
|
||||
"""
|
||||
|
||||
requested: bool
|
||||
"""
|
||||
Whether the FinancialAccount should have the Feature.
|
||||
"""
|
||||
status: Literal["active", "pending", "restricted"]
|
||||
"""
|
||||
Whether the Feature is operational.
|
||||
"""
|
||||
status_details: List[StatusDetail]
|
||||
"""
|
||||
Additional details; includes at least one entry when the status is not `active`.
|
||||
"""
|
||||
_inner_class_types = {"status_details": StatusDetail}
|
||||
|
||||
ach: Optional[Ach]
|
||||
"""
|
||||
Toggle settings for enabling/disabling an outbound ACH specific feature
|
||||
"""
|
||||
us_domestic_wire: Optional[UsDomesticWire]
|
||||
"""
|
||||
Toggle settings for enabling/disabling a feature
|
||||
"""
|
||||
_inner_class_types = {"ach": Ach, "us_domestic_wire": UsDomesticWire}
|
||||
|
||||
class OutboundTransfers(StripeObject):
|
||||
class Ach(StripeObject):
|
||||
class StatusDetail(StripeObject):
|
||||
code: Literal[
|
||||
"activating",
|
||||
"capability_not_requested",
|
||||
"financial_account_closed",
|
||||
"rejected_other",
|
||||
"rejected_unsupported_business",
|
||||
"requirements_past_due",
|
||||
"requirements_pending_verification",
|
||||
"restricted_by_platform",
|
||||
"restricted_other",
|
||||
]
|
||||
"""
|
||||
Represents the reason why the status is `pending` or `restricted`.
|
||||
"""
|
||||
resolution: Optional[
|
||||
Literal[
|
||||
"contact_stripe",
|
||||
"provide_information",
|
||||
"remove_restriction",
|
||||
]
|
||||
]
|
||||
"""
|
||||
Represents what the user should do, if anything, to activate the Feature.
|
||||
"""
|
||||
restriction: Optional[
|
||||
Literal["inbound_flows", "outbound_flows"]
|
||||
]
|
||||
"""
|
||||
The `platform_restrictions` that are restricting this Feature.
|
||||
"""
|
||||
|
||||
requested: bool
|
||||
"""
|
||||
Whether the FinancialAccount should have the Feature.
|
||||
"""
|
||||
status: Literal["active", "pending", "restricted"]
|
||||
"""
|
||||
Whether the Feature is operational.
|
||||
"""
|
||||
status_details: List[StatusDetail]
|
||||
"""
|
||||
Additional details; includes at least one entry when the status is not `active`.
|
||||
"""
|
||||
_inner_class_types = {"status_details": StatusDetail}
|
||||
|
||||
class UsDomesticWire(StripeObject):
|
||||
class StatusDetail(StripeObject):
|
||||
code: Literal[
|
||||
"activating",
|
||||
"capability_not_requested",
|
||||
"financial_account_closed",
|
||||
"rejected_other",
|
||||
"rejected_unsupported_business",
|
||||
"requirements_past_due",
|
||||
"requirements_pending_verification",
|
||||
"restricted_by_platform",
|
||||
"restricted_other",
|
||||
]
|
||||
"""
|
||||
Represents the reason why the status is `pending` or `restricted`.
|
||||
"""
|
||||
resolution: Optional[
|
||||
Literal[
|
||||
"contact_stripe",
|
||||
"provide_information",
|
||||
"remove_restriction",
|
||||
]
|
||||
]
|
||||
"""
|
||||
Represents what the user should do, if anything, to activate the Feature.
|
||||
"""
|
||||
restriction: Optional[
|
||||
Literal["inbound_flows", "outbound_flows"]
|
||||
]
|
||||
"""
|
||||
The `platform_restrictions` that are restricting this Feature.
|
||||
"""
|
||||
|
||||
requested: bool
|
||||
"""
|
||||
Whether the FinancialAccount should have the Feature.
|
||||
"""
|
||||
status: Literal["active", "pending", "restricted"]
|
||||
"""
|
||||
Whether the Feature is operational.
|
||||
"""
|
||||
status_details: List[StatusDetail]
|
||||
"""
|
||||
Additional details; includes at least one entry when the status is not `active`.
|
||||
"""
|
||||
_inner_class_types = {"status_details": StatusDetail}
|
||||
|
||||
ach: Optional[Ach]
|
||||
"""
|
||||
Toggle settings for enabling/disabling an outbound ACH specific feature
|
||||
"""
|
||||
us_domestic_wire: Optional[UsDomesticWire]
|
||||
"""
|
||||
Toggle settings for enabling/disabling a feature
|
||||
"""
|
||||
_inner_class_types = {"ach": Ach, "us_domestic_wire": UsDomesticWire}
|
||||
|
||||
card_issuing: Optional[CardIssuing]
|
||||
"""
|
||||
Toggle settings for enabling/disabling a feature
|
||||
"""
|
||||
deposit_insurance: Optional[DepositInsurance]
|
||||
"""
|
||||
Toggle settings for enabling/disabling a feature
|
||||
"""
|
||||
financial_addresses: Optional[FinancialAddresses]
|
||||
"""
|
||||
Settings related to Financial Addresses features on a Financial Account
|
||||
"""
|
||||
inbound_transfers: Optional[InboundTransfers]
|
||||
"""
|
||||
InboundTransfers contains inbound transfers features for a FinancialAccount.
|
||||
"""
|
||||
intra_stripe_flows: Optional[IntraStripeFlows]
|
||||
"""
|
||||
Toggle settings for enabling/disabling a feature
|
||||
"""
|
||||
object: Literal["treasury.financial_account_features"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
outbound_payments: Optional[OutboundPayments]
|
||||
"""
|
||||
Settings related to Outbound Payments features on a Financial Account
|
||||
"""
|
||||
outbound_transfers: Optional[OutboundTransfers]
|
||||
"""
|
||||
OutboundTransfers contains outbound transfers features for a FinancialAccount.
|
||||
"""
|
||||
_inner_class_types = {
|
||||
"card_issuing": CardIssuing,
|
||||
"deposit_insurance": DepositInsurance,
|
||||
"financial_addresses": FinancialAddresses,
|
||||
"inbound_transfers": InboundTransfers,
|
||||
"intra_stripe_flows": IntraStripeFlows,
|
||||
"outbound_payments": OutboundPayments,
|
||||
"outbound_transfers": OutboundTransfers,
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
# -*- 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.params.treasury._financial_account_features_retrieve_params import (
|
||||
FinancialAccountFeaturesRetrieveParams,
|
||||
)
|
||||
from stripe.params.treasury._financial_account_features_update_params import (
|
||||
FinancialAccountFeaturesUpdateParams,
|
||||
)
|
||||
from stripe.treasury._financial_account_features import (
|
||||
FinancialAccountFeatures,
|
||||
)
|
||||
|
||||
|
||||
class FinancialAccountFeaturesService(StripeService):
|
||||
def update(
|
||||
self,
|
||||
financial_account: str,
|
||||
params: Optional["FinancialAccountFeaturesUpdateParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Updates the Features associated with a FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccountFeatures",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/features".format(
|
||||
financial_account=sanitize_id(financial_account),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
financial_account: str,
|
||||
params: Optional["FinancialAccountFeaturesUpdateParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Updates the Features associated with a FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccountFeatures",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/features".format(
|
||||
financial_account=sanitize_id(financial_account),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
financial_account: str,
|
||||
params: Optional["FinancialAccountFeaturesRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Retrieves Features information associated with the FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccountFeatures",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/features".format(
|
||||
financial_account=sanitize_id(financial_account),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
financial_account: str,
|
||||
params: Optional["FinancialAccountFeaturesRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "FinancialAccountFeatures":
|
||||
"""
|
||||
Retrieves Features information associated with the FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccountFeatures",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/features".format(
|
||||
financial_account=sanitize_id(financial_account),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,268 @@
|
||||
# -*- 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.params.treasury._financial_account_close_params import (
|
||||
FinancialAccountCloseParams,
|
||||
)
|
||||
from stripe.params.treasury._financial_account_create_params import (
|
||||
FinancialAccountCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._financial_account_list_params import (
|
||||
FinancialAccountListParams,
|
||||
)
|
||||
from stripe.params.treasury._financial_account_retrieve_params import (
|
||||
FinancialAccountRetrieveParams,
|
||||
)
|
||||
from stripe.params.treasury._financial_account_update_params import (
|
||||
FinancialAccountUpdateParams,
|
||||
)
|
||||
from stripe.treasury._financial_account import FinancialAccount
|
||||
from stripe.treasury._financial_account_features_service import (
|
||||
FinancialAccountFeaturesService,
|
||||
)
|
||||
|
||||
_subservices = {
|
||||
"features": [
|
||||
"stripe.treasury._financial_account_features_service",
|
||||
"FinancialAccountFeaturesService",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
class FinancialAccountService(StripeService):
|
||||
features: "FinancialAccountFeaturesService"
|
||||
|
||||
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["FinancialAccountListParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[FinancialAccount]":
|
||||
"""
|
||||
Returns a list of FinancialAccounts.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[FinancialAccount]",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/financial_accounts",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
params: Optional["FinancialAccountListParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[FinancialAccount]":
|
||||
"""
|
||||
Returns a list of FinancialAccounts.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[FinancialAccount]",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/financial_accounts",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def create(
|
||||
self,
|
||||
params: "FinancialAccountCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Creates a new FinancialAccount. Each connected account can have up to three FinancialAccounts by default.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
params: "FinancialAccountCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Creates a new FinancialAccount. Each connected account can have up to three FinancialAccounts by default.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
financial_account: str,
|
||||
params: Optional["FinancialAccountRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Retrieves the details of a FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/financial_accounts/{financial_account}".format(
|
||||
financial_account=sanitize_id(financial_account),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
financial_account: str,
|
||||
params: Optional["FinancialAccountRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Retrieves the details of a FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/financial_accounts/{financial_account}".format(
|
||||
financial_account=sanitize_id(financial_account),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
financial_account: str,
|
||||
params: Optional["FinancialAccountUpdateParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Updates the details of a FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}".format(
|
||||
financial_account=sanitize_id(financial_account),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
financial_account: str,
|
||||
params: Optional["FinancialAccountUpdateParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Updates the details of a FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}".format(
|
||||
financial_account=sanitize_id(financial_account),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def close(
|
||||
self,
|
||||
financial_account: str,
|
||||
params: Optional["FinancialAccountCloseParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/close".format(
|
||||
financial_account=sanitize_id(financial_account),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def close_async(
|
||||
self,
|
||||
financial_account: str,
|
||||
params: Optional["FinancialAccountCloseParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "FinancialAccount":
|
||||
"""
|
||||
Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards.
|
||||
"""
|
||||
return cast(
|
||||
"FinancialAccount",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/financial_accounts/{financial_account}/close".format(
|
||||
financial_account=sanitize_id(financial_account),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,815 @@
|
||||
# -*- 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._listable_api_resource import ListableAPIResource
|
||||
from stripe._stripe_object import StripeObject
|
||||
from stripe._test_helpers import APIResourceTestHelpers
|
||||
from stripe._util import class_method_variant, sanitize_id
|
||||
from typing import ClassVar, Dict, Optional, cast, overload
|
||||
from typing_extensions import Literal, Type, Unpack, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe._mandate import Mandate
|
||||
from stripe.params.treasury._inbound_transfer_cancel_params import (
|
||||
InboundTransferCancelParams,
|
||||
)
|
||||
from stripe.params.treasury._inbound_transfer_create_params import (
|
||||
InboundTransferCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._inbound_transfer_fail_params import (
|
||||
InboundTransferFailParams,
|
||||
)
|
||||
from stripe.params.treasury._inbound_transfer_list_params import (
|
||||
InboundTransferListParams,
|
||||
)
|
||||
from stripe.params.treasury._inbound_transfer_retrieve_params import (
|
||||
InboundTransferRetrieveParams,
|
||||
)
|
||||
from stripe.params.treasury._inbound_transfer_return_inbound_transfer_params import (
|
||||
InboundTransferReturnInboundTransferParams,
|
||||
)
|
||||
from stripe.params.treasury._inbound_transfer_succeed_params import (
|
||||
InboundTransferSucceedParams,
|
||||
)
|
||||
from stripe.treasury._transaction import Transaction
|
||||
|
||||
|
||||
class InboundTransfer(
|
||||
CreateableAPIResource["InboundTransfer"],
|
||||
ListableAPIResource["InboundTransfer"],
|
||||
):
|
||||
"""
|
||||
Use [InboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit.
|
||||
|
||||
Related guide: [Moving money with Treasury using InboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers)
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["treasury.inbound_transfer"]] = (
|
||||
"treasury.inbound_transfer"
|
||||
)
|
||||
|
||||
class FailureDetails(StripeObject):
|
||||
code: Literal[
|
||||
"account_closed",
|
||||
"account_frozen",
|
||||
"bank_account_restricted",
|
||||
"bank_ownership_changed",
|
||||
"debit_not_authorized",
|
||||
"incorrect_account_holder_address",
|
||||
"incorrect_account_holder_name",
|
||||
"incorrect_account_holder_tax_id",
|
||||
"insufficient_funds",
|
||||
"invalid_account_number",
|
||||
"invalid_currency",
|
||||
"no_account",
|
||||
"other",
|
||||
]
|
||||
"""
|
||||
Reason for the failure.
|
||||
"""
|
||||
|
||||
class LinkedFlows(StripeObject):
|
||||
received_debit: Optional[str]
|
||||
"""
|
||||
If funds for this flow were returned after the flow went to the `succeeded` state, this field contains a reference to the ReceivedDebit return.
|
||||
"""
|
||||
|
||||
class OriginPaymentMethodDetails(StripeObject):
|
||||
class BillingDetails(StripeObject):
|
||||
class Address(StripeObject):
|
||||
city: Optional[str]
|
||||
"""
|
||||
City, district, suburb, town, or village.
|
||||
"""
|
||||
country: Optional[str]
|
||||
"""
|
||||
Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
|
||||
"""
|
||||
line1: Optional[str]
|
||||
"""
|
||||
Address line 1, such as the street, PO Box, or company name.
|
||||
"""
|
||||
line2: Optional[str]
|
||||
"""
|
||||
Address line 2, such as the apartment, suite, unit, or building.
|
||||
"""
|
||||
postal_code: Optional[str]
|
||||
"""
|
||||
ZIP or postal code.
|
||||
"""
|
||||
state: Optional[str]
|
||||
"""
|
||||
State, county, province, or region.
|
||||
"""
|
||||
|
||||
address: Address
|
||||
email: Optional[str]
|
||||
"""
|
||||
Email address.
|
||||
"""
|
||||
name: Optional[str]
|
||||
"""
|
||||
Full name.
|
||||
"""
|
||||
_inner_class_types = {"address": Address}
|
||||
|
||||
class UsBankAccount(StripeObject):
|
||||
account_holder_type: Optional[Literal["company", "individual"]]
|
||||
"""
|
||||
Account holder type: individual or company.
|
||||
"""
|
||||
account_type: Optional[Literal["checking", "savings"]]
|
||||
"""
|
||||
Account type: checkings or savings. Defaults to checking if omitted.
|
||||
"""
|
||||
bank_name: Optional[str]
|
||||
"""
|
||||
Name of the bank associated with the bank account.
|
||||
"""
|
||||
fingerprint: Optional[str]
|
||||
"""
|
||||
Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
|
||||
"""
|
||||
last4: Optional[str]
|
||||
"""
|
||||
Last four digits of the bank account number.
|
||||
"""
|
||||
mandate: Optional[ExpandableField["Mandate"]]
|
||||
"""
|
||||
ID of the mandate used to make this payment.
|
||||
"""
|
||||
network: Literal["ach"]
|
||||
"""
|
||||
The network rails used. See the [docs](https://stripe.com/docs/treasury/money-movement/timelines) to learn more about money movement timelines for each network type.
|
||||
"""
|
||||
routing_number: Optional[str]
|
||||
"""
|
||||
Routing number of the bank account.
|
||||
"""
|
||||
|
||||
billing_details: BillingDetails
|
||||
type: Literal["us_bank_account"]
|
||||
"""
|
||||
The type of the payment method used in the InboundTransfer.
|
||||
"""
|
||||
us_bank_account: Optional[UsBankAccount]
|
||||
_inner_class_types = {
|
||||
"billing_details": BillingDetails,
|
||||
"us_bank_account": UsBankAccount,
|
||||
}
|
||||
|
||||
class StatusTransitions(StripeObject):
|
||||
canceled_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when an InboundTransfer changed status to `canceled`.
|
||||
"""
|
||||
failed_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when an InboundTransfer changed status to `failed`.
|
||||
"""
|
||||
succeeded_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when an InboundTransfer changed status to `succeeded`.
|
||||
"""
|
||||
|
||||
amount: int
|
||||
"""
|
||||
Amount (in cents) transferred.
|
||||
"""
|
||||
cancelable: bool
|
||||
"""
|
||||
Returns `true` if the InboundTransfer is able to be canceled.
|
||||
"""
|
||||
created: int
|
||||
"""
|
||||
Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
"""
|
||||
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: Optional[str]
|
||||
"""
|
||||
An arbitrary string attached to the object. Often useful for displaying to users.
|
||||
"""
|
||||
failure_details: Optional[FailureDetails]
|
||||
"""
|
||||
Details about this InboundTransfer's failure. Only set when status is `failed`.
|
||||
"""
|
||||
financial_account: str
|
||||
"""
|
||||
The FinancialAccount that received the funds.
|
||||
"""
|
||||
hosted_regulatory_receipt_url: Optional[str]
|
||||
"""
|
||||
A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
|
||||
"""
|
||||
id: str
|
||||
"""
|
||||
Unique identifier for the object.
|
||||
"""
|
||||
linked_flows: LinkedFlows
|
||||
livemode: bool
|
||||
"""
|
||||
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
"""
|
||||
metadata: Dict[str, str]
|
||||
"""
|
||||
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
"""
|
||||
object: Literal["treasury.inbound_transfer"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
origin_payment_method: Optional[str]
|
||||
"""
|
||||
The origin payment method to be debited for an InboundTransfer.
|
||||
"""
|
||||
origin_payment_method_details: Optional[OriginPaymentMethodDetails]
|
||||
"""
|
||||
Details about the PaymentMethod for an InboundTransfer.
|
||||
"""
|
||||
returned: Optional[bool]
|
||||
"""
|
||||
Returns `true` if the funds for an InboundTransfer were returned after the InboundTransfer went to the `succeeded` state.
|
||||
"""
|
||||
statement_descriptor: str
|
||||
"""
|
||||
Statement descriptor shown when funds are debited from the source. Not all payment networks support `statement_descriptor`.
|
||||
"""
|
||||
status: Literal["canceled", "failed", "processing", "succeeded"]
|
||||
"""
|
||||
Status of the InboundTransfer: `processing`, `succeeded`, `failed`, and `canceled`. An InboundTransfer is `processing` if it is created and pending. The status changes to `succeeded` once the funds have been "confirmed" and a `transaction` is created and posted. The status changes to `failed` if the transfer fails.
|
||||
"""
|
||||
status_transitions: StatusTransitions
|
||||
transaction: Optional[ExpandableField["Transaction"]]
|
||||
"""
|
||||
The Transaction associated with this object.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def _cls_cancel(
|
||||
cls,
|
||||
inbound_transfer: str,
|
||||
**params: Unpack["InboundTransferCancelParams"],
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Cancels an InboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/treasury/inbound_transfers/{inbound_transfer}/cancel".format(
|
||||
inbound_transfer=sanitize_id(inbound_transfer)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def cancel(
|
||||
inbound_transfer: str, **params: Unpack["InboundTransferCancelParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Cancels an InboundTransfer.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def cancel(
|
||||
self, **params: Unpack["InboundTransferCancelParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Cancels an InboundTransfer.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_cancel")
|
||||
def cancel( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["InboundTransferCancelParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Cancels an InboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/inbound_transfers/{inbound_transfer}/cancel".format(
|
||||
inbound_transfer=sanitize_id(self.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_cancel_async(
|
||||
cls,
|
||||
inbound_transfer: str,
|
||||
**params: Unpack["InboundTransferCancelParams"],
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Cancels an InboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/treasury/inbound_transfers/{inbound_transfer}/cancel".format(
|
||||
inbound_transfer=sanitize_id(inbound_transfer)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def cancel_async(
|
||||
inbound_transfer: str, **params: Unpack["InboundTransferCancelParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Cancels an InboundTransfer.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def cancel_async(
|
||||
self, **params: Unpack["InboundTransferCancelParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Cancels an InboundTransfer.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_cancel_async")
|
||||
async def cancel_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["InboundTransferCancelParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Cancels an InboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/inbound_transfers/{inbound_transfer}/cancel".format(
|
||||
inbound_transfer=sanitize_id(self.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def create(
|
||||
cls, **params: Unpack["InboundTransferCreateParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Creates an InboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
cls._static_request(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def create_async(
|
||||
cls, **params: Unpack["InboundTransferCreateParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Creates an InboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def list(
|
||||
cls, **params: Unpack["InboundTransferListParams"]
|
||||
) -> ListObject["InboundTransfer"]:
|
||||
"""
|
||||
Returns a list of InboundTransfers sent from the specified FinancialAccount.
|
||||
"""
|
||||
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["InboundTransferListParams"]
|
||||
) -> ListObject["InboundTransfer"]:
|
||||
"""
|
||||
Returns a list of InboundTransfers sent from the specified FinancialAccount.
|
||||
"""
|
||||
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["InboundTransferRetrieveParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Retrieves the details of an existing InboundTransfer.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
instance.refresh()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
async def retrieve_async(
|
||||
cls, id: str, **params: Unpack["InboundTransferRetrieveParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Retrieves the details of an existing InboundTransfer.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
await instance.refresh_async()
|
||||
return instance
|
||||
|
||||
class TestHelpers(APIResourceTestHelpers["InboundTransfer"]):
|
||||
_resource_cls: Type["InboundTransfer"]
|
||||
|
||||
@classmethod
|
||||
def _cls_fail(
|
||||
cls, id: str, **params: Unpack["InboundTransferFailParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/inbound_transfers/{id}/fail".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def fail(
|
||||
id: str, **params: Unpack["InboundTransferFailParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def fail(
|
||||
self, **params: Unpack["InboundTransferFailParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_fail")
|
||||
def fail( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["InboundTransferFailParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
self.resource._request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/inbound_transfers/{id}/fail".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_fail_async(
|
||||
cls, id: str, **params: Unpack["InboundTransferFailParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/inbound_transfers/{id}/fail".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def fail_async(
|
||||
id: str, **params: Unpack["InboundTransferFailParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def fail_async(
|
||||
self, **params: Unpack["InboundTransferFailParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_fail_async")
|
||||
async def fail_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["InboundTransferFailParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
await self.resource._request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/inbound_transfers/{id}/fail".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _cls_return_inbound_transfer(
|
||||
cls,
|
||||
id: str,
|
||||
**params: Unpack["InboundTransferReturnInboundTransferParams"],
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/inbound_transfers/{id}/return".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def return_inbound_transfer(
|
||||
id: str,
|
||||
**params: Unpack["InboundTransferReturnInboundTransferParams"],
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def return_inbound_transfer(
|
||||
self,
|
||||
**params: Unpack["InboundTransferReturnInboundTransferParams"],
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_return_inbound_transfer")
|
||||
def return_inbound_transfer( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self,
|
||||
**params: Unpack["InboundTransferReturnInboundTransferParams"],
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
self.resource._request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/inbound_transfers/{id}/return".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_return_inbound_transfer_async(
|
||||
cls,
|
||||
id: str,
|
||||
**params: Unpack["InboundTransferReturnInboundTransferParams"],
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/inbound_transfers/{id}/return".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def return_inbound_transfer_async(
|
||||
id: str,
|
||||
**params: Unpack["InboundTransferReturnInboundTransferParams"],
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def return_inbound_transfer_async(
|
||||
self,
|
||||
**params: Unpack["InboundTransferReturnInboundTransferParams"],
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_return_inbound_transfer_async")
|
||||
async def return_inbound_transfer_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self,
|
||||
**params: Unpack["InboundTransferReturnInboundTransferParams"],
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
await self.resource._request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/inbound_transfers/{id}/return".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _cls_succeed(
|
||||
cls, id: str, **params: Unpack["InboundTransferSucceedParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/inbound_transfers/{id}/succeed".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def succeed(
|
||||
id: str, **params: Unpack["InboundTransferSucceedParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def succeed(
|
||||
self, **params: Unpack["InboundTransferSucceedParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_succeed")
|
||||
def succeed( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["InboundTransferSucceedParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
self.resource._request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/inbound_transfers/{id}/succeed".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_succeed_async(
|
||||
cls, id: str, **params: Unpack["InboundTransferSucceedParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/inbound_transfers/{id}/succeed".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def succeed_async(
|
||||
id: str, **params: Unpack["InboundTransferSucceedParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def succeed_async(
|
||||
self, **params: Unpack["InboundTransferSucceedParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_succeed_async")
|
||||
async def succeed_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["InboundTransferSucceedParams"]
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
await self.resource._request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/inbound_transfers/{id}/succeed".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@property
|
||||
def test_helpers(self):
|
||||
return self.TestHelpers(self)
|
||||
|
||||
_inner_class_types = {
|
||||
"failure_details": FailureDetails,
|
||||
"linked_flows": LinkedFlows,
|
||||
"origin_payment_method_details": OriginPaymentMethodDetails,
|
||||
"status_transitions": StatusTransitions,
|
||||
}
|
||||
|
||||
|
||||
InboundTransfer.TestHelpers._resource_cls = InboundTransfer
|
||||
@@ -0,0 +1,189 @@
|
||||
# -*- 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.params.treasury._inbound_transfer_cancel_params import (
|
||||
InboundTransferCancelParams,
|
||||
)
|
||||
from stripe.params.treasury._inbound_transfer_create_params import (
|
||||
InboundTransferCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._inbound_transfer_list_params import (
|
||||
InboundTransferListParams,
|
||||
)
|
||||
from stripe.params.treasury._inbound_transfer_retrieve_params import (
|
||||
InboundTransferRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._inbound_transfer import InboundTransfer
|
||||
|
||||
|
||||
class InboundTransferService(StripeService):
|
||||
def list(
|
||||
self,
|
||||
params: "InboundTransferListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[InboundTransfer]":
|
||||
"""
|
||||
Returns a list of InboundTransfers sent from the specified FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[InboundTransfer]",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/inbound_transfers",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
params: "InboundTransferListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[InboundTransfer]":
|
||||
"""
|
||||
Returns a list of InboundTransfers sent from the specified FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[InboundTransfer]",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/inbound_transfers",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def create(
|
||||
self,
|
||||
params: "InboundTransferCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Creates an InboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/inbound_transfers",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
params: "InboundTransferCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Creates an InboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/inbound_transfers",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["InboundTransferRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Retrieves the details of an existing InboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/inbound_transfers/{id}".format(
|
||||
id=sanitize_id(id),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["InboundTransferRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Retrieves the details of an existing InboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/inbound_transfers/{id}".format(
|
||||
id=sanitize_id(id),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def cancel(
|
||||
self,
|
||||
inbound_transfer: str,
|
||||
params: Optional["InboundTransferCancelParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Cancels an InboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/inbound_transfers/{inbound_transfer}/cancel".format(
|
||||
inbound_transfer=sanitize_id(inbound_transfer),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def cancel_async(
|
||||
self,
|
||||
inbound_transfer: str,
|
||||
params: Optional["InboundTransferCancelParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "InboundTransfer":
|
||||
"""
|
||||
Cancels an InboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"InboundTransfer",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/inbound_transfers/{inbound_transfer}/cancel".format(
|
||||
inbound_transfer=sanitize_id(inbound_transfer),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,990 @@
|
||||
# -*- 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._listable_api_resource import ListableAPIResource
|
||||
from stripe._stripe_object import StripeObject
|
||||
from stripe._test_helpers import APIResourceTestHelpers
|
||||
from stripe._util import class_method_variant, sanitize_id
|
||||
from typing import ClassVar, Dict, Optional, cast, overload
|
||||
from typing_extensions import Literal, Type, Unpack, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe._mandate import Mandate
|
||||
from stripe.params.treasury._outbound_payment_cancel_params import (
|
||||
OutboundPaymentCancelParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_payment_create_params import (
|
||||
OutboundPaymentCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_payment_fail_params import (
|
||||
OutboundPaymentFailParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_payment_list_params import (
|
||||
OutboundPaymentListParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_payment_post_params import (
|
||||
OutboundPaymentPostParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_payment_retrieve_params import (
|
||||
OutboundPaymentRetrieveParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_payment_return_outbound_payment_params import (
|
||||
OutboundPaymentReturnOutboundPaymentParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_payment_update_params import (
|
||||
OutboundPaymentUpdateParams,
|
||||
)
|
||||
from stripe.treasury._transaction import Transaction
|
||||
|
||||
|
||||
class OutboundPayment(
|
||||
CreateableAPIResource["OutboundPayment"],
|
||||
ListableAPIResource["OutboundPayment"],
|
||||
):
|
||||
"""
|
||||
Use [OutboundPayments](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments) to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers).
|
||||
|
||||
Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects.
|
||||
|
||||
Related guide: [Moving money with Treasury using OutboundPayment objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments)
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["treasury.outbound_payment"]] = (
|
||||
"treasury.outbound_payment"
|
||||
)
|
||||
|
||||
class DestinationPaymentMethodDetails(StripeObject):
|
||||
class BillingDetails(StripeObject):
|
||||
class Address(StripeObject):
|
||||
city: Optional[str]
|
||||
"""
|
||||
City, district, suburb, town, or village.
|
||||
"""
|
||||
country: Optional[str]
|
||||
"""
|
||||
Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
|
||||
"""
|
||||
line1: Optional[str]
|
||||
"""
|
||||
Address line 1, such as the street, PO Box, or company name.
|
||||
"""
|
||||
line2: Optional[str]
|
||||
"""
|
||||
Address line 2, such as the apartment, suite, unit, or building.
|
||||
"""
|
||||
postal_code: Optional[str]
|
||||
"""
|
||||
ZIP or postal code.
|
||||
"""
|
||||
state: Optional[str]
|
||||
"""
|
||||
State, county, province, or region.
|
||||
"""
|
||||
|
||||
address: Address
|
||||
email: Optional[str]
|
||||
"""
|
||||
Email address.
|
||||
"""
|
||||
name: Optional[str]
|
||||
"""
|
||||
Full name.
|
||||
"""
|
||||
_inner_class_types = {"address": Address}
|
||||
|
||||
class FinancialAccount(StripeObject):
|
||||
id: str
|
||||
"""
|
||||
Token of the FinancialAccount.
|
||||
"""
|
||||
network: Literal["stripe"]
|
||||
"""
|
||||
The rails used to send funds.
|
||||
"""
|
||||
|
||||
class UsBankAccount(StripeObject):
|
||||
account_holder_type: Optional[Literal["company", "individual"]]
|
||||
"""
|
||||
Account holder type: individual or company.
|
||||
"""
|
||||
account_type: Optional[Literal["checking", "savings"]]
|
||||
"""
|
||||
Account type: checkings or savings. Defaults to checking if omitted.
|
||||
"""
|
||||
bank_name: Optional[str]
|
||||
"""
|
||||
Name of the bank associated with the bank account.
|
||||
"""
|
||||
fingerprint: Optional[str]
|
||||
"""
|
||||
Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
|
||||
"""
|
||||
last4: Optional[str]
|
||||
"""
|
||||
Last four digits of the bank account number.
|
||||
"""
|
||||
mandate: Optional[ExpandableField["Mandate"]]
|
||||
"""
|
||||
ID of the mandate used to make this payment.
|
||||
"""
|
||||
network: Literal["ach", "us_domestic_wire"]
|
||||
"""
|
||||
The network rails used. See the [docs](https://stripe.com/docs/treasury/money-movement/timelines) to learn more about money movement timelines for each network type.
|
||||
"""
|
||||
routing_number: Optional[str]
|
||||
"""
|
||||
Routing number of the bank account.
|
||||
"""
|
||||
|
||||
billing_details: BillingDetails
|
||||
financial_account: Optional[FinancialAccount]
|
||||
type: Literal["financial_account", "us_bank_account"]
|
||||
"""
|
||||
The type of the payment method used in the OutboundPayment.
|
||||
"""
|
||||
us_bank_account: Optional[UsBankAccount]
|
||||
_inner_class_types = {
|
||||
"billing_details": BillingDetails,
|
||||
"financial_account": FinancialAccount,
|
||||
"us_bank_account": UsBankAccount,
|
||||
}
|
||||
|
||||
class EndUserDetails(StripeObject):
|
||||
ip_address: Optional[str]
|
||||
"""
|
||||
IP address of the user initiating the OutboundPayment. Set if `present` is set to `true`. IP address collection is required for risk and compliance reasons. This will be used to help determine if the OutboundPayment is authorized or should be blocked.
|
||||
"""
|
||||
present: bool
|
||||
"""
|
||||
`true` if the OutboundPayment creation request is being made on behalf of an end user by a platform. Otherwise, `false`.
|
||||
"""
|
||||
|
||||
class ReturnedDetails(StripeObject):
|
||||
code: Literal[
|
||||
"account_closed",
|
||||
"account_frozen",
|
||||
"bank_account_restricted",
|
||||
"bank_ownership_changed",
|
||||
"declined",
|
||||
"incorrect_account_holder_name",
|
||||
"invalid_account_number",
|
||||
"invalid_currency",
|
||||
"no_account",
|
||||
"other",
|
||||
]
|
||||
"""
|
||||
Reason for the return.
|
||||
"""
|
||||
transaction: ExpandableField["Transaction"]
|
||||
"""
|
||||
The Transaction associated with this object.
|
||||
"""
|
||||
|
||||
class StatusTransitions(StripeObject):
|
||||
canceled_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when an OutboundPayment changed status to `canceled`.
|
||||
"""
|
||||
failed_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when an OutboundPayment changed status to `failed`.
|
||||
"""
|
||||
posted_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when an OutboundPayment changed status to `posted`.
|
||||
"""
|
||||
returned_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when an OutboundPayment changed status to `returned`.
|
||||
"""
|
||||
|
||||
class TrackingDetails(StripeObject):
|
||||
class Ach(StripeObject):
|
||||
trace_id: str
|
||||
"""
|
||||
ACH trace ID of the OutboundPayment for payments sent over the `ach` network.
|
||||
"""
|
||||
|
||||
class UsDomesticWire(StripeObject):
|
||||
chips: Optional[str]
|
||||
"""
|
||||
CHIPS System Sequence Number (SSN) of the OutboundPayment for payments sent over the `us_domestic_wire` network.
|
||||
"""
|
||||
imad: Optional[str]
|
||||
"""
|
||||
IMAD of the OutboundPayment for payments sent over the `us_domestic_wire` network.
|
||||
"""
|
||||
omad: Optional[str]
|
||||
"""
|
||||
OMAD of the OutboundPayment for payments sent over the `us_domestic_wire` network.
|
||||
"""
|
||||
|
||||
ach: Optional[Ach]
|
||||
type: Literal["ach", "us_domestic_wire"]
|
||||
"""
|
||||
The US bank account network used to send funds.
|
||||
"""
|
||||
us_domestic_wire: Optional[UsDomesticWire]
|
||||
_inner_class_types = {"ach": Ach, "us_domestic_wire": UsDomesticWire}
|
||||
|
||||
amount: int
|
||||
"""
|
||||
Amount (in cents) transferred.
|
||||
"""
|
||||
cancelable: bool
|
||||
"""
|
||||
Returns `true` if the object can be canceled, and `false` otherwise.
|
||||
"""
|
||||
created: int
|
||||
"""
|
||||
Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
"""
|
||||
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).
|
||||
"""
|
||||
customer: Optional[str]
|
||||
"""
|
||||
ID of the [customer](https://stripe.com/docs/api/customers) to whom an OutboundPayment is sent.
|
||||
"""
|
||||
description: Optional[str]
|
||||
"""
|
||||
An arbitrary string attached to the object. Often useful for displaying to users.
|
||||
"""
|
||||
destination_payment_method: Optional[str]
|
||||
"""
|
||||
The PaymentMethod via which an OutboundPayment is sent. This field can be empty if the OutboundPayment was created using `destination_payment_method_data`.
|
||||
"""
|
||||
destination_payment_method_details: Optional[
|
||||
DestinationPaymentMethodDetails
|
||||
]
|
||||
"""
|
||||
Details about the PaymentMethod for an OutboundPayment.
|
||||
"""
|
||||
end_user_details: Optional[EndUserDetails]
|
||||
"""
|
||||
Details about the end user.
|
||||
"""
|
||||
expected_arrival_date: int
|
||||
"""
|
||||
The date when funds are expected to arrive in the destination account.
|
||||
"""
|
||||
financial_account: str
|
||||
"""
|
||||
The FinancialAccount that funds were pulled from.
|
||||
"""
|
||||
hosted_regulatory_receipt_url: Optional[str]
|
||||
"""
|
||||
A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
metadata: Dict[str, str]
|
||||
"""
|
||||
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
"""
|
||||
object: Literal["treasury.outbound_payment"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
returned_details: Optional[ReturnedDetails]
|
||||
"""
|
||||
Details about a returned OutboundPayment. Only set when the status is `returned`.
|
||||
"""
|
||||
statement_descriptor: str
|
||||
"""
|
||||
The description that appears on the receiving end for an OutboundPayment (for example, bank statement for external bank transfer).
|
||||
"""
|
||||
status: Literal["canceled", "failed", "posted", "processing", "returned"]
|
||||
"""
|
||||
Current status of the OutboundPayment: `processing`, `failed`, `posted`, `returned`, `canceled`. An OutboundPayment is `processing` if it has been created and is pending. The status changes to `posted` once the OutboundPayment has been "confirmed" and funds have left the account, or to `failed` or `canceled`. If an OutboundPayment fails to arrive at its destination, its status will change to `returned`.
|
||||
"""
|
||||
status_transitions: StatusTransitions
|
||||
tracking_details: Optional[TrackingDetails]
|
||||
"""
|
||||
Details about network-specific tracking information if available.
|
||||
"""
|
||||
transaction: ExpandableField["Transaction"]
|
||||
"""
|
||||
The Transaction associated with this object.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def _cls_cancel(
|
||||
cls, id: str, **params: Unpack["OutboundPaymentCancelParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Cancel an OutboundPayment.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/treasury/outbound_payments/{id}/cancel".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def cancel(
|
||||
id: str, **params: Unpack["OutboundPaymentCancelParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Cancel an OutboundPayment.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def cancel(
|
||||
self, **params: Unpack["OutboundPaymentCancelParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Cancel an OutboundPayment.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_cancel")
|
||||
def cancel( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundPaymentCancelParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Cancel an OutboundPayment.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/outbound_payments/{id}/cancel".format(
|
||||
id=sanitize_id(self.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_cancel_async(
|
||||
cls, id: str, **params: Unpack["OutboundPaymentCancelParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Cancel an OutboundPayment.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/treasury/outbound_payments/{id}/cancel".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def cancel_async(
|
||||
id: str, **params: Unpack["OutboundPaymentCancelParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Cancel an OutboundPayment.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def cancel_async(
|
||||
self, **params: Unpack["OutboundPaymentCancelParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Cancel an OutboundPayment.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_cancel_async")
|
||||
async def cancel_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundPaymentCancelParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Cancel an OutboundPayment.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/outbound_payments/{id}/cancel".format(
|
||||
id=sanitize_id(self.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def create(
|
||||
cls, **params: Unpack["OutboundPaymentCreateParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Creates an OutboundPayment.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
cls._static_request(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def create_async(
|
||||
cls, **params: Unpack["OutboundPaymentCreateParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Creates an OutboundPayment.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def list(
|
||||
cls, **params: Unpack["OutboundPaymentListParams"]
|
||||
) -> ListObject["OutboundPayment"]:
|
||||
"""
|
||||
Returns a list of OutboundPayments sent from the specified FinancialAccount.
|
||||
"""
|
||||
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["OutboundPaymentListParams"]
|
||||
) -> ListObject["OutboundPayment"]:
|
||||
"""
|
||||
Returns a list of OutboundPayments sent from the specified FinancialAccount.
|
||||
"""
|
||||
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["OutboundPaymentRetrieveParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Retrieves the details of an existing OutboundPayment by passing the unique OutboundPayment ID from either the OutboundPayment creation request or OutboundPayment list.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
instance.refresh()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
async def retrieve_async(
|
||||
cls, id: str, **params: Unpack["OutboundPaymentRetrieveParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Retrieves the details of an existing OutboundPayment by passing the unique OutboundPayment ID from either the OutboundPayment creation request or OutboundPayment list.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
await instance.refresh_async()
|
||||
return instance
|
||||
|
||||
class TestHelpers(APIResourceTestHelpers["OutboundPayment"]):
|
||||
_resource_cls: Type["OutboundPayment"]
|
||||
|
||||
@classmethod
|
||||
def _cls_fail(
|
||||
cls, id: str, **params: Unpack["OutboundPaymentFailParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}/fail".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def fail(
|
||||
id: str, **params: Unpack["OutboundPaymentFailParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def fail(
|
||||
self, **params: Unpack["OutboundPaymentFailParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_fail")
|
||||
def fail( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundPaymentFailParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
self.resource._request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}/fail".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_fail_async(
|
||||
cls, id: str, **params: Unpack["OutboundPaymentFailParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}/fail".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def fail_async(
|
||||
id: str, **params: Unpack["OutboundPaymentFailParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def fail_async(
|
||||
self, **params: Unpack["OutboundPaymentFailParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_fail_async")
|
||||
async def fail_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundPaymentFailParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await self.resource._request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}/fail".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _cls_post(
|
||||
cls, id: str, **params: Unpack["OutboundPaymentPostParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}/post".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def post(
|
||||
id: str, **params: Unpack["OutboundPaymentPostParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def post(
|
||||
self, **params: Unpack["OutboundPaymentPostParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_post")
|
||||
def post( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundPaymentPostParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
self.resource._request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}/post".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_post_async(
|
||||
cls, id: str, **params: Unpack["OutboundPaymentPostParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}/post".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def post_async(
|
||||
id: str, **params: Unpack["OutboundPaymentPostParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def post_async(
|
||||
self, **params: Unpack["OutboundPaymentPostParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_post_async")
|
||||
async def post_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundPaymentPostParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await self.resource._request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}/post".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _cls_return_outbound_payment(
|
||||
cls,
|
||||
id: str,
|
||||
**params: Unpack["OutboundPaymentReturnOutboundPaymentParams"],
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}/return".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def return_outbound_payment(
|
||||
id: str,
|
||||
**params: Unpack["OutboundPaymentReturnOutboundPaymentParams"],
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def return_outbound_payment(
|
||||
self,
|
||||
**params: Unpack["OutboundPaymentReturnOutboundPaymentParams"],
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_return_outbound_payment")
|
||||
def return_outbound_payment( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self,
|
||||
**params: Unpack["OutboundPaymentReturnOutboundPaymentParams"],
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
self.resource._request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}/return".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_return_outbound_payment_async(
|
||||
cls,
|
||||
id: str,
|
||||
**params: Unpack["OutboundPaymentReturnOutboundPaymentParams"],
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}/return".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def return_outbound_payment_async(
|
||||
id: str,
|
||||
**params: Unpack["OutboundPaymentReturnOutboundPaymentParams"],
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def return_outbound_payment_async(
|
||||
self,
|
||||
**params: Unpack["OutboundPaymentReturnOutboundPaymentParams"],
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_return_outbound_payment_async")
|
||||
async def return_outbound_payment_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self,
|
||||
**params: Unpack["OutboundPaymentReturnOutboundPaymentParams"],
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await self.resource._request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}/return".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _cls_update(
|
||||
cls, id: str, **params: Unpack["OutboundPaymentUpdateParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def update(
|
||||
id: str, **params: Unpack["OutboundPaymentUpdateParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def update(
|
||||
self, **params: Unpack["OutboundPaymentUpdateParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_update")
|
||||
def update( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundPaymentUpdateParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
self.resource._request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_update_async(
|
||||
cls, id: str, **params: Unpack["OutboundPaymentUpdateParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def update_async(
|
||||
id: str, **params: Unpack["OutboundPaymentUpdateParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def update_async(
|
||||
self, **params: Unpack["OutboundPaymentUpdateParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_update_async")
|
||||
async def update_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundPaymentUpdateParams"]
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await self.resource._request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_payments/{id}".format(
|
||||
id=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@property
|
||||
def test_helpers(self):
|
||||
return self.TestHelpers(self)
|
||||
|
||||
_inner_class_types = {
|
||||
"destination_payment_method_details": DestinationPaymentMethodDetails,
|
||||
"end_user_details": EndUserDetails,
|
||||
"returned_details": ReturnedDetails,
|
||||
"status_transitions": StatusTransitions,
|
||||
"tracking_details": TrackingDetails,
|
||||
}
|
||||
|
||||
|
||||
OutboundPayment.TestHelpers._resource_cls = OutboundPayment
|
||||
@@ -0,0 +1,189 @@
|
||||
# -*- 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.params.treasury._outbound_payment_cancel_params import (
|
||||
OutboundPaymentCancelParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_payment_create_params import (
|
||||
OutboundPaymentCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_payment_list_params import (
|
||||
OutboundPaymentListParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_payment_retrieve_params import (
|
||||
OutboundPaymentRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._outbound_payment import OutboundPayment
|
||||
|
||||
|
||||
class OutboundPaymentService(StripeService):
|
||||
def list(
|
||||
self,
|
||||
params: "OutboundPaymentListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[OutboundPayment]":
|
||||
"""
|
||||
Returns a list of OutboundPayments sent from the specified FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[OutboundPayment]",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/outbound_payments",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
params: "OutboundPaymentListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[OutboundPayment]":
|
||||
"""
|
||||
Returns a list of OutboundPayments sent from the specified FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[OutboundPayment]",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/outbound_payments",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def create(
|
||||
self,
|
||||
params: "OutboundPaymentCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Creates an OutboundPayment.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/outbound_payments",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
params: "OutboundPaymentCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Creates an OutboundPayment.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/outbound_payments",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["OutboundPaymentRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Retrieves the details of an existing OutboundPayment by passing the unique OutboundPayment ID from either the OutboundPayment creation request or OutboundPayment list.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/outbound_payments/{id}".format(
|
||||
id=sanitize_id(id),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["OutboundPaymentRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Retrieves the details of an existing OutboundPayment by passing the unique OutboundPayment ID from either the OutboundPayment creation request or OutboundPayment list.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/outbound_payments/{id}".format(
|
||||
id=sanitize_id(id),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def cancel(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["OutboundPaymentCancelParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Cancel an OutboundPayment.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/outbound_payments/{id}/cancel".format(
|
||||
id=sanitize_id(id),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def cancel_async(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["OutboundPaymentCancelParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "OutboundPayment":
|
||||
"""
|
||||
Cancel an OutboundPayment.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundPayment",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/outbound_payments/{id}/cancel".format(
|
||||
id=sanitize_id(id),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,990 @@
|
||||
# -*- 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._listable_api_resource import ListableAPIResource
|
||||
from stripe._stripe_object import StripeObject
|
||||
from stripe._test_helpers import APIResourceTestHelpers
|
||||
from stripe._util import class_method_variant, sanitize_id
|
||||
from typing import ClassVar, Dict, Optional, cast, overload
|
||||
from typing_extensions import Literal, Type, Unpack, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe._mandate import Mandate
|
||||
from stripe.params.treasury._outbound_transfer_cancel_params import (
|
||||
OutboundTransferCancelParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_transfer_create_params import (
|
||||
OutboundTransferCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_transfer_fail_params import (
|
||||
OutboundTransferFailParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_transfer_list_params import (
|
||||
OutboundTransferListParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_transfer_post_params import (
|
||||
OutboundTransferPostParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_transfer_retrieve_params import (
|
||||
OutboundTransferRetrieveParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_transfer_return_outbound_transfer_params import (
|
||||
OutboundTransferReturnOutboundTransferParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_transfer_update_params import (
|
||||
OutboundTransferUpdateParams,
|
||||
)
|
||||
from stripe.treasury._transaction import Transaction
|
||||
|
||||
|
||||
class OutboundTransfer(
|
||||
CreateableAPIResource["OutboundTransfer"],
|
||||
ListableAPIResource["OutboundTransfer"],
|
||||
):
|
||||
"""
|
||||
Use [OutboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers) to transfer funds from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) to a PaymentMethod belonging to the same entity. To send funds to a different party, use [OutboundPayments](https://stripe.com/docs/api#outbound_payments) instead. You can send funds over ACH rails or through a domestic wire transfer to a user's own external bank account.
|
||||
|
||||
Simulate OutboundTransfer state changes with the `/v1/test_helpers/treasury/outbound_transfers` endpoints. These methods can only be called on test mode objects.
|
||||
|
||||
Related guide: [Moving money with Treasury using OutboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers)
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["treasury.outbound_transfer"]] = (
|
||||
"treasury.outbound_transfer"
|
||||
)
|
||||
|
||||
class DestinationPaymentMethodDetails(StripeObject):
|
||||
class BillingDetails(StripeObject):
|
||||
class Address(StripeObject):
|
||||
city: Optional[str]
|
||||
"""
|
||||
City, district, suburb, town, or village.
|
||||
"""
|
||||
country: Optional[str]
|
||||
"""
|
||||
Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
|
||||
"""
|
||||
line1: Optional[str]
|
||||
"""
|
||||
Address line 1, such as the street, PO Box, or company name.
|
||||
"""
|
||||
line2: Optional[str]
|
||||
"""
|
||||
Address line 2, such as the apartment, suite, unit, or building.
|
||||
"""
|
||||
postal_code: Optional[str]
|
||||
"""
|
||||
ZIP or postal code.
|
||||
"""
|
||||
state: Optional[str]
|
||||
"""
|
||||
State, county, province, or region.
|
||||
"""
|
||||
|
||||
address: Address
|
||||
email: Optional[str]
|
||||
"""
|
||||
Email address.
|
||||
"""
|
||||
name: Optional[str]
|
||||
"""
|
||||
Full name.
|
||||
"""
|
||||
_inner_class_types = {"address": Address}
|
||||
|
||||
class FinancialAccount(StripeObject):
|
||||
id: str
|
||||
"""
|
||||
Token of the FinancialAccount.
|
||||
"""
|
||||
network: Literal["stripe"]
|
||||
"""
|
||||
The rails used to send funds.
|
||||
"""
|
||||
|
||||
class UsBankAccount(StripeObject):
|
||||
account_holder_type: Optional[Literal["company", "individual"]]
|
||||
"""
|
||||
Account holder type: individual or company.
|
||||
"""
|
||||
account_type: Optional[Literal["checking", "savings"]]
|
||||
"""
|
||||
Account type: checkings or savings. Defaults to checking if omitted.
|
||||
"""
|
||||
bank_name: Optional[str]
|
||||
"""
|
||||
Name of the bank associated with the bank account.
|
||||
"""
|
||||
fingerprint: Optional[str]
|
||||
"""
|
||||
Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
|
||||
"""
|
||||
last4: Optional[str]
|
||||
"""
|
||||
Last four digits of the bank account number.
|
||||
"""
|
||||
mandate: Optional[ExpandableField["Mandate"]]
|
||||
"""
|
||||
ID of the mandate used to make this payment.
|
||||
"""
|
||||
network: Literal["ach", "us_domestic_wire"]
|
||||
"""
|
||||
The network rails used. See the [docs](https://stripe.com/docs/treasury/money-movement/timelines) to learn more about money movement timelines for each network type.
|
||||
"""
|
||||
routing_number: Optional[str]
|
||||
"""
|
||||
Routing number of the bank account.
|
||||
"""
|
||||
|
||||
billing_details: BillingDetails
|
||||
financial_account: Optional[FinancialAccount]
|
||||
type: Literal["financial_account", "us_bank_account"]
|
||||
"""
|
||||
The type of the payment method used in the OutboundTransfer.
|
||||
"""
|
||||
us_bank_account: Optional[UsBankAccount]
|
||||
_inner_class_types = {
|
||||
"billing_details": BillingDetails,
|
||||
"financial_account": FinancialAccount,
|
||||
"us_bank_account": UsBankAccount,
|
||||
}
|
||||
|
||||
class ReturnedDetails(StripeObject):
|
||||
code: Literal[
|
||||
"account_closed",
|
||||
"account_frozen",
|
||||
"bank_account_restricted",
|
||||
"bank_ownership_changed",
|
||||
"declined",
|
||||
"incorrect_account_holder_name",
|
||||
"invalid_account_number",
|
||||
"invalid_currency",
|
||||
"no_account",
|
||||
"other",
|
||||
]
|
||||
"""
|
||||
Reason for the return.
|
||||
"""
|
||||
transaction: ExpandableField["Transaction"]
|
||||
"""
|
||||
The Transaction associated with this object.
|
||||
"""
|
||||
|
||||
class StatusTransitions(StripeObject):
|
||||
canceled_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when an OutboundTransfer changed status to `canceled`
|
||||
"""
|
||||
failed_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when an OutboundTransfer changed status to `failed`
|
||||
"""
|
||||
posted_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when an OutboundTransfer changed status to `posted`
|
||||
"""
|
||||
returned_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when an OutboundTransfer changed status to `returned`
|
||||
"""
|
||||
|
||||
class TrackingDetails(StripeObject):
|
||||
class Ach(StripeObject):
|
||||
trace_id: str
|
||||
"""
|
||||
ACH trace ID of the OutboundTransfer for transfers sent over the `ach` network.
|
||||
"""
|
||||
|
||||
class UsDomesticWire(StripeObject):
|
||||
chips: Optional[str]
|
||||
"""
|
||||
CHIPS System Sequence Number (SSN) of the OutboundTransfer for transfers sent over the `us_domestic_wire` network.
|
||||
"""
|
||||
imad: Optional[str]
|
||||
"""
|
||||
IMAD of the OutboundTransfer for transfers sent over the `us_domestic_wire` network.
|
||||
"""
|
||||
omad: Optional[str]
|
||||
"""
|
||||
OMAD of the OutboundTransfer for transfers sent over the `us_domestic_wire` network.
|
||||
"""
|
||||
|
||||
ach: Optional[Ach]
|
||||
type: Literal["ach", "us_domestic_wire"]
|
||||
"""
|
||||
The US bank account network used to send funds.
|
||||
"""
|
||||
us_domestic_wire: Optional[UsDomesticWire]
|
||||
_inner_class_types = {"ach": Ach, "us_domestic_wire": UsDomesticWire}
|
||||
|
||||
amount: int
|
||||
"""
|
||||
Amount (in cents) transferred.
|
||||
"""
|
||||
cancelable: bool
|
||||
"""
|
||||
Returns `true` if the object can be canceled, and `false` otherwise.
|
||||
"""
|
||||
created: int
|
||||
"""
|
||||
Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
"""
|
||||
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: Optional[str]
|
||||
"""
|
||||
An arbitrary string attached to the object. Often useful for displaying to users.
|
||||
"""
|
||||
destination_payment_method: Optional[str]
|
||||
"""
|
||||
The PaymentMethod used as the payment instrument for an OutboundTransfer.
|
||||
"""
|
||||
destination_payment_method_details: DestinationPaymentMethodDetails
|
||||
expected_arrival_date: int
|
||||
"""
|
||||
The date when funds are expected to arrive in the destination account.
|
||||
"""
|
||||
financial_account: str
|
||||
"""
|
||||
The FinancialAccount that funds were pulled from.
|
||||
"""
|
||||
hosted_regulatory_receipt_url: Optional[str]
|
||||
"""
|
||||
A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
metadata: Dict[str, str]
|
||||
"""
|
||||
Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
"""
|
||||
object: Literal["treasury.outbound_transfer"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
returned_details: Optional[ReturnedDetails]
|
||||
"""
|
||||
Details about a returned OutboundTransfer. Only set when the status is `returned`.
|
||||
"""
|
||||
statement_descriptor: str
|
||||
"""
|
||||
Information about the OutboundTransfer to be sent to the recipient account.
|
||||
"""
|
||||
status: Literal["canceled", "failed", "posted", "processing", "returned"]
|
||||
"""
|
||||
Current status of the OutboundTransfer: `processing`, `failed`, `canceled`, `posted`, `returned`. An OutboundTransfer is `processing` if it has been created and is pending. The status changes to `posted` once the OutboundTransfer has been "confirmed" and funds have left the account, or to `failed` or `canceled`. If an OutboundTransfer fails to arrive at its destination, its status will change to `returned`.
|
||||
"""
|
||||
status_transitions: StatusTransitions
|
||||
tracking_details: Optional[TrackingDetails]
|
||||
"""
|
||||
Details about network-specific tracking information if available.
|
||||
"""
|
||||
transaction: ExpandableField["Transaction"]
|
||||
"""
|
||||
The Transaction associated with this object.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def _cls_cancel(
|
||||
cls,
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferCancelParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
An OutboundTransfer can be canceled if the funds have not yet been paid out.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/treasury/outbound_transfers/{outbound_transfer}/cancel".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def cancel(
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferCancelParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
An OutboundTransfer can be canceled if the funds have not yet been paid out.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def cancel(
|
||||
self, **params: Unpack["OutboundTransferCancelParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
An OutboundTransfer can be canceled if the funds have not yet been paid out.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_cancel")
|
||||
def cancel( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundTransferCancelParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
An OutboundTransfer can be canceled if the funds have not yet been paid out.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/outbound_transfers/{outbound_transfer}/cancel".format(
|
||||
outbound_transfer=sanitize_id(self.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_cancel_async(
|
||||
cls,
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferCancelParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
An OutboundTransfer can be canceled if the funds have not yet been paid out.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/treasury/outbound_transfers/{outbound_transfer}/cancel".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def cancel_async(
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferCancelParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
An OutboundTransfer can be canceled if the funds have not yet been paid out.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def cancel_async(
|
||||
self, **params: Unpack["OutboundTransferCancelParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
An OutboundTransfer can be canceled if the funds have not yet been paid out.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_cancel_async")
|
||||
async def cancel_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundTransferCancelParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
An OutboundTransfer can be canceled if the funds have not yet been paid out.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/outbound_transfers/{outbound_transfer}/cancel".format(
|
||||
outbound_transfer=sanitize_id(self.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def create(
|
||||
cls, **params: Unpack["OutboundTransferCreateParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Creates an OutboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
cls._static_request(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def create_async(
|
||||
cls, **params: Unpack["OutboundTransferCreateParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Creates an OutboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
cls.class_url(),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def list(
|
||||
cls, **params: Unpack["OutboundTransferListParams"]
|
||||
) -> ListObject["OutboundTransfer"]:
|
||||
"""
|
||||
Returns a list of OutboundTransfers sent from the specified FinancialAccount.
|
||||
"""
|
||||
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["OutboundTransferListParams"]
|
||||
) -> ListObject["OutboundTransfer"]:
|
||||
"""
|
||||
Returns a list of OutboundTransfers sent from the specified FinancialAccount.
|
||||
"""
|
||||
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["OutboundTransferRetrieveParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID from either the OutboundTransfer creation request or OutboundTransfer list.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
instance.refresh()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
async def retrieve_async(
|
||||
cls, id: str, **params: Unpack["OutboundTransferRetrieveParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID from either the OutboundTransfer creation request or OutboundTransfer list.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
await instance.refresh_async()
|
||||
return instance
|
||||
|
||||
class TestHelpers(APIResourceTestHelpers["OutboundTransfer"]):
|
||||
_resource_cls: Type["OutboundTransfer"]
|
||||
|
||||
@classmethod
|
||||
def _cls_fail(
|
||||
cls,
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferFailParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def fail(
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferFailParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def fail(
|
||||
self, **params: Unpack["OutboundTransferFailParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_fail")
|
||||
def fail( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundTransferFailParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
self.resource._request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail".format(
|
||||
outbound_transfer=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_fail_async(
|
||||
cls,
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferFailParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def fail_async(
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferFailParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def fail_async(
|
||||
self, **params: Unpack["OutboundTransferFailParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_fail_async")
|
||||
async def fail_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundTransferFailParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await self.resource._request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail".format(
|
||||
outbound_transfer=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _cls_post(
|
||||
cls,
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferPostParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def post(
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferPostParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def post(
|
||||
self, **params: Unpack["OutboundTransferPostParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_post")
|
||||
def post( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundTransferPostParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
self.resource._request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post".format(
|
||||
outbound_transfer=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_post_async(
|
||||
cls,
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferPostParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def post_async(
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferPostParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def post_async(
|
||||
self, **params: Unpack["OutboundTransferPostParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_post_async")
|
||||
async def post_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundTransferPostParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await self.resource._request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post".format(
|
||||
outbound_transfer=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _cls_return_outbound_transfer(
|
||||
cls,
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferReturnOutboundTransferParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def return_outbound_transfer(
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferReturnOutboundTransferParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def return_outbound_transfer(
|
||||
self,
|
||||
**params: Unpack["OutboundTransferReturnOutboundTransferParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_return_outbound_transfer")
|
||||
def return_outbound_transfer( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self,
|
||||
**params: Unpack["OutboundTransferReturnOutboundTransferParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
self.resource._request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return".format(
|
||||
outbound_transfer=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_return_outbound_transfer_async(
|
||||
cls,
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferReturnOutboundTransferParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def return_outbound_transfer_async(
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferReturnOutboundTransferParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def return_outbound_transfer_async(
|
||||
self,
|
||||
**params: Unpack["OutboundTransferReturnOutboundTransferParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_return_outbound_transfer_async")
|
||||
async def return_outbound_transfer_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self,
|
||||
**params: Unpack["OutboundTransferReturnOutboundTransferParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await self.resource._request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return".format(
|
||||
outbound_transfer=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def _cls_update(
|
||||
cls,
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferUpdateParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
def update(
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferUpdateParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def update(
|
||||
self, **params: Unpack["OutboundTransferUpdateParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_update")
|
||||
def update( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundTransferUpdateParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
self.resource._request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}".format(
|
||||
outbound_transfer=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def _cls_update_async(
|
||||
cls,
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferUpdateParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer)
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@overload
|
||||
@staticmethod
|
||||
async def update_async(
|
||||
outbound_transfer: str,
|
||||
**params: Unpack["OutboundTransferUpdateParams"],
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
async def update_async(
|
||||
self, **params: Unpack["OutboundTransferUpdateParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
...
|
||||
|
||||
@class_method_variant("_cls_update_async")
|
||||
async def update_async( # pyright: ignore[reportGeneralTypeIssues]
|
||||
self, **params: Unpack["OutboundTransferUpdateParams"]
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await self.resource._request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}".format(
|
||||
outbound_transfer=sanitize_id(self.resource.get("id"))
|
||||
),
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@property
|
||||
def test_helpers(self):
|
||||
return self.TestHelpers(self)
|
||||
|
||||
_inner_class_types = {
|
||||
"destination_payment_method_details": DestinationPaymentMethodDetails,
|
||||
"returned_details": ReturnedDetails,
|
||||
"status_transitions": StatusTransitions,
|
||||
"tracking_details": TrackingDetails,
|
||||
}
|
||||
|
||||
|
||||
OutboundTransfer.TestHelpers._resource_cls = OutboundTransfer
|
||||
@@ -0,0 +1,189 @@
|
||||
# -*- 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.params.treasury._outbound_transfer_cancel_params import (
|
||||
OutboundTransferCancelParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_transfer_create_params import (
|
||||
OutboundTransferCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_transfer_list_params import (
|
||||
OutboundTransferListParams,
|
||||
)
|
||||
from stripe.params.treasury._outbound_transfer_retrieve_params import (
|
||||
OutboundTransferRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._outbound_transfer import OutboundTransfer
|
||||
|
||||
|
||||
class OutboundTransferService(StripeService):
|
||||
def list(
|
||||
self,
|
||||
params: "OutboundTransferListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[OutboundTransfer]":
|
||||
"""
|
||||
Returns a list of OutboundTransfers sent from the specified FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[OutboundTransfer]",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/outbound_transfers",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
params: "OutboundTransferListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[OutboundTransfer]":
|
||||
"""
|
||||
Returns a list of OutboundTransfers sent from the specified FinancialAccount.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[OutboundTransfer]",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/outbound_transfers",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def create(
|
||||
self,
|
||||
params: "OutboundTransferCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Creates an OutboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/outbound_transfers",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
params: "OutboundTransferCreateParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Creates an OutboundTransfer.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/outbound_transfers",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
outbound_transfer: str,
|
||||
params: Optional["OutboundTransferRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID from either the OutboundTransfer creation request or OutboundTransfer list.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/outbound_transfers/{outbound_transfer}".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
outbound_transfer: str,
|
||||
params: Optional["OutboundTransferRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID from either the OutboundTransfer creation request or OutboundTransfer list.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/outbound_transfers/{outbound_transfer}".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def cancel(
|
||||
self,
|
||||
outbound_transfer: str,
|
||||
params: Optional["OutboundTransferCancelParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
An OutboundTransfer can be canceled if the funds have not yet been paid out.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
self._request(
|
||||
"post",
|
||||
"/v1/treasury/outbound_transfers/{outbound_transfer}/cancel".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def cancel_async(
|
||||
self,
|
||||
outbound_transfer: str,
|
||||
params: Optional["OutboundTransferCancelParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "OutboundTransfer":
|
||||
"""
|
||||
An OutboundTransfer can be canceled if the funds have not yet been paid out.
|
||||
"""
|
||||
return cast(
|
||||
"OutboundTransfer",
|
||||
await self._request_async(
|
||||
"post",
|
||||
"/v1/treasury/outbound_transfers/{outbound_transfer}/cancel".format(
|
||||
outbound_transfer=sanitize_id(outbound_transfer),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,389 @@
|
||||
# -*- 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._test_helpers import APIResourceTestHelpers
|
||||
from typing import ClassVar, Optional, cast
|
||||
from typing_extensions import Literal, Type, Unpack, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe._payout import Payout
|
||||
from stripe.params.treasury._received_credit_create_params import (
|
||||
ReceivedCreditCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._received_credit_list_params import (
|
||||
ReceivedCreditListParams,
|
||||
)
|
||||
from stripe.params.treasury._received_credit_retrieve_params import (
|
||||
ReceivedCreditRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._credit_reversal import CreditReversal
|
||||
from stripe.treasury._outbound_payment import OutboundPayment
|
||||
from stripe.treasury._outbound_transfer import OutboundTransfer
|
||||
from stripe.treasury._transaction import Transaction
|
||||
|
||||
|
||||
class ReceivedCredit(ListableAPIResource["ReceivedCredit"]):
|
||||
"""
|
||||
ReceivedCredits represent funds sent to a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) (for example, via ACH or wire). These money movements are not initiated from the FinancialAccount.
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["treasury.received_credit"]] = (
|
||||
"treasury.received_credit"
|
||||
)
|
||||
|
||||
class InitiatingPaymentMethodDetails(StripeObject):
|
||||
class BillingDetails(StripeObject):
|
||||
class Address(StripeObject):
|
||||
city: Optional[str]
|
||||
"""
|
||||
City, district, suburb, town, or village.
|
||||
"""
|
||||
country: Optional[str]
|
||||
"""
|
||||
Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
|
||||
"""
|
||||
line1: Optional[str]
|
||||
"""
|
||||
Address line 1, such as the street, PO Box, or company name.
|
||||
"""
|
||||
line2: Optional[str]
|
||||
"""
|
||||
Address line 2, such as the apartment, suite, unit, or building.
|
||||
"""
|
||||
postal_code: Optional[str]
|
||||
"""
|
||||
ZIP or postal code.
|
||||
"""
|
||||
state: Optional[str]
|
||||
"""
|
||||
State, county, province, or region.
|
||||
"""
|
||||
|
||||
address: Address
|
||||
email: Optional[str]
|
||||
"""
|
||||
Email address.
|
||||
"""
|
||||
name: Optional[str]
|
||||
"""
|
||||
Full name.
|
||||
"""
|
||||
_inner_class_types = {"address": Address}
|
||||
|
||||
class FinancialAccount(StripeObject):
|
||||
id: str
|
||||
"""
|
||||
The FinancialAccount ID.
|
||||
"""
|
||||
network: Literal["stripe"]
|
||||
"""
|
||||
The rails the ReceivedCredit was sent over. A FinancialAccount can only send funds over `stripe`.
|
||||
"""
|
||||
|
||||
class UsBankAccount(StripeObject):
|
||||
bank_name: Optional[str]
|
||||
"""
|
||||
Bank name.
|
||||
"""
|
||||
last4: Optional[str]
|
||||
"""
|
||||
The last four digits of the bank account number.
|
||||
"""
|
||||
routing_number: Optional[str]
|
||||
"""
|
||||
The routing number for the bank account.
|
||||
"""
|
||||
|
||||
balance: Optional[Literal["payments"]]
|
||||
"""
|
||||
Set when `type` is `balance`.
|
||||
"""
|
||||
billing_details: BillingDetails
|
||||
financial_account: Optional[FinancialAccount]
|
||||
issuing_card: Optional[str]
|
||||
"""
|
||||
Set when `type` is `issuing_card`. This is an [Issuing Card](https://stripe.com/docs/api#issuing_cards) ID.
|
||||
"""
|
||||
type: Literal[
|
||||
"balance",
|
||||
"financial_account",
|
||||
"issuing_card",
|
||||
"stripe",
|
||||
"us_bank_account",
|
||||
]
|
||||
"""
|
||||
Polymorphic type matching the originating money movement's source. This can be an external account, a Stripe balance, or a FinancialAccount.
|
||||
"""
|
||||
us_bank_account: Optional[UsBankAccount]
|
||||
_inner_class_types = {
|
||||
"billing_details": BillingDetails,
|
||||
"financial_account": FinancialAccount,
|
||||
"us_bank_account": UsBankAccount,
|
||||
}
|
||||
|
||||
class LinkedFlows(StripeObject):
|
||||
class SourceFlowDetails(StripeObject):
|
||||
credit_reversal: Optional["CreditReversal"]
|
||||
"""
|
||||
You can reverse some [ReceivedCredits](https://stripe.com/docs/api#received_credits) depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a new object known as a CreditReversal.
|
||||
"""
|
||||
outbound_payment: Optional["OutboundPayment"]
|
||||
"""
|
||||
Use [OutboundPayments](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments) to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers).
|
||||
|
||||
Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects.
|
||||
|
||||
Related guide: [Moving money with Treasury using OutboundPayment objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments)
|
||||
"""
|
||||
outbound_transfer: Optional["OutboundTransfer"]
|
||||
"""
|
||||
Use [OutboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers) to transfer funds from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) to a PaymentMethod belonging to the same entity. To send funds to a different party, use [OutboundPayments](https://stripe.com/docs/api#outbound_payments) instead. You can send funds over ACH rails or through a domestic wire transfer to a user's own external bank account.
|
||||
|
||||
Simulate OutboundTransfer state changes with the `/v1/test_helpers/treasury/outbound_transfers` endpoints. These methods can only be called on test mode objects.
|
||||
|
||||
Related guide: [Moving money with Treasury using OutboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers)
|
||||
"""
|
||||
payout: Optional["Payout"]
|
||||
"""
|
||||
A `Payout` object is created when you receive funds from Stripe, or when you
|
||||
initiate a payout to either a bank account or debit card of a [connected
|
||||
Stripe account](https://docs.stripe.com/docs/connect/bank-debit-card-payouts). You can retrieve individual payouts,
|
||||
and list all payouts. Payouts are made on [varying
|
||||
schedules](https://docs.stripe.com/docs/connect/manage-payout-schedule), depending on your country and
|
||||
industry.
|
||||
|
||||
Related guide: [Receiving payouts](https://stripe.com/docs/payouts)
|
||||
"""
|
||||
type: Literal[
|
||||
"credit_reversal",
|
||||
"other",
|
||||
"outbound_payment",
|
||||
"outbound_transfer",
|
||||
"payout",
|
||||
]
|
||||
"""
|
||||
The type of the source flow that originated the ReceivedCredit.
|
||||
"""
|
||||
|
||||
credit_reversal: Optional[str]
|
||||
"""
|
||||
The CreditReversal created as a result of this ReceivedCredit being reversed.
|
||||
"""
|
||||
issuing_authorization: Optional[str]
|
||||
"""
|
||||
Set if the ReceivedCredit was created due to an [Issuing Authorization](https://stripe.com/docs/api#issuing_authorizations) object.
|
||||
"""
|
||||
issuing_transaction: Optional[str]
|
||||
"""
|
||||
Set if the ReceivedCredit is also viewable as an [Issuing transaction](https://stripe.com/docs/api#issuing_transactions) object.
|
||||
"""
|
||||
source_flow: Optional[str]
|
||||
"""
|
||||
ID of the source flow. Set if `network` is `stripe` and the source flow is visible to the user. Examples of source flows include OutboundPayments, payouts, or CreditReversals.
|
||||
"""
|
||||
source_flow_details: Optional[SourceFlowDetails]
|
||||
"""
|
||||
The expandable object of the source flow.
|
||||
"""
|
||||
source_flow_type: Optional[str]
|
||||
"""
|
||||
The type of flow that originated the ReceivedCredit (for example, `outbound_payment`).
|
||||
"""
|
||||
_inner_class_types = {"source_flow_details": SourceFlowDetails}
|
||||
|
||||
class ReversalDetails(StripeObject):
|
||||
deadline: Optional[int]
|
||||
"""
|
||||
Time before which a ReceivedCredit can be reversed.
|
||||
"""
|
||||
restricted_reason: Optional[
|
||||
Literal[
|
||||
"already_reversed",
|
||||
"deadline_passed",
|
||||
"network_restricted",
|
||||
"other",
|
||||
"source_flow_restricted",
|
||||
]
|
||||
]
|
||||
"""
|
||||
Set if a ReceivedCredit cannot be reversed.
|
||||
"""
|
||||
|
||||
amount: int
|
||||
"""
|
||||
Amount (in cents) transferred.
|
||||
"""
|
||||
created: int
|
||||
"""
|
||||
Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
"""
|
||||
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
|
||||
"""
|
||||
An arbitrary string attached to the object. Often useful for displaying to users.
|
||||
"""
|
||||
failure_code: Optional[
|
||||
Literal[
|
||||
"account_closed",
|
||||
"account_frozen",
|
||||
"international_transaction",
|
||||
"other",
|
||||
]
|
||||
]
|
||||
"""
|
||||
Reason for the failure. A ReceivedCredit might fail because the receiving FinancialAccount is closed or frozen.
|
||||
"""
|
||||
financial_account: Optional[str]
|
||||
"""
|
||||
The FinancialAccount that received the funds.
|
||||
"""
|
||||
hosted_regulatory_receipt_url: Optional[str]
|
||||
"""
|
||||
A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
|
||||
"""
|
||||
id: str
|
||||
"""
|
||||
Unique identifier for the object.
|
||||
"""
|
||||
initiating_payment_method_details: InitiatingPaymentMethodDetails
|
||||
linked_flows: LinkedFlows
|
||||
livemode: bool
|
||||
"""
|
||||
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
"""
|
||||
network: Literal["ach", "card", "stripe", "us_domestic_wire"]
|
||||
"""
|
||||
The rails used to send the funds.
|
||||
"""
|
||||
object: Literal["treasury.received_credit"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
reversal_details: Optional[ReversalDetails]
|
||||
"""
|
||||
Details describing when a ReceivedCredit may be reversed.
|
||||
"""
|
||||
status: Literal["failed", "succeeded"]
|
||||
"""
|
||||
Status of the ReceivedCredit. ReceivedCredits are created either `succeeded` (approved) or `failed` (declined). If a ReceivedCredit is declined, the failure reason can be found in the `failure_code` field.
|
||||
"""
|
||||
transaction: Optional[ExpandableField["Transaction"]]
|
||||
"""
|
||||
The Transaction associated with this object.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def list(
|
||||
cls, **params: Unpack["ReceivedCreditListParams"]
|
||||
) -> ListObject["ReceivedCredit"]:
|
||||
"""
|
||||
Returns a list of ReceivedCredits.
|
||||
"""
|
||||
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["ReceivedCreditListParams"]
|
||||
) -> ListObject["ReceivedCredit"]:
|
||||
"""
|
||||
Returns a list of ReceivedCredits.
|
||||
"""
|
||||
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["ReceivedCreditRetrieveParams"]
|
||||
) -> "ReceivedCredit":
|
||||
"""
|
||||
Retrieves the details of an existing ReceivedCredit by passing the unique ReceivedCredit ID from the ReceivedCredit list.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
instance.refresh()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
async def retrieve_async(
|
||||
cls, id: str, **params: Unpack["ReceivedCreditRetrieveParams"]
|
||||
) -> "ReceivedCredit":
|
||||
"""
|
||||
Retrieves the details of an existing ReceivedCredit by passing the unique ReceivedCredit ID from the ReceivedCredit list.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
await instance.refresh_async()
|
||||
return instance
|
||||
|
||||
class TestHelpers(APIResourceTestHelpers["ReceivedCredit"]):
|
||||
_resource_cls: Type["ReceivedCredit"]
|
||||
|
||||
@classmethod
|
||||
def create(
|
||||
cls, **params: Unpack["ReceivedCreditCreateParams"]
|
||||
) -> "ReceivedCredit":
|
||||
"""
|
||||
Use this endpoint to simulate a test mode ReceivedCredit initiated by a third party. In live mode, you can't directly create ReceivedCredits initiated by third parties.
|
||||
"""
|
||||
return cast(
|
||||
"ReceivedCredit",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/received_credits",
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def create_async(
|
||||
cls, **params: Unpack["ReceivedCreditCreateParams"]
|
||||
) -> "ReceivedCredit":
|
||||
"""
|
||||
Use this endpoint to simulate a test mode ReceivedCredit initiated by a third party. In live mode, you can't directly create ReceivedCredits initiated by third parties.
|
||||
"""
|
||||
return cast(
|
||||
"ReceivedCredit",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/received_credits",
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@property
|
||||
def test_helpers(self):
|
||||
return self.TestHelpers(self)
|
||||
|
||||
_inner_class_types = {
|
||||
"initiating_payment_method_details": InitiatingPaymentMethodDetails,
|
||||
"linked_flows": LinkedFlows,
|
||||
"reversal_details": ReversalDetails,
|
||||
}
|
||||
|
||||
|
||||
ReceivedCredit.TestHelpers._resource_cls = ReceivedCredit
|
||||
@@ -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.params.treasury._received_credit_list_params import (
|
||||
ReceivedCreditListParams,
|
||||
)
|
||||
from stripe.params.treasury._received_credit_retrieve_params import (
|
||||
ReceivedCreditRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._received_credit import ReceivedCredit
|
||||
|
||||
|
||||
class ReceivedCreditService(StripeService):
|
||||
def list(
|
||||
self,
|
||||
params: "ReceivedCreditListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[ReceivedCredit]":
|
||||
"""
|
||||
Returns a list of ReceivedCredits.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[ReceivedCredit]",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/received_credits",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
params: "ReceivedCreditListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[ReceivedCredit]":
|
||||
"""
|
||||
Returns a list of ReceivedCredits.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[ReceivedCredit]",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/received_credits",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["ReceivedCreditRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ReceivedCredit":
|
||||
"""
|
||||
Retrieves the details of an existing ReceivedCredit by passing the unique ReceivedCredit ID from the ReceivedCredit list.
|
||||
"""
|
||||
return cast(
|
||||
"ReceivedCredit",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/received_credits/{id}".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["ReceivedCreditRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ReceivedCredit":
|
||||
"""
|
||||
Retrieves the details of an existing ReceivedCredit by passing the unique ReceivedCredit ID from the ReceivedCredit list.
|
||||
"""
|
||||
return cast(
|
||||
"ReceivedCredit",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/received_credits/{id}".format(
|
||||
id=sanitize_id(id)
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,338 @@
|
||||
# -*- 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._test_helpers import APIResourceTestHelpers
|
||||
from typing import ClassVar, Optional, cast
|
||||
from typing_extensions import Literal, Type, Unpack, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe.params.treasury._received_debit_create_params import (
|
||||
ReceivedDebitCreateParams,
|
||||
)
|
||||
from stripe.params.treasury._received_debit_list_params import (
|
||||
ReceivedDebitListParams,
|
||||
)
|
||||
from stripe.params.treasury._received_debit_retrieve_params import (
|
||||
ReceivedDebitRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._transaction import Transaction
|
||||
|
||||
|
||||
class ReceivedDebit(ListableAPIResource["ReceivedDebit"]):
|
||||
"""
|
||||
ReceivedDebits represent funds pulled from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts). These are not initiated from the FinancialAccount.
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["treasury.received_debit"]] = (
|
||||
"treasury.received_debit"
|
||||
)
|
||||
|
||||
class InitiatingPaymentMethodDetails(StripeObject):
|
||||
class BillingDetails(StripeObject):
|
||||
class Address(StripeObject):
|
||||
city: Optional[str]
|
||||
"""
|
||||
City, district, suburb, town, or village.
|
||||
"""
|
||||
country: Optional[str]
|
||||
"""
|
||||
Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
|
||||
"""
|
||||
line1: Optional[str]
|
||||
"""
|
||||
Address line 1, such as the street, PO Box, or company name.
|
||||
"""
|
||||
line2: Optional[str]
|
||||
"""
|
||||
Address line 2, such as the apartment, suite, unit, or building.
|
||||
"""
|
||||
postal_code: Optional[str]
|
||||
"""
|
||||
ZIP or postal code.
|
||||
"""
|
||||
state: Optional[str]
|
||||
"""
|
||||
State, county, province, or region.
|
||||
"""
|
||||
|
||||
address: Address
|
||||
email: Optional[str]
|
||||
"""
|
||||
Email address.
|
||||
"""
|
||||
name: Optional[str]
|
||||
"""
|
||||
Full name.
|
||||
"""
|
||||
_inner_class_types = {"address": Address}
|
||||
|
||||
class FinancialAccount(StripeObject):
|
||||
id: str
|
||||
"""
|
||||
The FinancialAccount ID.
|
||||
"""
|
||||
network: Literal["stripe"]
|
||||
"""
|
||||
The rails the ReceivedCredit was sent over. A FinancialAccount can only send funds over `stripe`.
|
||||
"""
|
||||
|
||||
class UsBankAccount(StripeObject):
|
||||
bank_name: Optional[str]
|
||||
"""
|
||||
Bank name.
|
||||
"""
|
||||
last4: Optional[str]
|
||||
"""
|
||||
The last four digits of the bank account number.
|
||||
"""
|
||||
routing_number: Optional[str]
|
||||
"""
|
||||
The routing number for the bank account.
|
||||
"""
|
||||
|
||||
balance: Optional[Literal["payments"]]
|
||||
"""
|
||||
Set when `type` is `balance`.
|
||||
"""
|
||||
billing_details: BillingDetails
|
||||
financial_account: Optional[FinancialAccount]
|
||||
issuing_card: Optional[str]
|
||||
"""
|
||||
Set when `type` is `issuing_card`. This is an [Issuing Card](https://stripe.com/docs/api#issuing_cards) ID.
|
||||
"""
|
||||
type: Literal[
|
||||
"balance",
|
||||
"financial_account",
|
||||
"issuing_card",
|
||||
"stripe",
|
||||
"us_bank_account",
|
||||
]
|
||||
"""
|
||||
Polymorphic type matching the originating money movement's source. This can be an external account, a Stripe balance, or a FinancialAccount.
|
||||
"""
|
||||
us_bank_account: Optional[UsBankAccount]
|
||||
_inner_class_types = {
|
||||
"billing_details": BillingDetails,
|
||||
"financial_account": FinancialAccount,
|
||||
"us_bank_account": UsBankAccount,
|
||||
}
|
||||
|
||||
class LinkedFlows(StripeObject):
|
||||
debit_reversal: Optional[str]
|
||||
"""
|
||||
The DebitReversal created as a result of this ReceivedDebit being reversed.
|
||||
"""
|
||||
inbound_transfer: Optional[str]
|
||||
"""
|
||||
Set if the ReceivedDebit is associated with an InboundTransfer's return of funds.
|
||||
"""
|
||||
issuing_authorization: Optional[str]
|
||||
"""
|
||||
Set if the ReceivedDebit was created due to an [Issuing Authorization](https://stripe.com/docs/api#issuing_authorizations) object.
|
||||
"""
|
||||
issuing_transaction: Optional[str]
|
||||
"""
|
||||
Set if the ReceivedDebit is also viewable as an [Issuing Dispute](https://stripe.com/docs/api#issuing_disputes) object.
|
||||
"""
|
||||
payout: Optional[str]
|
||||
"""
|
||||
Set if the ReceivedDebit was created due to a [Payout](https://stripe.com/docs/api#payouts) object.
|
||||
"""
|
||||
|
||||
class ReversalDetails(StripeObject):
|
||||
deadline: Optional[int]
|
||||
"""
|
||||
Time before which a ReceivedDebit can be reversed.
|
||||
"""
|
||||
restricted_reason: Optional[
|
||||
Literal[
|
||||
"already_reversed",
|
||||
"deadline_passed",
|
||||
"network_restricted",
|
||||
"other",
|
||||
"source_flow_restricted",
|
||||
]
|
||||
]
|
||||
"""
|
||||
Set if a ReceivedDebit can't be reversed.
|
||||
"""
|
||||
|
||||
amount: int
|
||||
"""
|
||||
Amount (in cents) transferred.
|
||||
"""
|
||||
created: int
|
||||
"""
|
||||
Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
"""
|
||||
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
|
||||
"""
|
||||
An arbitrary string attached to the object. Often useful for displaying to users.
|
||||
"""
|
||||
failure_code: Optional[
|
||||
Literal[
|
||||
"account_closed",
|
||||
"account_frozen",
|
||||
"insufficient_funds",
|
||||
"international_transaction",
|
||||
"other",
|
||||
]
|
||||
]
|
||||
"""
|
||||
Reason for the failure. A ReceivedDebit might fail because the FinancialAccount doesn't have sufficient funds, is closed, or is frozen.
|
||||
"""
|
||||
financial_account: Optional[str]
|
||||
"""
|
||||
The FinancialAccount that funds were pulled from.
|
||||
"""
|
||||
hosted_regulatory_receipt_url: Optional[str]
|
||||
"""
|
||||
A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses.
|
||||
"""
|
||||
id: str
|
||||
"""
|
||||
Unique identifier for the object.
|
||||
"""
|
||||
initiating_payment_method_details: Optional[InitiatingPaymentMethodDetails]
|
||||
linked_flows: LinkedFlows
|
||||
livemode: bool
|
||||
"""
|
||||
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
"""
|
||||
network: Literal["ach", "card", "stripe"]
|
||||
"""
|
||||
The network used for the ReceivedDebit.
|
||||
"""
|
||||
object: Literal["treasury.received_debit"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
reversal_details: Optional[ReversalDetails]
|
||||
"""
|
||||
Details describing when a ReceivedDebit might be reversed.
|
||||
"""
|
||||
status: Literal["failed", "succeeded"]
|
||||
"""
|
||||
Status of the ReceivedDebit. ReceivedDebits are created with a status of either `succeeded` (approved) or `failed` (declined). The failure reason can be found under the `failure_code`.
|
||||
"""
|
||||
transaction: Optional[ExpandableField["Transaction"]]
|
||||
"""
|
||||
The Transaction associated with this object.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def list(
|
||||
cls, **params: Unpack["ReceivedDebitListParams"]
|
||||
) -> ListObject["ReceivedDebit"]:
|
||||
"""
|
||||
Returns a list of ReceivedDebits.
|
||||
"""
|
||||
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["ReceivedDebitListParams"]
|
||||
) -> ListObject["ReceivedDebit"]:
|
||||
"""
|
||||
Returns a list of ReceivedDebits.
|
||||
"""
|
||||
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["ReceivedDebitRetrieveParams"]
|
||||
) -> "ReceivedDebit":
|
||||
"""
|
||||
Retrieves the details of an existing ReceivedDebit by passing the unique ReceivedDebit ID from the ReceivedDebit list
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
instance.refresh()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
async def retrieve_async(
|
||||
cls, id: str, **params: Unpack["ReceivedDebitRetrieveParams"]
|
||||
) -> "ReceivedDebit":
|
||||
"""
|
||||
Retrieves the details of an existing ReceivedDebit by passing the unique ReceivedDebit ID from the ReceivedDebit list
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
await instance.refresh_async()
|
||||
return instance
|
||||
|
||||
class TestHelpers(APIResourceTestHelpers["ReceivedDebit"]):
|
||||
_resource_cls: Type["ReceivedDebit"]
|
||||
|
||||
@classmethod
|
||||
def create(
|
||||
cls, **params: Unpack["ReceivedDebitCreateParams"]
|
||||
) -> "ReceivedDebit":
|
||||
"""
|
||||
Use this endpoint to simulate a test mode ReceivedDebit initiated by a third party. In live mode, you can't directly create ReceivedDebits initiated by third parties.
|
||||
"""
|
||||
return cast(
|
||||
"ReceivedDebit",
|
||||
cls._static_request(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/received_debits",
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def create_async(
|
||||
cls, **params: Unpack["ReceivedDebitCreateParams"]
|
||||
) -> "ReceivedDebit":
|
||||
"""
|
||||
Use this endpoint to simulate a test mode ReceivedDebit initiated by a third party. In live mode, you can't directly create ReceivedDebits initiated by third parties.
|
||||
"""
|
||||
return cast(
|
||||
"ReceivedDebit",
|
||||
await cls._static_request_async(
|
||||
"post",
|
||||
"/v1/test_helpers/treasury/received_debits",
|
||||
params=params,
|
||||
),
|
||||
)
|
||||
|
||||
@property
|
||||
def test_helpers(self):
|
||||
return self.TestHelpers(self)
|
||||
|
||||
_inner_class_types = {
|
||||
"initiating_payment_method_details": InitiatingPaymentMethodDetails,
|
||||
"linked_flows": LinkedFlows,
|
||||
"reversal_details": ReversalDetails,
|
||||
}
|
||||
|
||||
|
||||
ReceivedDebit.TestHelpers._resource_cls = ReceivedDebit
|
||||
@@ -0,0 +1,97 @@
|
||||
# -*- 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.params.treasury._received_debit_list_params import (
|
||||
ReceivedDebitListParams,
|
||||
)
|
||||
from stripe.params.treasury._received_debit_retrieve_params import (
|
||||
ReceivedDebitRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._received_debit import ReceivedDebit
|
||||
|
||||
|
||||
class ReceivedDebitService(StripeService):
|
||||
def list(
|
||||
self,
|
||||
params: "ReceivedDebitListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[ReceivedDebit]":
|
||||
"""
|
||||
Returns a list of ReceivedDebits.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[ReceivedDebit]",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/received_debits",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
params: "ReceivedDebitListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[ReceivedDebit]":
|
||||
"""
|
||||
Returns a list of ReceivedDebits.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[ReceivedDebit]",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/received_debits",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["ReceivedDebitRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ReceivedDebit":
|
||||
"""
|
||||
Retrieves the details of an existing ReceivedDebit by passing the unique ReceivedDebit ID from the ReceivedDebit list
|
||||
"""
|
||||
return cast(
|
||||
"ReceivedDebit",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/received_debits/{id}".format(id=sanitize_id(id)),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["ReceivedDebitRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ReceivedDebit":
|
||||
"""
|
||||
Retrieves the details of an existing ReceivedDebit by passing the unique ReceivedDebit ID from the ReceivedDebit list
|
||||
"""
|
||||
return cast(
|
||||
"ReceivedDebit",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/received_debits/{id}".format(id=sanitize_id(id)),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,256 @@
|
||||
# -*- 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.issuing._authorization import Authorization
|
||||
from stripe.params.treasury._transaction_list_params import (
|
||||
TransactionListParams,
|
||||
)
|
||||
from stripe.params.treasury._transaction_retrieve_params import (
|
||||
TransactionRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._credit_reversal import CreditReversal
|
||||
from stripe.treasury._debit_reversal import DebitReversal
|
||||
from stripe.treasury._inbound_transfer import InboundTransfer
|
||||
from stripe.treasury._outbound_payment import OutboundPayment
|
||||
from stripe.treasury._outbound_transfer import OutboundTransfer
|
||||
from stripe.treasury._received_credit import ReceivedCredit
|
||||
from stripe.treasury._received_debit import ReceivedDebit
|
||||
from stripe.treasury._transaction_entry import TransactionEntry
|
||||
|
||||
|
||||
class Transaction(ListableAPIResource["Transaction"]):
|
||||
"""
|
||||
Transactions represent changes to a [FinancialAccount's](https://stripe.com/docs/api#financial_accounts) balance.
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["treasury.transaction"]] = (
|
||||
"treasury.transaction"
|
||||
)
|
||||
|
||||
class BalanceImpact(StripeObject):
|
||||
cash: int
|
||||
"""
|
||||
The change made to funds the user can spend right now.
|
||||
"""
|
||||
inbound_pending: int
|
||||
"""
|
||||
The change made to funds that are not spendable yet, but will become available at a later time.
|
||||
"""
|
||||
outbound_pending: int
|
||||
"""
|
||||
The change made to funds in the account, but not spendable because they are being held for pending outbound flows.
|
||||
"""
|
||||
|
||||
class FlowDetails(StripeObject):
|
||||
credit_reversal: Optional["CreditReversal"]
|
||||
"""
|
||||
You can reverse some [ReceivedCredits](https://stripe.com/docs/api#received_credits) depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a new object known as a CreditReversal.
|
||||
"""
|
||||
debit_reversal: Optional["DebitReversal"]
|
||||
"""
|
||||
You can reverse some [ReceivedDebits](https://stripe.com/docs/api#received_debits) depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal.
|
||||
"""
|
||||
inbound_transfer: Optional["InboundTransfer"]
|
||||
"""
|
||||
Use [InboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit.
|
||||
|
||||
Related guide: [Moving money with Treasury using InboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers)
|
||||
"""
|
||||
issuing_authorization: Optional["Authorization"]
|
||||
"""
|
||||
When an [issued card](https://stripe.com/docs/issuing) is used to make a purchase, an Issuing `Authorization`
|
||||
object is created. [Authorizations](https://stripe.com/docs/issuing/purchases/authorizations) must be approved for the
|
||||
purchase to be completed successfully.
|
||||
|
||||
Related guide: [Issued card authorizations](https://stripe.com/docs/issuing/purchases/authorizations)
|
||||
"""
|
||||
outbound_payment: Optional["OutboundPayment"]
|
||||
"""
|
||||
Use [OutboundPayments](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments) to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers).
|
||||
|
||||
Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects.
|
||||
|
||||
Related guide: [Moving money with Treasury using OutboundPayment objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments)
|
||||
"""
|
||||
outbound_transfer: Optional["OutboundTransfer"]
|
||||
"""
|
||||
Use [OutboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers) to transfer funds from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) to a PaymentMethod belonging to the same entity. To send funds to a different party, use [OutboundPayments](https://stripe.com/docs/api#outbound_payments) instead. You can send funds over ACH rails or through a domestic wire transfer to a user's own external bank account.
|
||||
|
||||
Simulate OutboundTransfer state changes with the `/v1/test_helpers/treasury/outbound_transfers` endpoints. These methods can only be called on test mode objects.
|
||||
|
||||
Related guide: [Moving money with Treasury using OutboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers)
|
||||
"""
|
||||
received_credit: Optional["ReceivedCredit"]
|
||||
"""
|
||||
ReceivedCredits represent funds sent to a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) (for example, via ACH or wire). These money movements are not initiated from the FinancialAccount.
|
||||
"""
|
||||
received_debit: Optional["ReceivedDebit"]
|
||||
"""
|
||||
ReceivedDebits represent funds pulled from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts). These are not initiated from the FinancialAccount.
|
||||
"""
|
||||
type: Literal[
|
||||
"credit_reversal",
|
||||
"debit_reversal",
|
||||
"inbound_transfer",
|
||||
"issuing_authorization",
|
||||
"other",
|
||||
"outbound_payment",
|
||||
"outbound_transfer",
|
||||
"received_credit",
|
||||
"received_debit",
|
||||
]
|
||||
"""
|
||||
Type of the flow that created the Transaction. Set to the same value as `flow_type`.
|
||||
"""
|
||||
|
||||
class StatusTransitions(StripeObject):
|
||||
posted_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when the Transaction changed status to `posted`.
|
||||
"""
|
||||
void_at: Optional[int]
|
||||
"""
|
||||
Timestamp describing when the Transaction changed status to `void`.
|
||||
"""
|
||||
|
||||
amount: int
|
||||
"""
|
||||
Amount (in cents) transferred.
|
||||
"""
|
||||
balance_impact: BalanceImpact
|
||||
"""
|
||||
Change to a FinancialAccount's balance
|
||||
"""
|
||||
created: int
|
||||
"""
|
||||
Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
"""
|
||||
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
|
||||
"""
|
||||
An arbitrary string attached to the object. Often useful for displaying to users.
|
||||
"""
|
||||
entries: Optional[ListObject["TransactionEntry"]]
|
||||
"""
|
||||
A list of TransactionEntries that are part of this Transaction. This cannot be expanded in any list endpoints.
|
||||
"""
|
||||
financial_account: str
|
||||
"""
|
||||
The FinancialAccount associated with this object.
|
||||
"""
|
||||
flow: Optional[str]
|
||||
"""
|
||||
ID of the flow that created the Transaction.
|
||||
"""
|
||||
flow_details: Optional[FlowDetails]
|
||||
"""
|
||||
Details of the flow that created the Transaction.
|
||||
"""
|
||||
flow_type: Literal[
|
||||
"credit_reversal",
|
||||
"debit_reversal",
|
||||
"inbound_transfer",
|
||||
"issuing_authorization",
|
||||
"other",
|
||||
"outbound_payment",
|
||||
"outbound_transfer",
|
||||
"received_credit",
|
||||
"received_debit",
|
||||
]
|
||||
"""
|
||||
Type of the flow that created the 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["treasury.transaction"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
status: Literal["open", "posted", "void"]
|
||||
"""
|
||||
Status of the Transaction.
|
||||
"""
|
||||
status_transitions: StatusTransitions
|
||||
|
||||
@classmethod
|
||||
def list(
|
||||
cls, **params: Unpack["TransactionListParams"]
|
||||
) -> ListObject["Transaction"]:
|
||||
"""
|
||||
Retrieves a list of 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"]:
|
||||
"""
|
||||
Retrieves a list of 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 an existing 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 an existing Transaction.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
await instance.refresh_async()
|
||||
return instance
|
||||
|
||||
_inner_class_types = {
|
||||
"balance_impact": BalanceImpact,
|
||||
"flow_details": FlowDetails,
|
||||
"status_transitions": StatusTransitions,
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
# -*- 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 typing import ClassVar, Optional
|
||||
from typing_extensions import Literal, Unpack, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from stripe.issuing._authorization import Authorization
|
||||
from stripe.params.treasury._transaction_entry_list_params import (
|
||||
TransactionEntryListParams,
|
||||
)
|
||||
from stripe.params.treasury._transaction_entry_retrieve_params import (
|
||||
TransactionEntryRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._credit_reversal import CreditReversal
|
||||
from stripe.treasury._debit_reversal import DebitReversal
|
||||
from stripe.treasury._inbound_transfer import InboundTransfer
|
||||
from stripe.treasury._outbound_payment import OutboundPayment
|
||||
from stripe.treasury._outbound_transfer import OutboundTransfer
|
||||
from stripe.treasury._received_credit import ReceivedCredit
|
||||
from stripe.treasury._received_debit import ReceivedDebit
|
||||
from stripe.treasury._transaction import Transaction
|
||||
|
||||
|
||||
class TransactionEntry(ListableAPIResource["TransactionEntry"]):
|
||||
"""
|
||||
TransactionEntries represent individual units of money movements within a single [Transaction](https://stripe.com/docs/api#transactions).
|
||||
"""
|
||||
|
||||
OBJECT_NAME: ClassVar[Literal["treasury.transaction_entry"]] = (
|
||||
"treasury.transaction_entry"
|
||||
)
|
||||
|
||||
class BalanceImpact(StripeObject):
|
||||
cash: int
|
||||
"""
|
||||
The change made to funds the user can spend right now.
|
||||
"""
|
||||
inbound_pending: int
|
||||
"""
|
||||
The change made to funds that are not spendable yet, but will become available at a later time.
|
||||
"""
|
||||
outbound_pending: int
|
||||
"""
|
||||
The change made to funds in the account, but not spendable because they are being held for pending outbound flows.
|
||||
"""
|
||||
|
||||
class FlowDetails(StripeObject):
|
||||
credit_reversal: Optional["CreditReversal"]
|
||||
"""
|
||||
You can reverse some [ReceivedCredits](https://stripe.com/docs/api#received_credits) depending on their network and source flow. Reversing a ReceivedCredit leads to the creation of a new object known as a CreditReversal.
|
||||
"""
|
||||
debit_reversal: Optional["DebitReversal"]
|
||||
"""
|
||||
You can reverse some [ReceivedDebits](https://stripe.com/docs/api#received_debits) depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal.
|
||||
"""
|
||||
inbound_transfer: Optional["InboundTransfer"]
|
||||
"""
|
||||
Use [InboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit.
|
||||
|
||||
Related guide: [Moving money with Treasury using InboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers)
|
||||
"""
|
||||
issuing_authorization: Optional["Authorization"]
|
||||
"""
|
||||
When an [issued card](https://stripe.com/docs/issuing) is used to make a purchase, an Issuing `Authorization`
|
||||
object is created. [Authorizations](https://stripe.com/docs/issuing/purchases/authorizations) must be approved for the
|
||||
purchase to be completed successfully.
|
||||
|
||||
Related guide: [Issued card authorizations](https://stripe.com/docs/issuing/purchases/authorizations)
|
||||
"""
|
||||
outbound_payment: Optional["OutboundPayment"]
|
||||
"""
|
||||
Use [OutboundPayments](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments) to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers).
|
||||
|
||||
Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects.
|
||||
|
||||
Related guide: [Moving money with Treasury using OutboundPayment objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments)
|
||||
"""
|
||||
outbound_transfer: Optional["OutboundTransfer"]
|
||||
"""
|
||||
Use [OutboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers) to transfer funds from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) to a PaymentMethod belonging to the same entity. To send funds to a different party, use [OutboundPayments](https://stripe.com/docs/api#outbound_payments) instead. You can send funds over ACH rails or through a domestic wire transfer to a user's own external bank account.
|
||||
|
||||
Simulate OutboundTransfer state changes with the `/v1/test_helpers/treasury/outbound_transfers` endpoints. These methods can only be called on test mode objects.
|
||||
|
||||
Related guide: [Moving money with Treasury using OutboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers)
|
||||
"""
|
||||
received_credit: Optional["ReceivedCredit"]
|
||||
"""
|
||||
ReceivedCredits represent funds sent to a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) (for example, via ACH or wire). These money movements are not initiated from the FinancialAccount.
|
||||
"""
|
||||
received_debit: Optional["ReceivedDebit"]
|
||||
"""
|
||||
ReceivedDebits represent funds pulled from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts). These are not initiated from the FinancialAccount.
|
||||
"""
|
||||
type: Literal[
|
||||
"credit_reversal",
|
||||
"debit_reversal",
|
||||
"inbound_transfer",
|
||||
"issuing_authorization",
|
||||
"other",
|
||||
"outbound_payment",
|
||||
"outbound_transfer",
|
||||
"received_credit",
|
||||
"received_debit",
|
||||
]
|
||||
"""
|
||||
Type of the flow that created the Transaction. Set to the same value as `flow_type`.
|
||||
"""
|
||||
|
||||
balance_impact: BalanceImpact
|
||||
"""
|
||||
Change to a FinancialAccount's balance
|
||||
"""
|
||||
created: int
|
||||
"""
|
||||
Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
"""
|
||||
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).
|
||||
"""
|
||||
effective_at: int
|
||||
"""
|
||||
When the TransactionEntry will impact the FinancialAccount's balance.
|
||||
"""
|
||||
financial_account: str
|
||||
"""
|
||||
The FinancialAccount associated with this object.
|
||||
"""
|
||||
flow: Optional[str]
|
||||
"""
|
||||
Token of the flow associated with the TransactionEntry.
|
||||
"""
|
||||
flow_details: Optional[FlowDetails]
|
||||
"""
|
||||
Details of the flow associated with the TransactionEntry.
|
||||
"""
|
||||
flow_type: Literal[
|
||||
"credit_reversal",
|
||||
"debit_reversal",
|
||||
"inbound_transfer",
|
||||
"issuing_authorization",
|
||||
"other",
|
||||
"outbound_payment",
|
||||
"outbound_transfer",
|
||||
"received_credit",
|
||||
"received_debit",
|
||||
]
|
||||
"""
|
||||
Type of the flow associated with the TransactionEntry.
|
||||
"""
|
||||
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["treasury.transaction_entry"]
|
||||
"""
|
||||
String representing the object's type. Objects of the same type share the same value.
|
||||
"""
|
||||
transaction: ExpandableField["Transaction"]
|
||||
"""
|
||||
The Transaction associated with this object.
|
||||
"""
|
||||
type: Literal[
|
||||
"credit_reversal",
|
||||
"credit_reversal_posting",
|
||||
"debit_reversal",
|
||||
"inbound_transfer",
|
||||
"inbound_transfer_return",
|
||||
"issuing_authorization_hold",
|
||||
"issuing_authorization_release",
|
||||
"other",
|
||||
"outbound_payment",
|
||||
"outbound_payment_cancellation",
|
||||
"outbound_payment_failure",
|
||||
"outbound_payment_posting",
|
||||
"outbound_payment_return",
|
||||
"outbound_transfer",
|
||||
"outbound_transfer_cancellation",
|
||||
"outbound_transfer_failure",
|
||||
"outbound_transfer_posting",
|
||||
"outbound_transfer_return",
|
||||
"received_credit",
|
||||
"received_debit",
|
||||
]
|
||||
"""
|
||||
The specific money movement that generated the TransactionEntry.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def list(
|
||||
cls, **params: Unpack["TransactionEntryListParams"]
|
||||
) -> ListObject["TransactionEntry"]:
|
||||
"""
|
||||
Retrieves a list of TransactionEntry 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["TransactionEntryListParams"]
|
||||
) -> ListObject["TransactionEntry"]:
|
||||
"""
|
||||
Retrieves a list of TransactionEntry 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["TransactionEntryRetrieveParams"]
|
||||
) -> "TransactionEntry":
|
||||
"""
|
||||
Retrieves a TransactionEntry object.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
instance.refresh()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
async def retrieve_async(
|
||||
cls, id: str, **params: Unpack["TransactionEntryRetrieveParams"]
|
||||
) -> "TransactionEntry":
|
||||
"""
|
||||
Retrieves a TransactionEntry object.
|
||||
"""
|
||||
instance = cls(id, **params)
|
||||
await instance.refresh_async()
|
||||
return instance
|
||||
|
||||
@classmethod
|
||||
def class_url(cls):
|
||||
return "/v1/treasury/transaction_entries"
|
||||
|
||||
_inner_class_types = {
|
||||
"balance_impact": BalanceImpact,
|
||||
"flow_details": FlowDetails,
|
||||
}
|
||||
@@ -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.params.treasury._transaction_entry_list_params import (
|
||||
TransactionEntryListParams,
|
||||
)
|
||||
from stripe.params.treasury._transaction_entry_retrieve_params import (
|
||||
TransactionEntryRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._transaction_entry import TransactionEntry
|
||||
|
||||
|
||||
class TransactionEntryService(StripeService):
|
||||
def list(
|
||||
self,
|
||||
params: "TransactionEntryListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[TransactionEntry]":
|
||||
"""
|
||||
Retrieves a list of TransactionEntry objects.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[TransactionEntry]",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/transaction_entries",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
params: "TransactionEntryListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[TransactionEntry]":
|
||||
"""
|
||||
Retrieves a list of TransactionEntry objects.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[TransactionEntry]",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/transaction_entries",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["TransactionEntryRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "TransactionEntry":
|
||||
"""
|
||||
Retrieves a TransactionEntry object.
|
||||
"""
|
||||
return cast(
|
||||
"TransactionEntry",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/transaction_entries/{id}".format(
|
||||
id=sanitize_id(id),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["TransactionEntryRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "TransactionEntry":
|
||||
"""
|
||||
Retrieves a TransactionEntry object.
|
||||
"""
|
||||
return cast(
|
||||
"TransactionEntry",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/transaction_entries/{id}".format(
|
||||
id=sanitize_id(id),
|
||||
),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
@@ -0,0 +1,97 @@
|
||||
# -*- 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.params.treasury._transaction_list_params import (
|
||||
TransactionListParams,
|
||||
)
|
||||
from stripe.params.treasury._transaction_retrieve_params import (
|
||||
TransactionRetrieveParams,
|
||||
)
|
||||
from stripe.treasury._transaction import Transaction
|
||||
|
||||
|
||||
class TransactionService(StripeService):
|
||||
def list(
|
||||
self,
|
||||
params: "TransactionListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[Transaction]":
|
||||
"""
|
||||
Retrieves a list of Transaction objects.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[Transaction]",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/transactions",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
params: "TransactionListParams",
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "ListObject[Transaction]":
|
||||
"""
|
||||
Retrieves a list of Transaction objects.
|
||||
"""
|
||||
return cast(
|
||||
"ListObject[Transaction]",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/transactions",
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
def retrieve(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["TransactionRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "Transaction":
|
||||
"""
|
||||
Retrieves the details of an existing Transaction.
|
||||
"""
|
||||
return cast(
|
||||
"Transaction",
|
||||
self._request(
|
||||
"get",
|
||||
"/v1/treasury/transactions/{id}".format(id=sanitize_id(id)),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
|
||||
async def retrieve_async(
|
||||
self,
|
||||
id: str,
|
||||
params: Optional["TransactionRetrieveParams"] = None,
|
||||
options: Optional["RequestOptions"] = None,
|
||||
) -> "Transaction":
|
||||
"""
|
||||
Retrieves the details of an existing Transaction.
|
||||
"""
|
||||
return cast(
|
||||
"Transaction",
|
||||
await self._request_async(
|
||||
"get",
|
||||
"/v1/treasury/transactions/{id}".format(id=sanitize_id(id)),
|
||||
base_address="api",
|
||||
params=params,
|
||||
options=options,
|
||||
),
|
||||
)
|
||||
Reference in New Issue
Block a user