Skip to content

Commit 02bd0f0

Browse files
feat(api): add unit parameter and travel/distance attributes to auth_rules
1 parent bbff608 commit 02bd0f0

3 files changed

Lines changed: 64 additions & 16 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 190
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-0f374e78a0212145a2f55a55dfc39a612de19094d5152ae26b1bc74b01b9e343.yml
3-
openapi_spec_hash: ec888cdaebea979a2cd6231ca04c346c
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-af9701d01abffc53ba2bf56c06415d893460e6b420f122e602cf4afe67bbf57b.yml
3+
openapi_spec_hash: 963688b09480159a06865075c94a2577
44
config_hash: 01dfc901bb6d54b0f582155d779bcbe0

src/lithic/types/auth_rules/conditional_authorization_action_parameters.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111

1212

1313
class ConditionParameters(BaseModel):
14-
"""Additional parameters required for transaction history signal attributes.
14+
"""Additional parameters for certain attributes.
1515
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`.
16+
Required when `attribute` is one of
17+
`AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`,
18+
`IS_NEW_COUNTRY`, `IS_NEW_MCC`, `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`,
19+
`TIME_SINCE_LAST_TRANSACTION`, or `DISTINCT_COUNTRY_COUNT` (require `scope`);
20+
or `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION` (require `unit`).
2021
Not used for other attributes.
2122
"""
2223

@@ -30,6 +31,16 @@ class ConditionParameters(BaseModel):
3031
scope: Optional[Literal["CARD", "ACCOUNT", "BUSINESS_ACCOUNT"]] = None
3132
"""The entity scope to evaluate the attribute against."""
3233

34+
unit: Optional[Literal["MPH", "KPH", "MILES", "KILOMETERS"]] = None
35+
"""The unit for impossible travel attributes.
36+
37+
Required when `attribute` is `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION`.
38+
39+
For `TRAVEL_SPEED`: `MPH` (miles per hour) or `KPH` (kilometers per hour).
40+
41+
For `DISTANCE_FROM_LAST_TRANSACTION`: `MILES` or `KILOMETERS`.
42+
"""
43+
3344

3445
class Condition(BaseModel):
3546
attribute: Literal[
@@ -70,6 +81,8 @@ class Condition(BaseModel):
7081
"DISTINCT_COUNTRY_COUNT",
7182
"IS_NEW_MERCHANT",
7283
"THREE_DS_SUCCESS_RATE",
84+
"TRAVEL_SPEED",
85+
"DISTANCE_FROM_LAST_TRANSACTION",
7386
]
7487
"""The attribute to target.
7588
@@ -173,6 +186,15 @@ class Condition(BaseModel):
173186
`parameters` required.
174187
- `THREE_DS_SUCCESS_RATE`: The 3DS authentication success rate for the card, as
175188
a percentage from 0.0 to 100.0. Card-scoped only; no `parameters` required.
189+
- `TRAVEL_SPEED`: The estimated speed of travel derived from the distance
190+
between the postal code centers of the last card-present transaction and the
191+
current transaction, divided by the elapsed time. Null if there is no prior
192+
card-present transaction, if either postal code cannot be geocoded, or if
193+
elapsed time is zero. Requires `parameters.unit` set to `MPH` or `KPH`.
194+
- `DISTANCE_FROM_LAST_TRANSACTION`: The estimated distance between the postal
195+
code centers of the last card-present transaction and the current transaction.
196+
Null if there is no prior card-present transaction or if either postal code
197+
cannot be geocoded. Requires `parameters.unit` set to `MILES` or `KILOMETERS`.
176198
"""
177199

178200
operation: ConditionalOperation
@@ -182,12 +204,14 @@ class Condition(BaseModel):
182204
"""A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`"""
183205

184206
parameters: Optional[ConditionParameters] = None
185-
"""Additional parameters required for transaction history signal attributes.
207+
"""Additional parameters for certain attributes.
186208
187209
Required when `attribute` is one of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
188210
`STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`,
189211
`IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`,
190-
or `DISTINCT_COUNTRY_COUNT`. Not used for other attributes.
212+
or `DISTINCT_COUNTRY_COUNT` (require `scope`); or `TRAVEL_SPEED` or
213+
`DISTANCE_FROM_LAST_TRANSACTION` (require `unit`). Not used for other
214+
attributes.
191215
"""
192216

193217

