From 4935a62b223a6069251fc7bf2d0e07ac4a9b0c02 Mon Sep 17 00:00:00 2001 From: Uku Taht <uku.taht@gmail.com> Date: Fri, 7 May 2021 16:02:12 +0300 Subject: [PATCH] Use JSON --- lib/plausible/billing/plans.ex | 79 +++------------------------------- priv/plans_v1.json | 72 +++++++++++++++++++++++++++++++ priv/plans_v2.json | 72 +++++++++++++++++++++++++++++++ 3 files changed, 151 insertions(+), 72 deletions(-) create mode 100644 priv/plans_v2.json diff --git a/lib/plausible/billing/plans.ex b/lib/plausible/billing/plans.ex index 714b2947..ed52a60d 100644 --- a/lib/plausible/billing/plans.ex +++ b/lib/plausible/billing/plans.ex @@ -1,76 +1,8 @@ defmodule Plausible.Billing.Plans do - @plans_v1 [ - %{ - limit: 10_000, - monthly_product_id: "558018", - monthly_cost: "$6", - yearly_product_id: "572810", - yearly_cost: "$48" - }, - %{ - limit: 100_000, - monthly_product_id: "558745", - monthly_cost: "$12", - yearly_product_id: "590752", - yearly_cost: "$96" - }, - %{ - limit: 200_000, - monthly_product_id: "597485", - monthly_cost: "$18", - yearly_product_id: "597486", - yearly_cost: "$144" - }, - %{ - limit: 500_000, - monthly_product_id: "597487", - monthly_cost: "$27", - yearly_product_id: "597488", - yearly_cost: "$216" - }, - %{ - limit: 1_000_000, - monthly_product_id: "597642", - monthly_cost: "$48", - yearly_product_id: "597643", - yearly_cost: "$384" - }, - %{ - limit: 2_000_000, - monthly_product_id: "597309", - monthly_cost: "$69", - yearly_product_id: "597310", - yearly_cost: "$552" - }, - %{ - limit: 5_000_000, - monthly_product_id: "597311", - monthly_cost: "$99", - yearly_product_id: "597312", - yearly_cost: "$792" - }, - %{ - limit: 10_000_000, - monthly_product_id: "642352", - monthly_cost: "$150", - yearly_product_id: "642354", - yearly_cost: "$1200" - }, - %{ - limit: 20_000_000, - monthly_product_id: "642355", - monthly_cost: "$225", - yearly_product_id: "642356", - yearly_cost: "$1800" - }, - %{ - limit: 50_000_000, - monthly_product_id: "650652", - monthly_cost: "$330", - yearly_product_id: "650653", - yearly_cost: "$2640" - } - ] + @plans_v1 File.read!(Application.app_dir(:plausible) <> "/priv/plans_v1.json") + |> Jason.decode!(keys: :atoms) + @plans_v2 File.read!(Application.app_dir(:plausible) <> "/priv/plans_v2.json") + |> Jason.decode!(keys: :atoms) @unlisted_plans_v1 [ %{limit: 150_000_000, yearly_product_id: "648089", yearly_cost: "$4800"} @@ -132,4 +64,7 @@ defmodule Plausible.Billing.Plans do defp number_format(num) do PlausibleWeb.StatsView.large_number_format(num) end + + defp plans_v1() do + end end diff --git a/priv/plans_v1.json b/priv/plans_v1.json index e69de29b..9ab90fb5 100644 --- a/priv/plans_v1.json +++ b/priv/plans_v1.json @@ -0,0 +1,72 @@ +[ + { + "limit":10000, + "monthly_cost":"$6", + "monthly_product_id":"558018", + "yearly_cost":"$48", + "yearly_product_id":"572810" + }, + { + "limit":100000, + "monthly_cost":"$12", + "monthly_product_id":"558745", + "yearly_cost":"$96", + "yearly_product_id":"590752" + }, + { + "limit":200000, + "monthly_cost":"$18", + "monthly_product_id":"597485", + "yearly_cost":"$144", + "yearly_product_id":"597486" + }, + { + "limit":500000, + "monthly_cost":"$27", + "monthly_product_id":"597487", + "yearly_cost":"$216", + "yearly_product_id":"597488" + }, + { + "limit":1000000, + "monthly_cost":"$48", + "monthly_product_id":"597642", + "yearly_cost":"$384", + "yearly_product_id":"597643" + }, + { + "limit":2000000, + "monthly_cost":"$69", + "monthly_product_id":"597309", + "yearly_cost":"$552", + "yearly_product_id":"597310" + }, + { + "limit":5000000, + "monthly_cost":"$99", + "monthly_product_id":"597311", + "yearly_cost":"$792", + "yearly_product_id":"597312" + }, + { + "limit":10000000, + "monthly_cost":"$150", + "monthly_product_id":"642352", + "yearly_cost":"$1200", + "yearly_product_id":"642354" + }, + { + "limit":20000000, + "monthly_cost":"$225", + "monthly_product_id":"642355", + "yearly_cost":"$1800", + "yearly_product_id":"642356" + }, + { + "limit":50000000, + "monthly_cost":"$330", + "monthly_product_id":"650652", + "yearly_cost":"$2640", + "yearly_product_id":"650653" + } +] diff --git a/priv/plans_v2.json b/priv/plans_v2.json new file mode 100644 index 00000000..67c2098d --- /dev/null +++ b/priv/plans_v2.json @@ -0,0 +1,72 @@ +[ + { + "limit":10000, + "monthly_cost":"$6", + "monthly_product_id":"558018", + "yearly_cost":"$60", + "yearly_product_id":"653232" + }, + { + "limit":100000, + "monthly_cost":"$12", + "monthly_product_id":"558745", + "yearly_cost":"$120", + "yearly_product_id":"653234" + }, + { + "limit":200000, + "monthly_cost":"$20", + "monthly_product_id":"653237", + "yearly_cost":"$200", + "yearly_product_id":"653236" + }, + { + "limit":500000, + "monthly_cost":"$30", + "monthly_product_id":"653238", + "yearly_cost":"$300", + "yearly_product_id":"653239" + }, + { + "limit":1000000, + "monthly_cost":"$50", + "monthly_product_id":"597642", + "yearly_cost":"$500", + "yearly_product_id":"597643" + }, + { + "limit":2000000, + "monthly_cost":"$70", + "monthly_product_id":"653253", + "yearly_cost":"$700", + "yearly_product_id":"653254" + }, + { + "limit":5000000, + "monthly_cost":"$100", + "monthly_product_id":"653255", + "yearly_cost":"$1000", + "yearly_product_id":"653256" + }, + { + "limit":10000000, + "monthly_cost":"$150", + "monthly_product_id":"642352", + "yearly_cost":"$1500", + "yearly_product_id":"653257" + }, + { + "limit":20000000, + "monthly_cost":"$225", + "monthly_product_id":"642355", + "yearly_cost":"$2250", + "yearly_product_id":"653258" + }, + { + "limit":50000000, + "monthly_cost":"$330", + "monthly_product_id":"650652", + "yearly_cost":"$3300", + "yearly_product_id":"653259" + } +] -- GitLab