Minor refactor
This commit is contained in:
parent
5635e63cb7
commit
78e5e3bdb1
1 changed files with 5 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue