Repository navigation
Support Kernel wallet payment methods and payment_request items - #306
Draft
hiroTamada wants to merge 1 commit into
Draft
hiroTamada wants to merge 1 commit into
hiroTamada wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Blocked on the
kernel-go-sdkv0.133.0 release.go.modpins the unreleased release-PR head as a pseudo-version (v0.132.1-0.20261027142730-6b2ae5c1cb1d, commit6b2ae5con kernel/kernel-go-sdk#213). Before merging, bump to the publishedv0.133.0(go get github.com/kernel/kernel-go-sdk@v0.133.0 && go mod tidy) and re-run the tests.Summary
The API now supports multiple cards per Kernel wallet (
add_payment_method/remove_payment_method) andpayment_requestitems for Link and Kernel purchases. Both are enabled per organization. This PR adds both to the vault commands. Organizations without them keep the original single-card Kernel wallet contract:wallets create --provider kernelstill shows the default card'scard_enrollmentaction, and Kernel cards withoutpayment_method_idsend the same request as before.Payment methods
items invoke <vault> <wallet> add_payment_methodand the shortcutwallets add-payment-method <vault> <wallet>print the new method, its status, itscard_enrollmentURL and expiry, and the existing guidance to share it privately with the cardholder.--openis allowed for a cardholder on their own machine.items invoke <vault> <wallet> remove_payment_method --params '{"payment_method_id":"<id>"}'(or--spec-file) andwallets remove-payment-method --payment-method-id <id>, which asks for confirmation unless--yesis passed, print the removal result. They also state that removal is not proof that a payment did not occur.purchase_unresolved(reconcile the funded purchase first), 409provider_revocation_pending(method staysremoval_pending; retry later), 409 on add (10-method / 3-open-link limits), 403insufficient_scope(needsvaults:writein addition tovaults:use), and 429 (honorsRetry-After). When either operation is not advertised, the error explains when the API offers it.wallets payment-methodsadds a status column and printsstatus_reasonand any pending enrollment URL with its expiry. The Kernel guidance now covers optionalpayment_method_id, the default cardcard, method statuses, and when to remove a method or contact support.payment_request items
cards create|update --type payment_requestsendstype: payment_requestthrough the SDK'sPaymentRequestupsert/update params;--typedefaults tocard. AgentCard is rejected with--type payment_request, and Kernel updates stay blocked as for Kernel cards.payment_requestitems are rendered like card items initems get/listand invoke results, including Linkauthorize --browser-id/--page-urland fill handling.payment method id(bound method from state, falling back to spec) andfunding status. They warn whenfunding_statusisunavailableorremoved.Output projection
status,status_reason,expires_at,action.{name,url}.capture_tokenis never printed in either output mode.payment_method_id,funding_status.item_type,provider,payment_method_id_present(payment_method_idwas already kept).Help
KernelCardSpec(optionalpayment_method_id), thepayment_requestsection,items invoke, and the root payment flow now describe empty wallets, add/remove, method statuses,funding_statusand thevaults:writerequirement.reconnect_requiredguidance now matches the API: legacy wallets refuse payment and deletion until upgraded. The previous "share the new card_enrollment action" no longer applies.Testing
make test(go vet ./...+go test ./...): passes.golangci-lint run --new-from-rev=HEAD ./...(v2.15.0): 0 new issues. Existing repo-wide warnings are unchanged.capture_tokenis withheld), error guidance per code, the unadvertised-operation message, parameter validation,--open,payment_requestcreate/update/authorize bodies, funding display, event projection, and help text.