Skip to content

Commit 01c7767

Browse files
feat: Add customer-managed VGS vault card payments
Stainless-Generated-From: 1dcb20713139739fb8eb730c9304ae4130c0dd48
1 parent 3f9a384 commit 01c7767

20 files changed

Lines changed: 577 additions & 12 deletions

‎api.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,11 @@ from kernel.types.vaults import (
652652
VaultItemOperationResponse,
653653
VaultPaymentMethod,
654654
VaultWebmcpBinding,
655+
VgsCardInput,
656+
VgsCardState,
657+
VgsCardVaultItemSpec,
658+
VgsWalletState,
659+
VgsWalletVaultItemSpec,
655660
WalletVaultItemSpec,
656661
WalletVaultItemState,
657662
WebmcpInvokeVaultItemOperationRequest,

‎src/kernel/resources/vault_provider_configs.py‎

Lines changed: 88 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,56 @@ def create(
125125
"""
126126
...
127127

128+
@overload
129+
def create(
130+
self,
131+
*,
132+
credentials: vault_provider_config_create_params.VaultVgsProviderConfigRequestCredentials,
133+
name: str,
134+
provider: Literal["vgs"],
135+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
136+
# The extra values given here take precedence over values defined on the client or passed to this method.
137+
extra_headers: Headers | None = None,
138+
extra_query: Query | None = None,
139+
extra_body: Body | None = None,
140+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
141+
idempotency_key: str | None = None,
142+
) -> VaultProviderConfig:
143+
"""Register a configuration shared across the organization's projects.
144+
145+
Names are
146+
unique within the organization; duplicate names return 409 without replacing
147+
credentials. A configuration serves many wallets. Secret credentials are never
148+
returned. Requires an organization-scoped credential or dashboard
149+
authentication; project-scoped credentials receive 403.
150+
151+
Args:
152+
credentials: A VGS service account with the aliases:read scope on the customer's vault, which
153+
Kernel uses to reveal the aliases each purchase sends.
154+
155+
name: Unique within the organization.
156+
157+
extra_headers: Send extra headers
158+
159+
extra_query: Add additional query parameters to the request
160+
161+
extra_body: Add additional JSON properties to the request
162+
163+
timeout: Override the client-level default timeout for this request, in seconds
164+
165+
idempotency_key: Specify a custom idempotency key for this request
166+
"""
167+
...
168+
128169
@required_args(["credentials", "name", "provider"])
129170
def create(
130171
self,
131172
*,
132173
credentials: vault_provider_config_create_params.VaultLinkProviderConfigRequestCredentials
133-
| vault_provider_config_create_params.VaultAgentCardProviderConfigRequestCredentials,
174+
| vault_provider_config_create_params.VaultAgentCardProviderConfigRequestCredentials
175+
| vault_provider_config_create_params.VaultVgsProviderConfigRequestCredentials,
134176
name: str,
135-
provider: Literal["link"] | Literal["agentcard"],
177+
provider: Literal["link"] | Literal["agentcard"] | Literal["vgs"],
136178
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
137179
# The extra values given here take precedence over values defined on the client or passed to this method.
138180
extra_headers: Headers | None = None,
@@ -454,14 +496,56 @@ async def create(
454496
"""
455497
...
456498

499+
@overload
500+
async def create(
501+
self,
502+
*,
503+
credentials: vault_provider_config_create_params.VaultVgsProviderConfigRequestCredentials,
504+
name: str,
505+
provider: Literal["vgs"],
506+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
507+
# The extra values given here take precedence over values defined on the client or passed to this method.
508+
extra_headers: Headers | None = None,
509+
extra_query: Query | None = None,
510+
extra_body: Body | None = None,
511+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
512+
idempotency_key: str | None = None,
513+
) -> VaultProviderConfig:
514+
"""Register a configuration shared across the organization's projects.
515+
516+
Names are
517+
unique within the organization; duplicate names return 409 without replacing
518+
credentials. A configuration serves many wallets. Secret credentials are never
519+
returned. Requires an organization-scoped credential or dashboard
520+
authentication; project-scoped credentials receive 403.
521+
522+
Args:
523+
credentials: A VGS service account with the aliases:read scope on the customer's vault, which
524+
Kernel uses to reveal the aliases each purchase sends.
525+
526+
name: Unique within the organization.
527+
528+
extra_headers: Send extra headers
529+
530+
extra_query: Add additional query parameters to the request
531+
532+
extra_body: Add additional JSON properties to the request
533+
534+
timeout: Override the client-level default timeout for this request, in seconds
535+
536+
idempotency_key: Specify a custom idempotency key for this request
537+
"""
538+
...
539+
457540
@required_args(["credentials", "name", "provider"])
458541
async def create(
459542
self,
460543
*,
461544
credentials: vault_provider_config_create_params.VaultLinkProviderConfigRequestCredentials
462-
| vault_provider_config_create_params.VaultAgentCardProviderConfigRequestCredentials,
545+
| vault_provider_config_create_params.VaultAgentCardProviderConfigRequestCredentials
546+
| vault_provider_config_create_params.VaultVgsProviderConfigRequestCredentials,
463547
name: str,
464-
provider: Literal["link"] | Literal["agentcard"],
548+
provider: Literal["link"] | Literal["agentcard"] | Literal["vgs"],
465549
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
466550
# The extra values given here take precedence over values defined on the client or passed to this method.
467551
extra_headers: Headers | None = None,

‎src/kernel/types/vault_provider_config.py‎

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from .._utils import PropertyInfo
88
from .._models import BaseModel
99

10-
__all__ = ["VaultProviderConfig", "VaultLinkProviderConfig", "VaultAgentCardProviderConfig"]
10+
__all__ = ["VaultProviderConfig", "VaultLinkProviderConfig", "VaultAgentCardProviderConfig", "VaultVgsProviderConfig"]
1111

1212

1313
class VaultLinkProviderConfig(BaseModel):
@@ -59,6 +59,33 @@ class VaultAgentCardProviderConfig(BaseModel):
5959
updated_at: datetime
6060

6161

62+
class VaultVgsProviderConfig(BaseModel):
63+
"""
64+
Response schema for a customer-managed VGS vault configuration, without the client secret. Kernel generates the ID and timestamps. Configuration creation uses VaultVgsProviderConfigRequest.
65+
"""
66+
67+
id: str
68+
69+
client_id: str
70+
"""Service account identity; immutable. The client secret is never returned."""
71+
72+
created_at: datetime
73+
74+
environment: Literal["sandbox", "live"]
75+
"""The vault's VGS environment; immutable."""
76+
77+
name: str
78+
"""Unique within the organization."""
79+
80+
provider: Literal["vgs"]
81+
82+
updated_at: datetime
83+
84+
vault_id: str
85+
"""The customer's VGS vault ID; immutable."""
86+
87+
6288
VaultProviderConfig: TypeAlias = Annotated[
63-
Union[VaultLinkProviderConfig, VaultAgentCardProviderConfig], PropertyInfo(discriminator="provider")
89+
Union[VaultLinkProviderConfig, VaultAgentCardProviderConfig, VaultVgsProviderConfig],
90+
PropertyInfo(discriminator="provider"),
6491
]

‎src/kernel/types/vault_provider_config_create_params.py‎

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"VaultLinkProviderConfigRequestCredentials",
1212
"VaultAgentCardProviderConfigRequest",
1313
"VaultAgentCardProviderConfigRequestCredentials",
14+
"VaultVgsProviderConfigRequest",
15+
"VaultVgsProviderConfigRequestCredentials",
1416
]
1517

1618

@@ -52,4 +54,35 @@ class VaultAgentCardProviderConfigRequestCredentials(TypedDict, total=False):
5254
client_secret: Required[str]
5355

5456

55-
VaultProviderConfigCreateParams: TypeAlias = Union[VaultLinkProviderConfigRequest, VaultAgentCardProviderConfigRequest]
57+
class VaultVgsProviderConfigRequest(TypedDict, total=False):
58+
credentials: Required[VaultVgsProviderConfigRequestCredentials]
59+
"""
60+
A VGS service account with the aliases:read scope on the customer's vault, which
61+
Kernel uses to reveal the aliases each purchase sends.
62+
"""
63+
64+
name: Required[str]
65+
"""Unique within the organization."""
66+
67+
provider: Required[Literal["vgs"]]
68+
69+
70+
class VaultVgsProviderConfigRequestCredentials(TypedDict, total=False):
71+
"""
72+
A VGS service account with the aliases:read scope on the customer's vault, which Kernel uses to reveal the aliases each purchase sends.
73+
"""
74+
75+
client_id: Required[str]
76+
77+
client_secret: Required[str]
78+
79+
environment: Required[Literal["sandbox", "live"]]
80+
"""The vault's VGS environment."""
81+
82+
vault_id: Required[str]
83+
"""The customer's VGS vault ID."""
84+
85+
86+
VaultProviderConfigCreateParams: TypeAlias = Union[
87+
VaultLinkProviderConfigRequest, VaultAgentCardProviderConfigRequest, VaultVgsProviderConfigRequest
88+
]

‎src/kernel/types/vaults/__init__.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
from .vault_item import VaultItem as VaultItem
66
from .link_user_info import LinkUserInfo as LinkUserInfo
7+
from .vgs_card_input import VgsCardInput as VgsCardInput
8+
from .vgs_card_state import VgsCardState as VgsCardState
79
from .vault_item_event import VaultItemEvent as VaultItemEvent
10+
from .vgs_wallet_state import VgsWalletState as VgsWalletState
811
from .kernel_card_state import KernelCardState as KernelCardState
912
from .vault_item_action import VaultItemAction as VaultItemAction
1013
from .item_events_params import ItemEventsParams as ItemEventsParams
@@ -18,6 +21,7 @@
1821
from .item_events_response import ItemEventsResponse as ItemEventsResponse
1922
from .item_retrieve_params import ItemRetrieveParams as ItemRetrieveParams
2023
from .vault_payment_method import VaultPaymentMethod as VaultPaymentMethod
24+
from .vgs_card_input_param import VgsCardInputParam as VgsCardInputParam
2125
from .card_vault_item_state import CardVaultItemState as CardVaultItemState
2226
from .credential_vault_item import CredentialVaultItem as CredentialVaultItem
2327
from .link_shipping_address import LinkShippingAddress as LinkShippingAddress
@@ -27,11 +31,13 @@
2731
from .wallet_vault_item_spec import WalletVaultItemSpec as WalletVaultItemSpec
2832
from .vault_fill_field_result import VaultFillFieldResult as VaultFillFieldResult
2933
from .wallet_vault_item_state import WalletVaultItemState as WalletVaultItemState
34+
from .vgs_card_vault_item_spec import VgsCardVaultItemSpec as VgsCardVaultItemSpec
3035
from .one_password_oauth_action import OnePasswordOAuthAction as OnePasswordOAuthAction
3136
from .card_vault_item_spec_param import CardVaultItemSpecParam as CardVaultItemSpecParam
3237
from .credential_vault_item_spec import CredentialVaultItemSpec as CredentialVaultItemSpec
3338
from .payment_request_vault_item import PaymentRequestVaultItem as PaymentRequestVaultItem
3439
from .vault_webmcp_binding_param import VaultWebmcpBindingParam as VaultWebmcpBindingParam
40+
from .vgs_wallet_vault_item_spec import VgsWalletVaultItemSpec as VgsWalletVaultItemSpec
3541
from .credential_vault_field_type import CredentialVaultFieldType as CredentialVaultFieldType
3642
from .credential_vault_item_state import CredentialVaultItemState as CredentialVaultItemState
3743
from .kernel_card_vault_item_spec import KernelCardVaultItemSpec as KernelCardVaultItemSpec
@@ -46,12 +52,14 @@
4652
from .shop_pay_card_vault_item_spec import ShopPayCardVaultItemSpec as ShopPayCardVaultItemSpec
4753
from .vault_item_operation_response import VaultItemOperationResponse as VaultItemOperationResponse
4854
from .agentcard_checkout_preparation import AgentcardCheckoutPreparation as AgentcardCheckoutPreparation
55+
from .vgs_card_vault_item_spec_param import VgsCardVaultItemSpecParam as VgsCardVaultItemSpecParam
4956
from .payment_request_vault_item_spec import PaymentRequestVaultItemSpec as PaymentRequestVaultItemSpec
5057
from .shop_pay_wallet_vault_item_spec import ShopPayWalletVaultItemSpec as ShopPayWalletVaultItemSpec
5158
from .single_use_card_billing_address import SingleUseCardBillingAddress as SingleUseCardBillingAddress
5259
from .agentcard_checkout_authorization import AgentcardCheckoutAuthorization as AgentcardCheckoutAuthorization
5360
from .fill_vault_item_operation_result import FillVaultItemOperationResult as FillVaultItemOperationResult
5461
from .payment_request_vault_item_state import PaymentRequestVaultItemState as PaymentRequestVaultItemState
62+
from .vgs_wallet_vault_item_spec_param import VgsWalletVaultItemSpecParam as VgsWalletVaultItemSpecParam
5563
from .credential_vault_field_definition import CredentialVaultFieldDefinition as CredentialVaultFieldDefinition
5664
from .kernel_card_vault_item_spec_param import KernelCardVaultItemSpecParam as KernelCardVaultItemSpecParam
5765
from .kernel_credential_vault_item_spec import KernelCredentialVaultItemSpec as KernelCredentialVaultItemSpec

‎src/kernel/types/vaults/card_vault_item_spec.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from ..._utils import PropertyInfo
77
from ..._models import BaseModel
8+
from .vgs_card_vault_item_spec import VgsCardVaultItemSpec
89
from .kernel_card_vault_item_spec import KernelCardVaultItemSpec
910
from .shop_pay_card_vault_item_spec import ShopPayCardVaultItemSpec
1011

@@ -162,6 +163,12 @@ class AgentCardCardVaultItemSpec(BaseModel):
162163

163164

164165
CardVaultItemSpec: TypeAlias = Annotated[
165-
Union[LinkCardVaultItemSpec, AgentCardCardVaultItemSpec, KernelCardVaultItemSpec, ShopPayCardVaultItemSpec],
166+
Union[
167+
LinkCardVaultItemSpec,
168+
AgentCardCardVaultItemSpec,
169+
KernelCardVaultItemSpec,
170+
ShopPayCardVaultItemSpec,
171+
VgsCardVaultItemSpec,
172+
],
166173
PropertyInfo(discriminator="provider"),
167174
]

‎src/kernel/types/vaults/card_vault_item_spec_param.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import Dict, Union, Iterable
66
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

8+
from .vgs_card_vault_item_spec_param import VgsCardVaultItemSpecParam
89
from .kernel_card_vault_item_spec_param import KernelCardVaultItemSpecParam
910
from .shop_pay_card_vault_item_spec_param import ShopPayCardVaultItemSpecParam
1011

@@ -162,5 +163,9 @@ class AgentCardCardVaultItemSpec(TypedDict, total=False):
162163

163164

164165
CardVaultItemSpecParam: TypeAlias = Union[
165-
LinkCardVaultItemSpec, AgentCardCardVaultItemSpec, KernelCardVaultItemSpecParam, ShopPayCardVaultItemSpecParam
166+
LinkCardVaultItemSpec,
167+
AgentCardCardVaultItemSpec,
168+
KernelCardVaultItemSpecParam,
169+
ShopPayCardVaultItemSpecParam,
170+
VgsCardVaultItemSpecParam,
166171
]

‎src/kernel/types/vaults/card_vault_item_state.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from ..._utils import PropertyInfo
99
from ..._models import BaseModel
10+
from .vgs_card_state import VgsCardState
1011
from .kernel_card_state import KernelCardState
1112
from .vault_card_aliases import VaultCardAliases
1213
from .shop_pay_card_state import ShopPayCardState
@@ -135,5 +136,6 @@ class AgentCardCardState(BaseModel):
135136

136137

137138
CardVaultItemState: TypeAlias = Annotated[
138-
Union[LinkCardState, AgentCardCardState, KernelCardState, ShopPayCardState], PropertyInfo(discriminator="provider")
139+
Union[LinkCardState, AgentCardCardState, KernelCardState, ShopPayCardState, VgsCardState],
140+
PropertyInfo(discriminator="provider"),
139141
]

‎src/kernel/types/vaults/item_upsert_params.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

88
from .card_vault_item_spec_param import CardVaultItemSpecParam
9+
from .vgs_wallet_vault_item_spec_param import VgsWalletVaultItemSpecParam
910
from .kernel_wallet_vault_item_spec_param import KernelWalletVaultItemSpecParam
1011
from .payment_request_vault_item_spec_param import PaymentRequestVaultItemSpecParam
1112
from .shop_pay_wallet_vault_item_spec_param import ShopPayWalletVaultItemSpecParam
@@ -204,6 +205,7 @@ class WalletVaultItemRequestSpecAgentCardWalletVaultItemSpec(TypedDict, total=Fa
204205
WalletVaultItemRequestSpecAgentCardWalletVaultItemSpec,
205206
KernelWalletVaultItemSpecParam,
206207
ShopPayWalletVaultItemSpecParam,
208+
VgsWalletVaultItemSpecParam,
207209
]
208210

209211

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 ..._models import BaseModel
4+
5+
__all__ = ["VgsCardInput"]
6+
7+
8+
class VgsCardInput(BaseModel):
9+
"""The card's aliases in the customer's VGS vault, its expiry and last four digits.
10+
11+
Write-only: stored encrypted and never returned in the item, its events or logs. A repeated PUT with the same key must send the same card.
12+
"""
13+
14+
pass

0 commit comments

Comments
 (0)