1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-11-30 04:10:01 +01:00
This commit is contained in:
binwiederhier 2025-07-04 06:41:14 +02:00
parent 7b470a7f6f
commit 5ccc131e73
5 changed files with 50 additions and 2 deletions

View file

@ -158,7 +158,7 @@ func New(conf *Config) (*Server, error) {
mailer = &smtpSender{config: conf}
}
var stripe stripeAPI
if conf.StripeSecretKey != "" {
if hasStripe && conf.StripeSecretKey != "" {
stripe = newStripeAPI()
}
messageCache, err := createMessageCache(conf)

View file

@ -1,3 +1,5 @@
//go:build !nopayments
package server
import (
@ -22,7 +24,7 @@ import (
// Payments in ntfy are done via Stripe.
//
// Pretty much all payments related things are in this file. The following processes
// Pretty much all payments-related things are in this file. The following processes
// handle payments:
//
// - Checkout:
@ -42,6 +44,8 @@ import (
// This is used to keep the local user database fields up to date. Stripe is the source of truth.
// What Stripe says is mirrored and not questioned.
const hasStripe = true
var (
errNotAPaidTier = errors.New("tier does not have billing price identifier")
errMultipleBillingSubscriptions = errors.New("cannot have multiple billing subscriptions")

View file

@ -0,0 +1,41 @@
//go:build nopayments
package server
const hasStripe = false
func (s *Server) handleBillingTiersGet(w http.ResponseWriter, _ *http.Request, _ *visitor) error {
return errHTTPNotFound
}
func (s *Server) handleAccountBillingSubscriptionCreate(w http.ResponseWriter, r *http.Request, v *visitor) error {
return errHTTPNotFound
}
func (s *Server) handleAccountBillingSubscriptionCreateSuccess(w http.ResponseWriter, r *http.Request, v *visitor) error {
return errHTTPNotFound
}
func (s *Server) handleAccountBillingSubscriptionUpdate(w http.ResponseWriter, r *http.Request, v *visitor) error {
return errHTTPNotFound
}
func (s *Server) handleAccountBillingSubscriptionDelete(w http.ResponseWriter, r *http.Request, v *visitor) error {
return errHTTPNotFound
}
func (s *Server) handleAccountBillingPortalSessionCreate(w http.ResponseWriter, r *http.Request, v *visitor) error {
return errHTTPNotFound
}
func (s *Server) handleAccountBillingWebhook(_ http.ResponseWriter, r *http.Request, v *visitor) error {
return errHTTPNotFound
}
func (s *Server) handleAccountBillingWebhookSubscriptionUpdated(r *http.Request, v *visitor, event stripe.Event) error {
return errHTTPNotFound
}
func (s *Server) handleAccountBillingWebhookSubscriptionDeleted(r *http.Request, v *visitor, event stripe.Event) error {
return errHTTPNotFound
}

View file

@ -1,3 +1,5 @@
//go:build !nopayments
package server
import (

1
stripe/types.go Normal file
View file

@ -0,0 +1 @@
package stripe