Skip to main content

max / makenotwork

Rename the AppState payment-provider field to payments The field holds the PaymentProvider abstraction and was named for the vendor. Renamed on AppState, AppStateParts and the Billing substate, with every reference and the architecture doc row updated. Vendor names in the data model and the stripe route module are unchanged.
Co-Authored-By
Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session
https://claude.ai/code/session_01KD2dJJETtYs7R5kku6YyLk
Author: Max Johnson <me@maxj.phd> · 2026-08-29 19:49 UTC
Signed with PGP, not checked
Commit: 5efe7472339567925d6d8392cda6c0b9475a0378
Parent: a8977ee
27 files changed, +54 insertions, -48 deletions
@@ -286,7 +286,7 @@
286 286 | `config` | `Config` | Environment-based configuration |
287 287 | `s3` | `Option<Arc<dyn StorageBackend>>` | Main file storage (uploads, covers, downloads) |
288 288 | `synckit_s3` | `Option<Arc<dyn StorageBackend>>` | Separate SyncKit blob storage bucket |
289 - | `stripe` | `Option<StripeClient>` | Stripe Connect client |
289 + | `payments` | `Option<Arc<dyn PaymentProvider>>` | Payment provider (Stripe today) |
290 290 | `email` | `EmailClient` | Postmark email client (logs in dev) |
291 291 | `docs` | `Arc<DocLoader>` | Documentation pages (loaded at startup) |
292 292 | `scanner` | `Option<Arc<ScanPipeline>>` | File scanning pipeline (YARA rules compiled at startup) |
@@ -128,7 +128,7 @@
128 128 /// S3-compatible storage backends: main private bucket, SyncKit blob
129 129 /// bucket, and the public CDN-served bucket.
130 130 pub storage: AppStorage,
131 - pub stripe: Option<Arc<dyn PaymentProvider>>,
131 + pub payments: Option<Arc<dyn PaymentProvider>>,
132 132 pub email: EmailClient,
133 133 pub docs: Arc<DocLoader>,
134 134 pub tier_prices: tier_prices::TierPrices,
@@ -250,7 +250,7 @@
250 250 /// public `/pricing` page.
251 251 #[derive(Clone)]
252 252 pub struct Billing {
253 - pub stripe: Option<Arc<dyn PaymentProvider>>,
253 + pub payments: Option<Arc<dyn PaymentProvider>>,
254 254 pub tier_prices: tier_prices::TierPrices,
255 255 pub runway_config: tier_prices::RunwayConfig,
256 256 pub fee_calculator: fee_calculator::FeeCalculator,
@@ -259,7 +259,7 @@
259 259 impl FromRef<AppState> for Billing {
260 260 fn from_ref(s: &AppState) -> Self {
261 261 Self {
262 - stripe: s.stripe.clone(),
262 + payments: s.payments.clone(),
263 263 tier_prices: s.tier_prices.clone(),
264 264 runway_config: s.runway_config.clone(),
265 265 fee_calculator: s.fee_calculator.clone(),
@@ -410,7 +410,7 @@
410 410 pub db: sqlx::PgPool,
411 411 pub config: Config,
412 412 pub storage: AppStorage,
413 - pub stripe: Option<Arc<dyn PaymentProvider>>,
413 + pub payments: Option<Arc<dyn PaymentProvider>>,
414 414 pub email: EmailClient,
415 415 pub docs: Arc<DocLoader>,
416 416 pub tier_prices: tier_prices::TierPrices,
@@ -475,7 +475,7 @@
475 475 db: parts.db,
476 476 config: parts.config,
477 477 storage: parts.storage,
478 - stripe: parts.stripe,
478 + payments: parts.payments,
479 479 email: parts.email,
480 480 docs: parts.docs,
481 481 tier_prices: parts.tier_prices,
@@ -571,7 +571,7 @@
571 571 public_s3,
572 572 rpm_s3,
573 573 },
574 - stripe,
574 + payments: stripe,
575 575 email,
576 576 docs,
577 577 tier_prices,
@@ -592,7 +592,7 @@
592 592 tracing::info!(
593 593 s3 = state.storage.s3.is_some(),
594 594 synckit_s3 = state.storage.synckit_s3.is_some(),
595 - stripe = state.stripe.is_some(),
595 + stripe = state.payments.is_some(),
596 596 scanner = state.scanner.is_some(),
597 597 mt = state.mt_client.is_some(),
598 598 wam = state.wam.is_some(),
@@ -206,7 +206,7 @@
206 206 viewer
207 207 .block_on(crate::payments::refund::refund(
208 208 &viewer.app.db,
209 - viewer.app.stripe.as_ref(),
209 + viewer.app.payments.as_ref(),
210 210 &viewer.user,
211 211 item,
212 212 transaction,
@@ -92,7 +92,7 @@
92 92 // Both `None` cases are the same screen: no Stripe account configured and a
93 93 // balance call that failed are indistinguishable to a reader, and the
94 94 // template already drew one card for both.
95 - let balance = match (&viewer.app.stripe, &user.stripe_account_id) {
95 + let balance = match (&viewer.app.payments, &user.stripe_account_id) {
96 96 (Some(stripe), Some(account_id)) => {
97 97 match viewer.block_on(stripe.get_balance(account_id, user.settlement_currency)) {
98 98 Ok(balance) => Some(BalanceView {
@@ -691,7 +691,7 @@
691 691 crate::tier_prices::TierPrices::install_test_default();
692 692 Pricing {
693 693 billing: Billing {
694 - stripe: None,
694 + payments: None,
695 695 tier_prices: crate::tier_prices::TierPrices::global().clone(),
696 696 runway_config: crate::tier_prices::RunwayConfig {
697 697 quarters: 0,