Skip to content

Commit 5748bc0

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(types)!: improve auth rules types (#671)
1 parent 2eddffd commit 5748bc0

24 files changed

+222
-1377
lines changed

api.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@
44
from lithic.types import (
55
AccountFinancialAccountType,
66
Address,
7-
AuthRule,
87
Carrier,
98
Currency,
109
Document,
1110
InstanceFinancialAccountType,
1211
ShippingAddress,
13-
VelocityLimitParams,
14-
VelocityLimitParamsPeriodWindow,
1512
)
1613
```
1714

@@ -80,6 +77,12 @@ Types:
8077

8178
```python
8279
from lithic.types.auth_rules import (
80+
AuthRule,
81+
AuthRuleCondition,
82+
ConditionalAttribute,
83+
ConditionalBlockParameters,
84+
VelocityLimitParams,
85+
VelocityLimitParamsPeriodWindow,
8386
V2CreateResponse,
8487
V2RetrieveResponse,
8588
V2UpdateResponse,

src/lithic/types/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,11 @@
77
from .shared import (
88
Address as Address,
99
Carrier as Carrier,
10-
AuthRule as AuthRule,
1110
Currency as Currency,
1211
Document as Document,
1312
ShippingAddress as ShippingAddress,
14-
VelocityLimitParams as VelocityLimitParams,
1513
AccountFinancialAccountType as AccountFinancialAccountType,
1614
InstanceFinancialAccountType as InstanceFinancialAccountType,
17-
VelocityLimitParamsPeriodWindow as VelocityLimitParamsPeriodWindow,
1815
)
1916
from .account import Account as Account
2017
from .balance import Balance as Balance

src/lithic/types/auth_rules/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,13 @@
1313
from .v2_create_response import V2CreateResponse as V2CreateResponse
1414
from .v2_report_response import V2ReportResponse as V2ReportResponse
1515
from .v2_update_response import V2UpdateResponse as V2UpdateResponse
16+
from .auth_rule_condition import AuthRuleCondition as AuthRuleCondition
1617
from .v2_promote_response import V2PromoteResponse as V2PromoteResponse
1718
from .v2_retrieve_response import V2RetrieveResponse as V2RetrieveResponse
19+
from .conditional_attribute import ConditionalAttribute as ConditionalAttribute
20+
from .velocity_limit_params import VelocityLimitParams as VelocityLimitParams
21+
from .auth_rule_condition_param import AuthRuleConditionParam as AuthRuleConditionParam
22+
from .velocity_limit_params_param import VelocityLimitParamsParam as VelocityLimitParamsParam
23+
from .conditional_block_parameters import ConditionalBlockParameters as ConditionalBlockParameters
24+
from .conditional_block_parameters_param import ConditionalBlockParametersParam as ConditionalBlockParametersParam
25+
from .velocity_limit_params_period_window import VelocityLimitParamsPeriodWindow as VelocityLimitParamsPeriodWindow
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Union, Optional
4+
from typing_extensions import Literal
5+
6+
from ..._models import BaseModel
7+
from .conditional_attribute import ConditionalAttribute
8+
9+
__all__ = ["AuthRuleCondition"]
10+
11+
12+
class AuthRuleCondition(BaseModel):
13+
attribute: Optional[ConditionalAttribute] = None
14+
"""The attribute to target.
15+
16+
The following attributes may be targeted:
17+
18+
- `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a
19+
business by the types of goods or services it provides.
20+
- `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all
21+
ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for
22+
Netherlands Antilles.
23+
- `CURRENCY`: 3-digit alphabetic ISO 4217 code for the merchant currency of the
24+
transaction.
25+
- `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor
26+
(merchant).
27+
- `DESCRIPTOR`: Short description of card acceptor.
28+
- `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer
29+
applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or
30+
`TOKEN_AUTHENTICATED`.
31+
- `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number
32+
(PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`,
33+
`ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`,
34+
`MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`,
35+
`UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`.
36+
- `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer
37+
fee field in the settlement/cardholder billing currency. This is the amount
38+
the issuer should authorize against unless the issuer is paying the acquirer
39+
fee on behalf of the cardholder.
40+
- `RISK_SCORE`: Network-provided score assessing risk level associated with a
41+
given authorization. Scores are on a range of 0-999, with 0 representing the
42+
lowest risk and 999 representing the highest risk. For Visa transactions,
43+
where the raw score has a range of 0-99, Lithic will normalize the score by
44+
multiplying the raw score by 10x.
45+
- `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the
46+
trailing hour up and until the authorization.
47+
- `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the
48+
trailing 24 hours up and until the authorization.
49+
"""
50+
51+
operation: Optional[
52+
Literal["IS_ONE_OF", "IS_NOT_ONE_OF", "MATCHES", "DOES_NOT_MATCH", "IS_GREATER_THAN", "IS_LESS_THAN"]
53+
] = None
54+
"""The operation to apply to the attribute"""
55+
56+
value: Union[str, int, List[str], None] = None
57+
"""A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`"""
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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 List, Union
6+
from typing_extensions import Literal, TypedDict
7+
8+
from .conditional_attribute import ConditionalAttribute
9+
10+
__all__ = ["AuthRuleConditionParam"]
11+
12+
13+
class AuthRuleConditionParam(TypedDict, total=False):
14+
attribute: ConditionalAttribute
15+
"""The attribute to target.
16+
17+
The following attributes may be targeted:
18+
19+
- `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a
20+
business by the types of goods or services it provides.
21+
- `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all
22+
ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for
23+
Netherlands Antilles.
24+
- `CURRENCY`: 3-digit alphabetic ISO 4217 code for the merchant currency of the
25+
transaction.
26+
- `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor
27+
(merchant).
28+
- `DESCRIPTOR`: Short description of card acceptor.
29+
- `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer
30+
applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or
31+
`TOKEN_AUTHENTICATED`.
32+
- `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number
33+
(PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`,
34+
`ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`,
35+
`MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`,
36+
`UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`.
37+
- `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer
38+
fee field in the settlement/cardholder billing currency. This is the amount
39+
the issuer should authorize against unless the issuer is paying the acquirer
40+
fee on behalf of the cardholder.
41+
- `RISK_SCORE`: Network-provided score assessing risk level associated with a
42+
given authorization. Scores are on a range of 0-999, with 0 representing the
43+
lowest risk and 999 representing the highest risk. For Visa transactions,
44+
where the raw score has a range of 0-99, Lithic will normalize the score by
45+
multiplying the raw score by 10x.
46+
- `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the
47+
trailing hour up and until the authorization.
48+
- `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the
49+
trailing 24 hours up and until the authorization.
50+
"""
51+
52+
operation: Literal["IS_ONE_OF", "IS_NOT_ONE_OF", "MATCHES", "DOES_NOT_MATCH", "IS_GREATER_THAN", "IS_LESS_THAN"]
53+
"""The operation to apply to the attribute"""
54+
55+
value: Union[str, int, List[str]]
56+
"""A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`"""
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing_extensions import Literal, TypeAlias
4+
5+
__all__ = ["ConditionalAttribute"]
6+
7+
ConditionalAttribute: TypeAlias = Literal[
8+
"MCC",
9+
"COUNTRY",
10+
"CURRENCY",
11+
"MERCHANT_ID",
12+
"DESCRIPTOR",
13+
"LIABILITY_SHIFT",
14+
"PAN_ENTRY_MODE",
15+
"TRANSACTION_AMOUNT",
16+
"RISK_SCORE",
17+
"CARD_TRANSACTION_COUNT_1H",
18+
"CARD_TRANSACTION_COUNT_24H",
19+
]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List
4+
5+
from ..._models import BaseModel
6+
from .auth_rule_condition import AuthRuleCondition
7+
8+
__all__ = ["ConditionalBlockParameters"]
9+
10+
11+
class ConditionalBlockParameters(BaseModel):
12+
conditions: List[AuthRuleCondition]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 Iterable
6+
from typing_extensions import Required, TypedDict
7+
8+
from .auth_rule_condition_param import AuthRuleConditionParam
9+
10+
__all__ = ["ConditionalBlockParametersParam"]
11+
12+
13+
class ConditionalBlockParametersParam(TypedDict, total=False):
14+
conditions: Required[Iterable[AuthRuleConditionParam]]

src/lithic/types/auth_rules/v2_apply_response.py

Lines changed: 5 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -4,88 +4,12 @@
44
from typing_extensions import Literal, TypeAlias
55

66
from ..._models import BaseModel
7-
from ..shared.velocity_limit_params import VelocityLimitParams
8-
9-
__all__ = [
10-
"V2ApplyResponse",
11-
"CurrentVersion",
12-
"CurrentVersionParameters",
13-
"CurrentVersionParametersConditionalBlockParameters",
14-
"CurrentVersionParametersConditionalBlockParametersCondition",
15-
"DraftVersion",
16-
"DraftVersionParameters",
17-
"DraftVersionParametersConditionalBlockParameters",
18-
"DraftVersionParametersConditionalBlockParametersCondition",
19-
]
20-
21-
22-
class CurrentVersionParametersConditionalBlockParametersCondition(BaseModel):
23-
attribute: Optional[
24-
Literal[
25-
"MCC",
26-
"COUNTRY",
27-
"CURRENCY",
28-
"MERCHANT_ID",
29-
"DESCRIPTOR",
30-
"LIABILITY_SHIFT",
31-
"PAN_ENTRY_MODE",
32-
"TRANSACTION_AMOUNT",
33-
"RISK_SCORE",
34-
"CARD_TRANSACTION_COUNT_1H",
35-
"CARD_TRANSACTION_COUNT_24H",
36-
]
37-
] = None
38-
"""The attribute to target.
39-
40-
The following attributes may be targeted:
41-
42-
- `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a
43-
business by the types of goods or services it provides.
44-
- `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all
45-
ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for
46-
Netherlands Antilles.
47-
- `CURRENCY`: 3-digit alphabetic ISO 4217 code for the merchant currency of the
48-
transaction.
49-
- `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor
50-
(merchant).
51-
- `DESCRIPTOR`: Short description of card acceptor.
52-
- `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer
53-
applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or
54-
`TOKEN_AUTHENTICATED`.
55-
- `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number
56-
(PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`,
57-
`ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`,
58-
`MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`,
59-
`UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`.
60-
- `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer
61-
fee field in the settlement/cardholder billing currency. This is the amount
62-
the issuer should authorize against unless the issuer is paying the acquirer
63-
fee on behalf of the cardholder.
64-
- `RISK_SCORE`: Network-provided score assessing risk level associated with a
65-
given authorization. Scores are on a range of 0-999, with 0 representing the
66-
lowest risk and 999 representing the highest risk. For Visa transactions,
67-
where the raw score has a range of 0-99, Lithic will normalize the score by
68-
multiplying the raw score by 10x.
69-
- `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the
70-
trailing hour up and until the authorization.
71-
- `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the
72-
trailing 24 hours up and until the authorization.
73-
"""
74-
75-
operation: Optional[
76-
Literal["IS_ONE_OF", "IS_NOT_ONE_OF", "MATCHES", "DOES_NOT_MATCH", "IS_GREATER_THAN", "IS_LESS_THAN"]
77-
] = None
78-
"""The operation to apply to the attribute"""
79-
80-
value: Union[str, int, List[str], None] = None
81-
"""A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`"""
7+
from .velocity_limit_params import VelocityLimitParams
8+
from .conditional_block_parameters import ConditionalBlockParameters
829

10+
__all__ = ["V2ApplyResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"]
8311

84-
class CurrentVersionParametersConditionalBlockParameters(BaseModel):
85-
conditions: List[CurrentVersionParametersConditionalBlockParametersCondition]
86-
87-
88-
CurrentVersionParameters: TypeAlias = Union[CurrentVersionParametersConditionalBlockParameters, VelocityLimitParams]
12+
CurrentVersionParameters: TypeAlias = Union[ConditionalBlockParameters, VelocityLimitParams]
8913

9014

9115
class CurrentVersion(BaseModel):
@@ -99,73 +23,7 @@ class CurrentVersion(BaseModel):
9923
"""
10024

10125

102-
class DraftVersionParametersConditionalBlockParametersCondition(BaseModel):
103-
attribute: Optional[
104-
Literal[
105-
"MCC",
106-
"COUNTRY",
107-
"CURRENCY",
108-
"MERCHANT_ID",
109-
"DESCRIPTOR",
110-
"LIABILITY_SHIFT",
111-
"PAN_ENTRY_MODE",
112-
"TRANSACTION_AMOUNT",
113-
"RISK_SCORE",
114-
"CARD_TRANSACTION_COUNT_1H",
115-
"CARD_TRANSACTION_COUNT_24H",
116-
]
117-
] = None
118-
"""The attribute to target.
119-
120-
The following attributes may be targeted:
121-
122-
- `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify a
123-
business by the types of goods or services it provides.
124-
- `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all
125-
ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for
126-
Netherlands Antilles.
127-
- `CURRENCY`: 3-digit alphabetic ISO 4217 code for the merchant currency of the
128-
transaction.
129-
- `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor
130-
(merchant).
131-
- `DESCRIPTOR`: Short description of card acceptor.
132-
- `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the issuer
133-
applies to the transaction. Valid values are `NONE`, `3DS_AUTHENTICATED`, or
134-
`TOKEN_AUTHENTICATED`.
135-
- `PAN_ENTRY_MODE`: The method by which the cardholder's primary account number
136-
(PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, `CONTACTLESS`,
137-
`ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`,
138-
`MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`,
139-
`UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`.
140-
- `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the acquirer
141-
fee field in the settlement/cardholder billing currency. This is the amount
142-
the issuer should authorize against unless the issuer is paying the acquirer
143-
fee on behalf of the cardholder.
144-
- `RISK_SCORE`: Network-provided score assessing risk level associated with a
145-
given authorization. Scores are on a range of 0-999, with 0 representing the
146-
lowest risk and 999 representing the highest risk. For Visa transactions,
147-
where the raw score has a range of 0-99, Lithic will normalize the score by
148-
multiplying the raw score by 10x.
149-
- `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the
150-
trailing hour up and until the authorization.
151-
- `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the
152-
trailing 24 hours up and until the authorization.
153-
"""
154-
155-
operation: Optional[
156-
Literal["IS_ONE_OF", "IS_NOT_ONE_OF", "MATCHES", "DOES_NOT_MATCH", "IS_GREATER_THAN", "IS_LESS_THAN"]
157-
] = None
158-
"""The operation to apply to the attribute"""
159-
160-
value: Union[str, int, List[str], None] = None
161-
"""A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`"""
162-
163-
164-
class DraftVersionParametersConditionalBlockParameters(BaseModel):
165-
conditions: List[DraftVersionParametersConditionalBlockParametersCondition]
166-
167-
168-
DraftVersionParameters: TypeAlias = Union[DraftVersionParametersConditionalBlockParameters, VelocityLimitParams]
26+
DraftVersionParameters: TypeAlias = Union[ConditionalBlockParameters, VelocityLimitParams]
16927

17028

17129
class DraftVersion(BaseModel):

0 commit comments

Comments
 (0)