mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
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.
This commit is contained in:
parent
1c5e3ecb6e
commit
5cfe9b4169
4 changed files with 1 additions and 19 deletions
|
|
@ -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).
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
3
main.go
3
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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue