π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Create new subs only if the existing subscription is in a cancelled state
vishnukvmdb95d7c241d7d
diff --git a/server/pkg/controller/stripe.go b/server/pkg/controller/stripe.goindex 4b20817992..b3a0376faf 100644--- a/server/pkg/controller/stripe.go+++ b/server/pkg/controller/stripe.go@@ -86,9 +86,15 @@ func (c *StripeController) GetCheckoutSession(productID string, userID int64, rereturn "", stacktrace.Propagate(ente.ErrBadRequest, "")}}- if subscription.PaymentProvider == ente.Stripe && !subscription.Attributes.IsCancelled {- // TODO: Check Stripe's cancellation state instead of our own- return "", stacktrace.Propagate(err, "")+ if hasStripeSubscription {+ client := c.StripeClients[subscription.Attributes.StripeAccountCountry]+ stripeSubscription, err := client.Subscriptions.Get(subscription.OriginalTransactionID, nil)+ if err != nil {+ return "", stacktrace.Propagate(err, "")+ }+ if stripeSubscription.Status != stripe.SubscriptionStatusCanceled {+ return "", stacktrace.Propagate(ente.ErrBadRequest, "")+ }}stripeSuccessURL := redirectRootURL + viper.GetString("stripe.path.success")stripeCancelURL := redirectRootURL + viper.GetString("stripe.path.cancel")