Skip to content

Commit e678784

Browse files
feat(api): adds new merchant lock Auth Rule
- Add `SERVICE` as a new Financial Transaction event type - Add `scope` query parameter when retrieving AuthRules
1 parent bb36724 commit e678784

File tree

18 files changed

+738
-54
lines changed

18 files changed

+738
-54
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 156
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-569e7dcb415398515370989172038db711642cd3b0bd7559bfd2b94e325a6086.yml
3-
openapi_spec_hash: ce1dae8c6eb50d4490e75357c5e520a7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-d44845cfc597e545a51450a62b2185d7a1ce76a3f9ac71145c3e74f99397d42a.yml
3+
openapi_spec_hash: 3339f9fd912f2eb8ba5efc3c73f5d030
44
config_hash: e9de93b19060a153a852f7c03f235162

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

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def create(
6767
account_tokens: List[str],
6868
name: Optional[str] | NotGiven = NOT_GIVEN,
6969
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
70-
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
70+
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
7171
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
7272
# The extra values given here take precedence over values defined on the client or passed to this method.
7373
extra_headers: Headers | None = None,
@@ -104,7 +104,7 @@ def create(
104104
card_tokens: List[str],
105105
name: Optional[str] | NotGiven = NOT_GIVEN,
106106
parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | NotGiven = NOT_GIVEN,
107-
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
107+
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
108108
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
109109
# The extra values given here take precedence over values defined on the client or passed to this method.
110110
extra_headers: Headers | None = None,
@@ -142,7 +142,7 @@ def create(
142142
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
143143
name: Optional[str] | NotGiven = NOT_GIVEN,
144144
parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | NotGiven = NOT_GIVEN,
145-
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
145+
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
146146
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
147147
# The extra values given here take precedence over values defined on the client or passed to this method.
148148
extra_headers: Headers | None = None,
@@ -181,7 +181,7 @@ def create(
181181
account_tokens: List[str] | NotGiven = NOT_GIVEN,
182182
name: Optional[str] | NotGiven = NOT_GIVEN,
183183
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
184-
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
184+
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
185185
card_tokens: List[str] | NotGiven = NOT_GIVEN,
186186
program_level: bool | NotGiven = NOT_GIVEN,
187187
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
@@ -422,6 +422,7 @@ def list(
422422
card_token: str | NotGiven = NOT_GIVEN,
423423
ending_before: str | NotGiven = NOT_GIVEN,
424424
page_size: int | NotGiven = NOT_GIVEN,
425+
scope: Literal["PROGRAM", "ACCOUNT", "CARD"] | NotGiven = NOT_GIVEN,
425426
starting_after: str | NotGiven = NOT_GIVEN,
426427
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
427428
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -443,6 +444,8 @@ def list(
443444
444445
page_size: Page size (for pagination).
445446
447+
scope: Only return Authorization Rules that are bound to the provided scope;
448+
446449
starting_after: A cursor representing an item's token after which a page of results should
447450
begin. Used to retrieve the next page of results after this item.
448451
@@ -468,6 +471,7 @@ def list(
468471
"card_token": card_token,
469472
"ending_before": ending_before,
470473
"page_size": page_size,
474+
"scope": scope,
471475
"starting_after": starting_after,
472476
},
473477
v2_list_params.V2ListParams,
@@ -832,7 +836,7 @@ async def create(
832836
account_tokens: List[str],
833837
name: Optional[str] | NotGiven = NOT_GIVEN,
834838
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
835-
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
839+
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
836840
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
837841
# The extra values given here take precedence over values defined on the client or passed to this method.
838842
extra_headers: Headers | None = None,
@@ -869,7 +873,7 @@ async def create(
869873
card_tokens: List[str],
870874
name: Optional[str] | NotGiven = NOT_GIVEN,
871875
parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | NotGiven = NOT_GIVEN,
872-
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
876+
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
873877
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
874878
# The extra values given here take precedence over values defined on the client or passed to this method.
875879
extra_headers: Headers | None = None,
@@ -907,7 +911,7 @@ async def create(
907911
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
908912
name: Optional[str] | NotGiven = NOT_GIVEN,
909913
parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | NotGiven = NOT_GIVEN,
910-
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
914+
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
911915
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
912916
# The extra values given here take precedence over values defined on the client or passed to this method.
913917
extra_headers: Headers | None = None,
@@ -946,7 +950,7 @@ async def create(
946950
account_tokens: List[str] | NotGiven = NOT_GIVEN,
947951
name: Optional[str] | NotGiven = NOT_GIVEN,
948952
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
949-
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
953+
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
950954
card_tokens: List[str] | NotGiven = NOT_GIVEN,
951955
program_level: bool | NotGiven = NOT_GIVEN,
952956
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
@@ -1187,6 +1191,7 @@ def list(
11871191
card_token: str | NotGiven = NOT_GIVEN,
11881192
ending_before: str | NotGiven = NOT_GIVEN,
11891193
page_size: int | NotGiven = NOT_GIVEN,
1194+
scope: Literal["PROGRAM", "ACCOUNT", "CARD"] | NotGiven = NOT_GIVEN,
11901195
starting_after: str | NotGiven = NOT_GIVEN,
11911196
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
11921197
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -1208,6 +1213,8 @@ def list(
12081213
12091214
page_size: Page size (for pagination).
12101215
1216+
scope: Only return Authorization Rules that are bound to the provided scope;
1217+
12111218
starting_after: A cursor representing an item's token after which a page of results should
12121219
begin. Used to retrieve the next page of results after this item.
12131220
@@ -1233,6 +1240,7 @@ def list(
12331240
"card_token": card_token,
12341241
"ending_before": ending_before,
12351242
"page_size": page_size,
1243+
"scope": scope,
12361244
"starting_after": starting_after,
12371245
},
12381246
v2_list_params.V2ListParams,

src/lithic/resources/book_transfers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def create(
8282
"INACTIVITY_FEE_DOWN",
8383
"PROVISIONAL_CREDIT",
8484
"DISPUTE_WON",
85+
"SERVICE",
8586
"TRANSFER",
8687
],
8788
token: str | NotGiven = NOT_GIVEN,
@@ -368,6 +369,7 @@ async def create(
368369
"INACTIVITY_FEE_DOWN",
369370
"PROVISIONAL_CREDIT",
370371
"DISPUTE_WON",
372+
"SERVICE",
371373
"TRANSFER",
372374
],
373375
token: str | NotGiven = NOT_GIVEN,

src/lithic/resources/cards/cards.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ def reissue(
841841
card is
842842
physically damaged). The PAN, expiry, and CVC2 will remain the same and the
843843
original card can continue to be used until the new card is activated. Only
844-
applies to cards of type `PHYSICAL`. A card can be replaced or renewed a total
844+
applies to cards of type `PHYSICAL`. A card can be reissued or renewed a total
845845
of 8 times.
846846
847847
Args:
@@ -918,7 +918,7 @@ def renew(
918918
original card will keep working for card-present transactions until the new card
919919
is activated. For card-not-present transactions, the original card details
920920
(expiry, CVC2) will also keep working until the new card is activated. A
921-
`PHYSICAL` card can be replaced or renewed a total of 8 times. For `VIRTUAL`,
921+
`PHYSICAL` card can be reissued or renewed a total of 8 times. For `VIRTUAL`,
922922
the card will retain the same card token and PAN and receive an updated expiry
923923
and CVC2 code. `product_id`, `shipping_method`, `shipping_address`, `carrier`
924924
are only relevant for renewing `PHYSICAL` cards.
@@ -1828,7 +1828,7 @@ async def reissue(
18281828
card is
18291829
physically damaged). The PAN, expiry, and CVC2 will remain the same and the
18301830
original card can continue to be used until the new card is activated. Only
1831-
applies to cards of type `PHYSICAL`. A card can be replaced or renewed a total
1831+
applies to cards of type `PHYSICAL`. A card can be reissued or renewed a total
18321832
of 8 times.
18331833
18341834
Args:
@@ -1905,7 +1905,7 @@ async def renew(
19051905
original card will keep working for card-present transactions until the new card
19061906
is activated. For card-not-present transactions, the original card details
19071907
(expiry, CVC2) will also keep working until the new card is activated. A
1908-
`PHYSICAL` card can be replaced or renewed a total of 8 times. For `VIRTUAL`,
1908+
`PHYSICAL` card can be reissued or renewed a total of 8 times. For `VIRTUAL`,
19091909
the card will retain the same card token and PAN and receive an updated expiry
19101910
and CVC2 code. `product_id`, `shipping_method`, `shipping_address`, `carrier`
19111911
are only relevant for renewing `PHYSICAL` cards.

src/lithic/types/auth_rules/v2_apply_response.py

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,52 @@
77
from .velocity_limit_params import VelocityLimitParams
88
from .conditional_block_parameters import ConditionalBlockParameters
99

10-
__all__ = ["V2ApplyResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"]
10+
__all__ = [
11+
"V2ApplyResponse",
12+
"CurrentVersion",
13+
"CurrentVersionParameters",
14+
"CurrentVersionParametersMerchantLockParameters",
15+
"CurrentVersionParametersMerchantLockParametersMerchant",
16+
"DraftVersion",
17+
"DraftVersionParameters",
18+
"DraftVersionParametersMerchantLockParameters",
19+
"DraftVersionParametersMerchantLockParametersMerchant",
20+
]
21+
22+
23+
class CurrentVersionParametersMerchantLockParametersMerchant(BaseModel):
24+
comment: Optional[str] = None
25+
"""
26+
A comment or explanation about the merchant, used internally for rule management
27+
purposes.
28+
"""
29+
30+
descriptor: Optional[str] = None
31+
"""
32+
Short description of the merchant, often used to provide more human-readable
33+
context about the transaction merchant. This is typically the name or label
34+
shown on transaction summaries.
35+
"""
36+
37+
merchant_id: Optional[str] = None
38+
"""Unique alphanumeric identifier for the payment card acceptor (merchant).
39+
40+
This attribute specifies the merchant entity that will be locked or referenced
41+
for authorization rules.
42+
"""
43+
1144

12-
CurrentVersionParameters: TypeAlias = Union[ConditionalBlockParameters, VelocityLimitParams]
45+
class CurrentVersionParametersMerchantLockParameters(BaseModel):
46+
merchants: List[CurrentVersionParametersMerchantLockParametersMerchant]
47+
"""
48+
A list of merchant locks defining specific merchants or groups of merchants
49+
(based on descriptors or IDs) that the lock applies to.
50+
"""
51+
52+
53+
CurrentVersionParameters: TypeAlias = Union[
54+
ConditionalBlockParameters, VelocityLimitParams, CurrentVersionParametersMerchantLockParameters
55+
]
1356

1457

1558
class CurrentVersion(BaseModel):
@@ -23,7 +66,39 @@ class CurrentVersion(BaseModel):
2366
"""
2467

2568

26-
DraftVersionParameters: TypeAlias = Union[ConditionalBlockParameters, VelocityLimitParams]
69+
class DraftVersionParametersMerchantLockParametersMerchant(BaseModel):
70+
comment: Optional[str] = None
71+
"""
72+
A comment or explanation about the merchant, used internally for rule management
73+
purposes.
74+
"""
75+
76+
descriptor: Optional[str] = None
77+
"""
78+
Short description of the merchant, often used to provide more human-readable
79+
context about the transaction merchant. This is typically the name or label
80+
shown on transaction summaries.
81+
"""
82+
83+
merchant_id: Optional[str] = None
84+
"""Unique alphanumeric identifier for the payment card acceptor (merchant).
85+
86+
This attribute specifies the merchant entity that will be locked or referenced
87+
for authorization rules.
88+
"""
89+
90+
91+
class DraftVersionParametersMerchantLockParameters(BaseModel):
92+
merchants: List[DraftVersionParametersMerchantLockParametersMerchant]
93+
"""
94+
A list of merchant locks defining specific merchants or groups of merchants
95+
(based on descriptors or IDs) that the lock applies to.
96+
"""
97+
98+
99+
DraftVersionParameters: TypeAlias = Union[
100+
ConditionalBlockParameters, VelocityLimitParams, DraftVersionParametersMerchantLockParameters
101+
]
27102

28103

29104
class DraftVersion(BaseModel):
@@ -60,7 +135,7 @@ class V2ApplyResponse(BaseModel):
60135
state: Literal["ACTIVE", "INACTIVE"]
61136
"""The state of the Auth Rule"""
62137

63-
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"]
138+
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"]
64139
"""The type of Auth Rule"""
65140

66141
excluded_card_tokens: Optional[List[str]] = None

0 commit comments

Comments
 (0)