Delete test/support/test_paddle_api_mock.ex with huggingface_hub
Browse files
test/support/test_paddle_api_mock.ex
DELETED
|
@@ -1,80 +0,0 @@
|
|
| 1 |
-
defmodule Plausible.Billing.TestPaddleApiMock do
|
| 2 |
-
@moduledoc false
|
| 3 |
-
|
| 4 |
-
def get_subscription(_) do
|
| 5 |
-
{:ok,
|
| 6 |
-
%{
|
| 7 |
-
"next_payment" => %{
|
| 8 |
-
"date" => "2019-07-10",
|
| 9 |
-
"amount" => 6
|
| 10 |
-
},
|
| 11 |
-
"last_payment" => %{
|
| 12 |
-
"date" => "2019-06-10",
|
| 13 |
-
"amount" => 6
|
| 14 |
-
}
|
| 15 |
-
}}
|
| 16 |
-
end
|
| 17 |
-
|
| 18 |
-
def update_subscription(_, %{plan_id: new_plan_id}) do
|
| 19 |
-
new_plan_id = String.to_integer(new_plan_id)
|
| 20 |
-
|
| 21 |
-
{:ok,
|
| 22 |
-
%{
|
| 23 |
-
"plan_id" => new_plan_id,
|
| 24 |
-
"next_payment" => %{
|
| 25 |
-
"date" => "2019-07-10",
|
| 26 |
-
"amount" => 6
|
| 27 |
-
}
|
| 28 |
-
}}
|
| 29 |
-
end
|
| 30 |
-
|
| 31 |
-
def update_subscription_preview(_user, _new_plan_id) do
|
| 32 |
-
{:ok,
|
| 33 |
-
%{
|
| 34 |
-
"immediate_payment" => %{
|
| 35 |
-
"amount" => -72.6,
|
| 36 |
-
"currency" => "EUR",
|
| 37 |
-
"date" => "2023-11-05"
|
| 38 |
-
},
|
| 39 |
-
"next_payment" => %{
|
| 40 |
-
"amount" => 47.19,
|
| 41 |
-
"currency" => "EUR",
|
| 42 |
-
"date" => "2023-12-05"
|
| 43 |
-
},
|
| 44 |
-
"plan_id" => 63_852,
|
| 45 |
-
"subscription_id" => 600_279,
|
| 46 |
-
"user_id" => 666_317
|
| 47 |
-
}}
|
| 48 |
-
end
|
| 49 |
-
|
| 50 |
-
def get_invoices(nil), do: {:error, :no_invoices}
|
| 51 |
-
def get_invoices(%{paddle_subscription_id: nil}), do: {:error, :no_invoices}
|
| 52 |
-
|
| 53 |
-
def get_invoices(subscription) do
|
| 54 |
-
case subscription.paddle_subscription_id do
|
| 55 |
-
"invalid_subscription_id" ->
|
| 56 |
-
{:error, :request_failed}
|
| 57 |
-
|
| 58 |
-
_ ->
|
| 59 |
-
{:ok,
|
| 60 |
-
[
|
| 61 |
-
%{
|
| 62 |
-
"amount" => 11.11,
|
| 63 |
-
"currency" => "EUR",
|
| 64 |
-
"payout_date" => "2020-12-24",
|
| 65 |
-
"receipt_url" => "https://some-receipt-url.com"
|
| 66 |
-
},
|
| 67 |
-
%{
|
| 68 |
-
"amount" => 22,
|
| 69 |
-
"currency" => "USD",
|
| 70 |
-
"payout_date" => "2020-11-24",
|
| 71 |
-
"receipt_url" => "https://other-receipt-url.com"
|
| 72 |
-
}
|
| 73 |
-
]}
|
| 74 |
-
end
|
| 75 |
-
end
|
| 76 |
-
|
| 77 |
-
def fetch_prices(product_ids, customer_ip) do
|
| 78 |
-
Plausible.Billing.DevPaddleApiMock.fetch_prices(product_ids, customer_ip)
|
| 79 |
-
end
|
| 80 |
-
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|