11# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22
3- from typing import List
3+ from typing import List , Optional
44from typing_extensions import Literal
55
66from ..._models import BaseModel
77from .conditional_value import ConditionalValue
88from .conditional_operation import ConditionalOperation
99
10- __all__ = ["ConditionalAuthorizationActionParameters" , "Condition" ]
10+ __all__ = ["ConditionalAuthorizationActionParameters" , "Condition" , "ConditionParameters" ]
11+
12+
13+ class ConditionParameters (BaseModel ):
14+ """Additional parameters required for transaction history signal attributes.
15+
16+ Required when
17+ `attribute` is one of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
18+ `STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`, `IS_FIRST_TRANSACTION`,
19+ `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`, or `DISTINCT_COUNTRY_COUNT`.
20+ Not used for other attributes.
21+ """
22+
23+ interval : Optional [Literal ["LIFETIME" , "7D" , "30D" , "90D" ]] = None
24+ """
25+ The time window for statistical attributes (`AMOUNT_Z_SCORE`,
26+ `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`). Use `LIFETIME` for
27+ all-time history or a specific window (`7D`, `30D`, `90D`).
28+ """
29+
30+ scope : Optional [Literal ["CARD" , "ACCOUNT" , "BUSINESS_ACCOUNT" ]] = None
31+ """The entity scope to evaluate the attribute against."""
1132
1233
1334class Condition (BaseModel ):
@@ -38,6 +59,16 @@ class Condition(BaseModel):
3859 "SERVICE_LOCATION_POSTAL_CODE" ,
3960 "CARD_AGE" ,
4061 "ACCOUNT_AGE" ,
62+ "AMOUNT_Z_SCORE" ,
63+ "AVG_TRANSACTION_AMOUNT" ,
64+ "STDEV_TRANSACTION_AMOUNT" ,
65+ "IS_NEW_COUNTRY" ,
66+ "IS_NEW_MCC" ,
67+ "IS_FIRST_TRANSACTION" ,
68+ "CONSECUTIVE_DECLINES" ,
69+ "TIME_SINCE_LAST_TRANSACTION" ,
70+ "DISTINCT_COUNTRY_COUNT" ,
71+ "THREE_DS_SUCCESS_RATE" ,
4172 ]
4273 """The attribute to target.
4374
@@ -110,6 +141,33 @@ class Condition(BaseModel):
110141 - `CARD_AGE`: The age of the card in seconds at the time of the authorization.
111142 - `ACCOUNT_AGE`: The age of the account holder's account in seconds at the time
112143 of the authorization.
144+ - `AMOUNT_Z_SCORE`: The z-score of the transaction amount relative to the
145+ entity's transaction history. Null if fewer than 30 approved transactions in
146+ the specified window. Requires `parameters.scope` and `parameters.interval`.
147+ - `AVG_TRANSACTION_AMOUNT`: The average approved transaction amount for the
148+ entity over the specified window, in cents. Requires `parameters.scope` and
149+ `parameters.interval`.
150+ - `STDEV_TRANSACTION_AMOUNT`: The standard deviation of approved transaction
151+ amounts for the entity over the specified window, in cents. Null if fewer than
152+ 30 approved transactions in the specified window. Requires `parameters.scope`
153+ and `parameters.interval`.
154+ - `IS_NEW_COUNTRY`: Whether the transaction's merchant country has not been seen
155+ in the entity's transaction history. Valid values are `TRUE`, `FALSE`.
156+ Requires `parameters.scope`.
157+ - `IS_NEW_MCC`: Whether the transaction's MCC has not been seen in the entity's
158+ transaction history. Valid values are `TRUE`, `FALSE`. Requires
159+ `parameters.scope`.
160+ - `IS_FIRST_TRANSACTION`: Whether this is the first transaction for the entity.
161+ Valid values are `TRUE`, `FALSE`. Requires `parameters.scope`.
162+ - `CONSECUTIVE_DECLINES`: The number of consecutive declined transactions for
163+ the entity over the last 30 days (rolling). Requires `parameters.scope`. Not
164+ supported for `BUSINESS_ACCOUNT` scope.
165+ - `TIME_SINCE_LAST_TRANSACTION`: The number of days since the last approved
166+ transaction for the entity. Requires `parameters.scope`.
167+ - `DISTINCT_COUNTRY_COUNT`: The number of distinct merchant countries seen in
168+ the entity's transaction history. Requires `parameters.scope`.
169+ - `THREE_DS_SUCCESS_RATE`: The 3DS authentication success rate for the card, as
170+ a percentage from 0.0 to 100.0. Card-scoped only; no `parameters` required.
113171 """
114172
115173 operation : ConditionalOperation
@@ -118,6 +176,15 @@ class Condition(BaseModel):
118176 value : ConditionalValue
119177 """A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`"""
120178
179+ parameters : Optional [ConditionParameters ] = None
180+ """Additional parameters required for transaction history signal attributes.
181+
182+ Required when `attribute` is one of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
183+ `STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`,
184+ `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`,
185+ or `DISTINCT_COUNTRY_COUNT`. Not used for other attributes.
186+ """
187+
121188
122189class ConditionalAuthorizationActionParameters (BaseModel ):
123190 action : Literal ["DECLINE" , "CHALLENGE" ]
0 commit comments