فهرست منبع

schema change for subscription webhook

Alexander Belanger 4 سال پیش
والد
کامیت
5a29944a6b
2فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 1 1
      ee/billing/ironplans.go
  2. 5 1
      ee/billing/types.go

+ 1 - 1
ee/billing/ironplans.go

@@ -431,7 +431,7 @@ func (c *Client) ParseProjectUsageFromWebhook(payload []byte) (*cemodels.Project
 	for _, feature := range subscription.Plan.Features {
 		// look for slug of "cpus" and "memory"
 		maxLimit := uint(feature.MaxLimit)
-		switch feature.Slug {
+		switch feature.Feature.Slug {
 		case FeatureSlugCPU:
 			usage.ResourceCPU = maxLimit
 		case FeatureSlugMemory:

+ 5 - 1
ee/billing/types.go

@@ -45,11 +45,15 @@ type ListPlansResponse struct {
 type PlanFeature struct {
 	ID          string      `json:"id"`
 	IsActive    bool        `json:"is_active"`
+	Feature     Feature     `json:"feature"`
 	FeatureSpec FeatureSpec `json:"spec"`
-	Slug        string      `json:"slug"`
 	MaxLimit    int64       `json:"max_limit"`
 }
 
+type Feature struct {
+	Slug string `json:"slug"`
+}
+
 type FeatureSpec struct {
 	ID         string `json:"id"`
 	Name       string `json:"name"`