Skip to content

Commit 043d252

Browse files
feat: Fix vault provider errors and remove test card mode
Stainless-Generated-From: 784d7148c308af595e9b55dc6af92f4d371a3361
1 parent c8a873b commit 043d252

7 files changed

Lines changed: 21 additions & 65 deletions

File tree

src/kernel/resources/vaults/items.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ def update(
131131
Update a card specification before or between authorizations
132132
133133
Args:
134-
spec: AgentCard reusable card. Each checkout creates an approval-gated authorization
135-
for spec.merchant / spec.amount. The card stays ready after each authorization.
134+
spec: Live payment card. Test-mode card creation is not supported.
136135
137136
extra_headers: Send extra headers
138137
@@ -296,7 +295,9 @@ def perform_operation(
296295
"""
297296
Retrieve the item first and invoke only an operation listed in
298297
`available_operations`, following its natural-language description. Operations
299-
may call an external provider and can return the item's updated state.
298+
may call an external provider and can return the item's updated state. If the
299+
provider rate limits spend-request creation, returns HTTP 429 with code
300+
`spend_request_rate_limited`; stop and back off before retrying.
300301
301302
Args:
302303
extra_headers: Send extra headers
@@ -375,8 +376,7 @@ def upsert(
375376
Create or retrieve an identical vault item by immutable key
376377
377378
Args:
378-
spec: AgentCard reusable card. Each checkout creates an approval-gated authorization
379-
for spec.merchant / spec.amount. The card stays ready after each authorization.
379+
spec: Live payment card. Test-mode card creation is not supported.
380380
381381
extra_headers: Send extra headers
382382
@@ -523,8 +523,7 @@ async def update(
523523
Update a card specification before or between authorizations
524524
525525
Args:
526-
spec: AgentCard reusable card. Each checkout creates an approval-gated authorization
527-
for spec.merchant / spec.amount. The card stays ready after each authorization.
526+
spec: Live payment card. Test-mode card creation is not supported.
528527
529528
extra_headers: Send extra headers
530529
@@ -688,7 +687,9 @@ async def perform_operation(
688687
"""
689688
Retrieve the item first and invoke only an operation listed in
690689
`available_operations`, following its natural-language description. Operations
691-
may call an external provider and can return the item's updated state.
690+
may call an external provider and can return the item's updated state. If the
691+
provider rate limits spend-request creation, returns HTTP 429 with code
692+
`spend_request_rate_limited`; stop and back off before retrying.
692693
693694
Args:
694695
extra_headers: Send extra headers
@@ -769,8 +770,7 @@ async def upsert(
769770
Create or retrieve an identical vault item by immutable key
770771
771772
Args:
772-
spec: AgentCard reusable card. Each checkout creates an approval-gated authorization
773-
for spec.merchant / spec.amount. The card stays ready after each authorization.
773+
spec: Live payment card. Test-mode card creation is not supported.
774774
775775
extra_headers: Send extra headers
776776

src/kernel/types/vaults/card_vault_item_spec.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ class LinkCardVaultItemSpecTotal(BaseModel):
5656

5757

5858
class LinkCardVaultItemSpec(BaseModel):
59+
"""Live payment card. Test-mode card creation is not supported."""
60+
5961
amount: int
6062
"""Integer amount in minor currency units."""
6163

@@ -76,12 +78,6 @@ class LinkCardVaultItemSpec(BaseModel):
7678

7779
provider: Literal["link"]
7880

79-
test: bool
80-
"""
81-
Whether Link should return test credentials instead of a live payment
82-
credential.
83-
"""
84-
8581
wallet: str
8682
"""Wallet item key used to mint this card."""
8783

@@ -95,9 +91,9 @@ class LinkCardVaultItemSpec(BaseModel):
9591

9692

9793
class AgentCardCardVaultItemSpec(BaseModel):
98-
"""AgentCard reusable card.
94+
"""AgentCard reusable live payment card.
9995
100-
Each checkout creates an approval-gated authorization for spec.merchant / spec.amount. The card stays ready after each authorization.
96+
Test-mode card creation is not supported. Each checkout creates an approval-gated authorization for spec.merchant / spec.amount. The card stays ready after each authorization.
10197
"""
10298

10399
amount: int

src/kernel/types/vaults/card_vault_item_spec_param.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class LinkCardVaultItemSpecTotal(TypedDict, total=False):
5555

5656

5757
class LinkCardVaultItemSpec(TypedDict, total=False):
58+
"""Live payment card. Test-mode card creation is not supported."""
59+
5860
amount: Required[int]
5961
"""Integer amount in minor currency units."""
6062

@@ -75,12 +77,6 @@ class LinkCardVaultItemSpec(TypedDict, total=False):
7577

7678
provider: Required[Literal["link"]]
7779

78-
test: Required[bool]
79-
"""
80-
Whether Link should return test credentials instead of a live payment
81-
credential.
82-
"""
83-
8480
wallet: Required[str]
8581
"""Wallet item key used to mint this card."""
8682

@@ -94,9 +90,9 @@ class LinkCardVaultItemSpec(TypedDict, total=False):
9490

9591

9692
class AgentCardCardVaultItemSpec(TypedDict, total=False):
97-
"""AgentCard reusable card.
93+
"""AgentCard reusable live payment card.
9894
99-
Each checkout creates an approval-gated authorization for spec.merchant / spec.amount. The card stays ready after each authorization.
95+
Test-mode card creation is not supported. Each checkout creates an approval-gated authorization for spec.merchant / spec.amount. The card stays ready after each authorization.
10096
"""
10197

10298
amount: Required[int]

src/kernel/types/vaults/item_update_params.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,4 @@ class ItemUpdateParams(TypedDict, total=False):
1313
id_or_name: Required[str]
1414

1515
spec: Required[CardVaultItemSpecParam]
16-
"""AgentCard reusable card.
17-
18-
Each checkout creates an approval-gated authorization for spec.merchant /
19-
spec.amount. The card stays ready after each authorization.
20-
"""
16+
"""Live payment card. Test-mode card creation is not supported."""

src/kernel/types/vaults/item_upsert_params.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ class CardVaultItemRequest(TypedDict, total=False):
2929
id_or_name: Required[str]
3030

3131
spec: Required[CardVaultItemSpecParam]
32-
"""AgentCard reusable card.
33-
34-
Each checkout creates an approval-gated authorization for spec.merchant /
35-
spec.amount. The card stays ready after each authorization.
36-
"""
32+
"""Live payment card. Test-mode card creation is not supported."""
3733

3834
type: Required[Literal["card"]]
3935

src/kernel/types/vaults/vault_item.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,7 @@ class CardVaultItem(BaseModel):
120120
"""Immutable item key assigned when the item is created."""
121121

122122
spec: CardVaultItemSpec
123-
"""AgentCard reusable card.
124-
125-
Each checkout creates an approval-gated authorization for spec.merchant /
126-
spec.amount. The card stays ready after each authorization.
127-
"""
123+
"""Live payment card. Test-mode card creation is not supported."""
128124

129125
state: CardVaultItemState
130126

tests/api_resources/vaults/test_items.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ def test_method_update(self, client: Kernel) -> None:
9898
"merchant_url": "https://example.com",
9999
"payment_method_id": "x",
100100
"provider": "link",
101-
"test": True,
102101
"wallet": "wallet",
103102
},
104103
)
@@ -118,7 +117,6 @@ def test_method_update_with_all_params(self, client: Kernel) -> None:
118117
"merchant_url": "https://example.com",
119118
"payment_method_id": "x",
120119
"provider": "link",
121-
"test": True,
122120
"wallet": "wallet",
123121
"expires_at": 0,
124122
"line_items": [
@@ -166,7 +164,6 @@ def test_raw_response_update(self, client: Kernel) -> None:
166164
"merchant_url": "https://example.com",
167165
"payment_method_id": "x",
168166
"provider": "link",
169-
"test": True,
170167
"wallet": "wallet",
171168
},
172169
)
@@ -190,7 +187,6 @@ def test_streaming_response_update(self, client: Kernel) -> None:
190187
"merchant_url": "https://example.com",
191188
"payment_method_id": "x",
192189
"provider": "link",
193-
"test": True,
194190
"wallet": "wallet",
195191
},
196192
) as response:
@@ -217,7 +213,6 @@ def test_path_params_update(self, client: Kernel) -> None:
217213
"merchant_url": "https://example.com",
218214
"payment_method_id": "x",
219215
"provider": "link",
220-
"test": True,
221216
"wallet": "wallet",
222217
},
223218
)
@@ -234,7 +229,6 @@ def test_path_params_update(self, client: Kernel) -> None:
234229
"merchant_url": "https://example.com",
235230
"payment_method_id": "x",
236231
"provider": "link",
237-
"test": True,
238232
"wallet": "wallet",
239233
},
240234
)
@@ -576,7 +570,6 @@ def test_method_upsert_overload_2(self, client: Kernel) -> None:
576570
"merchant_url": "https://example.com",
577571
"payment_method_id": "x",
578572
"provider": "link",
579-
"test": True,
580573
"wallet": "wallet",
581574
},
582575
type="card",
@@ -597,7 +590,6 @@ def test_method_upsert_with_all_params_overload_2(self, client: Kernel) -> None:
597590
"merchant_url": "https://example.com",
598591
"payment_method_id": "x",
599592
"provider": "link",
600-
"test": True,
601593
"wallet": "wallet",
602594
"expires_at": 0,
603595
"line_items": [
@@ -646,7 +638,6 @@ def test_raw_response_upsert_overload_2(self, client: Kernel) -> None:
646638
"merchant_url": "https://example.com",
647639
"payment_method_id": "x",
648640
"provider": "link",
649-
"test": True,
650641
"wallet": "wallet",
651642
},
652643
type="card",
@@ -671,7 +662,6 @@ def test_streaming_response_upsert_overload_2(self, client: Kernel) -> None:
671662
"merchant_url": "https://example.com",
672663
"payment_method_id": "x",
673664
"provider": "link",
674-
"test": True,
675665
"wallet": "wallet",
676666
},
677667
type="card",
@@ -699,7 +689,6 @@ def test_path_params_upsert_overload_2(self, client: Kernel) -> None:
699689
"merchant_url": "https://example.com",
700690
"payment_method_id": "x",
701691
"provider": "link",
702-
"test": True,
703692
"wallet": "wallet",
704693
},
705694
type="card",
@@ -717,7 +706,6 @@ def test_path_params_upsert_overload_2(self, client: Kernel) -> None:
717706
"merchant_url": "https://example.com",
718707
"payment_method_id": "x",
719708
"provider": "link",
720-
"test": True,
721709
"wallet": "wallet",
722710
},
723711
type="card",
@@ -806,7 +794,6 @@ async def test_method_update(self, async_client: AsyncKernel) -> None:
806794
"merchant_url": "https://example.com",
807795
"payment_method_id": "x",
808796
"provider": "link",
809-
"test": True,
810797
"wallet": "wallet",
811798
},
812799
)
@@ -826,7 +813,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncKernel) ->
826813
"merchant_url": "https://example.com",
827814
"payment_method_id": "x",
828815
"provider": "link",
829-
"test": True,
830816
"wallet": "wallet",
831817
"expires_at": 0,
832818
"line_items": [
@@ -874,7 +860,6 @@ async def test_raw_response_update(self, async_client: AsyncKernel) -> None:
874860
"merchant_url": "https://example.com",
875861
"payment_method_id": "x",
876862
"provider": "link",
877-
"test": True,
878863
"wallet": "wallet",
879864
},
880865
)
@@ -898,7 +883,6 @@ async def test_streaming_response_update(self, async_client: AsyncKernel) -> Non
898883
"merchant_url": "https://example.com",
899884
"payment_method_id": "x",
900885
"provider": "link",
901-
"test": True,
902886
"wallet": "wallet",
903887
},
904888
) as response:
@@ -925,7 +909,6 @@ async def test_path_params_update(self, async_client: AsyncKernel) -> None:
925909
"merchant_url": "https://example.com",
926910
"payment_method_id": "x",
927911
"provider": "link",
928-
"test": True,
929912
"wallet": "wallet",
930913
},
931914
)
@@ -942,7 +925,6 @@ async def test_path_params_update(self, async_client: AsyncKernel) -> None:
942925
"merchant_url": "https://example.com",
943926
"payment_method_id": "x",
944927
"provider": "link",
945-
"test": True,
946928
"wallet": "wallet",
947929
},
948930
)
@@ -1284,7 +1266,6 @@ async def test_method_upsert_overload_2(self, async_client: AsyncKernel) -> None
12841266
"merchant_url": "https://example.com",
12851267
"payment_method_id": "x",
12861268
"provider": "link",
1287-
"test": True,
12881269
"wallet": "wallet",
12891270
},
12901271
type="card",
@@ -1305,7 +1286,6 @@ async def test_method_upsert_with_all_params_overload_2(self, async_client: Asyn
13051286
"merchant_url": "https://example.com",
13061287
"payment_method_id": "x",
13071288
"provider": "link",
1308-
"test": True,
13091289
"wallet": "wallet",
13101290
"expires_at": 0,
13111291
"line_items": [
@@ -1354,7 +1334,6 @@ async def test_raw_response_upsert_overload_2(self, async_client: AsyncKernel) -
13541334
"merchant_url": "https://example.com",
13551335
"payment_method_id": "x",
13561336
"provider": "link",
1357-
"test": True,
13581337
"wallet": "wallet",
13591338
},
13601339
type="card",
@@ -1379,7 +1358,6 @@ async def test_streaming_response_upsert_overload_2(self, async_client: AsyncKer
13791358
"merchant_url": "https://example.com",
13801359
"payment_method_id": "x",
13811360
"provider": "link",
1382-
"test": True,
13831361
"wallet": "wallet",
13841362
},
13851363
type="card",
@@ -1407,7 +1385,6 @@ async def test_path_params_upsert_overload_2(self, async_client: AsyncKernel) ->
14071385
"merchant_url": "https://example.com",
14081386
"payment_method_id": "x",
14091387
"provider": "link",
1410-
"test": True,
14111388
"wallet": "wallet",
14121389
},
14131390
type="card",
@@ -1425,7 +1402,6 @@ async def test_path_params_upsert_overload_2(self, async_client: AsyncKernel) ->
14251402
"merchant_url": "https://example.com",
14261403
"payment_method_id": "x",
14271404
"provider": "link",
1428-
"test": True,
14291405
"wallet": "wallet",
14301406
},
14311407
type="card",

0 commit comments

Comments
 (0)