Test task for Elixir developers. Candidate should write a simple banking OTP application in Elixir language.
git
repo (candidate can use his/her own github account).mix
project.:ex_banking
(main Elixir module is ExBanking
).ExBanking
module (no API endpoint, no REST / SOAP API, no TCP / UDP sockets, no any external network interface).not
use any database / disc storage. All needed data should be stored only in application memory.ExBanking
module described in this document is the only one
thing tested by our auto-tests. If anything else needs to be called for normal application functioning then probably tests will fail.not
be negative.2 decimal
precision of money amount for any currency.Requirements for public functions provided by ExBanking
module. Any function should return success result or error result.
@spec create_user(user :: String.t) :: :ok | {:error, :wrong_arguments | :user_already_exists}
@spec deposit(user :: String.t, amount :: number, currency :: String.t) :: {:ok, new_balance :: number} | {:error, :wrong_arguments | :user_does_not_exist | :too_many_requests_to_user}
currency
by amount
valuenew_balance
of the user in given format@spec withdraw(user :: String.t, amount :: number, currency :: String.t) :: {:ok, new_balance :: number} | {:error, :wrong_arguments | :user_does_not_exist | :not_enough_money | :too_many_requests_to_user}
currency
by amount
valuenew_balance
of the user in given format@spec get_balance(user :: String.t, currency :: String.t) :: {:ok, balance :: number} | {:error, :wrong_arguments | :user_does_not_exist | :too_many_requests_to_user}
balance
of the user in given format@spec send(from_user :: String.t, to_user :: String.t, amount :: number, currency :: String.t) :: {:ok, from_user_balance :: number, to_user_balance :: number} | {:error, :wrong_arguments | :not_enough_money | :sender_does_not_exist | :receiver_does_not_exist | :too_many_requests_to_sender | :too_many_requests_to_receiver}
from_user
’s balance in given currency
by amount
valueto_user
’s balance in given currency
by amount
valuebalance
of from_user
and to_user
in given formattoo_many_requests_to_user
error until number of requests for this user decreases < 10send
function when both A and B users are involved in the request)