Packages
ex_money
2.2.0
6.1.1
6.1.0
6.0.0
6.0.0-rc.0
5.24.2
5.24.1
5.24.0
retired
5.23.0
5.22.0
5.21.0
5.20.0
5.19.2
5.19.1
5.19.0
5.18.0
5.17.2
5.17.1
5.17.0
5.16.1
5.16.0
5.15.4
5.15.3
5.15.2
5.15.1
5.15.0
5.14.1
5.13.0
5.12.4
5.12.3
5.12.2
5.12.1
5.12.0
5.11.0
5.10.0
5.9.0
5.8.0
5.7.4
5.7.3
5.7.2
5.7.1
5.7.0
5.6.0
5.5.5
5.5.4
5.5.3
5.5.2
5.5.1
5.5.0
5.4.1
5.4.0
5.4.0-rc.0
5.3.2
5.3.1
5.3.0
5.2.1
5.2.0
5.1.0
5.0.2
5.0.1
5.0.0
retired
4.4.3
4.4.2
retired
4.4.1
4.4.0
4.3.0
4.2.2
4.2.1
4.2.0
4.1.0
4.0.0
3.4.4
3.4.3
3.4.2
3.4.1
3.4.0
3.3.1
3.3.0
3.2.4
3.2.3
3.2.2
3.2.1
3.2.0
3.1.0
3.0.0
2.12.2
2.12.1
retired
2.12.0
retired
2.11.0
2.10.0
2.9.1
2.9.0
2.8.0
2.7.3
2.7.2
2.7.1
2.7.0
2.6.1
2.6.0
2.5.0
2.4.0
2.3.0
2.2.2
2.2.1
2.2.0
2.1.0
2.1.0-rc.1
retired
2.1.0-rc.0
retired
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0
1.1.3
1.1.2
1.1.1
retired
1.1.0
1.0.0
1.0.0-rc.0
retired
0.9.0
retired
0.8.5
retired
0.8.4
retired
0.8.3
retired
0.8.2
retired
0.8.1
retired
0.8.0
retired
0.7.0
retired
0.6.2
retired
0.6.1
retired
0.6.0
retired
0.5.3
retired
0.5.2
retired
0.5.1
retired
0.5.0
retired
0.4.3
retired
0.4.2
retired
0.4.1
retired
0.4.0
retired
0.3.0
retired
0.2.0
retired
0.1.7
retired
0.1.6
retired
0.1.5
retired
0.1.4
retired
0.1.3
retired
0.1.2
retired
0.1.1
retired
0.1.0
retired
0.0.16
retired
0.0.15
retired
0.0.14
retired
0.0.13
retired
0.0.12
retired
0.0.11
retired
0.0.10
retired
0.0.9
retired
0.0.7
retired
0.0.6
retired
0.0.5
retired
0.0.4
retired
0.0.3
retired
0.0.2
retired
Money functions for operations on and localization of a money data type with support for ISO 4217 currencies and ISO 24165 digial tokens (crypto currencies).
Current section
Files
Jump to
Current section
Files
CHANGELOG.md
# Changelog for Money v2.2.0
This is the changelog for Money v2.2.0 released on February 11, 2018. For older changelogs please consult the release tag on [GitHub](https://github.com/kipcole9/money/tags)
This release is primarily a refactoring of the exchange rates service. It separates the concerns of retrieval and caching. It also normalises the API amongst the three modules `Money.ExchangeRates`, `Money.ExchangeRates.Retriever` and `Money.ExchangeRates.Cache`. Each of these modules implements:
* `latest_rates/0`
* `historic_rates/1`
This makes it clear that rates can be retrieved through the cache or the service API. The implementation in `Money.ExchangeRates` will return the cached value if available or will call the service API if not.
### Migration from earlier releases
The only know issue for migrating from earlier releases is if your application requires a different supervision strategy for the exchange rate service that the default one. This is documented in the README in the section "Using Ecto or other applications from within the callback module". The change is the way in which the supervisor is defined. It is included here for completeness:
**In prior releases:**
```
supervisor(Money.ExchangeRates.Supervisor, [])
```
**From this release onwards:**
```
supervisor(Money.ExchangeRates.Supervisor, [[restart: true, start_retriever: true]])
```
Note that the option `start_retriever: true` is optional. The default is `false`. The option `restart: true` is required in this case because the exchange rates supervisor is always started when `ex_money` is started even if the retriever is not started.
### Enhancements
* Define an exchange rates cache behaviour `Money.ExchangeRates.Cache`
* Adds the config key `:exchange_rates_cache_module` which can be set to a module that implements the `Money.ExchangeRates.Cache` behaviour. Two modules are provided:
* `Money.ExchangeRates.Cache.Ets` (the default) and
* `Money.ExchangeRates.Cache.Dets`
* Move all exchange rates retrieval functions to `Money.ExchangeRates.Retriever`
* Add several functions to `Money.ExchangeRates.Retriever`:
* `:config/0` to return the current retriever configuration.
* `reconfigure/1` to allow reconfiguration of the exchange rates retriever.
* `start/1` to start the service. Delegates to `Money.ExchangeRates.Supervisor.start_retriever/1`.
* `stop/0` to stop the service. Delegates to `Money.ExchangeRates.Supervisor.stop_retriever/0`.
* `restart/0` to restart the service. Delegates to `Money.ExchangeRates.Supervisor.restart_retriever/0`.
* `delete/0` to delete the service. It can be started again with `start/1`. Delegates to `Money.ExchangeRates.Supervisor.delete_retriever/0`.
* If the config key `:exchange_rates_retrieve_every` is set to an `atom` rather than an `integer` then no periodic retrieval will be performed. This allows the configuration of the following, which is also the default:
```
config :ex_money,
exchange_rates_retrieve_every: :never
```
* Use `etag`'s in the `Money.ExchangeRates.OpenExchangeRates` API module when retrieving exchange rates from the service.
* Add `Money.known_currencies/0` which delegates to `Cldr.known_currencies/0` and returns the list of known currency codes
* Add `Money.known_current_currencies/0` to return the list of currencies currently active according to ISO 4217
* Add `Money.known_historic_currencies/0` to return a list of currencies known to Cldr but which are not considered in current use
* Add `Money.known_tender_currencies/0` to return a list of currencies defined as legal tender in Cldr
* Add the configuration key `:json_library` that specifies which json library to use for decoding json. The default is `Cldr.Config.json_library/0` which is currently `Poison` although this is likely to change to `Jason` when `Phoenix` makes this change.
* Moves the protocol implementations for `String.Chars`, `Inspect` and `Phoenix.HTML.Safe` to a separate file so that recompilation on locale configuration change works correctly.
# Changelog for Money v2.1.0
### Enhancements
* `Money.to_integer_exp/2` now uses the definition of digits (subunits) as defined by ISO 4217. Previously the definition was that supplied by CLDR. CLDR's definition is not always in alignment with ISO 4217. ISO 4217 is a firm requirement for financial transactions through payment gateways.
* Bump dependencies for `ex_cldr` to 1.4.0 and `ex_cldr_numbers` to 1.3.0 to support `:iso_digits`
# Changelog for Money v2.0.4
### Bug Fixes
* Fixed `from_float!/2` which would fail since `new/2` does not return `{:ok, Money.t}`. Note that from `ex_money` 3.0, `Money.new/2` will return `{:ok, Money.t}` to be consistent with canonical approaches in Elixir. Closes #48. Thanks for @lostkobrakai.
# Changelog for Money v2.0.3
### Bug Fixes
* Fixes the typespec for `Money.new/2` and revises several other typespecs. Added a dialyzer configuration. Since `Money.new/2` allows flexible (probably too flexible) order or arguments, the typespec does not fully match the function implementation and Dialyzer understandably complains. However the value of a typespec as documentation argues against making the typespec formally correct. This will be revisited for Money 3.0.
# Changelog for Money v2.0.2
### Bug Fixes
* `Money.Sigil` was calling `String.to_existing_atom/1` directly rather than `Cldr.validate_currency/1`. Since currency codes are only loaded and therefore the atoms materialized when `Cldr` is loaded this created a situation whereby a valid currency code may raise an `agument error`. `Money.Sigil` now correctly calls `Cldr.validate_currency/1` which ensures the currency atoms are loaded before validation. Closes #46.
# Changelog for Money v2.0.1
### Bug Fixes
* `Phoenix.HTML.Safe` protocol implementation correctly returns a formatted string, not an `{:ok, string}` tuple. Closes #45.
# Changelog for Money v2.0.0
### Breaking Changes
* The function `Money.new/2` no longer supports a `float` amount. The new function `Money.from_float/2` is introduced. The factory function `Money.new/2` previously supported a `float` amount as a parameter. There are many well-documented issues with float. Although a float with a precision of no more than 15 digits will convert (and round-trip) without loss of precision there is a real possibility that the upstream calculations that produced the float will have introduced rounding or precision errors. Calling `Money.new/2` with a float amount will return an error tuple:
```
{:error, {
Money.InvalidAmountError,
"Float amounts are not supported in new/2 due to potenial rounding " <>
"and precision issues. If absolutely required, use Money.from_float/2"}}
```
* Remove support for `Money` tuples in `Money.Ecto.Composite.Type` and `Money.Ecto.Map.Type`. Previously there has been support for dumping `Money` in a tuple format. This support has now been removed and all `Money` operations should be based on the `Money.t` struct.
### Enhancements
* Add `Money.from_float/2` to create a `Money` struct from a float and a currency code. This function is named to make it clear that we risk losing precision due to upstream rounding errors. According to the standard and experimentation, floats of up to 15 digits of precision will round trip without error. Therefore `from_float/2` will check the precision of the number and return an error if the precision is greater than 15 since the correctness of the number cannot be verified beyond that.
* Add `Money.from_float!/2` which is like `from_float/2` but raises on error
* Formatted the text the with the Elixir 1.6 code formatter