Merge pull request #21005 from mattermost/MM-45580-notify-admin-delinquency-update-billing
[MM-45580] Send deliquency since to end users and allow new notify ad…
Этот коммит содержится в:
@@ -67,20 +67,21 @@ func getSubscription(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
// if it is an end user, return basic subscription data without sensitive information
|
// if it is an end user, return basic subscription data without sensitive information
|
||||||
if !c.App.SessionHasPermissionTo(*c.AppContext.Session(), model.PermissionSysconsoleReadBilling) {
|
if !c.App.SessionHasPermissionTo(*c.AppContext.Session(), model.PermissionSysconsoleReadBilling) {
|
||||||
subscription = &model.Subscription{
|
subscription = &model.Subscription{
|
||||||
ID: subscription.ID,
|
ID: subscription.ID,
|
||||||
ProductID: subscription.ProductID,
|
ProductID: subscription.ProductID,
|
||||||
IsFreeTrial: subscription.IsFreeTrial,
|
IsFreeTrial: subscription.IsFreeTrial,
|
||||||
TrialEndAt: subscription.TrialEndAt,
|
TrialEndAt: subscription.TrialEndAt,
|
||||||
CustomerID: "",
|
CustomerID: "",
|
||||||
AddOns: []string{},
|
AddOns: []string{},
|
||||||
StartAt: 0,
|
StartAt: 0,
|
||||||
EndAt: 0,
|
EndAt: 0,
|
||||||
CreateAt: 0,
|
CreateAt: 0,
|
||||||
Seats: 0,
|
Seats: 0,
|
||||||
Status: "",
|
Status: "",
|
||||||
DNS: "",
|
DNS: "",
|
||||||
IsPaidTier: "",
|
IsPaidTier: "",
|
||||||
LastInvoice: &model.Invoice{},
|
LastInvoice: &model.Invoice{},
|
||||||
|
DelinquentSince: subscription.DelinquentSince,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,36 +111,40 @@ func Test_getCloudLimits(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Test_GetSubscription(t *testing.T) {
|
func Test_GetSubscription(t *testing.T) {
|
||||||
|
deliquencySince := int64(2000000000)
|
||||||
|
|
||||||
subscription := &model.Subscription{
|
subscription := &model.Subscription{
|
||||||
ID: "MySubscriptionID",
|
ID: "MySubscriptionID",
|
||||||
CustomerID: "MyCustomer",
|
CustomerID: "MyCustomer",
|
||||||
ProductID: "SomeProductId",
|
ProductID: "SomeProductId",
|
||||||
AddOns: []string{},
|
AddOns: []string{},
|
||||||
StartAt: 1000000000,
|
StartAt: 1000000000,
|
||||||
EndAt: 2000000000,
|
EndAt: 2000000000,
|
||||||
CreateAt: 1000000000,
|
CreateAt: 1000000000,
|
||||||
Seats: 10,
|
Seats: 10,
|
||||||
IsFreeTrial: "true",
|
IsFreeTrial: "true",
|
||||||
DNS: "some.dns.server",
|
DNS: "some.dns.server",
|
||||||
IsPaidTier: "false",
|
IsPaidTier: "false",
|
||||||
TrialEndAt: 2000000000,
|
TrialEndAt: 2000000000,
|
||||||
LastInvoice: &model.Invoice{},
|
LastInvoice: &model.Invoice{},
|
||||||
|
DelinquentSince: &deliquencySince,
|
||||||
}
|
}
|
||||||
|
|
||||||
userFacingSubscription := &model.Subscription{
|
userFacingSubscription := &model.Subscription{
|
||||||
ID: "MySubscriptionID",
|
ID: "MySubscriptionID",
|
||||||
CustomerID: "",
|
CustomerID: "",
|
||||||
ProductID: "SomeProductId",
|
ProductID: "SomeProductId",
|
||||||
AddOns: []string{},
|
AddOns: []string{},
|
||||||
StartAt: 0,
|
StartAt: 0,
|
||||||
EndAt: 0,
|
EndAt: 0,
|
||||||
CreateAt: 0,
|
CreateAt: 0,
|
||||||
Seats: 0,
|
Seats: 0,
|
||||||
IsFreeTrial: "true",
|
IsFreeTrial: "true",
|
||||||
DNS: "",
|
DNS: "",
|
||||||
IsPaidTier: "",
|
IsPaidTier: "",
|
||||||
TrialEndAt: 2000000000,
|
TrialEndAt: 2000000000,
|
||||||
LastInvoice: &model.Invoice{},
|
LastInvoice: &model.Invoice{},
|
||||||
|
DelinquentSince: &deliquencySince,
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run("NON Admin users receive the user facing subscription", func(t *testing.T) {
|
t.Run("NON Admin users receive the user facing subscription", func(t *testing.T) {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ const (
|
|||||||
PaidFeatureUnlimitedBoardcards = MattermostPaidFeature("mattermost.feature.unlimited_board_cards")
|
PaidFeatureUnlimitedBoardcards = MattermostPaidFeature("mattermost.feature.unlimited_board_cards")
|
||||||
PaidFeatureAllProfessionalfeatures = MattermostPaidFeature("mattermost.feature.all_professional")
|
PaidFeatureAllProfessionalfeatures = MattermostPaidFeature("mattermost.feature.all_professional")
|
||||||
PaidFeatureAllEnterprisefeatures = MattermostPaidFeature("mattermost.feature.all_enterprise")
|
PaidFeatureAllEnterprisefeatures = MattermostPaidFeature("mattermost.feature.all_enterprise")
|
||||||
|
UpgradeDowngradedWorkspace = MattermostPaidFeature("mattermost.feature.upgrade_downgraded_workspace")
|
||||||
)
|
)
|
||||||
|
|
||||||
var validSKUs map[string]struct{} = map[string]struct{}{
|
var validSKUs map[string]struct{} = map[string]struct{}{
|
||||||
@@ -42,6 +43,7 @@ var paidFeatures map[MattermostPaidFeature]struct{} = map[MattermostPaidFeature]
|
|||||||
PaidFeatureUnlimitedBoardcards: {},
|
PaidFeatureUnlimitedBoardcards: {},
|
||||||
PaidFeatureAllProfessionalfeatures: {},
|
PaidFeatureAllProfessionalfeatures: {},
|
||||||
PaidFeatureAllEnterprisefeatures: {},
|
PaidFeatureAllEnterprisefeatures: {},
|
||||||
|
UpgradeDowngradedWorkspace: {},
|
||||||
}
|
}
|
||||||
|
|
||||||
type NotifyAdminToUpgradeRequest struct {
|
type NotifyAdminToUpgradeRequest struct {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user