From 5cfe9b4169f74aba5f6399a2225a04919e1613b0 Mon Sep 17 00:00:00 2001 From: Ruidy Date: Thu, 30 Oct 2025 17:03:55 +0100 Subject: [PATCH] refactor(stripe): remove support for Stripe Connect account Eliminated all references to the Stripe Connect account configuration and option handling. This includes removing the related environment variable, config struct field, client option, and usage in Stripe client setup. Stripe integration now only uses the main secret key and webhook secret. --- README.md | 1 - internal/config/config.go | 2 -- internal/driver/stripe/client.go | 14 +------------- main.go | 3 --- 4 files changed, 1 insertion(+), 19 deletions(-) diff --git a/README.md b/README.md index bff99ac..36f9051 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,6 @@ use a cloud alternative such as Railway, fly.io, _etc._ # Stripe configuration (optional until you enable automatic sync) APP_STRIPE_SECRET_KEY=sk_test_your_key APP_STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret - APP_STRIPE_CONNECT_ACCOUNT=acct_your_connect_account # optional ``` Leave the Stripe variables blank to continue using manual cash entry only. When set, Rentease will pull payments from Stripe, process webhooks sent to `/webhooks/stripe`, and expose a manual sync endpoint at `POST /api/stripe/sync` (protected by the existing API key middleware). diff --git a/internal/config/config.go b/internal/config/config.go index 1c6edae..057db61 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -40,8 +40,6 @@ type Config struct { StripeSecretKey string `env:"STRIPE_SECRET_KEY"` // StripeWebhookSecret is the signing secret for validating Stripe webhooks StripeWebhookSecret string `env:"STRIPE_WEBHOOK_SECRET"` - // StripeConnectAccount is the connected account ID when using Stripe Connect (optional) - StripeConnectAccount string `env:"STRIPE_CONNECT_ACCOUNT"` } // New creates a [Config] struct. It first parses the environment variables. You can use a .env file. diff --git a/internal/driver/stripe/client.go b/internal/driver/stripe/client.go index 299cb17..2caa531 100644 --- a/internal/driver/stripe/client.go +++ b/internal/driver/stripe/client.go @@ -14,18 +14,10 @@ import ( // Option configures a Client instance. type Option func(*Client) -// WithAccount sets the Stripe connected account identifier used for requests. -func WithAccount(account string) Option { - return func(c *Client) { - c.account = strings.TrimSpace(account) - } -} - // Client wraps Stripe's SDK to expose the subset of functionality needed by the // application while keeping the rest of the codebase decoupled from the SDK. type Client struct { - api *stripe.Client - account string + api *stripe.Client } // New constructs a Client using the provided secret key. The key must not be empty. @@ -98,10 +90,6 @@ func (c *Client) ListPayments(ctx context.Context, params ListPaymentsParams) ([ listParams.Filters.AddFilter("created", "lte", strconv.FormatInt(params.To.Unix(), 10)) } - if c.account != "" { - listParams.SetStripeAccount(c.account) - } - seq := c.api.V1PaymentIntents.List(ctx, listParams) payments := make([]Payment, 0) var listErr error diff --git a/main.go b/main.go index feac07d..215cc1a 100644 --- a/main.go +++ b/main.go @@ -75,9 +75,6 @@ func run(ctx context.Context, appConfig *config.Config, appLogger *slog.Logger) var stripeClient booking.StripeClient if appConfig.StripeSecretKey != "" { opts := []stripeclient.Option{} - if appConfig.StripeConnectAccount != "" { - opts = append(opts, stripeclient.WithAccount(appConfig.StripeConnectAccount)) - } client, err := stripeclient.New(appConfig.StripeSecretKey, opts...) if err != nil {