Skip to content

Commit 6412dcd

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
chore(api): new ConvertPhysical endpoint to convert a virtual card to a physical card (#656)
- adds `name` and `excluded_card_tokens` params to AuthRules - adds `CARD_TRANSACTION_COUNT` attributes to AuthRules - adds `pin` to Transaction simulations - small updates to documentation on Cards - adds `card.converted` Event - adds `RETURNED_PAYMENT` and `RETURNED_PAYMENT_REVERSAL` Event types
1 parent b0b1b64 commit 6412dcd

40 files changed

+854
-79
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 152
1+
configured_endpoints: 153

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ Methods:
187187
- <code title="get /v1/cards/{card_token}">client.cards.<a href="./src/lithic/resources/cards/cards.py">retrieve</a>(card_token) -> <a href="./src/lithic/types/card.py">Card</a></code>
188188
- <code title="patch /v1/cards/{card_token}">client.cards.<a href="./src/lithic/resources/cards/cards.py">update</a>(card_token, \*\*<a href="src/lithic/types/card_update_params.py">params</a>) -> <a href="./src/lithic/types/card.py">Card</a></code>
189189
- <code title="get /v1/cards">client.cards.<a href="./src/lithic/resources/cards/cards.py">list</a>(\*\*<a href="src/lithic/types/card_list_params.py">params</a>) -> <a href="./src/lithic/types/card.py">SyncCursorPage[Card]</a></code>
190+
- <code title="post /v1/cards/{card_token}/convert_physical">client.cards.<a href="./src/lithic/resources/cards/cards.py">convert_physical</a>(card_token, \*\*<a href="src/lithic/types/card_convert_physical_params.py">params</a>) -> <a href="./src/lithic/types/card.py">Card</a></code>
190191
- <code title="get /v1/embed/card">client.cards.<a href="./src/lithic/resources/cards/cards.py">embed</a>(\*\*<a href="src/lithic/types/card_embed_params.py">params</a>) -> str</code>
191192
- <code title="post /v1/cards/{card_token}/provision">client.cards.<a href="./src/lithic/resources/cards/cards.py">provision</a>(card_token, \*\*<a href="src/lithic/types/card_provision_params.py">params</a>) -> <a href="./src/lithic/types/card_provision_response.py">CardProvisionResponse</a></code>
192193
- <code title="post /v1/cards/{card_token}/reissue">client.cards.<a href="./src/lithic/resources/cards/cards.py">reissue</a>(card_token, \*\*<a href="src/lithic/types/card_reissue_params.py">params</a>) -> <a href="./src/lithic/types/card.py">Card</a></code>

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

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def create(
6969
self,
7070
*,
7171
account_tokens: List[str],
72+
name: Optional[str] | NotGiven = NOT_GIVEN,
7273
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
7374
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
7475
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -84,6 +85,8 @@ def create(
8485
Args:
8586
account_tokens: Account tokens to which the Auth Rule applies.
8687
88+
name: Auth Rule Name
89+
8790
parameters: Parameters for the current version of the Auth Rule
8891
8992
type: The type of Auth Rule
@@ -103,6 +106,7 @@ def create(
103106
self,
104107
*,
105108
card_tokens: List[str],
109+
name: Optional[str] | NotGiven = NOT_GIVEN,
106110
parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | NotGiven = NOT_GIVEN,
107111
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
108112
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -118,6 +122,8 @@ def create(
118122
Args:
119123
card_tokens: Card tokens to which the Auth Rule applies.
120124
125+
name: Auth Rule Name
126+
121127
parameters: Parameters for the current version of the Auth Rule
122128
123129
type: The type of Auth Rule
@@ -137,6 +143,8 @@ def create(
137143
self,
138144
*,
139145
program_level: bool,
146+
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
147+
name: Optional[str] | NotGiven = NOT_GIVEN,
140148
parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | NotGiven = NOT_GIVEN,
141149
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
142150
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -152,6 +160,10 @@ def create(
152160
Args:
153161
program_level: Whether the Auth Rule applies to all authorizations on the card program.
154162
163+
excluded_card_tokens: Card tokens to which the Auth Rule does not apply.
164+
165+
name: Auth Rule Name
166+
155167
parameters: Parameters for the current version of the Auth Rule
156168
157169
type: The type of Auth Rule
@@ -171,10 +183,12 @@ def create(
171183
self,
172184
*,
173185
account_tokens: List[str] | NotGiven = NOT_GIVEN,
186+
name: Optional[str] | NotGiven = NOT_GIVEN,
174187
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
175188
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
176189
card_tokens: List[str] | NotGiven = NOT_GIVEN,
177190
program_level: bool | NotGiven = NOT_GIVEN,
191+
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
178192
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
179193
# The extra values given here take precedence over values defined on the client or passed to this method.
180194
extra_headers: Headers | None = None,
@@ -187,10 +201,12 @@ def create(
187201
body=maybe_transform(
188202
{
189203
"account_tokens": account_tokens,
204+
"name": name,
190205
"parameters": parameters,
191206
"type": type,
192207
"card_tokens": card_tokens,
193208
"program_level": program_level,
209+
"excluded_card_tokens": excluded_card_tokens,
194210
},
195211
v2_create_params.V2CreateParams,
196212
),
@@ -237,6 +253,7 @@ def update(
237253
self,
238254
auth_rule_token: str,
239255
*,
256+
name: Optional[str] | NotGiven = NOT_GIVEN,
240257
state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN,
241258
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
242259
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -249,6 +266,8 @@ def update(
249266
Updates an authorization rule's properties
250267
251268
Args:
269+
name: Auth Rule Name
270+
252271
state: The desired state of the Auth Rule.
253272
254273
Note that only deactivating an Auth Rule through this endpoint is supported at
@@ -267,7 +286,13 @@ def update(
267286
raise ValueError(f"Expected a non-empty value for `auth_rule_token` but received {auth_rule_token!r}")
268287
return self._patch(
269288
f"/v2/auth_rules/{auth_rule_token}",
270-
body=maybe_transform({"state": state}, v2_update_params.V2UpdateParams),
289+
body=maybe_transform(
290+
{
291+
"name": name,
292+
"state": state,
293+
},
294+
v2_update_params.V2UpdateParams,
295+
),
271296
options=make_request_options(
272297
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
273298
),
@@ -407,6 +432,7 @@ def apply(
407432
auth_rule_token: str,
408433
*,
409434
program_level: bool,
435+
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
410436
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
411437
# The extra values given here take precedence over values defined on the client or passed to this method.
412438
extra_headers: Headers | None = None,
@@ -424,6 +450,8 @@ def apply(
424450
Args:
425451
program_level: Whether the Auth Rule applies to all authorizations on the card program.
426452
453+
excluded_card_tokens: Card tokens to which the Auth Rule does not apply.
454+
427455
extra_headers: Send extra headers
428456
429457
extra_query: Add additional query parameters to the request
@@ -442,6 +470,7 @@ def apply(
442470
account_tokens: List[str] | NotGiven = NOT_GIVEN,
443471
card_tokens: List[str] | NotGiven = NOT_GIVEN,
444472
program_level: bool | NotGiven = NOT_GIVEN,
473+
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
445474
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
446475
# The extra values given here take precedence over values defined on the client or passed to this method.
447476
extra_headers: Headers | None = None,
@@ -458,6 +487,7 @@ def apply(
458487
"account_tokens": account_tokens,
459488
"card_tokens": card_tokens,
460489
"program_level": program_level,
490+
"excluded_card_tokens": excluded_card_tokens,
461491
},
462492
v2_apply_params.V2ApplyParams,
463493
),
@@ -655,6 +685,7 @@ async def create(
655685
self,
656686
*,
657687
account_tokens: List[str],
688+
name: Optional[str] | NotGiven = NOT_GIVEN,
658689
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
659690
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
660691
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -670,6 +701,8 @@ async def create(
670701
Args:
671702
account_tokens: Account tokens to which the Auth Rule applies.
672703
704+
name: Auth Rule Name
705+
673706
parameters: Parameters for the current version of the Auth Rule
674707
675708
type: The type of Auth Rule
@@ -689,6 +722,7 @@ async def create(
689722
self,
690723
*,
691724
card_tokens: List[str],
725+
name: Optional[str] | NotGiven = NOT_GIVEN,
692726
parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | NotGiven = NOT_GIVEN,
693727
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
694728
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -704,6 +738,8 @@ async def create(
704738
Args:
705739
card_tokens: Card tokens to which the Auth Rule applies.
706740
741+
name: Auth Rule Name
742+
707743
parameters: Parameters for the current version of the Auth Rule
708744
709745
type: The type of Auth Rule
@@ -723,6 +759,8 @@ async def create(
723759
self,
724760
*,
725761
program_level: bool,
762+
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
763+
name: Optional[str] | NotGiven = NOT_GIVEN,
726764
parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | NotGiven = NOT_GIVEN,
727765
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
728766
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -738,6 +776,10 @@ async def create(
738776
Args:
739777
program_level: Whether the Auth Rule applies to all authorizations on the card program.
740778
779+
excluded_card_tokens: Card tokens to which the Auth Rule does not apply.
780+
781+
name: Auth Rule Name
782+
741783
parameters: Parameters for the current version of the Auth Rule
742784
743785
type: The type of Auth Rule
@@ -757,10 +799,12 @@ async def create(
757799
self,
758800
*,
759801
account_tokens: List[str] | NotGiven = NOT_GIVEN,
802+
name: Optional[str] | NotGiven = NOT_GIVEN,
760803
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
761804
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
762805
card_tokens: List[str] | NotGiven = NOT_GIVEN,
763806
program_level: bool | NotGiven = NOT_GIVEN,
807+
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
764808
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
765809
# The extra values given here take precedence over values defined on the client or passed to this method.
766810
extra_headers: Headers | None = None,
@@ -773,10 +817,12 @@ async def create(
773817
body=await async_maybe_transform(
774818
{
775819
"account_tokens": account_tokens,
820+
"name": name,
776821
"parameters": parameters,
777822
"type": type,
778823
"card_tokens": card_tokens,
779824
"program_level": program_level,
825+
"excluded_card_tokens": excluded_card_tokens,
780826
},
781827
v2_create_params.V2CreateParams,
782828
),
@@ -823,6 +869,7 @@ async def update(
823869
self,
824870
auth_rule_token: str,
825871
*,
872+
name: Optional[str] | NotGiven = NOT_GIVEN,
826873
state: Literal["INACTIVE"] | NotGiven = NOT_GIVEN,
827874
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
828875
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -835,6 +882,8 @@ async def update(
835882
Updates an authorization rule's properties
836883
837884
Args:
885+
name: Auth Rule Name
886+
838887
state: The desired state of the Auth Rule.
839888
840889
Note that only deactivating an Auth Rule through this endpoint is supported at
@@ -853,7 +902,13 @@ async def update(
853902
raise ValueError(f"Expected a non-empty value for `auth_rule_token` but received {auth_rule_token!r}")
854903
return await self._patch(
855904
f"/v2/auth_rules/{auth_rule_token}",
856-
body=await async_maybe_transform({"state": state}, v2_update_params.V2UpdateParams),
905+
body=await async_maybe_transform(
906+
{
907+
"name": name,
908+
"state": state,
909+
},
910+
v2_update_params.V2UpdateParams,
911+
),
857912
options=make_request_options(
858913
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
859914
),
@@ -993,6 +1048,7 @@ async def apply(
9931048
auth_rule_token: str,
9941049
*,
9951050
program_level: bool,
1051+
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
9961052
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
9971053
# The extra values given here take precedence over values defined on the client or passed to this method.
9981054
extra_headers: Headers | None = None,
@@ -1010,6 +1066,8 @@ async def apply(
10101066
Args:
10111067
program_level: Whether the Auth Rule applies to all authorizations on the card program.
10121068
1069+
excluded_card_tokens: Card tokens to which the Auth Rule does not apply.
1070+
10131071
extra_headers: Send extra headers
10141072
10151073
extra_query: Add additional query parameters to the request
@@ -1028,6 +1086,7 @@ async def apply(
10281086
account_tokens: List[str] | NotGiven = NOT_GIVEN,
10291087
card_tokens: List[str] | NotGiven = NOT_GIVEN,
10301088
program_level: bool | NotGiven = NOT_GIVEN,
1089+
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
10311090
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
10321091
# The extra values given here take precedence over values defined on the client or passed to this method.
10331092
extra_headers: Headers | None = None,
@@ -1044,6 +1103,7 @@ async def apply(
10441103
"account_tokens": account_tokens,
10451104
"card_tokens": card_tokens,
10461105
"program_level": program_level,
1106+
"excluded_card_tokens": excluded_card_tokens,
10471107
},
10481108
v2_apply_params.V2ApplyParams,
10491109
),

0 commit comments

Comments
 (0)