feat(payment): add canonical *RailSpec types for cross-helper rail config - #40
Merged
Conversation
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>
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
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
🤖 Generated with Claude Code