Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CODEGEN_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
68065dff88008f079e79eb1ef0add5e261b416e1
6fc98fdf6be6311e05ec2589480dda60a8e6eb5b
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2176
v2180
6 changes: 6 additions & 0 deletions stripe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ def add_beta_version(
from stripe._account_session_service import (
AccountSessionService as AccountSessionService,
)
from stripe._account_signals import AccountSignals as AccountSignals
from stripe._account_signals_service import (
AccountSignalsService as AccountSignalsService,
)
from stripe._api_mode import ApiMode as ApiMode
from stripe._api_resource import APIResource as APIResource
from stripe._apple_pay_domain import ApplePayDomain as ApplePayDomain
Expand Down Expand Up @@ -687,6 +691,8 @@ def add_beta_version(
"AccountService": ("stripe._account_service", False),
"AccountSession": ("stripe._account_session", False),
"AccountSessionService": ("stripe._account_session_service", False),
"AccountSignals": ("stripe._account_signals", False),
"AccountSignalsService": ("stripe._account_signals_service", False),
"ApiMode": ("stripe._api_mode", False),
"APIResource": ("stripe._api_resource", False),
"ApplePayDomain": ("stripe._apple_pay_domain", False),
Expand Down
40 changes: 40 additions & 0 deletions stripe/_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from typing_extensions import Literal, Unpack, TYPE_CHECKING

if TYPE_CHECKING:
from stripe._account_signals import AccountSignals
from stripe._bank_account import BankAccount
from stripe._capability import Capability
from stripe._card import Card
Expand Down Expand Up @@ -68,6 +69,9 @@
from stripe.params._account_retrieve_person_params import (
AccountRetrievePersonParams,
)
from stripe.params._account_retrieve_signal_params import (
AccountRetrieveSignalParams,
)


@nested_resource_class_methods("capability")
Expand Down Expand Up @@ -2779,6 +2783,42 @@ async def create_person_async(
),
)

@classmethod
def retrieve_signal(
cls, account_id: str, **params: Unpack["AccountRetrieveSignalParams"]
) -> "AccountSignals":
"""
Retrieves the account's Signal objects
"""
return cast(
"AccountSignals",
cls._static_request(
"get",
"/v1/accounts/{account_id}/signals".format(
account_id=sanitize_id(account_id)
),
params=params,
),
)

@classmethod
async def retrieve_signal_async(
cls, account_id: str, **params: Unpack["AccountRetrieveSignalParams"]
) -> "AccountSignals":
"""
Retrieves the account's Signal objects
"""
return cast(
"AccountSignals",
await cls._static_request_async(
"get",
"/v1/accounts/{account_id}/signals".format(
account_id=sanitize_id(account_id)
),
params=params,
),
)

_inner_class_types = {
"business_profile": BusinessProfile,
"capabilities": Capabilities,
Expand Down
3 changes: 3 additions & 0 deletions stripe/_account_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
)
from stripe._account_login_link_service import AccountLoginLinkService
from stripe._account_person_service import AccountPersonService
from stripe._account_signals_service import AccountSignalsService
from stripe._list_object import ListObject
from stripe._request_options import RequestOptions
from stripe.params._account_create_params import AccountCreateParams
Expand All @@ -40,6 +41,7 @@
"AccountLoginLinkService",
],
"persons": ["stripe._account_person_service", "AccountPersonService"],
"signals": ["stripe._account_signals_service", "AccountSignalsService"],
}


Expand All @@ -48,6 +50,7 @@ class AccountService(StripeService):
external_accounts: "AccountExternalAccountService"
login_links: "AccountLoginLinkService"
persons: "AccountPersonService"
signals: "AccountSignalsService"

def __init__(self, requestor):
super().__init__(requestor)
Expand Down
88 changes: 88 additions & 0 deletions stripe/_account_signals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# -*- 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 AccountSignals(StripeObject):
"""
The Account Signals API provides risk related signals that can be used to better manage risks.
"""

OBJECT_NAME: ClassVar[Literal["account_signals"]] = "account_signals"

class Delinquency(StripeObject):
class Indicator(StripeObject):
description: str
"""
A brief explanation of how this indicator contributed to the delinquency probability.
"""
impact: Literal[
"decrease", "neutral", "slight_increase", "strong_increase"
]
"""
The effect this indicator had on the overall risk level.
"""
indicator: Literal[
"account_balance",
"aov",
"charge_concentration",
"dispute_window",
"disputes",
"duplicates",
"exposure",
"firmographic",
"lifetime_metrics",
"payment_processing",
"payment_volume",
"payouts",
"refunds",
"tenure",
"transfers",
]
"""
The name of the specific indicator used in the risk assessment.
"""

