diff --git a/lib/plausible_web/templates/email/trial_upgrade_email.html.eex b/lib/plausible_web/templates/email/trial_upgrade_email.html.eex index 82f668aa3..1c1dd960f 100644 --- a/lib/plausible_web/templates/email/trial_upgrade_email.html.eex +++ b/lib/plausible_web/templates/email/trial_upgrade_email.html.eex @@ -3,7 +3,7 @@ Hey <%= user_salutation(@user) %>, Thanks for exploring Plausible, a simple and privacy-friendly alternative to Google Analytics. Your free 30-day trial is ending <%= @day %>, but you can keep using Plausible by upgrading to a paid plan.

In the last month, your account has used <%= PlausibleWeb.AuthView.delimit_integer(@usage) %> billable pageviews<%= if @custom_events > 0, do: " and custom events in total", else: "" %>. -<%= if @usage <= 20_000_000 do %> +<%= if @usage <= 10_000_000 do %> Based on that we recommend you select the <%= @suggested_plan[:volume] %>/mo plan.

<%= link("Upgrade now", to: "#{plausible_url()}/billing/upgrade") %> diff --git a/test/plausible/billing/plans_test.exs b/test/plausible/billing/plans_test.exs index 8e94702ea..599a20aab 100644 --- a/test/plausible/billing/plans_test.exs +++ b/test/plausible/billing/plans_test.exs @@ -4,6 +4,7 @@ defmodule Plausible.Billing.PlansTest do @v1_plan_id "558018" @v2_plan_id "654177" + @v3_plan_id "749342" describe "plans_for" do test "shows v1 pricing for users who are already on v1 pricing" do @@ -12,11 +13,23 @@ defmodule Plausible.Billing.PlansTest do assert List.first(Plans.plans_for(user))[:monthly_product_id] == @v1_plan_id end - test "shows v2 pricing for everyone else" do - user = insert(:user) |> Repo.preload(:subscription) + test "shows v2 pricing for users who are already on v2 pricing" do + user = insert(:user, subscription: build(:subscription, paddle_plan_id: @v2_plan_id)) assert List.first(Plans.plans_for(user))[:monthly_product_id] == @v2_plan_id end + + test "shows v2 pricing for users who signed up in 2021" do + user = insert(:user, inserted_at: ~N[2021-12-31 00:00:00]) |> Repo.preload(:subscription) + + assert List.first(Plans.plans_for(user))[:monthly_product_id] == @v2_plan_id + end + + test "shows v3 pricing for everyone else" do + user = insert(:user) |> Repo.preload(:subscription) + + assert List.first(Plans.plans_for(user))[:monthly_product_id] == @v3_plan_id + end end describe "allowance" do diff --git a/test/workers/send_trial_notifications_test.exs b/test/workers/send_trial_notifications_test.exs index aaef84038..8285e2c2e 100644 --- a/test/workers/send_trial_notifications_test.exs +++ b/test/workers/send_trial_notifications_test.exs @@ -162,17 +162,10 @@ defmodule Plausible.Workers.SendTrialNotificationsTest do assert email.html_body =~ "we recommend you select the 10M/mo plan." end - test "suggests 20m/mo plan" do - user = insert(:user) - - email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {19_000_000, 0}) - assert email.html_body =~ "we recommend you select the 20M/mo plan." - end - test "does not suggest a plan above that" do user = insert(:user) - email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {50_000_000, 0}) + email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {20_000_000, 0}) assert email.html_body =~ "please reply back to this email to get a quote for your volume" end end