A Soft Bank To Handle your Financial Accounts
This Module has the following banking functions available
Account Management ( a genserver that acts as the gateway between you and your accounts backed by a double entry accounting system )
Currency Conversion ( with auto update on conversion rates )
Custom Currencies ( added to the accounting system automatically)
Transfers(the producers send amount will be converted to match the recievers account currency type)
If available in Hex, the package can be installed
by adding soft_bank
to your list of dependencies in mix.exs
:
def deps do
[
{:soft_bank, ">= 0.0.0"}
]
end
The Database Tables can be created by running the mix alias.
mix install
Add the following to your config.exs
config :soft_bank, :ecto_repos, [SoftBank.Repo]
config :ex_money,
exchange_rates_retrieve_every: 300_000,
api_module: Money.ExchangeRates.OpenExchangeRates,
callback_module: Money.ExchangeRates.Callback,
exchange_rates_cache_module: Money.ExchangeRates.Cache.Ets,
preload_historic_rates: nil,
retriever_options: nil,
log_failure: :warn,
log_info: :info,
log_success: nil,
json_library: Jason,
default_cldr_backend: SoftBank.Cldr
config :ex_cldr,
json_library: Jason
Add the following to your dev and/or prod config
config :soft_bank, :ecto_repos, [SoftBank.Repo]
config :soft_bank, SoftBank.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "softbank_dev",
hostname: "localhost",
pool_size: 10
#primary_key_type: :id
mix SoftBank.install
# login to your account and return the balance
my_account_hash = "account_hash"
my_account_number = "from-acct-number"
to_account_number = "to-acct-number"
SoftBank.login(my_account_hash)
amount = Money.new :USD, 10
SoftBank.deposit(amount,my_account_number)
SoftBank.withdrawl(amount,my_account_number)
SoftBank.transfer(amount,my_account_number,to_account_number)
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/soft_bank.
- Fuentes by davidkuhta https://github.com/davidkuhta/fuentes
thx to the owner of the excellent fuentes package upon which this was based i needed the ability to handle multiple accounts currencys and cldr, this is what it morphed into. fuentes had some build problems when i used it but it was long ago, and i was living outdoors at the time it served as good refresher for the elixir language.