refactor(identity/ucp): payment handlers consume *RailSpec - #42
Merged
Conversation
mpp_payment_handler, x402_payment_handler, stripe_spt_payment_handler now accept *RailSpec instances instead of plain dicts. Tempo, Solana MPP, and TempoSession rails all flow through mpp_payment_handler in any mix; x402 takes X402BaseRailSpec; stripe takes StripeRailSpec (replacing the flat profile_id kwarg). CAIP-2 → UCP-namespace network conversion is internal: eip155:8453 → base-8453 eip155:84532 → base-84532 solana:5eykt4... → solana-mainnet-beta solana:EtWTRABZaY... → solana-devnet tempo-mainnet (UCP) → tempo-mainnet (passthrough) TempoRailSpec.testnet → tempo-testnet Mainnet + testnet for every rail is preserved. Per-order recipient factories are omitted from the static UCP profile (the authoritative recipient ships in the 402 body at request time instead); static string recipients are emitted verbatim. signed_ucp_merchant example migrated inline. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
`mpp_payment_handler`, `x402_payment_handler`, `stripe_spt_payment_handler` now accept `*RailSpec` instances directly instead of plain dicts. Tempo, Solana MPP, and TempoSession rails all flow through `mpp_payment_handler` in any mix; `x402_payment_handler` takes `X402BaseRailSpec`; `stripe_spt_payment_handler` takes `StripeRailSpec` (replacing the flat `profile_id` kwarg).
CAIP-2 → UCP-namespace network conversion is internal:
Mainnet + testnet for every rail is preserved.
Per-order recipient factories are omitted from the static UCP profile output (`if isinstance(r, str): include`); the authoritative recipient ships in the 402 body at request time. Static string recipients are emitted verbatim.
Helpers stay synchronous — the UCP profile is built at boot, no async resolution needed.
`signed_ucp_merchant` example migrated inline. New `tests/test_payment_handlers.py` covers every conversion path + the omit-factory branch.
Test plan
🤖 Generated with Claude Code