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

View File

@@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from importlib import import_module
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe.test_helpers import (
issuing as issuing,
terminal as terminal,
treasury as treasury,
)
from stripe.test_helpers._confirmation_token_service import (
ConfirmationTokenService as ConfirmationTokenService,
)
from stripe.test_helpers._customer_service import (
CustomerService as CustomerService,
)
from stripe.test_helpers._issuing_service import (
IssuingService as IssuingService,
)
from stripe.test_helpers._refund_service import (
RefundService as RefundService,
)
from stripe.test_helpers._terminal_service import (
TerminalService as TerminalService,
)
from stripe.test_helpers._test_clock import TestClock as TestClock
from stripe.test_helpers._test_clock_service import (
TestClockService as TestClockService,
)
from stripe.test_helpers._treasury_service import (
TreasuryService as TreasuryService,
)
# name -> (import_target, is_submodule)
_import_map = {
"issuing": ("stripe.test_helpers.issuing", True),
"terminal": ("stripe.test_helpers.terminal", True),
"treasury": ("stripe.test_helpers.treasury", True),
"ConfirmationTokenService": (
"stripe.test_helpers._confirmation_token_service",
False,
),
"CustomerService": ("stripe.test_helpers._customer_service", False),
"IssuingService": ("stripe.test_helpers._issuing_service", False),
"RefundService": ("stripe.test_helpers._refund_service", False),
"TerminalService": ("stripe.test_helpers._terminal_service", False),
"TestClock": ("stripe.test_helpers._test_clock", False),
"TestClockService": ("stripe.test_helpers._test_clock_service", False),
"TreasuryService": ("stripe.test_helpers._treasury_service", False),
}
if not TYPE_CHECKING:
def __getattr__(name):
try:
target, is_submodule = _import_map[name]
module = import_module(target)
if is_submodule:
return module
return getattr(
module,
name,
)
except KeyError:
raise AttributeError()

View File

