diff --git a/lib/plausible/billing/plans.ex b/lib/plausible/billing/plans.ex index 619c2a9a2ea17ce667e2a8c850468f42cdd8bcf2..714b29477cc2bccc707554c9c965abf924c81d9c 100644 --- a/lib/plausible/billing/plans.ex +++ b/lib/plausible/billing/plans.ex @@ -72,7 +72,7 @@ defmodule Plausible.Billing.Plans do } ] - @yearly_plans_v1 [ + @unlisted_plans_v1 [ %{limit: 150_000_000, yearly_product_id: "648089", yearly_cost: "$4800"} ] @@ -85,7 +85,7 @@ defmodule Plausible.Billing.Plans do end def for_product_id(product_id) do - Enum.find(@plans_v1, fn plan -> + Enum.find(@plans_v1 ++ @unlisted_plans_v1, fn plan -> product_id in [plan[:monthly_product_id], plan[:yearly_product_id]] end) end diff --git a/lib/plausible_web/controllers/billing_controller.ex b/lib/plausible_web/controllers/billing_controller.ex index 4f31637d10502a0951014b9a8d5afbab64c2d295..52660ff2ba5c80772190beb7668e73ad6dbec198 100644 --- a/lib/plausible_web/controllers/billing_controller.ex +++ b/lib/plausible_web/controllers/billing_controller.ex @@ -94,6 +94,9 @@ defmodule PlausibleWeb.BillingController do plan = Plausible.Billing.Plans.for_product_id(plan_id) if plan do + cycle = if plan[:monthly_product_id] == plan_id, do: "monthly", else: "yearly" + cost = if cycle == "monthly", do: plan[:monthly_cost], else: plan[:yearly_cost] + plan = Map.merge(plan, %{cycle: cycle, cost: cost, product_id: plan_id}) usage = Plausible.Billing.usage(conn.assigns[:current_user]) render(conn, "upgrade_to_plan.html",