Skip to content

Commit 9495142

Browse files
feat(api): add external bank/payment velocity/declines/history features to auth_rules
1 parent 8e5cdbb commit 9495142

3 files changed

Lines changed: 168 additions & 4 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: 213
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-48e8284d7f1f51f36402cf5f22a23b27071af86110e2aeddb8da06f8c790fd3d.yml
3-
openapi_spec_hash: a64ba9e94686bce4f0a8c5b1b3c704da
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-47e9f78d22682623e313f1689f5fa7e3420575ff285a14a2f4704c49ffb6b72e.yml
3+
openapi_spec_hash: 4797fe46d942cb32e648a79015783d01
44
config_hash: 5bb913c05ebeb301ec925b16e75bb251

src/lithic/types/auth_rules/rule_feature.py

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Union, Optional
3+
from typing import Dict, List, Union, Optional
44
from typing_extensions import Literal, TypeAlias
55

66
from ..._models import BaseModel
@@ -15,11 +15,16 @@
1515
"ACHReceiptFeature",
1616
"CardTransactionFeature",
1717
"ACHPaymentFeature",
18+
"ExternalBankAccountFeature",
1819
"CardFeature",
1920
"AccountHolderFeature",
2021
"IPMetadataFeature",
2122
"SpendVelocityFeature",
23+
"PaymentVelocityFeature",
24+
"PaymentVelocityFeatureFilters",
2225
"TransactionHistorySignalsFeature",
26+
"ConsecutiveDeclinesFeature",
27+
"ACHPaymentHistoryFeature",
2328
]
2429

2530

@@ -65,6 +70,13 @@ class ACHPaymentFeature(BaseModel):
6570
"""The variable name for this feature in the rule function signature"""
6671

6772

73+
class ExternalBankAccountFeature(BaseModel):
74+
type: Literal["EXTERNAL_BANK_ACCOUNT"]
75+
76+
name: Optional[str] = None
77+
"""The variable name for this feature in the rule function signature"""
78+
79+
6880
class CardFeature(BaseModel):
6981
type: Literal["CARD"]
7082

@@ -101,6 +113,53 @@ class SpendVelocityFeature(BaseModel):
101113
"""The variable name for this feature in the rule function signature"""
102114

103115

116+
class PaymentVelocityFeatureFilters(BaseModel):
117+
"""Optional filters applied when aggregating ACH payment velocity.
118+
119+
Payments not matching the provided filters are excluded from the calculated velocity.
120+
"""
121+
122+
exclude_tags: Optional[Dict[str, str]] = None
123+
"""Exclude payments matching any of the provided tag key-value pairs."""
124+
125+
include_payment_types: Optional[List[Literal["ORIGINATION", "RECEIPT"]]] = None
126+
"""Payment types to include in the velocity calculation."""
127+
128+
include_polarities: Optional[List[Literal["CREDIT", "DEBIT"]]] = None
129+
"""Payment polarities to include in the velocity calculation."""
130+
131+
include_statuses: Optional[List[Literal["PENDING", "SETTLED", "DECLINED", "REVERSED", "CANCELED", "RETURNED"]]] = (
132+
None
133+
)
134+
"""Payment statuses to include in the velocity calculation."""
135+
136+
include_tags: Optional[Dict[str, str]] = None
137+
"""Only include payments matching all of the provided tag key-value pairs."""
138+
139+
result: Optional[Literal["APPROVED", "DECLINED"]] = None
140+
"""Only include payments with the given result."""
141+
142+
143+
class PaymentVelocityFeature(BaseModel):
144+
period: VelocityLimitPeriod
145+
"""Velocity over the current day since 00:00 / 12 AM in Eastern Time"""
146+
147+
scope: Literal["FINANCIAL_ACCOUNT", "GLOBAL"]
148+
"""The scope over which the ACH payment velocity is aggregated."""
149+
150+
type: Literal["PAYMENT_VELOCITY"]
151+
152+
filters: Optional[PaymentVelocityFeatureFilters] = None
153+
"""Optional filters applied when aggregating ACH payment velocity.
154+
155+
Payments not matching the provided filters are excluded from the calculated
156+
velocity.
157+
"""
158+
159+
name: Optional[str] = None
160+
"""The variable name for this feature in the rule function signature"""
161+
162+
104163
class TransactionHistorySignalsFeature(BaseModel):
105164
scope: Literal["CARD", "ACCOUNT", "BUSINESS_ACCOUNT"]
106165
"""The entity scope to load transaction history signals for."""
@@ -111,16 +170,40 @@ class TransactionHistorySignalsFeature(BaseModel):
111170
"""The variable name for this feature in the rule function signature"""
112171

113172

173+
class ConsecutiveDeclinesFeature(BaseModel):
174+
scope: Literal["CARD", "ACCOUNT"]
175+
"""The entity scope to count consecutive declines for."""
176+
177+
type: Literal["CONSECUTIVE_DECLINES"]
178+
179+
name: Optional[str] = None
180+
"""The variable name for this feature in the rule function signature"""
181+
182+
183+
class ACHPaymentHistoryFeature(BaseModel):
184+
scope: Literal["FINANCIAL_ACCOUNT"]
185+
"""The entity scope to load ACH payment history for."""
186+
187+
type: Literal["ACH_PAYMENT_HISTORY"]
188+
189+
name: Optional[str] = None
190+
"""The variable name for this feature in the rule function signature"""
191+
192+
114193
RuleFeature: TypeAlias = Union[
115194
AuthorizationFeature,
116195
AuthenticationFeature,
117196
TokenizationFeature,
118197
ACHReceiptFeature,
119198
CardTransactionFeature,
120199
ACHPaymentFeature,
200+
ExternalBankAccountFeature,
121201
CardFeature,
122202
AccountHolderFeature,
123203
IPMetadataFeature,
124204
SpendVelocityFeature,
205+
PaymentVelocityFeature,
125206
TransactionHistorySignalsFeature,
207+
ConsecutiveDeclinesFeature,
208+
ACHPaymentHistoryFeature,
126209
]

src/lithic/types/auth_rules/rule_feature_param.py

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Union
5+
from typing import Dict, List, Union, Optional
66
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

88
from .velocity_limit_period_param import VelocityLimitPeriodParam
@@ -16,11 +16,16 @@
1616
"ACHReceiptFeature",
1717
"CardTransactionFeature",
1818
"ACHPaymentFeature",
19+
"ExternalBankAccountFeature",
1920
"CardFeature",
2021
"AccountHolderFeature",
2122
"IPMetadataFeature",
2223
"SpendVelocityFeature",
24+
"PaymentVelocityFeature",
25+
"PaymentVelocityFeatureFilters",
2326
"TransactionHistorySignalsFeature",
27+
"ConsecutiveDeclinesFeature",
28+
"ACHPaymentHistoryFeature",
2429
]
2530

2631

@@ -66,6 +71,13 @@ class ACHPaymentFeature(TypedDict, total=False):
6671
"""The variable name for this feature in the rule function signature"""
6772

6873

74+
class ExternalBankAccountFeature(TypedDict, total=False):
75+
type: Required[Literal["EXTERNAL_BANK_ACCOUNT"]]
76+
77+
name: str
78+
"""The variable name for this feature in the rule function signature"""
79+
80+
6981
class CardFeature(TypedDict, total=False):
7082
type: Required[Literal["CARD"]]
7183

@@ -102,6 +114,51 @@ class SpendVelocityFeature(TypedDict, total=False):
102114
"""The variable name for this feature in the rule function signature"""
103115

104116

117+
class PaymentVelocityFeatureFilters(TypedDict, total=False):
118+
"""Optional filters applied when aggregating ACH payment velocity.
119+
120+
Payments not matching the provided filters are excluded from the calculated velocity.
121+
"""
122+
123+
exclude_tags: Optional[Dict[str, str]]
124+
"""Exclude payments matching any of the provided tag key-value pairs."""
125+
126+
include_payment_types: Optional[List[Literal["ORIGINATION", "RECEIPT"]]]
127+
"""Payment types to include in the velocity calculation."""
128+
129+
include_polarities: Optional[List[Literal["CREDIT", "DEBIT"]]]
130+
"""Payment polarities to include in the velocity calculation."""
131+
132+
include_statuses: Optional[List[Literal["PENDING", "SETTLED", "DECLINED", "REVERSED", "CANCELED", "RETURNED"]]]
133+
"""Payment statuses to include in the velocity calculation."""
134+
135+
include_tags: Optional[Dict[str, str]]
136+
"""Only include payments matching all of the provided tag key-value pairs."""
137+
138+
result: Literal["APPROVED", "DECLINED"]
139+
"""Only include payments with the given result."""
140+
141+
142+
class PaymentVelocityFeature(TypedDict, total=False):
143+
period: Required[VelocityLimitPeriodParam]
144+
"""Velocity over the current day since 00:00 / 12 AM in Eastern Time"""
145+
146+
scope: Required[Literal["FINANCIAL_ACCOUNT", "GLOBAL"]]
147+
"""The scope over which the ACH payment velocity is aggregated."""
148+
149+
type: Required[Literal["PAYMENT_VELOCITY"]]
150+
151+
filters: PaymentVelocityFeatureFilters
152+
"""Optional filters applied when aggregating ACH payment velocity.
153+
154+
Payments not matching the provided filters are excluded from the calculated
155+
velocity.
156+
"""
157+
158+
name: str
159+
"""The variable name for this feature in the rule function signature"""
160+
161+
105162
class TransactionHistorySignalsFeature(TypedDict, total=False):
106163
scope: Required[Literal["CARD", "ACCOUNT", "BUSINESS_ACCOUNT"]]
107164
"""The entity scope to load transaction history signals for."""
@@ -112,16 +169,40 @@ class TransactionHistorySignalsFeature(TypedDict, total=False):
112169
"""The variable name for this feature in the rule function signature"""
113170

114171

172+
class ConsecutiveDeclinesFeature(TypedDict, total=False):
173+
scope: Required[Literal["CARD", "ACCOUNT"]]
174+
"""The entity scope to count consecutive declines for."""
175+
176+
type: Required[Literal["CONSECUTIVE_DECLINES"]]
177+
178+
name: str
179+
"""The variable name for this feature in the rule function signature"""
180+
181+
182+
class ACHPaymentHistoryFeature(TypedDict, total=False):
183+
scope: Required[Literal["FINANCIAL_ACCOUNT"]]
184+
"""The entity scope to load ACH payment history for."""
185+
186+
type: Required[Literal["ACH_PAYMENT_HISTORY"]]
187+
188+
name: str
189+
"""The variable name for this feature in the rule function signature"""
190+
191+
115192
RuleFeatureParam: TypeAlias = Union[
116193
AuthorizationFeature,
117194
AuthenticationFeature,
118195
TokenizationFeature,
119196
ACHReceiptFeature,
120197
CardTransactionFeature,
121198
ACHPaymentFeature,
199+
ExternalBankAccountFeature,
122200
CardFeature,
123201
AccountHolderFeature,
124202
IPMetadataFeature,
125203
SpendVelocityFeature,
204+
PaymentVelocityFeature,
126205
TransactionHistorySignalsFeature,
206+
ConsecutiveDeclinesFeature,
207+
ACHPaymentHistoryFeature,
127208
]

0 commit comments

Comments
 (0)