Skip to content

Commit 9c858fe

Browse files
CLI: Update Go SDK to 418cdfed18c8cf129147945463ebeccc22c2fb27 and document merchant_country
- Bump kernel-go-sdk to 418cdfed18c8 (Visa passkey approval for Kernel cards) - Document optional merchant_country (ISO 3166-1 alpha-2, required for Visa) on the Kernel card spec, and replace the old "Visa purchases are not yet supported" note with the spend_approval flow - Show merchant_country in display-safe JSON output and as a "Merchant country" row for Kernel cards Tested: go test ./cmd/ passes. On a throwaway vault, vaults cards create --provider kernel with merchant_country "US" passed spec validation (then got 409 because the wallet had no enrolled card); "USAX" was rejected with 400 invalid Kernel card spec. The vault was deleted afterwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 9b9d484 commit 9c858fe

5 files changed

Lines changed: 32 additions & 6 deletions

File tree

‎cmd/vaults_help.go‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,18 @@ type AgentCardCardSpec = {
8484
};
8585
8686
// One live purchase with a Kernel-enrolled card. Authorize obtains a network token and
87-
// one-time code for fill on merchant_url's origin until expires_at. Visa purchases are
88-
// not yet supported (authorize returns 400). Updates are not supported.
87+
// one-time code for fill on merchant_url's origin until expires_at. Mastercard purchases
88+
// need no hosted approval. A Visa purchase returns a spend_approval action: the cardholder
89+
// approves it with a Visa passkey (the link expires after 30 minutes) before the code is
90+
// issued. Updates are not supported.
8991
type KernelCardSpec = {
9092
provider: "kernel";
9193
wallet: string; // Kernel wallet item key
9294
amount: number; // integer minor units; 1..50000
9395
currency: string; // ISO 4217 three letters
9496
merchant_name: string; // 1..255 characters
9597
merchant_url: string; // HTTPS merchant checkout URL; fill is locked to its origin
98+
merchant_country?: string; // ISO 3166-1 alpha-2; required for Visa cards
9699
};
97100
98101
type LinkLineItem = {

‎cmd/vaults_output.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var vaultItemFields = vaultOutputFields{
4444
"expanded": {"payment_methods": vaultMethodFields},
4545
"spec": {
4646
"provider": nil, "wallet": nil, "user_id": nil, "payment_method_id": nil, "card_id": nil, "checkout_origin": nil,
47-
"amount": nil, "currency": nil, "merchant": nil, "merchant_name": nil, "merchant_url": nil,
47+
"amount": nil, "currency": nil, "merchant": nil, "merchant_name": nil, "merchant_url": nil, "merchant_country": nil,
4848
"context": nil, "expires_at": nil, "description": nil, "account": nil, "connection_id": nil,
4949
"requests": onePasswordRequestFields,
5050
"fields": vaultFieldsOf("name label type required sensitive"),
@@ -381,6 +381,9 @@ func printVaultItem(item *kernel.VaultItemUnion, output string) error {
381381
if item.Spec.Provider == "kernel" && item.Spec.MerchantURL != "" {
382382
rows = append(rows, []string{"Merchant URL", item.Spec.MerchantURL})
383383
}
384+
if item.Spec.Provider == "kernel" && item.Spec.MerchantCountry != "" {
385+
rows = append(rows, []string{"Merchant country", item.Spec.MerchantCountry})
386+
}
384387
if masks := item.State.Masks; masks.Last4 != "" || masks.TokenLast4 != "" {
385388
rows = append(rows, []string{"Card last4", util.OrDash(masks.Last4)})
386389
if masks.TokenLast4 != "" {

‎cmd/vaults_output_test.go‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,26 @@ func TestVaultOutputLinkHasNoAliases(t *testing.T) {
104104
}
105105
}
106106

107+
func TestVaultOutputKernelCardMerchantCountry(t *testing.T) {
108+
var item kernel.VaultItemUnion
109+
require.NoError(t, json.Unmarshal([]byte(`{
110+
"id":"card-id","key":"order-1","type":"card",
111+
"spec":{"provider":"kernel","wallet":"wallet-1","amount":1234,"currency":"usd","merchant_name":"Example Shop","merchant_url":"https://shop.example/checkout","merchant_country":"US"},
112+
"state":{"provider":"kernel","status":"pending_authorization"},
113+
"available_operations":[],"available_expansions":[]
114+
}`), &item))
115+
buf := capturePtermOutput(t)
116+
require.NoError(t, printVaultItem(&item, ""))
117+
assert.Contains(t, buf.String(), "Merchant country")
118+
assert.Contains(t, buf.String(), "US")
119+
out := captureStdout(t, func() { require.NoError(t, printVaultItem(&item, "json")) })
120+
var decoded struct {
121+
Spec vaultJSON `json:"spec"`
122+
}
123+
require.NoError(t, json.Unmarshal([]byte(out), &decoded))
124+
assert.JSONEq(t, `"US"`, string(decoded.Spec["merchant_country"]))
125+
}
126+
107127
func TestVaultOutputAgentCardAuthorizationIsNotPaymentSuccess(t *testing.T) {
108128
var item kernel.VaultItemUnion
109129
require.NoError(t, json.Unmarshal([]byte(`{

‎go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.1
1010
github.com/golang-jwt/jwt/v5 v5.2.2
1111
github.com/joho/godotenv v1.5.1
12-
github.com/kernel/kernel-go-sdk v0.119.1-0.20261006183707-be15dab89b9b
12+
github.com/kernel/kernel-go-sdk v0.119.1-0.20261006192232-418cdfed18c8
1313
github.com/klauspost/compress v1.18.5
1414
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
1515
github.com/pterm/pterm v0.12.80

‎go.sum‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
6666
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
6767
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
6868
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
69-
github.com/kernel/kernel-go-sdk v0.119.1-0.20261006183707-be15dab89b9b h1:gKAq0sFluyC2GKVHZVrTmT5v5A626dvSxNTT4q3fXnY=
70-
github.com/kernel/kernel-go-sdk v0.119.1-0.20261006183707-be15dab89b9b/go.mod h1:EeZzSuHZVeHKxKCPUzxou2bovNGhXaz0RXrSqKNf1AQ=
69+
github.com/kernel/kernel-go-sdk v0.119.1-0.20261006192232-418cdfed18c8 h1:g1zA+KLA3DXNHY3rZwr0zZPGUeC6X7PWru0qnWc820I=
70+
github.com/kernel/kernel-go-sdk v0.119.1-0.20261006192232-418cdfed18c8/go.mod h1:EeZzSuHZVeHKxKCPUzxou2bovNGhXaz0RXrSqKNf1AQ=
7171
github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE=
7272
github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
7373
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=

0 commit comments

Comments
 (0)