[MM-47565]: In product true up for yearly products (#21704)

Этот коммит содержится в:
emmyni
2022-11-29 11:47:51 -05:00
коммит произвёл GitHub
родитель 37466fe438
Коммит 2455de99ff
8 изменённых файлов: 215 добавлений и 15 удалений

Просмотреть файл

@@ -230,3 +230,20 @@ func (a *App) SendNoCardPaymentFailedEmail() *model.AppError {
}
return nil
}
// Create/ Update a subscription history event
func (a *App) SendSubscriptionHistoryEvent(userID string) (*model.SubscriptionHistory, error) {
license := a.Srv().License()
// No need to create a Subscription History Event if the license isn't cloud
if !license.IsCloud() {
return nil, nil
}
// Get user count
userCount, err := a.Srv().Store().User().Count(model.UserCountOptions{})
if err != nil {
return nil, err
}
return a.Cloud().CreateOrUpdateSubscriptionHistoryEvent(userID, int(userCount))
}