22
33from __future__ import annotations
44
5- from typing import Union
5+ from typing import Dict , List , Union , Optional
66from typing_extensions import Literal , Required , TypeAlias , TypedDict
77
88from .velocity_limit_period_param import VelocityLimitPeriodParam
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+
6981class 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+
105162class 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+
115192RuleFeatureParam : 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