Skip to content

Commit b81fa5c

Browse files
fix(api): [breaking] remove approved/decision/challenged/declined fields from auth_rules report_stats
1 parent ce41be2 commit b81fa5c

3 files changed

Lines changed: 18 additions & 315 deletions

File tree

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 189
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-bc1866f92f50e1de35c16e782a13052913aeedc56723b13de396dea7c754889b.yml
3-
openapi_spec_hash: d7110a33edc390903093258735ee0cfb
4-
config_hash: edbdfefeb0d3d927c2f9fe3402793215
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-df28ee30a3bd4fa595befc2048216e1ee1d3845fcfcf179c1c694ba58fd5e4ed.yml
3+
openapi_spec_hash: 79bfc19d85c7f03754684d794653e333
4+
config_hash: 5eca052bb23d273fa970eac3127dd919

src/lithic/types/auth_rules/report_stats.py

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -243,55 +243,33 @@ class ExampleActionReturnAction(BaseModel):
243243

244244

245245
class Example(BaseModel):
246-
actions: Optional[List[ExampleAction]] = None
247-
"""The actions taken by the rule for this event."""
246+
actions: List[ExampleAction]
247+
"""The actions taken by this version for this event."""
248248

249-
approved: Optional[bool] = None
250-
"""Whether the rule would have approved the request."""
251-
252-
decision: Optional[Literal["APPROVED", "DECLINED", "CHALLENGED"]] = None
253-
"""The decision made by the rule for this event."""
254-
255-
event_token: Optional[str] = None
249+
event_token: str
256250
"""The event token."""
257251

258-
timestamp: Optional[datetime] = None
252+
timestamp: datetime
259253
"""The timestamp of the event."""
260254

261255
transaction_token: Optional[str] = None
262256
"""The token of the transaction associated with the event"""
263257

264258

265259
class ReportStats(BaseModel):
266-
action_counts: Optional[Dict[str, int]] = None
260+
action_counts: Dict[str, int]
267261
"""
268262
A mapping of action types to the number of times that action was returned by
269-
this rule during the relevant period. Actions are the possible outcomes of a
263+
this version during the relevant period. Actions are the possible outcomes of a
270264
rule evaluation, such as DECLINE, CHALLENGE, REQUIRE_TFA, etc. In case rule
271265
didn't trigger any action, it's counted under NO_ACTION key.
272266
"""
273267

274-
approved: Optional[int] = None
275-
"""
276-
The total number of historical transactions approved by this rule during the
277-
relevant period, or the number of transactions that would have been approved if
278-
the rule was evaluated in shadow mode.
279-
"""
268+
examples: List[Example]
269+
"""Example events and their outcomes for this version."""
280270

281-
challenged: Optional[int] = None
282-
"""
283-
The total number of historical transactions challenged by this rule during the
284-
relevant period, or the number of transactions that would have been challenged
285-
if the rule was evaluated in shadow mode. Currently applicable only for 3DS Auth
286-
Rules.
287-
"""
288-
289-
declined: Optional[int] = None
290-
"""
291-
The total number of historical transactions declined by this rule during the
292-
relevant period, or the number of transactions that would have been declined if
293-
the rule was evaluated in shadow mode.
294-
"""
271+
state: Literal["ACTIVE", "SHADOW", "INACTIVE"]
272+
"""The evaluation mode of this version during the reported period."""
295273

296-
examples: Optional[List[Example]] = None
297-
"""Example events and their outcomes."""
274+
version: int
275+
"""The rule version number."""

src/lithic/types/auth_rules/v2_retrieve_report_response.py

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

33
import datetime
4-
from typing import Dict, List, Union, Optional
5-
from typing_extensions import Literal, TypeAlias
4+
from typing import List
65

76
from ..._models import BaseModel
87
from .report_stats import ReportStats
98

