|
@@ -14,6 +14,7 @@ import (
|
|
|
"github.com/stripe/stripe-go/v74/subscription"
|
|
"github.com/stripe/stripe-go/v74/subscription"
|
|
|
"github.com/stripe/stripe-go/v74/webhook"
|
|
"github.com/stripe/stripe-go/v74/webhook"
|
|
|
"heckel.io/ntfy/v2/log"
|
|
"heckel.io/ntfy/v2/log"
|
|
|
|
|
+ "heckel.io/ntfy/v2/payments"
|
|
|
"heckel.io/ntfy/v2/user"
|
|
"heckel.io/ntfy/v2/user"
|
|
|
"heckel.io/ntfy/v2/util"
|
|
"heckel.io/ntfy/v2/util"
|
|
|
"io"
|
|
"io"
|
|
@@ -44,8 +45,6 @@ import (
|
|
|
// This is used to keep the local user database fields up to date. Stripe is the source of truth.
|
|
// 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.
|
|
// What Stripe says is mirrored and not questioned.
|
|
|
|
|
|
|
|
-const hasStripe = true
|
|
|
|
|
-
|
|
|
|
|
var (
|
|
var (
|
|
|
errNotAPaidTier = errors.New("tier does not have billing price identifier")
|
|
errNotAPaidTier = errors.New("tier does not have billing price identifier")
|
|
|
errMultipleBillingSubscriptions = errors.New("cannot have multiple billing subscriptions")
|
|
errMultipleBillingSubscriptions = errors.New("cannot have multiple billing subscriptions")
|
|
@@ -468,8 +467,8 @@ func (s *Server) updateSubscriptionAndTier(r *http.Request, v *visitor, u *user.
|
|
|
billing := &user.Billing{
|
|
billing := &user.Billing{
|
|
|
StripeCustomerID: customerID,
|
|
StripeCustomerID: customerID,
|
|
|
StripeSubscriptionID: subscriptionID,
|
|
StripeSubscriptionID: subscriptionID,
|
|
|
- StripeSubscriptionStatus: stripe.SubscriptionStatus(status),
|
|
|
|
|
- StripeSubscriptionInterval: stripe.PriceRecurringInterval(interval),
|
|
|
|
|
|
|
+ StripeSubscriptionStatus: payments.SubscriptionStatus(status),
|
|
|
|
|
+ StripeSubscriptionInterval: payments.PriceRecurringInterval(interval),
|
|
|
StripeSubscriptionPaidUntil: time.Unix(paidUntil, 0),
|
|
StripeSubscriptionPaidUntil: time.Unix(paidUntil, 0),
|
|
|
StripeSubscriptionCancelAt: time.Unix(cancelAt, 0),
|
|
StripeSubscriptionCancelAt: time.Unix(cancelAt, 0),
|
|
|
}
|
|
}
|