Skip to content

feat(payment): add canonical *RailSpec types for cross-helper rail config - #40

Merged
vvillait88 merged 1 commit into
mainfrom
feat/304a-rail-spec-types
May 14, 2026
Merged

feat(payment): add canonical *RailSpec types for cross-helper rail config#40
vvillait88 merged 1 commit into
mainfrom
feat/304a-rail-spec-types

Conversation

@vvillait88

@vvillait88 vvillait88 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Defines five `*RailSpec` dataclasses (TempoRailSpec, X402BaseRailSpec, SolanaMppRailSpec, StripeRailSpec, TempoSessionRailSpec) plus `RecipientLike` (`str | sync factory | async factory`) and `resolve_recipient(r)`.

Pre-existing pattern: merchants restated the same recipient four times in four different shapes across `build_accepted_methods` / `build_how_to_pay` / `mpp_payment_handler` / `create_mppx_server`. This adds one canonical type per rail; follow-up PRs migrate the helpers to consume them.

Multi-use data shapes (the same RailSpec instance flows through every helper) — same pattern as `PaymentMethodConfig` / `X402AcceptsBlock` which we kept exported. Not a re-introduction of the per-helper input wrappers we deleted earlier.

Additive only at this stage. No existing helper consumes the new types yet so consumer migrations stay sequenced.

Test plan

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

🤖 Generated with Claude Code

Defines five *RailSpec dataclasses (TempoRailSpec, X402BaseRailSpec,
SolanaMppRailSpec, StripeRailSpec, TempoSessionRailSpec) plus RecipientLike
(str | sync factory | async factory) and resolve_recipient(r) that any
helper can use to materialize the recipient inline.

Foundation for TEC-304. Subsequent PRs (304b-304g) migrate
build_accepted_methods / build_how_to_pay / mpp_payment_handler /
x402_payment_handler / stripe_spt_payment_handler / create_mppx_server /
respond_402 to consume *RailSpec instances; per-helper rail-config types get
deleted in the same train.

Additive only at this stage so consumer migrations stay sequenced.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vvillait88
vvillait88 merged commit fa7616c into main May 14, 2026
7 checks passed
@vvillait88
vvillait88 deleted the feat/304a-rail-spec-types branch May 14, 2026 20:37
@vvillait88 vvillait88 changed the title feat(payment): add canonical *RailSpec types (TEC-304 phase 1) feat(payment): add canonical *RailSpec types for cross-helper rail config May 14, 2026
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