From 0bce0e1fd09978a7bc6157d64ad8989e701b6622 Mon Sep 17 00:00:00 2001 From: Jonathan Lange Date: Wed, 29 Aug 2018 18:09:22 +0100 Subject: [PATCH 1/4] Reduce the trial length From @Futurile > I'd like to move Weave Cloud to 14 day trial ASAP. I'd also like to > reduce the time period before we block them from sending us new data. > How fast can we do the engineering? > > The impact will be that this will accelerate users through the system to > either convert or terminate their trial. I've resisted it previously as > I felt that it was too short to actually try the product: but Customer > Success can extend trials so lets try it. --- billing-api/trial/trial.go | 2 +- users/organization.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/billing-api/trial/trial.go b/billing-api/trial/trial.go index a936c891c..d2a18c02f 100644 --- a/billing-api/trial/trial.go +++ b/billing-api/trial/trial.go @@ -9,7 +9,7 @@ import ( const ( trialFlag string = "trial:days" - defaultTrialLength int = 30 + defaultTrialLength int = 14 ) // Trial is a bundle of information about the trial period used by the frontend. diff --git a/users/organization.go b/users/organization.go index be75623fd..5aadbf682 100644 --- a/users/organization.go +++ b/users/organization.go @@ -17,7 +17,7 @@ const ( // TrialRefuseDataUploadAfter is the period after the trial expired before an // instance's data upload is restricted. - TrialRefuseDataUploadAfter = 15 * 24 * time.Hour + TrialRefuseDataUploadAfter = 7 * 24 * time.Hour defaultTeamNameTemplate = "%v Team" ) From 4c6ee3f3b41a8cfa0fa9805fb918df67cd26f771 Mon Sep 17 00:00:00 2001 From: Roland Schilter Date: Wed, 29 Aug 2018 10:34:37 -0700 Subject: [PATCH 2/4] Remove comment as Trial.Length is now in use See https://github.com/weaveworks/service-ui/pull/2004 which introduced it again. --- billing-api/trial/trial.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/billing-api/trial/trial.go b/billing-api/trial/trial.go index d2a18c02f..2b23c6f37 100644 --- a/billing-api/trial/trial.go +++ b/billing-api/trial/trial.go @@ -14,9 +14,7 @@ const ( // Trial is a bundle of information about the trial period used by the frontend. type Trial struct { - // Length is the original length of trial period. This isn't actually - // used. TODO(jml): Remove this field once weaveworks/service-ui#1037 is - // deployed to production. + // Length is the original length of trial period. Length int `json:"length"` // Remaining is the number of days remaining, rounded to whole days. Remaining int `json:"remaining"` From 7047e802188ab74434589ff42e8c6eb0d219feff Mon Sep 17 00:00:00 2001 From: Roland Schilter Date: Wed, 29 Aug 2018 10:37:51 -0700 Subject: [PATCH 3/4] refactor: Remove dead code --- billing-api/trial/trial.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/billing-api/trial/trial.go b/billing-api/trial/trial.go index 2b23c6f37..fd0883d8f 100644 --- a/billing-api/trial/trial.go +++ b/billing-api/trial/trial.go @@ -7,11 +7,6 @@ import ( common_time "github.com/weaveworks/service/common/time" ) -const ( - trialFlag string = "trial:days" - defaultTrialLength int = 14 -) - // Trial is a bundle of information about the trial period used by the frontend. type Trial struct { // Length is the original length of trial period. From 56eeb0671f288ffe0175a860b484ea29029671f7 Mon Sep 17 00:00:00 2001 From: Roland Schilter Date: Wed, 29 Aug 2018 10:38:03 -0700 Subject: [PATCH 4/4] Reduce user trial length --- billing-api/trial/trial_test.go | 2 +- users/api/admin_test.go | 6 +++--- users/organization.go | 2 +- users/user.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/billing-api/trial/trial_test.go b/billing-api/trial/trial_test.go index a3f6617c7..0bf59ebab 100644 --- a/billing-api/trial/trial_test.go +++ b/billing-api/trial/trial_test.go @@ -66,7 +66,7 @@ func TestTrialInfo(t *testing.T) { TrialExpiresAt: now.Add(asDays(20) + 1*time.Hour), }, trial: trial.Trial{ - Length: int(users.TrialDuration.Hours() / 24), + Length: 30, Remaining: 21, Start: now.Add(asDays(-10) + 1*time.Hour), End: now.Add(asDays(20) + 1*time.Hour), diff --git a/users/api/admin_test.go b/users/api/admin_test.go index 555278871..bca5c952c 100644 --- a/users/api/admin_test.go +++ b/users/api/admin_test.go @@ -190,18 +190,18 @@ func TestAPI_adminTrial(t *testing.T) { defer cleanup(t) usr, org := getOrg(t) - assert.Equal(t, 30, org.TrialRemaining(), "trial is not 30 days on instance creation") + assert.Equal(t, 14, org.TrialRemaining(), "trial is not 14 days on instance creation") { // Cannot shrink w := httptest.NewRecorder() - r := requestAs(t, usr, "POST", fmt.Sprintf("/admin/users/organizations/%s/trial", org.ExternalID), strings.NewReader("remaining=29")) + r := requestAs(t, usr, "POST", fmt.Sprintf("/admin/users/organizations/%s/trial", org.ExternalID), strings.NewReader("remaining=9")) r.Header.Set("Content-Type", "application/x-www-form-urlencoded") app.ServeHTTP(w, r) assert.Equal(t, http.StatusFound, w.Code) org, err := database.FindOrganizationByID(context.TODO(), org.ExternalID) assert.NoError(t, err) - assert.Equal(t, 30, org.TrialRemaining()) + assert.Equal(t, 14, org.TrialRemaining()) } { // but can expand w := httptest.NewRecorder() diff --git a/users/organization.go b/users/organization.go index 5aadbf682..4bf87d77e 100644 --- a/users/organization.go +++ b/users/organization.go @@ -13,7 +13,7 @@ import ( const ( // TrialExtensionDuration is the extension period if billing is // enabled for an existing customer - TrialExtensionDuration = 15 * 24 * time.Hour + TrialExtensionDuration = 7 * 24 * time.Hour // TrialRefuseDataUploadAfter is the period after the trial expired before an // instance's data upload is restricted. diff --git a/users/user.go b/users/user.go index e517ad81f..d799f14f4 100644 --- a/users/user.go +++ b/users/user.go @@ -9,7 +9,7 @@ import ( // TrialDuration is how long a user has a free trial // period before we start charging for it. -const TrialDuration = 30 * 24 * time.Hour +const TrialDuration = 14 * 24 * time.Hour // FindUserByIDer is an interface of just FindUserByID, for loosely coupling // things to the db.DB