analytics/test/support/exchange_rate_mock.ex
Vini Brasil 10d9e3b083
Revenue tracking: Add currency field to goal creation (#2948)
* Add revenue goal option to goal creation

This commit adds a currency field to the goals form. Goals that have a
currency set are now revenue goals, and are cached with sites to later
be used during ingestion.

Co-authored-by: Robert Joonas <robertjoonas16@gmail.com>

* Enable feature flag in tests

---------

Co-authored-by: Robert Joonas <robertjoonas16@gmail.com>
2023-05-23 12:08:09 +02:00

21 lines
495 B
Elixir

defmodule Plausible.ExchangeRateMock do
@moduledoc false
@behaviour Money.ExchangeRates
def init(config) do
config
end
def decode_rates(rates) do
Money.ExchangeRates.OpenExchangeRates.decode_rates(rates)
end
def get_latest_rates(_config) do
{:ok, %{BRL: Decimal.new("0.7"), EUR: Decimal.new("1.2"), USD: Decimal.new(1)}}
end
def get_historic_rates(_date, _config) do
{:ok, %{BRL: Decimal.new("0.8"), EUR: Decimal.new("1.3"), USD: Decimal.new(2)}}
end
end