55from typing_extensions import Literal , TypeAlias
66
77from ..._models import BaseModel
8- from .event_stream import EventStream
98
109__all__ = [
1110 "V2ListResultsResponse" ,
12- "Action" ,
13- "ActionAuthorizationAction" ,
14- "ActionAuthentication3DSAction" ,
15- "ActionDeclineAction" ,
16- "ActionRequireTfaAction" ,
17- "ActionApproveAction" ,
18- "ActionReturnAction" ,
11+ "AuthorizationResult" ,
12+ "AuthorizationResultAction" ,
13+ "Authentication3DSResult" ,
14+ "Authentication3DsResultAction" ,
15+ "TokenizationResult" ,
16+ "TokenizationResultAction" ,
17+ "TokenizationResultActionDeclineAction" ,
18+ "TokenizationResultActionRequireTfaAction" ,
19+ "ACHResult" ,
20+ "ACHResultAction" ,
21+ "ACHResultActionApproveAction" ,
22+ "ACHResultActionReturnAction" ,
1923]
2024
2125
22- class ActionAuthorizationAction (BaseModel ):
26+ class AuthorizationResultAction (BaseModel ):
27+ type : Literal ["DECLINE" , "CHALLENGE" ]
28+
2329 explanation : Optional [str ] = None
2430 """Optional explanation for why this action was taken"""
2531
2632
27- class ActionAuthentication3DSAction (BaseModel ):
33+ class AuthorizationResult (BaseModel ):
34+ token : str
35+ """Globally unique identifier for the evaluation"""
36+
37+ actions : List [AuthorizationResultAction ]
38+ """Actions returned by the rule evaluation"""
39+
40+ auth_rule_token : str
41+ """The Auth Rule token"""
42+
43+ evaluation_time : datetime
44+ """Timestamp of the rule evaluation"""
45+
46+ event_stream : Literal ["AUTHORIZATION" ]
47+ """The event stream during which the rule was evaluated"""
48+
49+ event_token : str
50+ """Token of the event that triggered the evaluation"""
51+
52+ mode : Literal ["ACTIVE" , "INACTIVE" ]
53+ """The state of the Auth Rule"""
54+
55+ rule_version : int
56+ """Version of the rule that was evaluated"""
57+
58+
59+ class Authentication3DsResultAction (BaseModel ):
60+ type : Literal ["DECLINE" , "CHALLENGE" ]
61+
2862 explanation : Optional [str ] = None
2963 """Optional explanation for why this action was taken"""
3064
3165
32- class ActionDeclineAction (BaseModel ):
66+ class Authentication3DSResult (BaseModel ):
67+ token : str
68+ """Globally unique identifier for the evaluation"""
69+
70+ actions : List [Authentication3DsResultAction ]
71+ """Actions returned by the rule evaluation"""
72+
73+ auth_rule_token : str
74+ """The Auth Rule token"""
75+
76+ evaluation_time : datetime
77+ """Timestamp of the rule evaluation"""
78+
79+ event_stream : Literal ["THREE_DS_AUTHENTICATION" ]
80+ """The event stream during which the rule was evaluated"""
81+
82+ event_token : str
83+ """Token of the event that triggered the evaluation"""
84+
85+ mode : Literal ["ACTIVE" , "INACTIVE" ]
86+ """The state of the Auth Rule"""
87+
88+ rule_version : int
89+ """Version of the rule that was evaluated"""
90+
91+
92+ class TokenizationResultActionDeclineAction (BaseModel ):
3393 type : Literal ["DECLINE" ]
3494 """Decline the tokenization request"""
3595
96+ explanation : Optional [str ] = None
97+ """Optional explanation for why this action was taken"""
98+
3699 reason : Optional [
37100 Literal [
38101 "ACCOUNT_SCORE_1" ,
@@ -53,10 +116,13 @@ class ActionDeclineAction(BaseModel):
53116 """Reason code for declining the tokenization request"""
54117
55118
56- class ActionRequireTfaAction (BaseModel ):
119+ class TokenizationResultActionRequireTfaAction (BaseModel ):
57120 type : Literal ["REQUIRE_TFA" ]
58121 """Require two-factor authentication for the tokenization request"""
59122
123+ explanation : Optional [str ] = None
124+ """Optional explanation for why this action was taken"""
125+
60126 reason : Optional [
61127 Literal [
62128 "WALLET_RECOMMENDED_TFA" ,
@@ -79,12 +145,46 @@ class ActionRequireTfaAction(BaseModel):
79145 """Reason code for requiring two-factor authentication"""
80146
81147
82- class ActionApproveAction (BaseModel ):
148+ TokenizationResultAction : TypeAlias = Union [
149+ TokenizationResultActionDeclineAction , TokenizationResultActionRequireTfaAction
150+ ]
151+
152+
153+ class TokenizationResult (BaseModel ):
154+ token : str
155+ """Globally unique identifier for the evaluation"""
156+
157+ actions : List [TokenizationResultAction ]
158+ """Actions returned by the rule evaluation"""
159+
160+ auth_rule_token : str
161+ """The Auth Rule token"""
162+
163+ evaluation_time : datetime
164+ """Timestamp of the rule evaluation"""
165+
166+ event_stream : Literal ["TOKENIZATION" ]
167+ """The event stream during which the rule was evaluated"""
168+
169+ event_token : str
170+ """Token of the event that triggered the evaluation"""
171+
172+ mode : Literal ["ACTIVE" , "INACTIVE" ]
173+ """The state of the Auth Rule"""
174+
175+ rule_version : int
176+ """Version of the rule that was evaluated"""
177+
178+
179+ class ACHResultActionApproveAction (BaseModel ):
83180 type : Literal ["APPROVE" ]
84181 """Approve the ACH transaction"""
85182
183+ explanation : Optional [str ] = None
184+ """Optional explanation for why this action was taken"""
185+
86186
87- class ActionReturnAction (BaseModel ):
187+ class ACHResultActionReturnAction (BaseModel ):
88188 code : Literal [
89189 "R01" ,
90190 "R02" ,
@@ -166,24 +266,18 @@ class ActionReturnAction(BaseModel):
166266 type : Literal ["RETURN" ]
167267 """Return the ACH transaction"""
168268
269+ explanation : Optional [str ] = None
270+ """Optional explanation for why this action was taken"""
169271
170- Action : TypeAlias = Union [
171- ActionAuthorizationAction ,
172- ActionAuthentication3DSAction ,
173- ActionDeclineAction ,
174- ActionRequireTfaAction ,
175- ActionApproveAction ,
176- ActionReturnAction ,
177- ]
178272
273+ ACHResultAction : TypeAlias = Union [ACHResultActionApproveAction , ACHResultActionReturnAction ]
179274
180- class V2ListResultsResponse (BaseModel ):
181- """Result of an Auth Rule evaluation"""
182275
276+ class ACHResult (BaseModel ):
183277 token : str
184278 """Globally unique identifier for the evaluation"""
185279
186- actions : List [Action ]
280+ actions : List [ACHResultAction ]
187281 """Actions returned by the rule evaluation"""
188282
189283 auth_rule_token : str
@@ -192,7 +286,7 @@ class V2ListResultsResponse(BaseModel):
192286 evaluation_time : datetime
193287 """Timestamp of the rule evaluation"""
194288
195- event_stream : EventStream
289+ event_stream : Literal [ "ACH_CREDIT_RECEIPT" , "ACH_DEBIT_RECEIPT" ]
196290 """The event stream during which the rule was evaluated"""
197291
198292 event_token : str
@@ -203,3 +297,6 @@ class V2ListResultsResponse(BaseModel):
203297
204298 rule_version : int
205299 """Version of the rule that was evaluated"""
300+
301+
302+ V2ListResultsResponse : TypeAlias = Union [AuthorizationResult , Authentication3DSResult , TokenizationResult , ACHResult ]
0 commit comments