@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from typing import Optional, cast
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe._confirmation_token import ConfirmationToken
from stripe._request_options import RequestOptions
from stripe.params.test_helpers._confirmation_token_create_params import (
ConfirmationTokenCreateParams,
)
class ConfirmationTokenService(StripeService):
def create(
self,
params: Optional["ConfirmationTokenCreateParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "ConfirmationToken":
"""
Creates a test mode Confirmation Token server side for your integration tests.
"""
return cast(
"ConfirmationToken",
self._request(
"post",
"/v1/test_helpers/confirmation_tokens",
base_address="api",
params=params,
options=options,
),
)
async def create_async(
self,
params: Optional["ConfirmationTokenCreateParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "ConfirmationToken":
"""
Creates a test mode Confirmation Token server side for your integration tests.
"""
return cast(
"ConfirmationToken",
await self._request_async(
"post",
"/v1/test_helpers/confirmation_tokens",
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,61 @@
# -*- 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._customer_cash_balance_transaction import (
CustomerCashBalanceTransaction,
)
from stripe._request_options import RequestOptions
from stripe.params.test_helpers._customer_fund_cash_balance_params import (
CustomerFundCashBalanceParams,
)
class CustomerService(StripeService):
def fund_cash_balance(
self,
customer: str,
params: "CustomerFundCashBalanceParams",
options: Optional["RequestOptions"] = None,
) -> "CustomerCashBalanceTransaction":
"""
Create an incoming testmode bank transfer
"""
return cast(
"CustomerCashBalanceTransaction",
self._request(
"post",
"/v1/test_helpers/customers/{customer}/fund_cash_balance".format(
customer=sanitize_id(customer),
),
base_address="api",
params=params,
options=options,
),
)
async def fund_cash_balance_async(
self,
customer: str,
params: "CustomerFundCashBalanceParams",
options: Optional["RequestOptions"] = None,
) -> "CustomerCashBalanceTransaction":
"""
Create an incoming testmode bank transfer
"""
return cast(
"CustomerCashBalanceTransaction",
await self._request_async(
"post",
"/v1/test_helpers/customers/{customer}/fund_cash_balance".format(
customer=sanitize_id(customer),
),
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from importlib import import_module
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe.test_helpers.issuing._authorization_service import (
AuthorizationService,
)
from stripe.test_helpers.issuing._card_service import CardService
from stripe.test_helpers.issuing._personalization_design_service import (
PersonalizationDesignService,
)
from stripe.test_helpers.issuing._transaction_service import (
TransactionService,
)
_subservices = {
"authorizations": [
"stripe.test_helpers.issuing._authorization_service",
"AuthorizationService",
],
"cards": ["stripe.test_helpers.issuing._card_service", "CardService"],
"personalization_designs": [
"stripe.test_helpers.issuing._personalization_design_service",
"PersonalizationDesignService",
],
"transactions": [
"stripe.test_helpers.issuing._transaction_service",
"TransactionService",
],
}
class IssuingService(StripeService):
authorizations: "AuthorizationService"
cards: "CardService"
personalization_designs: "PersonalizationDesignService"
transactions: "TransactionService"
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()

View File

@@ -0,0 +1,59 @@
# -*- 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._refund import Refund
from stripe._request_options import RequestOptions
from stripe.params.test_helpers._refund_expire_params import (
RefundExpireParams,
)
class RefundService(StripeService):
def expire(
self,
refund: str,
params: Optional["RefundExpireParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Refund":
"""
Expire a refund with a status of requires_action.
"""
return cast(
"Refund",
self._request(
"post",
"/v1/test_helpers/refunds/{refund}/expire".format(
refund=sanitize_id(refund),
),
base_address="api",
params=params,
options=options,
),
)
async def expire_async(
self,
refund: str,
params: Optional["RefundExpireParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Refund":
"""
Expire a refund with a status of requires_action.
"""
return cast(
"Refund",
await self._request_async(
"post",
"/v1/test_helpers/refunds/{refund}/expire".format(
refund=sanitize_id(refund),
),
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from importlib import import_module
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe.test_helpers.terminal._reader_service import ReaderService
_subservices = {
"readers": [
"stripe.test_helpers.terminal._reader_service",
"ReaderService",
],
}
class TerminalService(StripeService):
readers: "ReaderService"
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()

View File

@@ -0,0 +1,391 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._createable_api_resource import CreateableAPIResource
from stripe._deletable_api_resource import DeletableAPIResource
from stripe._list_object import ListObject
from stripe._listable_api_resource import ListableAPIResource
from stripe._stripe_object import StripeObject
from stripe._util import class_method_variant, sanitize_id
from typing import ClassVar, Optional, cast, overload
from typing_extensions import Literal, Unpack, TYPE_CHECKING
if TYPE_CHECKING:
from stripe.params.test_helpers._test_clock_advance_params import (
TestClockAdvanceParams,
)
from stripe.params.test_helpers._test_clock_create_params import (
TestClockCreateParams,
)
from stripe.params.test_helpers._test_clock_delete_params import (
TestClockDeleteParams,
)
from stripe.params.test_helpers._test_clock_list_params import (
TestClockListParams,
)
from stripe.params.test_helpers._test_clock_retrieve_params import (
TestClockRetrieveParams,
)
class TestClock(
CreateableAPIResource["TestClock"],
DeletableAPIResource["TestClock"],
ListableAPIResource["TestClock"],
):
"""
A test clock enables deterministic control over objects in testmode. With a test clock, you can create
objects at a frozen time in the past or future, and advance to a specific future time to observe webhooks and state changes. After the clock advances,
you can either validate the current state of your scenario (and test your assumptions), change the current state of your scenario (and test more complex scenarios), or keep advancing forward in time.
"""
OBJECT_NAME: ClassVar[Literal["test_helpers.test_clock"]] = (
"test_helpers.test_clock"
)
class StatusDetails(StripeObject):
class Advancing(StripeObject):
target_frozen_time: int
"""
The `frozen_time` that the Test Clock is advancing towards.
"""
advancing: Optional[Advancing]
_inner_class_types = {"advancing": Advancing}
created: int
"""
Time at which the object was created. Measured in seconds since the Unix epoch.
"""
deleted: Optional[Literal[True]]
"""
Always true for a deleted object
"""
deletes_after: int
"""
Time at which this clock is scheduled to auto delete.
"""
frozen_time: int
"""
Time at which all objects belonging to this clock are frozen.
"""
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.
"""
name: Optional[str]
"""
The custom name supplied at creation.
"""
object: Literal["test_helpers.test_clock"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
status: Literal["advancing", "internal_failure", "ready"]
"""
The status of the Test Clock.
"""
status_details: StatusDetails
@classmethod
def _cls_advance(
cls, test_clock: str, **params: Unpack["TestClockAdvanceParams"]
) -> "TestClock":
"""
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
"""
return cast(
"TestClock",
cls._static_request(
"post",
"/v1/test_helpers/test_clocks/{test_clock}/advance".format(
test_clock=sanitize_id(test_clock)
),
params=params,
),
)
@overload
@staticmethod
def advance(
test_clock: str, **params: Unpack["TestClockAdvanceParams"]
) -> "TestClock":
"""
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
"""
...
@overload
def advance(
self, **params: Unpack["TestClockAdvanceParams"]
) -> "TestClock":
"""
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
"""
...
@class_method_variant("_cls_advance")
def advance( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["TestClockAdvanceParams"]
) -> "TestClock":
"""
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
"""
return cast(
"TestClock",
self._request(
"post",
"/v1/test_helpers/test_clocks/{test_clock}/advance".format(
test_clock=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
async def _cls_advance_async(
cls, test_clock: str, **params: Unpack["TestClockAdvanceParams"]
) -> "TestClock":
"""
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
"""
return cast(
"TestClock",
await cls._static_request_async(
"post",
"/v1/test_helpers/test_clocks/{test_clock}/advance".format(
test_clock=sanitize_id(test_clock)
),
params=params,
),
)
@overload
@staticmethod
async def advance_async(
test_clock: str, **params: Unpack["TestClockAdvanceParams"]
) -> "TestClock":
"""
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
"""
...
@overload
async def advance_async(
self, **params: Unpack["TestClockAdvanceParams"]
) -> "TestClock":
"""
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
"""
...
@class_method_variant("_cls_advance_async")
async def advance_async( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["TestClockAdvanceParams"]
) -> "TestClock":
"""
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
"""
return cast(
"TestClock",
await self._request_async(
"post",
"/v1/test_helpers/test_clocks/{test_clock}/advance".format(
test_clock=sanitize_id(self.get("id"))
),
params=params,
),
)
@classmethod
def create(cls, **params: Unpack["TestClockCreateParams"]) -> "TestClock":
"""
Creates a new test clock that can be attached to new customers and quotes.
"""
return cast(
"TestClock",
cls._static_request(
"post",
cls.class_url(),
params=params,
),
)
@classmethod
async def create_async(
cls, **params: Unpack["TestClockCreateParams"]
) -> "TestClock":
"""
Creates a new test clock that can be attached to new customers and quotes.
"""
return cast(
"TestClock",
await cls._static_request_async(
"post",
cls.class_url(),
params=params,
),
)
@classmethod
def _cls_delete(
cls, sid: str, **params: Unpack["TestClockDeleteParams"]
) -> "TestClock":
"""
Deletes a test clock.
"""
url = "%s/%s" % (cls.class_url(), sanitize_id(sid))
return cast(
"TestClock",
cls._static_request(
"delete",
url,
params=params,
),
)
@overload
@staticmethod
def delete(
sid: str, **params: Unpack["TestClockDeleteParams"]
) -> "TestClock":
"""
Deletes a test clock.
"""
...
@overload
def delete(self, **params: Unpack["TestClockDeleteParams"]) -> "TestClock":
"""
Deletes a test clock.
"""
...
@class_method_variant("_cls_delete")
def delete( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["TestClockDeleteParams"]
) -> "TestClock":
"""
Deletes a test clock.
"""
return self._request_and_refresh(
"delete",
self.instance_url(),
params=params,
)
@classmethod
async def _cls_delete_async(
cls, sid: str, **params: Unpack["TestClockDeleteParams"]
) -> "TestClock":
"""
Deletes a test clock.
"""
url = "%s/%s" % (cls.class_url(), sanitize_id(sid))
return cast(
"TestClock",
await cls._static_request_async(
"delete",
url,
params=params,
),
)
@overload
@staticmethod
async def delete_async(
sid: str, **params: Unpack["TestClockDeleteParams"]
) -> "TestClock":
"""
Deletes a test clock.
"""
...
@overload
async def delete_async(
self, **params: Unpack["TestClockDeleteParams"]
) -> "TestClock":
"""
Deletes a test clock.
"""
...
@class_method_variant("_cls_delete_async")
async def delete_async( # pyright: ignore[reportGeneralTypeIssues]
self, **params: Unpack["TestClockDeleteParams"]
) -> "TestClock":
"""
Deletes a test clock.
"""
return await self._request_and_refresh_async(
"delete",
self.instance_url(),
params=params,
)
@classmethod
def list(
cls, **params: Unpack["TestClockListParams"]
) -> ListObject["TestClock"]:
"""
Returns a list of your test clocks.
"""
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["TestClockListParams"]
) -> ListObject["TestClock"]:
"""
Returns a list of your test clocks.
"""
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["TestClockRetrieveParams"]
) -> "TestClock":
"""
Retrieves a test clock.
"""
instance = cls(id, **params)
instance.refresh()
return instance
@classmethod
async def retrieve_async(
cls, id: str, **params: Unpack["TestClockRetrieveParams"]
) -> "TestClock":
"""
Retrieves a test clock.
"""
instance = cls(id, **params)
await instance.refresh_async()
return instance
_inner_class_types = {"status_details": StatusDetails}

View File

@@ -0,0 +1,236 @@
# -*- 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.test_helpers._test_clock_advance_params import (
TestClockAdvanceParams,
)
from stripe.params.test_helpers._test_clock_create_params import (
TestClockCreateParams,
)
from stripe.params.test_helpers._test_clock_delete_params import (
TestClockDeleteParams,
)
from stripe.params.test_helpers._test_clock_list_params import (
TestClockListParams,
)
from stripe.params.test_helpers._test_clock_retrieve_params import (
TestClockRetrieveParams,
)
from stripe.test_helpers._test_clock import TestClock
class TestClockService(StripeService):
def delete(
self,
test_clock: str,
params: Optional["TestClockDeleteParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "TestClock":
"""
Deletes a test clock.
"""
return cast(
"TestClock",
self._request(
"delete",
"/v1/test_helpers/test_clocks/{test_clock}".format(
test_clock=sanitize_id(test_clock),
),
base_address="api",
params=params,
options=options,
),
)
async def delete_async(
self,
test_clock: str,
params: Optional["TestClockDeleteParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "TestClock":
"""
Deletes a test clock.
"""
return cast(
"TestClock",
await self._request_async(
"delete",
"/v1/test_helpers/test_clocks/{test_clock}".format(
test_clock=sanitize_id(test_clock),
),
base_address="api",
params=params,
options=options,
),
)
def retrieve(
self,
test_clock: str,
params: Optional["TestClockRetrieveParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "TestClock":
"""
Retrieves a test clock.
"""
return cast(
"TestClock",
self._request(
"get",
"/v1/test_helpers/test_clocks/{test_clock}".format(
test_clock=sanitize_id(test_clock),
),
base_address="api",
params=params,
options=options,
),
)
async def retrieve_async(
self,
test_clock: str,
params: Optional["TestClockRetrieveParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "TestClock":
"""
Retrieves a test clock.
"""
return cast(
"TestClock",
await self._request_async(
"get",
"/v1/test_helpers/test_clocks/{test_clock}".format(
test_clock=sanitize_id(test_clock),
),
base_address="api",
params=params,
options=options,
),
)
def list(
self,
params: Optional["TestClockListParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "ListObject[TestClock]":
"""
Returns a list of your test clocks.
"""
return cast(
"ListObject[TestClock]",
self._request(
"get",
"/v1/test_helpers/test_clocks",
base_address="api",
params=params,
options=options,
),
)
async def list_async(
self,
params: Optional["TestClockListParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "ListObject[TestClock]":
"""
Returns a list of your test clocks.
"""
return cast(
"ListObject[TestClock]",
await self._request_async(
"get",
"/v1/test_helpers/test_clocks",
base_address="api",
params=params,
options=options,
),
)
def create(
self,
params: "TestClockCreateParams",
options: Optional["RequestOptions"] = None,
) -> "TestClock":
"""
Creates a new test clock that can be attached to new customers and quotes.
"""
return cast(
"TestClock",
self._request(
"post",
"/v1/test_helpers/test_clocks",
base_address="api",
params=params,
options=options,
),
)
async def create_async(
self,
params: "TestClockCreateParams",
options: Optional["RequestOptions"] = None,
) -> "TestClock":
"""
Creates a new test clock that can be attached to new customers and quotes.
"""
return cast(
"TestClock",
await self._request_async(
"post",
"/v1/test_helpers/test_clocks",
base_address="api",
params=params,
options=options,
),
)
def advance(
self,
test_clock: str,
params: "TestClockAdvanceParams",
options: Optional["RequestOptions"] = None,
) -> "TestClock":
"""
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
"""
return cast(
"TestClock",
self._request(
"post",
"/v1/test_helpers/test_clocks/{test_clock}/advance".format(
test_clock=sanitize_id(test_clock),
),
base_address="api",
params=params,
options=options,
),
)
async def advance_async(
self,
test_clock: str,
params: "TestClockAdvanceParams",
options: Optional["RequestOptions"] = None,
) -> "TestClock":
"""
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
"""
return cast(
"TestClock",
await self._request_async(
"post",
"/v1/test_helpers/test_clocks/{test_clock}/advance".format(
test_clock=sanitize_id(test_clock),
),
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,72 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from importlib import import_module
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe.test_helpers.treasury._inbound_transfer_service import (
InboundTransferService,
)
from stripe.test_helpers.treasury._outbound_payment_service import (
OutboundPaymentService,
)
from stripe.test_helpers.treasury._outbound_transfer_service import (
OutboundTransferService,
)
from stripe.test_helpers.treasury._received_credit_service import (
ReceivedCreditService,
)
from stripe.test_helpers.treasury._received_debit_service import (
ReceivedDebitService,
)
_subservices = {
"inbound_transfers": [
"stripe.test_helpers.treasury._inbound_transfer_service",
"InboundTransferService",
],
"outbound_payments": [
"stripe.test_helpers.treasury._outbound_payment_service",
"OutboundPaymentService",
],
"outbound_transfers": [
"stripe.test_helpers.treasury._outbound_transfer_service",
"OutboundTransferService",
],
"received_credits": [
"stripe.test_helpers.treasury._received_credit_service",
"ReceivedCreditService",
],
"received_debits": [
"stripe.test_helpers.treasury._received_debit_service",
"ReceivedDebitService",
],
}
class TreasuryService(StripeService):
inbound_transfers: "InboundTransferService"
outbound_payments: "OutboundPaymentService"
outbound_transfers: "OutboundTransferService"
received_credits: "ReceivedCreditService"
received_debits: "ReceivedDebitService"
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()

View File

@@ -0,0 +1,50 @@
# -*- 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.test_helpers.issuing._authorization_service import (
AuthorizationService as AuthorizationService,
)
from stripe.test_helpers.issuing._card_service import (
CardService as CardService,
)
from stripe.test_helpers.issuing._personalization_design_service import (
PersonalizationDesignService as PersonalizationDesignService,
)
from stripe.test_helpers.issuing._transaction_service import (
TransactionService as TransactionService,
)
# name -> (import_target, is_submodule)
_import_map = {
"AuthorizationService": (
"stripe.test_helpers.issuing._authorization_service",
False,
),
"CardService": ("stripe.test_helpers.issuing._card_service", False),
"PersonalizationDesignService": (
"stripe.test_helpers.issuing._personalization_design_service",
False,
),
"TransactionService": (
"stripe.test_helpers.issuing._transaction_service",
False,
),
}
if not TYPE_CHECKING:
def __getattr__(name):
try:
target, is_submodule = _import_map[name]
module = import_module(target)
if is_submodule:
return module
return getattr(
module,
name,
)
except KeyError:
raise AttributeError()

View File

@@ -0,0 +1,335 @@
# -*- 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.issuing._authorization import Authorization
from stripe.params.test_helpers.issuing._authorization_capture_params import (
AuthorizationCaptureParams,
)
from stripe.params.test_helpers.issuing._authorization_create_params import (
AuthorizationCreateParams,
)
from stripe.params.test_helpers.issuing._authorization_expire_params import (
AuthorizationExpireParams,
)
from stripe.params.test_helpers.issuing._authorization_finalize_amount_params import (
AuthorizationFinalizeAmountParams,
)
from stripe.params.test_helpers.issuing._authorization_increment_params import (
AuthorizationIncrementParams,
)
from stripe.params.test_helpers.issuing._authorization_respond_params import (
AuthorizationRespondParams,
)
from stripe.params.test_helpers.issuing._authorization_reverse_params import (
AuthorizationReverseParams,
)
class AuthorizationService(StripeService):
def create(
self,
params: "AuthorizationCreateParams",
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Create a test-mode authorization.
"""
return cast(
"Authorization",
self._request(
"post",
"/v1/test_helpers/issuing/authorizations",
base_address="api",
params=params,
options=options,
),
)
async def create_async(
self,
params: "AuthorizationCreateParams",
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Create a test-mode authorization.
"""
return cast(
"Authorization",
await self._request_async(
"post",
"/v1/test_helpers/issuing/authorizations",
base_address="api",
params=params,
options=options,
),
)
def capture(
self,
authorization: str,
params: Optional["AuthorizationCaptureParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Capture a test-mode authorization.
"""
return cast(
"Authorization",
self._request(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/capture".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)
async def capture_async(
self,
authorization: str,
params: Optional["AuthorizationCaptureParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Capture a test-mode authorization.
"""
return cast(
"Authorization",
await self._request_async(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/capture".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)
def expire(
self,
authorization: str,
params: Optional["AuthorizationExpireParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Expire a test-mode Authorization.
"""
return cast(
"Authorization",
self._request(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/expire".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)
async def expire_async(
self,
authorization: str,
params: Optional["AuthorizationExpireParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Expire a test-mode Authorization.
"""
return cast(
"Authorization",
await self._request_async(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/expire".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)
def finalize_amount(
self,
authorization: str,
params: "AuthorizationFinalizeAmountParams",
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
"""
return cast(
"Authorization",
self._request(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/finalize_amount".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)
async def finalize_amount_async(
self,
authorization: str,
params: "AuthorizationFinalizeAmountParams",
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
"""
return cast(
"Authorization",
await self._request_async(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/finalize_amount".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)
def respond(
self,
authorization: str,
params: "AuthorizationRespondParams",
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
"""
return cast(
"Authorization",
self._request(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)
async def respond_async(
self,
authorization: str,
params: "AuthorizationRespondParams",
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
"""
return cast(
"Authorization",
await self._request_async(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)
def increment(
self,
authorization: str,
params: "AuthorizationIncrementParams",
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Increment a test-mode Authorization.
"""
return cast(
"Authorization",
self._request(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/increment".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)
async def increment_async(
self,
authorization: str,
params: "AuthorizationIncrementParams",
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Increment a test-mode Authorization.
"""
return cast(
"Authorization",
await self._request_async(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/increment".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)
def reverse(
self,
authorization: str,
params: Optional["AuthorizationReverseParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Reverse a test-mode Authorization.
"""
return cast(
"Authorization",
self._request(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/reverse".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)
async def reverse_async(
self,
authorization: str,
params: Optional["AuthorizationReverseParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Authorization":
"""
Reverse a test-mode Authorization.
"""
return cast(
"Authorization",
await self._request_async(
"post",
"/v1/test_helpers/issuing/authorizations/{authorization}/reverse".format(
authorization=sanitize_id(authorization),
),
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,247 @@
# -*- 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.issuing._card import Card
from stripe.params.test_helpers.issuing._card_deliver_card_params import (
CardDeliverCardParams,
)
from stripe.params.test_helpers.issuing._card_fail_card_params import (
CardFailCardParams,
)
from stripe.params.test_helpers.issuing._card_return_card_params import (
CardReturnCardParams,
)
from stripe.params.test_helpers.issuing._card_ship_card_params import (
CardShipCardParams,
)
from stripe.params.test_helpers.issuing._card_submit_card_params import (
CardSubmitCardParams,
)
class CardService(StripeService):
def deliver_card(
self,
card: str,
params: Optional["CardDeliverCardParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Card":
"""
Updates the shipping status of the specified Issuing Card object to delivered.
"""
return cast(
"Card",
self._request(
"post",
"/v1/test_helpers/issuing/cards/{card}/shipping/deliver".format(
card=sanitize_id(card),
),
base_address="api",
params=params,
options=options,
),
)
async def deliver_card_async(
self,
card: str,
params: Optional["CardDeliverCardParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Card":
"""
Updates the shipping status of the specified Issuing Card object to delivered.
"""
return cast(
"Card",
await self._request_async(
"post",
"/v1/test_helpers/issuing/cards/{card}/shipping/deliver".format(
card=sanitize_id(card),
),
base_address="api",
params=params,
options=options,
),
)
def fail_card(
self,
card: str,
params: Optional["CardFailCardParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Card":
"""
Updates the shipping status of the specified Issuing Card object to failure.
"""
return cast(
"Card",
self._request(
"post",
"/v1/test_helpers/issuing/cards/{card}/shipping/fail".format(
card=sanitize_id(card),
),
base_address="api",
params=params,
options=options,
),
)
async def fail_card_async(
self,
card: str,
params: Optional["CardFailCardParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Card":
"""
Updates the shipping status of the specified Issuing Card object to failure.
"""
return cast(
"Card",
await self._request_async(
"post",
"/v1/test_helpers/issuing/cards/{card}/shipping/fail".format(
card=sanitize_id(card),
),
base_address="api",
params=params,
options=options,
),
)
def return_card(
self,
card: str,
params: Optional["CardReturnCardParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Card":
"""
Updates the shipping status of the specified Issuing Card object to returned.
"""
return cast(
"Card",
self._request(
"post",
"/v1/test_helpers/issuing/cards/{card}/shipping/return".format(
card=sanitize_id(card),
),
base_address="api",
params=params,
options=options,
),
)
async def return_card_async(
self,
card: str,
params: Optional["CardReturnCardParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Card":
"""
Updates the shipping status of the specified Issuing Card object to returned.
"""
return cast(
"Card",
await self._request_async(
"post",
"/v1/test_helpers/issuing/cards/{card}/shipping/return".format(
card=sanitize_id(card),
),
base_address="api",
params=params,
options=options,
),
)
def ship_card(
self,
card: str,
params: Optional["CardShipCardParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Card":
"""
Updates the shipping status of the specified Issuing Card object to shipped.
"""
return cast(
"Card",
self._request(
"post",
"/v1/test_helpers/issuing/cards/{card}/shipping/ship".format(
card=sanitize_id(card),
),
base_address="api",
params=params,
options=options,
),
)
async def ship_card_async(
self,
card: str,
params: Optional["CardShipCardParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Card":
"""
Updates the shipping status of the specified Issuing Card object to shipped.
"""
return cast(
"Card",
await self._request_async(
"post",
"/v1/test_helpers/issuing/cards/{card}/shipping/ship".format(
card=sanitize_id(card),
),
base_address="api",
params=params,
options=options,
),
)
def submit_card(
self,
card: str,
params: Optional["CardSubmitCardParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Card":
"""
Updates the shipping status of the specified Issuing Card object to submitted. This method requires Stripe Version 2024-09-30.acacia' or later.
"""
return cast(
"Card",
self._request(
"post",
"/v1/test_helpers/issuing/cards/{card}/shipping/submit".format(
card=sanitize_id(card),
),
base_address="api",
params=params,
options=options,
),
)
async def submit_card_async(
self,
card: str,
params: Optional["CardSubmitCardParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Card":
"""
Updates the shipping status of the specified Issuing Card object to submitted. This method requires Stripe Version 2024-09-30.acacia' or later.
"""
return cast(
"Card",
await self._request_async(
"post",
"/v1/test_helpers/issuing/cards/{card}/shipping/submit".format(
card=sanitize_id(card),
),
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,153 @@
# -*- 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.issuing._personalization_design import PersonalizationDesign
from stripe.params.test_helpers.issuing._personalization_design_activate_params import (
PersonalizationDesignActivateParams,
)
from stripe.params.test_helpers.issuing._personalization_design_deactivate_params import (
PersonalizationDesignDeactivateParams,
)
from stripe.params.test_helpers.issuing._personalization_design_reject_params import (
PersonalizationDesignRejectParams,
)
class PersonalizationDesignService(StripeService):
def activate(
self,
personalization_design: str,
params: Optional["PersonalizationDesignActivateParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "PersonalizationDesign":
"""
Updates the status of the specified testmode personalization design object to active.
"""
return cast(
"PersonalizationDesign",
self._request(
"post",
"/v1/test_helpers/issuing/personalization_designs/{personalization_design}/activate".format(
personalization_design=sanitize_id(personalization_design),
),
base_address="api",
params=params,
options=options,
),
)
async def activate_async(
self,
personalization_design: str,
params: Optional["PersonalizationDesignActivateParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "PersonalizationDesign":
"""
Updates the status of the specified testmode personalization design object to active.
"""
return cast(
"PersonalizationDesign",
await self._request_async(
"post",
"/v1/test_helpers/issuing/personalization_designs/{personalization_design}/activate".format(
personalization_design=sanitize_id(personalization_design),
),
base_address="api",
params=params,
options=options,
),
)
def deactivate(
self,
personalization_design: str,
params: Optional["PersonalizationDesignDeactivateParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "PersonalizationDesign":
"""
Updates the status of the specified testmode personalization design object to inactive.
"""
return cast(
"PersonalizationDesign",
self._request(
"post",
"/v1/test_helpers/issuing/personalization_designs/{personalization_design}/deactivate".format(
personalization_design=sanitize_id(personalization_design),
),
base_address="api",
params=params,
options=options,
),
)
async def deactivate_async(
self,
personalization_design: str,
params: Optional["PersonalizationDesignDeactivateParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "PersonalizationDesign":
"""
Updates the status of the specified testmode personalization design object to inactive.
"""
return cast(
"PersonalizationDesign",
await self._request_async(
"post",
"/v1/test_helpers/issuing/personalization_designs/{personalization_design}/deactivate".format(
personalization_design=sanitize_id(personalization_design),
),
base_address="api",
params=params,
options=options,
),
)
def reject(
self,
personalization_design: str,
params: "PersonalizationDesignRejectParams",
options: Optional["RequestOptions"] = None,
) -> "PersonalizationDesign":
"""
Updates the status of the specified testmode personalization design object to rejected.
"""
return cast(
"PersonalizationDesign",
self._request(
"post",
"/v1/test_helpers/issuing/personalization_designs/{personalization_design}/reject".format(
personalization_design=sanitize_id(personalization_design),
),
base_address="api",
params=params,
options=options,
),
)
async def reject_async(
self,
personalization_design: str,
params: "PersonalizationDesignRejectParams",
options: Optional["RequestOptions"] = None,
) -> "PersonalizationDesign":
"""
Updates the status of the specified testmode personalization design object to rejected.
"""
return cast(
"PersonalizationDesign",
await self._request_async(
"post",
"/v1/test_helpers/issuing/personalization_designs/{personalization_design}/reject".format(
personalization_design=sanitize_id(personalization_design),
),
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,141 @@
# -*- 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.issuing._transaction import Transaction
from stripe.params.test_helpers.issuing._transaction_create_force_capture_params import (
TransactionCreateForceCaptureParams,
)
from stripe.params.test_helpers.issuing._transaction_create_unlinked_refund_params import (
TransactionCreateUnlinkedRefundParams,
)
from stripe.params.test_helpers.issuing._transaction_refund_params import (
TransactionRefundParams,
)
class TransactionService(StripeService):
def refund(
self,
transaction: str,
params: Optional["TransactionRefundParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Transaction":
"""
Refund a test-mode Transaction.
"""
return cast(
"Transaction",
self._request(
"post",
"/v1/test_helpers/issuing/transactions/{transaction}/refund".format(
transaction=sanitize_id(transaction),
),
base_address="api",
params=params,
options=options,
),
)
async def refund_async(
self,
transaction: str,
params: Optional["TransactionRefundParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Transaction":
"""
Refund a test-mode Transaction.
"""
return cast(
"Transaction",
await self._request_async(
"post",
"/v1/test_helpers/issuing/transactions/{transaction}/refund".format(
transaction=sanitize_id(transaction),
),
base_address="api",
params=params,
options=options,
),
)
def create_force_capture(
self,
params: "TransactionCreateForceCaptureParams",
options: Optional["RequestOptions"] = None,
) -> "Transaction":
"""
Allows the user to capture an arbitrary amount, also known as a forced capture.
"""
return cast(
"Transaction",
self._request(
"post",
"/v1/test_helpers/issuing/transactions/create_force_capture",
base_address="api",
params=params,
options=options,
),
)
async def create_force_capture_async(
self,
params: "TransactionCreateForceCaptureParams",
options: Optional["RequestOptions"] = None,
) -> "Transaction":
"""
Allows the user to capture an arbitrary amount, also known as a forced capture.
"""
return cast(
"Transaction",
await self._request_async(
"post",
"/v1/test_helpers/issuing/transactions/create_force_capture",
base_address="api",
params=params,
options=options,
),
)
def create_unlinked_refund(
self,
params: "TransactionCreateUnlinkedRefundParams",
options: Optional["RequestOptions"] = None,
) -> "Transaction":
"""
Allows the user to refund an arbitrary amount, also known as a unlinked refund.
"""
return cast(
"Transaction",
self._request(
"post",
"/v1/test_helpers/issuing/transactions/create_unlinked_refund",
base_address="api",
params=params,
options=options,
),
)
async def create_unlinked_refund_async(
self,
params: "TransactionCreateUnlinkedRefundParams",
options: Optional["RequestOptions"] = None,
) -> "Transaction":
"""
Allows the user to refund an arbitrary amount, also known as a unlinked refund.
"""
return cast(
"Transaction",
await self._request_async(
"post",
"/v1/test_helpers/issuing/transactions/create_unlinked_refund",
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,29 @@
# -*- 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.test_helpers.terminal._reader_service import (
ReaderService as ReaderService,
)
# name -> (import_target, is_submodule)
_import_map = {
"ReaderService": ("stripe.test_helpers.terminal._reader_service", False),
}
if not TYPE_CHECKING:
def __getattr__(name):
try:
target, is_submodule = _import_map[name]
module = import_module(target)
if is_submodule:
return module
return getattr(
module,
name,
)
except KeyError:
raise AttributeError()

View File

@@ -0,0 +1,153 @@
# -*- 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.test_helpers.terminal._reader_present_payment_method_params import (
ReaderPresentPaymentMethodParams,
)
from stripe.params.test_helpers.terminal._reader_succeed_input_collection_params import (
ReaderSucceedInputCollectionParams,
)
from stripe.params.test_helpers.terminal._reader_timeout_input_collection_params import (
ReaderTimeoutInputCollectionParams,
)
from stripe.terminal._reader import Reader
class ReaderService(StripeService):
def present_payment_method(
self,
reader: str,
params: Optional["ReaderPresentPaymentMethodParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Reader":
"""
Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction.
"""
return cast(
"Reader",
self._request(
"post",
"/v1/test_helpers/terminal/readers/{reader}/present_payment_method".format(
reader=sanitize_id(reader),
),
base_address="api",
params=params,
options=options,
),
)
async def present_payment_method_async(
self,
reader: str,
params: Optional["ReaderPresentPaymentMethodParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Reader":
"""
Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction.
"""
return cast(
"Reader",
await self._request_async(
"post",
"/v1/test_helpers/terminal/readers/{reader}/present_payment_method".format(
reader=sanitize_id(reader),
),
base_address="api",
params=params,
options=options,
),
)
def succeed_input_collection(
self,
reader: str,
params: Optional["ReaderSucceedInputCollectionParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Reader":
"""
Use this endpoint to trigger a successful input collection on a simulated reader.
"""
return cast(
"Reader",
self._request(
"post",
"/v1/test_helpers/terminal/readers/{reader}/succeed_input_collection".format(
reader=sanitize_id(reader),
),
base_address="api",
params=params,
options=options,
),
)
async def succeed_input_collection_async(
self,
reader: str,
params: Optional["ReaderSucceedInputCollectionParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Reader":
"""
Use this endpoint to trigger a successful input collection on a simulated reader.
"""
return cast(
"Reader",
await self._request_async(
"post",
"/v1/test_helpers/terminal/readers/{reader}/succeed_input_collection".format(
reader=sanitize_id(reader),
),
base_address="api",
params=params,
options=options,
),
)
def timeout_input_collection(
self,
reader: str,
params: Optional["ReaderTimeoutInputCollectionParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Reader":
"""
Use this endpoint to complete an input collection with a timeout error on a simulated reader.
"""
return cast(
"Reader",
self._request(
"post",
"/v1/test_helpers/terminal/readers/{reader}/timeout_input_collection".format(
reader=sanitize_id(reader),
),
base_address="api",
params=params,
options=options,
),
)
async def timeout_input_collection_async(
self,
reader: str,
params: Optional["ReaderTimeoutInputCollectionParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "Reader":
"""
Use this endpoint to complete an input collection with a timeout error on a simulated reader.
"""
return cast(
"Reader",
await self._request_async(
"post",
"/v1/test_helpers/terminal/readers/{reader}/timeout_input_collection".format(
reader=sanitize_id(reader),
),
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,60 @@
# -*- 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.test_helpers.treasury._inbound_transfer_service import (
InboundTransferService as InboundTransferService,
)
from stripe.test_helpers.treasury._outbound_payment_service import (
OutboundPaymentService as OutboundPaymentService,
)
from stripe.test_helpers.treasury._outbound_transfer_service import (
OutboundTransferService as OutboundTransferService,
)
from stripe.test_helpers.treasury._received_credit_service import (
ReceivedCreditService as ReceivedCreditService,
)
from stripe.test_helpers.treasury._received_debit_service import (
ReceivedDebitService as ReceivedDebitService,
)
# name -> (import_target, is_submodule)
_import_map = {
"InboundTransferService": (
"stripe.test_helpers.treasury._inbound_transfer_service",
False,
),
"OutboundPaymentService": (
"stripe.test_helpers.treasury._outbound_payment_service",
False,
),
"OutboundTransferService": (
"stripe.test_helpers.treasury._outbound_transfer_service",
False,
),
"ReceivedCreditService": (
"stripe.test_helpers.treasury._received_credit_service",
False,
),
"ReceivedDebitService": (
"stripe.test_helpers.treasury._received_debit_service",
False,
),
}
if not TYPE_CHECKING:
def __getattr__(name):
try:
target, is_submodule = _import_map[name]
module = import_module(target)
if is_submodule:
return module
return getattr(
module,
name,
)
except KeyError:
raise AttributeError()

View File

@@ -0,0 +1,153 @@
# -*- 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.test_helpers.treasury._inbound_transfer_fail_params import (
InboundTransferFailParams,
)
from stripe.params.test_helpers.treasury._inbound_transfer_return_inbound_transfer_params import (
InboundTransferReturnInboundTransferParams,
)
from stripe.params.test_helpers.treasury._inbound_transfer_succeed_params import (
InboundTransferSucceedParams,
)
from stripe.treasury._inbound_transfer import InboundTransfer
class InboundTransferService(StripeService):
def fail(
self,
id: str,
params: Optional["InboundTransferFailParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "InboundTransfer":
"""
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
"""
return cast(
"InboundTransfer",
self._request(
"post",
"/v1/test_helpers/treasury/inbound_transfers/{id}/fail".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)
async def fail_async(
self,
id: str,
params: Optional["InboundTransferFailParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "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._request_async(
"post",
"/v1/test_helpers/treasury/inbound_transfers/{id}/fail".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)
def return_inbound_transfer(
self,
id: str,
params: Optional["InboundTransferReturnInboundTransferParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "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._request(
"post",
"/v1/test_helpers/treasury/inbound_transfers/{id}/return".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)
async def return_inbound_transfer_async(
self,
id: str,
params: Optional["InboundTransferReturnInboundTransferParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "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._request_async(
"post",
"/v1/test_helpers/treasury/inbound_transfers/{id}/return".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)
def succeed(
self,
id: str,
params: Optional["InboundTransferSucceedParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "InboundTransfer":
"""
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
"""
return cast(
"InboundTransfer",
self._request(
"post",
"/v1/test_helpers/treasury/inbound_transfers/{id}/succeed".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)
async def succeed_async(
self,
id: str,
params: Optional["InboundTransferSucceedParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "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._request_async(
"post",
"/v1/test_helpers/treasury/inbound_transfers/{id}/succeed".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,200 @@
# -*- 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.test_helpers.treasury._outbound_payment_fail_params import (
OutboundPaymentFailParams,
)
from stripe.params.test_helpers.treasury._outbound_payment_post_params import (
OutboundPaymentPostParams,
)
from stripe.params.test_helpers.treasury._outbound_payment_return_outbound_payment_params import (
OutboundPaymentReturnOutboundPaymentParams,
)
from stripe.params.test_helpers.treasury._outbound_payment_update_params import (
OutboundPaymentUpdateParams,
)
from stripe.treasury._outbound_payment import OutboundPayment
class OutboundPaymentService(StripeService):
def update(
self,
id: str,
params: "OutboundPaymentUpdateParams",
options: Optional["RequestOptions"] = None,
) -> "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._request(
"post",
"/v1/test_helpers/treasury/outbound_payments/{id}".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)
async def update_async(
self,
id: str,
params: "OutboundPaymentUpdateParams",
options: Optional["RequestOptions"] = None,
) -> "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._request_async(
"post",
"/v1/test_helpers/treasury/outbound_payments/{id}".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)
def fail(
self,
id: str,
params: Optional["OutboundPaymentFailParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "OutboundPayment":
"""
Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
"""
return cast(
"OutboundPayment",
self._request(
"post",
"/v1/test_helpers/treasury/outbound_payments/{id}/fail".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)
async def fail_async(
self,
id: str,
params: Optional["OutboundPaymentFailParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "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._request_async(
"post",
"/v1/test_helpers/treasury/outbound_payments/{id}/fail".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)
def post(
self,
id: str,
params: Optional["OutboundPaymentPostParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "OutboundPayment":
"""
Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
"""
return cast(
"OutboundPayment",
self._request(
"post",
"/v1/test_helpers/treasury/outbound_payments/{id}/post".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)
async def post_async(
self,
id: str,
params: Optional["OutboundPaymentPostParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "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._request_async(
"post",
"/v1/test_helpers/treasury/outbound_payments/{id}/post".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)
def return_outbound_payment(
self,
id: str,
params: Optional["OutboundPaymentReturnOutboundPaymentParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "OutboundPayment":
"""
Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
"""
return cast(
"OutboundPayment",
self._request(
"post",
"/v1/test_helpers/treasury/outbound_payments/{id}/return".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)
async def return_outbound_payment_async(
self,
id: str,
params: Optional["OutboundPaymentReturnOutboundPaymentParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "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._request_async(
"post",
"/v1/test_helpers/treasury/outbound_payments/{id}/return".format(
id=sanitize_id(id),
),
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,204 @@
# -*- 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.test_helpers.treasury._outbound_transfer_fail_params import (
OutboundTransferFailParams,
)
from stripe.params.test_helpers.treasury._outbound_transfer_post_params import (
OutboundTransferPostParams,
)
from stripe.params.test_helpers.treasury._outbound_transfer_return_outbound_transfer_params import (
OutboundTransferReturnOutboundTransferParams,
)
from stripe.params.test_helpers.treasury._outbound_transfer_update_params import (
OutboundTransferUpdateParams,
)
from stripe.treasury._outbound_transfer import OutboundTransfer
class OutboundTransferService(StripeService):
def update(
self,
outbound_transfer: str,
params: "OutboundTransferUpdateParams",
options: Optional["RequestOptions"] = None,
) -> "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._request(
"post",
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}".format(
outbound_transfer=sanitize_id(outbound_transfer),
),
base_address="api",
params=params,
options=options,
),
)
async def update_async(
self,
outbound_transfer: str,
params: "OutboundTransferUpdateParams",
options: Optional["RequestOptions"] = None,
) -> "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._request_async(
"post",
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}".format(
outbound_transfer=sanitize_id(outbound_transfer),
),
base_address="api",
params=params,
options=options,
),
)
def fail(
self,
outbound_transfer: str,
params: Optional["OutboundTransferFailParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "OutboundTransfer":
"""
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
"""
return cast(
"OutboundTransfer",
self._request(
"post",
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail".format(
outbound_transfer=sanitize_id(outbound_transfer),
),
base_address="api",
params=params,
options=options,
),
)
async def fail_async(
self,
outbound_transfer: str,
params: Optional["OutboundTransferFailParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "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._request_async(
"post",
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/fail".format(
outbound_transfer=sanitize_id(outbound_transfer),
),
base_address="api",
params=params,
options=options,
),
)
def post(
self,
outbound_transfer: str,
params: Optional["OutboundTransferPostParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "OutboundTransfer":
"""
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
"""
return cast(
"OutboundTransfer",
self._request(
"post",
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post".format(
outbound_transfer=sanitize_id(outbound_transfer),
),
base_address="api",
params=params,
options=options,
),
)
async def post_async(
self,
outbound_transfer: str,
params: Optional["OutboundTransferPostParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "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._request_async(
"post",
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/post".format(
outbound_transfer=sanitize_id(outbound_transfer),
),
base_address="api",
params=params,
options=options,
),
)
def return_outbound_transfer(
self,
outbound_transfer: str,
params: Optional[
"OutboundTransferReturnOutboundTransferParams"
] = None,
options: Optional["RequestOptions"] = None,
) -> "OutboundTransfer":
"""
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
"""
return cast(
"OutboundTransfer",
self._request(
"post",
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return".format(
outbound_transfer=sanitize_id(outbound_transfer),
),
base_address="api",
params=params,
options=options,
),
)
async def return_outbound_transfer_async(
self,
outbound_transfer: str,
params: Optional[
"OutboundTransferReturnOutboundTransferParams"
] = None,
options: Optional["RequestOptions"] = None,
) -> "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._request_async(
"post",
"/v1/test_helpers/treasury/outbound_transfers/{outbound_transfer}/return".format(
outbound_transfer=sanitize_id(outbound_transfer),
),
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from typing import Optional, cast
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe._request_options import RequestOptions
from stripe.params.test_helpers.treasury._received_credit_create_params import (
ReceivedCreditCreateParams,
)
from stripe.treasury._received_credit import ReceivedCredit
class ReceivedCreditService(StripeService):
def create(
self,
params: "ReceivedCreditCreateParams",
options: Optional["RequestOptions"] = None,
) -> "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",
self._request(
"post",
"/v1/test_helpers/treasury/received_credits",
base_address="api",
params=params,
options=options,
),
)
async def create_async(
self,
params: "ReceivedCreditCreateParams",
options: Optional["RequestOptions"] = None,
) -> "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 self._request_async(
"post",
"/v1/test_helpers/treasury/received_credits",
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from typing import Optional, cast
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe._request_options import RequestOptions
from stripe.params.test_helpers.treasury._received_debit_create_params import (
ReceivedDebitCreateParams,
)
from stripe.treasury._received_debit import ReceivedDebit
class ReceivedDebitService(StripeService):
def create(
self,
params: "ReceivedDebitCreateParams",
options: Optional["RequestOptions"] = None,
) -> "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",
self._request(
"post",
"/v1/test_helpers/treasury/received_debits",
base_address="api",
params=params,
options=options,
),
)
async def create_async(
self,
params: "ReceivedDebitCreateParams",
options: Optional["RequestOptions"] = None,
) -> "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 self._request_async(
"post",
"/v1/test_helpers/treasury/received_debits",
base_address="api",
params=params,
options=options,
),
)