evaluated_at: Optional[int]
"""
Time at which the signal was evaluated, measured in seconds since the Unix epoch.
"""
indicators: Optional[List[Indicator]]
"""
Array of objects representing individual factors that contributed to the calculated probability of delinquency.
"""
probability: Optional[float]
"""
The probability of delinquency. Can be between 0.00 and 100.00
"""
risk_level: Literal[
"elevated", "highest", "low", "normal", "not_assessed", "unknown"
]
"""
Categorical assessment of the delinquency risk based on probability.
"""
signal_id: Optional[str]
"""
Unique identifier for the delinquency signal.
"""
_inner_class_types = {"indicators": Indicator}

account: str
"""
The account for which the signals belong to.
"""
delinquency: Optional[Delinquency]
"""
The delinquency signal of the account
"""
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["account_signals"]
"""
String representing the object's type. Objects of the same type share the same value.
"""
_inner_class_types = {"delinquency": Delinquency}
59 changes: 59 additions & 0 deletions stripe/_account_signals_service.py
Original file line number Diff line number Diff line change
@@ -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._account_signals import AccountSignals
from stripe._request_options import RequestOptions
from stripe.params._account_signals_retrieve_params import (
AccountSignalsRetrieveParams,
)


class AccountSignalsService(StripeService):
def retrieve(
self,
account_id: str,
params: Optional["AccountSignalsRetrieveParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "AccountSignals":
"""
Retrieves the account's Signal objects
"""
return cast(
"AccountSignals",
self._request(
"get",
"/v1/accounts/{account_id}/signals".format(
account_id=sanitize_id(account_id),
),
base_address="api",
params=params,
options=options,
),
)

async def retrieve_async(
self,
account_id: str,
params: Optional["AccountSignalsRetrieveParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "AccountSignals":
"""
Retrieves the account's Signal objects
"""
return cast(
"AccountSignals",
await self._request_async(
"get",
"/v1/accounts/{account_id}/signals".format(
account_id=sanitize_id(account_id),
),
base_address="api",
params=params,
options=options,
),
)
19 changes: 18 additions & 1 deletion stripe/_application_fee.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ class FeeSource(StripeObject):
Type of object that created the application fee.
"""

class FundingSource(StripeObject):
invoice: Optional[str]
"""
The invoice ID associated with this funding source, if applicable.
"""
type: str
"""
The type of funding source.
"""

account: ExpandableField["Account"]
"""
ID of the Stripe account this fee was taken from.
Expand Down Expand Up @@ -96,6 +106,10 @@ class FeeSource(StripeObject):
"""
Polymorphic source of the application fee. Includes the ID of the object the application fee was created from.
"""
funding_source: Optional[FundingSource]
"""
Polymorphic funding source of the application fee. Includes the type and details of the funding source.
"""
id: str
"""
Unique identifier for the object.
Expand Down Expand Up @@ -525,4 +539,7 @@ async def create_refund_async(
),
)

_inner_class_types = {"fee_source": FeeSource}
_inner_class_types = {
"fee_source": FeeSource,
"funding_source": FundingSource,
}
1 change: 1 addition & 0 deletions stripe/_object_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"account_link": ("stripe._account_link", "AccountLink"),
"account_notice": ("stripe._account_notice", "AccountNotice"),
"account_session": ("stripe._account_session", "AccountSession"),
"account_signals": ("stripe._account_signals", "AccountSignals"),
"apple_pay_domain": ("stripe._apple_pay_domain", "ApplePayDomain"),
"application": ("stripe._application", "Application"),
"application_fee": ("stripe._application_fee", "ApplicationFee"),
Expand Down
41 changes: 41 additions & 0 deletions stripe/billing/_alert_triggered.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,35 @@ class AlertTriggered(StripeObject):
OBJECT_NAME: ClassVar[Literal["billing.alert_triggered"]] = (
"billing.alert_triggered"
)

class AggregationPeriod(StripeObject):
ends_at: int
"""
End time of the aggregation period
"""
starts_at: int
"""
Start time of the aggregation period
"""

class GroupBy(StripeObject):
billing_cadence: Optional[str]
"""
The billing cadence ID, populated when type is `billing_cadence`
"""
pricing_plan_subscription: Optional[str]
"""
The pricing plan subscription ID, populated when type is `pricing_plan_subscription`
"""
type: Literal["billing_cadence", "pricing_plan_subscription"]
"""
The type of grouping used for this alert notification
"""

aggregation_period: Optional[AggregationPeriod]
"""
The aggregation period for which this alert triggered
"""
alert: "Alert"
"""
A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.
Expand All @@ -36,6 +65,10 @@ class AlertTriggered(StripeObject):
"""
External customer ID for the customer for which the alert triggered
"""
group_by: Optional[GroupBy]
"""
Populated specifically for spend alerts to notify merchants which group_by entity has the exceeded spend
"""
livemode: bool
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
Expand All @@ -44,7 +77,15 @@ class AlertTriggered(StripeObject):
"""
String representing the object's type. Objects of the same type share the same value.
"""
triggered_at: Optional[int]
"""
Timestamp at which the threshold was crossed
"""
value: str
"""
The value triggering the alert
"""
_inner_class_types = {
"aggregation_period": AggregationPeriod,
"group_by": GroupBy,
}
Loading