10-
__all__ = [
11-
"V2RetrieveReportResponse",
12-
"DailyStatistic",
13-
"DailyStatisticVersion",
14-
"DailyStatisticVersionExample",
15-
"DailyStatisticVersionExampleAction",
16-
"DailyStatisticVersionExampleActionDeclineActionAuthorization",
17-
"DailyStatisticVersionExampleActionChallengeActionAuthorization",
18-
"DailyStatisticVersionExampleActionResultAuthentication3DSAction",
19-
"DailyStatisticVersionExampleActionDeclineActionTokenization",
20-
"DailyStatisticVersionExampleActionRequireTfaAction",
21-
"DailyStatisticVersionExampleActionApproveActionACH",
22-
"DailyStatisticVersionExampleActionReturnAction",
23-
]
24-
25-
26-
class DailyStatisticVersionExampleActionDeclineActionAuthorization(BaseModel):
27-
code: Literal[
28-
"ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED",
29-
"ACCOUNT_DELINQUENT",
30-
"ACCOUNT_INACTIVE",
31-
"ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED",
32-
"ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED",
33-
"ACCOUNT_PAUSED",
34-
"ACCOUNT_UNDER_REVIEW",
35-
"ADDRESS_INCORRECT",
36-
"APPROVED",
37-
"AUTH_RULE_ALLOWED_COUNTRY",
38-
"AUTH_RULE_ALLOWED_MCC",
39-
"AUTH_RULE_BLOCKED_COUNTRY",
40-
"AUTH_RULE_BLOCKED_MCC",
41-
"AUTH_RULE",
42-
"CARD_CLOSED",
43-
"CARD_CRYPTOGRAM_VALIDATION_FAILURE",
44-
"CARD_EXPIRED",
45-
"CARD_EXPIRY_DATE_INCORRECT",
46-
"CARD_INVALID",
47-
"CARD_NOT_ACTIVATED",
48-
"CARD_PAUSED",
49-
"CARD_PIN_INCORRECT",
50-
"CARD_RESTRICTED",
51-
"CARD_SECURITY_CODE_INCORRECT",
52-
"CARD_SPEND_LIMIT_EXCEEDED",
53-
"CONTACT_CARD_ISSUER",
54-
"CUSTOMER_ASA_TIMEOUT",
55-
"CUSTOM_ASA_RESULT",
56-
"DECLINED",
57-
"DO_NOT_HONOR",
58-
"DRIVER_NUMBER_INVALID",
59-
"FORMAT_ERROR",
60-
"INSUFFICIENT_FUNDING_SOURCE_BALANCE",
61-
"INSUFFICIENT_FUNDS",
62-
"LITHIC_SYSTEM_ERROR",
63-
"LITHIC_SYSTEM_RATE_LIMIT",
64-
"MALFORMED_ASA_RESPONSE",
65-
"MERCHANT_INVALID",
66-
"MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE",
67-
"MERCHANT_NOT_PERMITTED",
68-
"OVER_REVERSAL_ATTEMPTED",
69-
"PIN_BLOCKED",
70-
"PROGRAM_CARD_SPEND_LIMIT_EXCEEDED",
71-
"PROGRAM_SUSPENDED",
72-
"PROGRAM_USAGE_RESTRICTION",
73-
"REVERSAL_UNMATCHED",
74-
"SECURITY_VIOLATION",
75-
"SINGLE_USE_CARD_REATTEMPTED",
76-
"SUSPECTED_FRAUD",
77-
"TRANSACTION_INVALID",
78-
"TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL",
79-
"TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER",
80-
"TRANSACTION_PREVIOUSLY_COMPLETED",
81-
"UNAUTHORIZED_MERCHANT",
82-
"VEHICLE_NUMBER_INVALID",
83-
"CARDHOLDER_CHALLENGED",
84-
"CARDHOLDER_CHALLENGE_FAILED",
85-
]
86-
"""The detailed result code explaining the specific reason for the decline"""
87-
88-
type: Literal["DECLINE"]
89-
90-
91-
class DailyStatisticVersionExampleActionChallengeActionAuthorization(BaseModel):
92-
type: Literal["CHALLENGE"]
93-
94-
95-
class DailyStatisticVersionExampleActionResultAuthentication3DSAction(BaseModel):
96-
type: Literal["DECLINE", "CHALLENGE"]
97-
98-
99-
class DailyStatisticVersionExampleActionDeclineActionTokenization(BaseModel):
100-
type: Literal["DECLINE"]
101-
"""Decline the tokenization request"""
102-
103-
reason: Optional[
104-
Literal[
105-
"ACCOUNT_SCORE_1",
106-
"DEVICE_SCORE_1",
107-
"ALL_WALLET_DECLINE_REASONS_PRESENT",
108-
"WALLET_RECOMMENDED_DECISION_RED",
109-
"CVC_MISMATCH",
110-
"CARD_EXPIRY_MONTH_MISMATCH",
111-
"CARD_EXPIRY_YEAR_MISMATCH",
112-
"CARD_INVALID_STATE",
113-
"CUSTOMER_RED_PATH",
114-
"INVALID_CUSTOMER_RESPONSE",
115-
"NETWORK_FAILURE",
116-
"GENERIC_DECLINE",
117-
"DIGITAL_CARD_ART_REQUIRED",
118-
]
119-
] = None
120-
"""Reason code for declining the tokenization request"""
121-
122-
123-
class DailyStatisticVersionExampleActionRequireTfaAction(BaseModel):
124-
type: Literal["REQUIRE_TFA"]
125-
"""Require two-factor authentication for the tokenization request"""
126-
127-
reason: Optional[
128-
Literal[
129-
"WALLET_RECOMMENDED_TFA",
130-
"SUSPICIOUS_ACTIVITY",
131-
"DEVICE_RECENTLY_LOST",
132-
"TOO_MANY_RECENT_ATTEMPTS",
133-
"TOO_MANY_RECENT_TOKENS",
134-
"TOO_MANY_DIFFERENT_CARDHOLDERS",
135-
"OUTSIDE_HOME_TERRITORY",
136-
"HAS_SUSPENDED_TOKENS",
137-
"HIGH_RISK",
138-
"ACCOUNT_SCORE_LOW",
139-
"DEVICE_SCORE_LOW",
140-
"CARD_STATE_TFA",
141-
"HARDCODED_TFA",
142-
"CUSTOMER_RULE_TFA",
143-
"DEVICE_HOST_CARD_EMULATION",
144-
]
145-
] = None
146-
"""Reason code for requiring two-factor authentication"""
147-
148-
149-
class DailyStatisticVersionExampleActionApproveActionACH(BaseModel):
150-
type: Literal["APPROVE"]
151-
"""Approve the ACH transaction"""
152-
153-
154-
class DailyStatisticVersionExampleActionReturnAction(BaseModel):
155-
code: Literal[
156-
"R01",
157-
"R02",
158-
"R03",
159-
"R04",
160-
"R05",
161-
"R06",
162-
"R07",
163-
"R08",
164-
"R09",
165-
"R10",
166-
"R11",
167-
"R12",
168-
"R13",
169-
"R14",
170-
"R15",
171-
"R16",
172-
"R17",
173-
"R18",
174-
"R19",
175-
"R20",
176-
"R21",
177-
"R22",
178-
"R23",
179-
"R24",
180-
"R25",
181-
"R26",
182-
"R27",
183-
"R28",
184-
"R29",
185-
"R30",
186-
"R31",
187-
"R32",
188-
"R33",
189-
"R34",
190-
"R35",
191-
"R36",
192-
"R37",
193-
"R38",
194-
"R39",
195-
"R40",
196-
"R41",
197-
"R42",
198-
"R43",
199-
"R44",
200-
"R45",
201-
"R46",
202-
"R47",
203-
"R50",
204-
"R51",
205-
"R52",
206-
"R53",
207-
"R61",
208-
"R62",
209-
"R67",
210-
"R68",
211-
"R69",
212-
"R70",
213-
"R71",
214-
"R72",
215-
"R73",
216-
"R74",
217-
"R75",
218-
"R76",
219-
"R77",
220-
"R80",
221-
"R81",
222-
"R82",
223-
"R83",
224-
"R84",
225-
"R85",
226-
]
227-
"""NACHA return code to use when returning the transaction.
228-
229-
Note that the list of available return codes is subject to an allowlist
230-
configured at the program level
231-
"""
232-
233-
type: Literal["RETURN"]
234-
"""Return the ACH transaction"""
235-
236-
237-
DailyStatisticVersionExampleAction: TypeAlias = Union[
238-
DailyStatisticVersionExampleActionDeclineActionAuthorization,
239-
DailyStatisticVersionExampleActionChallengeActionAuthorization,
240-
DailyStatisticVersionExampleActionResultAuthentication3DSAction,
241-
DailyStatisticVersionExampleActionDeclineActionTokenization,
242-
DailyStatisticVersionExampleActionRequireTfaAction,
243-
DailyStatisticVersionExampleActionApproveActionACH,
244-
DailyStatisticVersionExampleActionReturnAction,
245-
]
246-
247-
248-
class DailyStatisticVersionExample(BaseModel):
249-
actions: List[DailyStatisticVersionExampleAction]
250-
"""The actions taken by this version for this event."""
251-
252-
event_token: str
253-
"""The event token."""
254-
255-
timestamp: datetime.datetime
256-
"""The timestamp of the event."""
257-
258-
transaction_token: Optional[str] = None
259-
"""The token of the transaction associated with the event"""
260-
261-
262-
class DailyStatisticVersion(BaseModel):
263-
action_counts: Dict[str, int]
264-
"""
265-
A mapping of action types to the number of times that action was returned by
266-
this version during the relevant period. Actions are the possible outcomes of a
267-
rule evaluation, such as DECLINE, CHALLENGE, REQUIRE_TFA, etc. In case rule
268-
didn't trigger any action, it's counted under NO_ACTION key.
269-
"""
270-
271-
examples: List[DailyStatisticVersionExample]
272-
"""Example events and their outcomes for this version."""
273-
274-
state: Literal["ACTIVE", "SHADOW", "INACTIVE"]
275-
"""The evaluation mode of this version during the reported period."""
276-
277-
version: int
278-
"""The rule version number."""
9+
__all__ = ["V2RetrieveReportResponse", "DailyStatistic"]
27910

28011

28112
class DailyStatistic(BaseModel):
282-
current_version_statistics: Optional[ReportStats] = None
283-
"""Detailed statistics for the current version of the rule."""
284-
28513
date: datetime.date
28614
"""The date (UTC) for which the statistics are reported."""
28715

288-
draft_version_statistics: Optional[ReportStats] = None
289-
"""Detailed statistics for the draft version of the rule."""
290-
291-
versions: List[DailyStatisticVersion]
16+
versions: List[ReportStats]
29217
"""
29318
Statistics for each version of the rule that was evaluated during the reported
29419
day.

0 commit comments

Comments
 (0)