src/lithic/types/auth_rules/conditional_authorization_action_parameters_param.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313

1414

1515
class ConditionParameters(TypedDict, total=False):
16-
"""Additional parameters required for transaction history signal attributes.
16+
"""Additional parameters for certain attributes.
1717
18-
Required when
19-
`attribute` is one of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
20-
`STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`, `IS_FIRST_TRANSACTION`,
21-
`CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`, or `DISTINCT_COUNTRY_COUNT`.
18+
Required when `attribute` is one of
19+
`AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`, `STDEV_TRANSACTION_AMOUNT`,
20+
`IS_NEW_COUNTRY`, `IS_NEW_MCC`, `IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`,
21+
`TIME_SINCE_LAST_TRANSACTION`, or `DISTINCT_COUNTRY_COUNT` (require `scope`);
22+
or `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION` (require `unit`).
2223
Not used for other attributes.
2324
"""
2425

@@ -32,6 +33,16 @@ class ConditionParameters(TypedDict, total=False):
3233
scope: Literal["CARD", "ACCOUNT", "BUSINESS_ACCOUNT"]
3334
"""The entity scope to evaluate the attribute against."""
3435

36+
unit: Literal["MPH", "KPH", "MILES", "KILOMETERS"]
37+
"""The unit for impossible travel attributes.
38+
39+
Required when `attribute` is `TRAVEL_SPEED` or `DISTANCE_FROM_LAST_TRANSACTION`.
40+
41+
For `TRAVEL_SPEED`: `MPH` (miles per hour) or `KPH` (kilometers per hour).
42+
43+
For `DISTANCE_FROM_LAST_TRANSACTION`: `MILES` or `KILOMETERS`.
44+
"""
45+
3546

3647
class Condition(TypedDict, total=False):
3748
attribute: Required[
@@ -73,6 +84,8 @@ class Condition(TypedDict, total=False):
7384
"DISTINCT_COUNTRY_COUNT",
7485
"IS_NEW_MERCHANT",
7586
"THREE_DS_SUCCESS_RATE",
87+
"TRAVEL_SPEED",
88+
"DISTANCE_FROM_LAST_TRANSACTION",
7689
]
7790
]
7891
"""The attribute to target.
@@ -177,6 +190,15 @@ class Condition(TypedDict, total=False):
177190
`parameters` required.
178191
- `THREE_DS_SUCCESS_RATE`: The 3DS authentication success rate for the card, as
179192
a percentage from 0.0 to 100.0. Card-scoped only; no `parameters` required.
193+
- `TRAVEL_SPEED`: The estimated speed of travel derived from the distance
194+
between the postal code centers of the last card-present transaction and the
195+
current transaction, divided by the elapsed time. Null if there is no prior
196+
card-present transaction, if either postal code cannot be geocoded, or if
197+
elapsed time is zero. Requires `parameters.unit` set to `MPH` or `KPH`.
198+
- `DISTANCE_FROM_LAST_TRANSACTION`: The estimated distance between the postal
199+
code centers of the last card-present transaction and the current transaction.
200+
Null if there is no prior card-present transaction or if either postal code
201+
cannot be geocoded. Requires `parameters.unit` set to `MILES` or `KILOMETERS`.
180202
"""
181203

182204
operation: Required[ConditionalOperation]
@@ -186,12 +208,14 @@ class Condition(TypedDict, total=False):
186208
"""A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`"""
187209

188210
parameters: ConditionParameters
189-
"""Additional parameters required for transaction history signal attributes.
211+
"""Additional parameters for certain attributes.
190212
191213
Required when `attribute` is one of `AMOUNT_Z_SCORE`, `AVG_TRANSACTION_AMOUNT`,
192214
`STDEV_TRANSACTION_AMOUNT`, `IS_NEW_COUNTRY`, `IS_NEW_MCC`,
193215
`IS_FIRST_TRANSACTION`, `CONSECUTIVE_DECLINES`, `TIME_SINCE_LAST_TRANSACTION`,
194-
or `DISTINCT_COUNTRY_COUNT`. Not used for other attributes.
216+
or `DISTINCT_COUNTRY_COUNT` (require `scope`); or `TRAVEL_SPEED` or
217+
`DISTANCE_FROM_LAST_TRANSACTION` (require `unit`). Not used for other
218+
attributes.
195219
"""
196220

197221

0 commit comments

Comments
 (0)