mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 09:33:19 +03:00
Fix webhook
This commit is contained in:
parent
1bb756362d
commit
b458b5a392
@ -8,7 +8,7 @@ defmodule Plausible.Billing do
|
||||
end
|
||||
|
||||
def subscription_created(params) do
|
||||
params = if params["passthrough"] do
|
||||
params = if present?(params["passthrough"]) do
|
||||
params
|
||||
else
|
||||
user = Repo.get_by(Plausible.Auth.User, email: params["email"])
|
||||
@ -137,4 +137,9 @@ defmodule Plausible.Billing do
|
||||
next_bill_amount: params["unit_price"] || params["new_unit_price"]
|
||||
}
|
||||
end
|
||||
|
||||
defp present?(""), do: false
|
||||
defp present?(nil), do: false
|
||||
defp present?(_), do: true
|
||||
|
||||
end
|
||||
|
@ -45,6 +45,7 @@ defmodule Plausible.BillingTest do
|
||||
user = insert(:user)
|
||||
|
||||
Billing.subscription_created(%{
|
||||
"passthrough" => "",
|
||||
"email" => user.email,
|
||||
"alert_name" => "subscription_created",
|
||||
"subscription_id" => @subscription_id,
|
||||
|
Loading…
Reference in New Issue
Block a user