Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Minor refactor

vishnukvmd78e5e3bdb1ba
diff --git a/server/pkg/controller/stripe.go b/server/pkg/controller/stripe.go
index 0f6600af02..4b275fc474 100644
--- a/server/pkg/controller/stripe.go
+++ b/server/pkg/controller/stripe.go
@@ -348,10 +348,6 @@ func (c *StripeController) handleCustomerSubscriptionUpdated(event stripe.Event,
}
userID := currentSubscription.UserID
- newSubscription, err := c.getEnteSubscriptionFromStripeSubscription(userID, stripeSubscription)
- if err != nil {
- return ente.StripeEventLog{}, stacktrace.Propagate(err, "")
- }
if stripeSubscription.Status == stripe.SubscriptionStatusPastDue {
user, err := c.UserRepo.Get(userID)
if err != nil {
@@ -365,6 +361,11 @@ func (c *StripeController) handleCustomerSubscriptionUpdated(event stripe.Event,
return ente.StripeEventLog{}, stacktrace.Propagate(err, "")
}
}
+
+ newSubscription, err := c.getEnteSubscriptionFromStripeSubscription(userID, stripeSubscription)
+ if err != nil {
+ return ente.StripeEventLog{}, stacktrace.Propagate(err, "")
+ }
// If the customer has changed the plan, we update state in the database. If
// the plan has not changed, we will ignore this webhook and rely on other
// events to update the state