Skip to content

Commit 8602af5

Browse files
feat(api): add 'pin status' and 'pending_commands' to Card model (#548)
1 parent 989599a commit 8602af5

4 files changed

Lines changed: 38 additions & 6 deletions

File tree

src/lithic/resources/cards/cards.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ def update(
301301
digital_card_art_token: str | NotGiven = NOT_GIVEN,
302302
memo: str | NotGiven = NOT_GIVEN,
303303
pin: str | NotGiven = NOT_GIVEN,
304+
pin_status: Literal["OK"] | NotGiven = NOT_GIVEN,
304305
spend_limit: int | NotGiven = NOT_GIVEN,
305306
spend_limit_duration: SpendLimitDuration | NotGiven = NOT_GIVEN,
306307
state: Literal["CLOSED", "OPEN", "PAUSED"] | NotGiven = NOT_GIVEN,
@@ -329,8 +330,11 @@ def update(
329330
store JSON data as it can cause unexpected behavior.
330331
331332
pin: Encrypted PIN block (in base64). Only applies to cards of type `PHYSICAL` and
332-
`VIRTUAL`. See
333-
[Encrypted PIN Block](https://docs.lithic.com/docs/cards#encrypted-pin-block-enterprise).
333+
`VIRTUAL`. Changing PIN also resets PIN status to `OK`. See
334+
[Encrypted PIN Block](https://docs.lithic.com/docs/cards#encrypted-pin-block).
335+
336+
pin_status: Indicates if a card is blocked due a PIN status issue (e.g. excessive incorrect
337+
attempts). Can only be set to `OK` to unblock a card.
334338
335339
spend_limit: Amount (in cents) to limit approved authorizations. Transaction requests above
336340
the spend limit will be declined. Note that a spend limit of 0 is effectively no
@@ -379,6 +383,7 @@ def update(
379383
"digital_card_art_token": digital_card_art_token,
380384
"memo": memo,
381385
"pin": pin,
386+
"pin_status": pin_status,
382387
"spend_limit": spend_limit,
383388
"spend_limit_duration": spend_limit_duration,
384389
"state": state,
@@ -1172,6 +1177,7 @@ async def update(
11721177
digital_card_art_token: str | NotGiven = NOT_GIVEN,
11731178
memo: str | NotGiven = NOT_GIVEN,
11741179
pin: str | NotGiven = NOT_GIVEN,
1180+
pin_status: Literal["OK"] | NotGiven = NOT_GIVEN,
11751181
spend_limit: int | NotGiven = NOT_GIVEN,
11761182
spend_limit_duration: SpendLimitDuration | NotGiven = NOT_GIVEN,
11771183
state: Literal["CLOSED", "OPEN", "PAUSED"] | NotGiven = NOT_GIVEN,
@@ -1200,8 +1206,11 @@ async def update(
12001206
store JSON data as it can cause unexpected behavior.
12011207
12021208
pin: Encrypted PIN block (in base64). Only applies to cards of type `PHYSICAL` and
1203-
`VIRTUAL`. See
1204-
[Encrypted PIN Block](https://docs.lithic.com/docs/cards#encrypted-pin-block-enterprise).
1209+
`VIRTUAL`. Changing PIN also resets PIN status to `OK`. See
1210+
[Encrypted PIN Block](https://docs.lithic.com/docs/cards#encrypted-pin-block).
1211+
1212+
pin_status: Indicates if a card is blocked due a PIN status issue (e.g. excessive incorrect
1213+
attempts). Can only be set to `OK` to unblock a card.
12051214
12061215
spend_limit: Amount (in cents) to limit approved authorizations. Transaction requests above
12071216
the spend limit will be declined. Note that a spend limit of 0 is effectively no
@@ -1250,6 +1259,7 @@ async def update(
12501259
"digital_card_art_token": digital_card_art_token,
12511260
"memo": memo,
12521261
"pin": pin,
1262+
"pin_status": pin_status,
12531263
"spend_limit": spend_limit,
12541264
"spend_limit_duration": spend_limit_duration,
12551265
"state": state,

src/lithic/types/card.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ class Card(BaseModel):
7171
last_four: str
7272
"""Last four digits of the card number."""
7373

74+
pin_status: Literal["OK", "BLOCKED", "NOT_SET"]
75+
"""Indicates if a card is blocked due a PIN status issue (e.g.
76+
77+
excessive incorrect attempts).
78+
"""
79+
7480
spend_limit: int
7581
"""Amount (in cents) to limit approved authorizations.
7682
@@ -176,6 +182,13 @@ class Card(BaseModel):
176182
[support@lithic.com](mailto:support@lithic.com) for questions.
177183
"""
178184

185+
pending_commands: Optional[List[str]] = None
186+
"""
187+
Indicates if there are offline PIN changes pending card interaction with an
188+
offline PIN terminal. Possible commands are: CHANGE_PIN, UNBLOCK_PIN. Applicable
189+
only to cards issued in markets supporting offline PINs.
190+
"""
191+
179192
product_id: Optional[str] = None
180193
"""Only applicable to cards of type `PHYSICAL`.
181194

src/lithic/types/card_update_params.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,15 @@ class CardUpdateParams(TypedDict, total=False):
2828
pin: str
2929
"""Encrypted PIN block (in base64).
3030
31-
Only applies to cards of type `PHYSICAL` and `VIRTUAL`. See
32-
[Encrypted PIN Block](https://docs.lithic.com/docs/cards#encrypted-pin-block-enterprise).
31+
Only applies to cards of type `PHYSICAL` and `VIRTUAL`. Changing PIN also resets
32+
PIN status to `OK`. See
33+
[Encrypted PIN Block](https://docs.lithic.com/docs/cards#encrypted-pin-block).
34+
"""
35+
36+
pin_status: Literal["OK"]
37+
"""Indicates if a card is blocked due a PIN status issue (e.g.
38+
39+
excessive incorrect attempts). Can only be set to `OK` to unblock a card.
3340
"""
3441

3542
spend_limit: int

tests/api_resources/test_cards.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def test_method_update_with_all_params(self, client: Lithic) -> None:
140140
digital_card_art_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
141141
memo="Updated Name",
142142
pin="pin",
143+
pin_status="OK",
143144
spend_limit=100,
144145
spend_limit_duration="ANNUALLY",
145146
state="CLOSED",
@@ -662,6 +663,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncLithic) ->
662663
digital_card_art_token="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
663664
memo="Updated Name",
664665
pin="pin",
666+
pin_status="OK",
665667
spend_limit=100,
666668
spend_limit_duration="ANNUALLY",
667669
state="CLOSED",

0 commit comments

Comments
 (0)