jshmrtn / currency-conversion Goto Github PK
View Code? Open in Web Editor NEWConvert Money Amounts between currencies.
License: MIT License
Convert Money Amounts between currencies.
License: MIT License
I am trying to write tests in my project and the following seemed not to have any effect:
config :myproject, MyProject.CurrencyExchange,
source: CurrencyConversion.Source.Test
Can you confirm this does not work anymore? Or it's expected that it's set as:
config :myproject, CurrencyConversion,
source: CurrencyConversion.Source.Test
?
CurrencyExchange is the exchange module:
defmodule MyProject.CurrencyExchange do
use CurrencyConversion, otp_app: :myproject
...
This will provide a better read concurrency.
when I define it with
defmodule MyApp.CurrencyConversion do
use CurrencyConversion, otp_app: :my_app
end
I am getting the error - function CurrencyConversion.__using__/1 is undefined or private
I need to update the version of dependency ": money" to be compatible with phoenix 1.4.
When giving an invalid api key or an api key that has exceeded the authorized amount of requests (rate limit), the following error is returned and the application never starts.
''' elixir
[error] An error occured while rereshing currency rates. "Fixer API Schema has changed."
** (Mix) Could not start application currency_conversion: CurrencyConversion.Application.start(:normal, []) returned an error: shutdown: failed to start child: CurrencyConversion.UpdateWorker
** (EXIT) {:error, "Fixer API Schema has changed."}
'''
What is the recommended approach when this error happens?
It would make sense to add support for ex_money
.
Best would probably be to add both money libs as optional dependencies and conditionally compile convert
functions.
I would like to avoid automatic refresh()
call on the update worker start: https://github.com/jshmrtn/currency-conversion/blob/master/lib/currency_conversion/update_worker.ex#L22
The use-case is that I wish to keep a given currency exchange same during the day. If the worker gets restarted it would change the exchange rates during the day. My work-flow would be to update the worker with a manual refresh()
call (this is possible).
At last I would also need a function that can load the data I provide (rather then getting them from the service provider) and use them on start. Do you think we can support this in the library? I could make an attempt on adding this functionality.
If you think there is a better way to provide same-day rates I would welcome any suggestions.
I am thinking that it would be awesome to also support plain Decimals as an alternative to Money library that limits itself to cent values (integers as cents). Since many application save money data as decimals, this could be pretty useful (it could work without loosing any precision at all).
Currently when the source API's are down the CurrencyConversion
supervisor does not start because the UpdateWorker
is not started.
Would it be possible to start the CurrencyConversion
process using the seed
data in this case? In this case the UpdateWorker
would need to keep retrying to fetch the rates from the source instead of stopping.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.