Skip to content

refactor(identity/ucp): payment handlers consume *RailSpec - #42

Merged
vvillait88 merged 1 commit into
mainfrom
feat/304c-payment-handlers-railspec
May 14, 2026
Merged

refactor(identity/ucp): payment handlers consume *RailSpec#42
vvillait88 merged 1 commit into
mainfrom
feat/304c-payment-handlers-railspec

Conversation

@vvillait88

Copy link
Copy Markdown
Contributor

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:

CAIP-2 / spec field UCP-namespace
`eip155:8453` `base-8453`
`eip155:84532` `base-84532`
`solana:5eykt4...` `solana-mainnet-beta`
`solana:EtWTRABZaY...` `solana-devnet`
`tempo-mainnet` passthrough
`TempoRailSpec.testnet=True` `tempo-testnet`

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

  • `uv run pytest tests/` — 1061 passed, 95.21% coverage
  • `uv run ty check` — clean
  • `uv run ruff check` — clean

🤖 Generated with Claude Code

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>
@vvillait88
vvillait88 merged commit d8ff934 into main May 14, 2026
7 checks passed
@vvillait88
vvillait88 deleted the feat/304c-payment-handlers-railspec branch May 14, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant