diff --git a/ee/query-service/app/api/license.go b/ee/query-service/app/api/license.go index 0cb7fa2bab..ff1e24dfff 100644 --- a/ee/query-service/app/api/license.go +++ b/ee/query-service/app/api/license.go @@ -218,6 +218,10 @@ func (ah *APIHandler) getBilling(w http.ResponseWriter, r *http.Request) { func convertLicenseV3ToLicenseV2(licenses []*model.LicenseV3) []model.License { licensesV2 := []model.License{} for _, l := range licenses { + planKeyFromPlanName, ok := model.MapOldPlanKeyToNewPlanName[l.PlanName] + if !ok { + planKeyFromPlanName = model.Basic + } licenseV2 := model.License{ Key: l.Key, ActivationId: "", @@ -226,7 +230,7 @@ func convertLicenseV3ToLicenseV2(licenses []*model.LicenseV3) []model.License { ValidationMessage: "", IsCurrent: l.IsCurrent, LicensePlan: model.LicensePlan{ - PlanKey: l.PlanName, + PlanKey: planKeyFromPlanName, ValidFrom: l.ValidFrom, ValidUntil: l.ValidUntil, Status: l.Status}, diff --git a/ee/query-service/license/manager.go b/ee/query-service/license/manager.go index aa58e7e5a5..337d9ecb57 100644 --- a/ee/query-service/license/manager.go +++ b/ee/query-service/license/manager.go @@ -253,6 +253,11 @@ func (lm *Manager) GetLicensesV3(ctx context.Context) (response []*model.License if lm.activeLicenseV3 != nil && l.Key == lm.activeLicenseV3.Key { l.IsCurrent = true } + if l.ValidUntil == -1 { + // for subscriptions, there is no end-date as such + // but for showing user some validity we default one year timespan + l.ValidUntil = l.ValidFrom + 31556926 + } response = append(response, l) } diff --git a/ee/query-service/model/plans.go b/ee/query-service/model/plans.go index 1ac9ac28d6..cb9760180b 100644 --- a/ee/query-service/model/plans.go +++ b/ee/query-service/model/plans.go @@ -16,6 +16,10 @@ var ( PlanNameBasic = "BASIC" ) +var ( + MapOldPlanKeyToNewPlanName map[string]string = map[string]string{PlanNameBasic: Basic, PlanNameTeams: Pro, PlanNameEnterprise: Enterprise} +) + var ( LicenseStatusInactive = "INACTIVE" )