Skip to content

Commit aefeac5

Browse files
feat(api): add CARD_TRANSACTION_UPDATE event stream and action params to auth_rules v2
1 parent 6ede6ae commit aefeac5

15 files changed

Lines changed: 421 additions & 14 deletions

.stats.yml

Lines changed: 3 additions & 3 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-92d7ce0702a494edb7beb0ad484c4f24aca65777197d40b2108d05c13c3fa505.yml
3-
openapi_spec_hash: 35e4b9edb38ef23f528fcfbfeaabac02
4-
config_hash: ac8326134e692f3f3bdec82396bbec80
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-0f374e78a0212145a2f55a55dfc39a612de19094d5152ae26b1bc74b01b9e343.yml
3+
openapi_spec_hash: ec888cdaebea979a2cd6231ca04c346c
4+
config_hash: 01dfc901bb6d54b0f582155d779bcbe0

api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,21 @@ from lithic.types.auth_rules import (
9898
AuthRuleCondition,
9999
AuthRuleVersion,
100100
BacktestStats,
101+
CardTransactionUpdateAction,
101102
Conditional3DSActionParameters,
102103
ConditionalACHActionParameters,
103104
ConditionalAttribute,
104105
ConditionalAuthorizationActionParameters,
105106
ConditionalBlockParameters,
107+
ConditionalCardTransactionUpdateActionParameters,
106108
ConditionalOperation,
107109
ConditionalTokenizationActionParameters,
108110
ConditionalValue,
109111
EventStream,
110112
MerchantLockParameters,
111113
ReportStats,
112114
RuleFeature,
115+
SpendVelocityFilters,
113116
TypescriptCodeParameters,
114117
VelocityLimitFilters,
115118
VelocityLimitParams,

src/lithic/resources/auth_rules/v2/v2.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ def create(
101101
- `VELOCITY_LIMIT`: AUTHORIZATION event stream.
102102
- `MERCHANT_LOCK`: AUTHORIZATION event stream.
103103
- `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
104-
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
104+
ACH_CREDIT_RECEIPT, ACH_DEBIT_RECEIPT, or CARD_TRANSACTION_UPDATE event
105+
stream.
105106
- `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
106107
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
107108
@@ -157,7 +158,8 @@ def create(
157158
- `VELOCITY_LIMIT`: AUTHORIZATION event stream.
158159
- `MERCHANT_LOCK`: AUTHORIZATION event stream.
159160
- `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
160-
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
161+
ACH_CREDIT_RECEIPT, ACH_DEBIT_RECEIPT, or CARD_TRANSACTION_UPDATE event
162+
stream.
161163
- `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
162164
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
163165
@@ -212,7 +214,8 @@ def create(
212214
- `VELOCITY_LIMIT`: AUTHORIZATION event stream.
213215
- `MERCHANT_LOCK`: AUTHORIZATION event stream.
214216
- `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
215-
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
217+
ACH_CREDIT_RECEIPT, ACH_DEBIT_RECEIPT, or CARD_TRANSACTION_UPDATE event
218+
stream.
216219
- `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
217220
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
218221
@@ -979,7 +982,8 @@ async def create(
979982
- `VELOCITY_LIMIT`: AUTHORIZATION event stream.
980983
- `MERCHANT_LOCK`: AUTHORIZATION event stream.
981984
- `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
982-
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
985+
ACH_CREDIT_RECEIPT, ACH_DEBIT_RECEIPT, or CARD_TRANSACTION_UPDATE event
986+
stream.
983987
- `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
984988
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
985989
@@ -1035,7 +1039,8 @@ async def create(
10351039
- `VELOCITY_LIMIT`: AUTHORIZATION event stream.
10361040
- `MERCHANT_LOCK`: AUTHORIZATION event stream.
10371041
- `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
1038-
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
1042+
ACH_CREDIT_RECEIPT, ACH_DEBIT_RECEIPT, or CARD_TRANSACTION_UPDATE event
1043+
stream.
10391044
- `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
10401045
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
10411046
@@ -1090,7 +1095,8 @@ async def create(
10901095
- `VELOCITY_LIMIT`: AUTHORIZATION event stream.
10911096
- `MERCHANT_LOCK`: AUTHORIZATION event stream.
10921097
- `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
1093-
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
1098+
ACH_CREDIT_RECEIPT, ACH_DEBIT_RECEIPT, or CARD_TRANSACTION_UPDATE event
1099+
stream.
10941100
- `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
10951101
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
10961102

src/lithic/types/auth_rules/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from .conditional_operation import ConditionalOperation as ConditionalOperation
2020
from .velocity_limit_params import VelocityLimitParams as VelocityLimitParams
2121
from .velocity_limit_period import VelocityLimitPeriod as VelocityLimitPeriod
22+
from .spend_velocity_filters import SpendVelocityFilters as SpendVelocityFilters
2223
from .v2_list_results_params import V2ListResultsParams as V2ListResultsParams
2324
from .velocity_limit_filters import VelocityLimitFilters as VelocityLimitFilters
2425
from .conditional_value_param import ConditionalValueParam as ConditionalValueParam
@@ -33,13 +34,16 @@
3334
from .velocity_limit_params_param import VelocityLimitParamsParam as VelocityLimitParamsParam
3435
from .velocity_limit_period_param import VelocityLimitPeriodParam as VelocityLimitPeriodParam
3536
from .conditional_block_parameters import ConditionalBlockParameters as ConditionalBlockParameters
37+
from .spend_velocity_filters_param import SpendVelocityFiltersParam as SpendVelocityFiltersParam
3638
from .velocity_limit_filters_param import VelocityLimitFiltersParam as VelocityLimitFiltersParam
3739
from .v2_retrieve_features_response import V2RetrieveFeaturesResponse as V2RetrieveFeaturesResponse
40+
from .card_transaction_update_action import CardTransactionUpdateAction as CardTransactionUpdateAction
3841
from .merchant_lock_parameters_param import MerchantLockParametersParam as MerchantLockParametersParam
3942
from .typescript_code_parameters_param import TypescriptCodeParametersParam as TypescriptCodeParametersParam
4043
from .conditional_3ds_action_parameters import Conditional3DSActionParameters as Conditional3DSActionParameters
4144
from .conditional_ach_action_parameters import ConditionalACHActionParameters as ConditionalACHActionParameters
4245
from .conditional_block_parameters_param import ConditionalBlockParametersParam as ConditionalBlockParametersParam
46+
from .card_transaction_update_action_param import CardTransactionUpdateActionParam as CardTransactionUpdateActionParam
4347
from .conditional_3ds_action_parameters_param import (
4448
Conditional3DSActionParametersParam as Conditional3DSActionParametersParam,
4549
)
@@ -58,3 +62,9 @@
5862
from .conditional_authorization_action_parameters_param import (
5963
ConditionalAuthorizationActionParametersParam as ConditionalAuthorizationActionParametersParam,
6064
)
65+
from .conditional_card_transaction_update_action_parameters import (
66+
ConditionalCardTransactionUpdateActionParameters as ConditionalCardTransactionUpdateActionParameters,
67+
)
68+
from .conditional_card_transaction_update_action_parameters_param import (
69+
ConditionalCardTransactionUpdateActionParametersParam as ConditionalCardTransactionUpdateActionParametersParam,
70+
)

src/lithic/types/auth_rules/auth_rule.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from .conditional_ach_action_parameters import ConditionalACHActionParameters
1414
from .conditional_tokenization_action_parameters import ConditionalTokenizationActionParameters
1515
from .conditional_authorization_action_parameters import ConditionalAuthorizationActionParameters
16+
from .conditional_card_transaction_update_action_parameters import ConditionalCardTransactionUpdateActionParameters
1617

1718
__all__ = ["AuthRule", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"]
1819

@@ -24,6 +25,7 @@
2425
ConditionalAuthorizationActionParameters,
2526
ConditionalACHActionParameters,
2627
ConditionalTokenizationActionParameters,
28+
ConditionalCardTransactionUpdateActionParameters,
2729
TypescriptCodeParameters,
2830
]
2931

@@ -47,6 +49,7 @@ class CurrentVersion(BaseModel):
4749
ConditionalAuthorizationActionParameters,
4850
ConditionalACHActionParameters,
4951
ConditionalTokenizationActionParameters,
52+
ConditionalCardTransactionUpdateActionParameters,
5053
TypescriptCodeParameters,
5154
]
5255

@@ -129,7 +132,8 @@ class AuthRule(BaseModel):
129132
- `VELOCITY_LIMIT`: AUTHORIZATION event stream.
130133
- `MERCHANT_LOCK`: AUTHORIZATION event stream.
131134
- `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
132-
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
135+
ACH_CREDIT_RECEIPT, ACH_DEBIT_RECEIPT, or CARD_TRANSACTION_UPDATE event
136+
stream.
133137
- `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION,
134138
ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream.
135139
"""

src/lithic/types/auth_rules/auth_rule_version.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from .conditional_ach_action_parameters import ConditionalACHActionParameters
1414
from .conditional_tokenization_action_parameters import ConditionalTokenizationActionParameters
1515
from .conditional_authorization_action_parameters import ConditionalAuthorizationActionParameters
16+
from .conditional_card_transaction_update_action_parameters import ConditionalCardTransactionUpdateActionParameters
1617

1718
__all__ = ["AuthRuleVersion", "Parameters"]
1819

@@ -24,6 +25,7 @@
2425
ConditionalAuthorizationActionParameters,
2526
ConditionalACHActionParameters,
2627
ConditionalTokenizationActionParameters,
28+
ConditionalCardTransactionUpdateActionParameters,
2729
TypescriptCodeParameters,
2830
]
2931

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Union
4+
from typing_extensions import Literal, TypeAlias
5+
6+
from ..._models import BaseModel
7+
8+
__all__ = ["CardTransactionUpdateAction", "TagAction", "CreateCaseAction"]
9+
10+
11+
class TagAction(BaseModel):
12+
key: str
13+
"""The key of the tag to apply to the transaction"""
14+
15+
type: Literal["TAG"]
16+
"""Tag the transaction with key-value metadata"""
17+
18+
value: str
19+
"""The value of the tag to apply to the transaction"""
20+
21+
22+
class CreateCaseAction(BaseModel):
23+
queue_token: str
24+
"""The token of the queue to create the case in"""
25+
26+
scope: Literal["CARD", "ACCOUNT"]
27+
"""The scope of the case to create"""
28+
29+
type: Literal["CREATE_CASE"]
30+
"""Create a case for the transaction"""
31+
32+
33+
CardTransactionUpdateAction: TypeAlias = Union[TagAction, CreateCaseAction]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Union
6+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
7+
8+
__all__ = ["CardTransactionUpdateActionParam", "TagAction", "CreateCaseAction"]
9+
10+
11+
class TagAction(TypedDict, total=False):
12+
key: Required[str]
13+
"""The key of the tag to apply to the transaction"""
14+
15+
type: Required[Literal["TAG"]]
16+
"""Tag the transaction with key-value metadata"""
17+
18+
value: Required[str]
19+
"""The value of the tag to apply to the transaction"""
20+
21+
22+
class CreateCaseAction(TypedDict, total=False):
23+
queue_token: Required[str]
24+
"""The token of the queue to create the case in"""
25+
26+
scope: Required[Literal["CARD", "ACCOUNT"]]
27+
"""The scope of the case to create"""
28+
29+
type: Required[Literal["CREATE_CASE"]]
30+
"""Create a case for the transaction"""
31+
32+
33+
CardTransactionUpdateActionParam: TypeAlias = Union[TagAction, CreateCaseAction]
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Optional
4+
from typing_extensions import Literal
5+
6+
from ..._models import BaseModel
7+
from .conditional_value import ConditionalValue
8+
from .conditional_operation import ConditionalOperation
9+
from .velocity_limit_period import VelocityLimitPeriod
10+
from .spend_velocity_filters import SpendVelocityFilters
11+
from .card_transaction_update_action import CardTransactionUpdateAction
12+
13+
__all__ = ["ConditionalCardTransactionUpdateActionParameters", "Condition", "ConditionParameters"]
14+
15+
16+
class ConditionParameters(BaseModel):
17+
"""Additional parameters for spend velocity attributes.
18+
19+
Required when `attribute` is
20+
`SPEND_VELOCITY_COUNT` or `SPEND_VELOCITY_AMOUNT`. Not used for other attributes.
21+
"""
22+
23+
filters: Optional[SpendVelocityFilters] = None
24+
25+
period: Optional[VelocityLimitPeriod] = None
26+
"""The time period over which to calculate the spend velocity."""
27+
28+
scope: Optional[Literal["CARD", "ACCOUNT", "GLOBAL"]] = None
29+
"""The entity scope to evaluate the attribute against."""
30+
31+
32+
class Condition(BaseModel):
33+
attribute: Literal[
34+
"MCC",
35+
"COUNTRY",
36+
"CURRENCY",
37+
"MERCHANT_ID",
38+
"DESCRIPTOR",
39+
"TRANSACTION_AMOUNT",
40+
"RISK_SCORE",
41+
"TRANSACTION_STATUS",
42+
"LAST_EVENT_TYPE",
43+
"LIABILITY_SHIFT",
44+
"PAN_ENTRY_MODE",
45+
"WALLET_TYPE",
46+
"CARD_AGE",
47+
"ACCOUNT_AGE",
48+
"SPEND_VELOCITY_COUNT",
49+
"SPEND_VELOCITY_AMOUNT",
50+
]
51+
"""The attribute to target.
52+
53+
The following attributes may be targeted:
54+
55+
- `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a
56+
business by the types of goods or services it provides.
57+
- `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all
58+
ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for
59+
Netherlands Antilles.
60+
- `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency of
61+
the transaction.
62+
- `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor
63+
(merchant).
64+
- `DESCRIPTOR`: Short description of card acceptor.
65+
- `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer
66+
fee field in the settlement/cardholder billing currency. This is the amount
67+
the issuer should authorize against unless the issuer is paying the acquirer
68+
fee on behalf of the cardholder.
69+
- `RISK_SCORE`: Network-provided score assessing risk level associated with a
70+
given authorization. Scores are on a range of 0-999, with 0 representing the
71+
lowest risk and 999 representing the highest risk. For Visa transactions,
72+
where the raw score has a range of 0-99, Lithic will normalize the score by
73+
multiplying the raw score by 10x.
74+
- `TRANSACTION_STATUS`: The status of the transaction. Valid values are
75+
`PENDING`, `VOIDED`, `SETTLING`, `SETTLED`, `BOUNCED`, `RETURNED`, `DECLINED`,
76+
`EXPIRED`.
77+
- `LAST_EVENT_TYPE`: The type of the most recent event on the transaction. Valid
78+
values are `AUTHORIZATION`, `AUTHORIZATION_ADVICE`, `AUTHORIZATION_EXPIRY`,
79+
`AUTHORIZATION_REVERSAL`, `BALANCE_INQUIRY`, `CLEARING`, `CORRECTION_CREDIT`,
80+
`CORRECTION_DEBIT`, `CREDIT_AUTHORIZATION`, `CREDIT_AUTHORIZATION_ADVICE`,
81+
`FINANCIAL_AUTHORIZATION`, `FINANCIAL_CREDIT_AUTHORIZATION`, `RETURN`,
82+
`RETURN_REVERSAL`.
83+
- `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer
84+
applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or
85+
`TOKEN_AUTHENTICATED`.
86+
- `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number
87+
(PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`,
88+
`ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`,
89+
`MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`,
90+
`UNKNOWN`, or `CREDENTIAL_ON_FILE`.
91+
- `WALLET_TYPE`: For transactions using a digital wallet token, indicates the
92+
source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`,
93+
`SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`.
94+
- `CARD_AGE`: The age of the card in seconds at the time of the transaction.
95+
- `ACCOUNT_AGE`: The age of the account in seconds at the time of the
96+
transaction.
97+
- `SPEND_VELOCITY_COUNT`: The number of transactions matching the specified
98+
filters within the given period. Requires `parameters` with `scope`, `period`,
99+
and optional `filters`.
100+
- `SPEND_VELOCITY_AMOUNT`: The total spend amount (in cents) of transactions
101+
matching the specified filters within the given period. Requires `parameters`
102+
with `scope`, `period`, and optional `filters`.
103+
"""
104+
105+
operation: ConditionalOperation
106+
"""The operation to apply to the attribute"""
107+
108+
value: ConditionalValue
109+
"""A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`"""
110+
111+
parameters: Optional[ConditionParameters] = None
112+
"""Additional parameters for spend velocity attributes.
113+
114+
Required when `attribute` is `SPEND_VELOCITY_COUNT` or `SPEND_VELOCITY_AMOUNT`.
115+
Not used for other attributes.
116+
"""
117+
118+
119+
class ConditionalCardTransactionUpdateActionParameters(BaseModel):
120+
action: CardTransactionUpdateAction
121+
"""The action to take if the conditions are met."""
122+
123+
conditions: List[Condition]

0 commit comments

Comments
 (0)