
This code implements a bank Web portal that tightly integrates with
the GNU Taler payment system.  The bank it primarily meant be used as
part of a demonstrator for the Taler system.

==================== Dependencies ==========================

-----------
For Debian:
-----------

First, you need to:

# apt-get install -t unstable git python3-django python3-psycopg2

Note that "make install" will re-download additional dependencies
needed for "make check".  For the above, at the time of writing, you
need Debian unstable, with older versions I get obscure errors.

================== HOW TO INSTALL THE BANK =================

From the repository's top directory, run

$ ./bootstrap

this operation will fetch additional libraries needed by the
bank (mostly JavaScript includes), and create the configure script.

The next step is to specify the install prefix, run

$ export PREFIX=$HOME/local # Adapt to your needs.
$ ./configure --prefix=$PREFIX

On some Debian systems, the additional flag --enable-debian-system
might be useful to let the --prefix option be correctly executed.

Then the usual GNU-compatible commands, that are

$ make install

and optionally

$ export PYTHONPATH=$PREFIX/lib/python3.5/site-packages/
$ make check # run the tests

================== HOW TO CONFIGURE THE BANK =================

The bank obeys to the INI syntax for configuration files. When launched, the bank
will by default look for a configuration file located at ~/.config/taler.conf.
To overide this behaviour, give the -c option when launching the bank.

In order to properly run, the bank needs the following parts to be configured

* Database name: connection string for the database to be used, currently Postgresql.
* Serving: whether we want the bank accessible via TCP or unix domain sockets.
* Fractional precision: precision of the fractional part of Taler objects.
* Fractional length: how many digits after the floating point we want to be shown
  in HTML pages.
* Debt thresholds

# Mandatory section name
[bank]

# We accept requests via unix domain sockets
UWSGI_SERVE = unix

# If we want serve the bank via TCP, just replace the statement
# above with the following one:
# UWSGI_SERVE = tcp
# And also give the port to listen to
# UWSGI_PORT = 8585

# The path below indicates where to create the unix domain socket
UWSGI_UNIXPATH = /deployment/sockets/bank.uwsgi

# The mode to assign to the unix domain socket when
# creating it (automatically done by the bank)
UWSGI_UNIXPATH_MODE = 660

# We want at most two fractional digits shown for amounts
# throughout the page pages
NDIGITS = 2

# The fractional part of Taler amount objects is 100000000.
# This value needs to be changed ONLY IF there is a change
# protocol-wise.  In other words, its value it's not up to the
# bank
FRACTION = 100000000

# The bank will try to connect to a database called 'talerlocal'
# running under Postgresql.  The sysadmin will have to make sure
# that the bank has all the rights to work on that database.
# NOTE, this value is optional, and the bank will fallback to sqlite3
# if not given.
DATABASE = postgres:///talerlocal

# See above
UWSGI_SERVE = unix

# See above
UWSGI_UNIXPATH_MODE = 660

# Maximum debt allowed for normal users.  The notation
# used for amounts is: xy[.uv]:CURRENCY, with '.uv' being
# optional.  NOTE that an amount of zero means there is no
# maximum threshold.
MAX_DEBT = 60:KUDOS

# Maximum debt allowed for the bank itself
MAX_DEBT_BANK = 0:KUDOS # Infinite debt allowed.

================== HOW TO LAUNCH THE BANK =================

The bank can accept connections via the UWSGI protocol and HTTP.

To launch it for the UWSGI protocol, issue

$ taler-bank-manage serve-uwsgi

To launch it for HTTP, issue

$ taler-bank-manage serve-http

the port the bank will listen to, can be either specified on the
command line (option -p), or in the configuration file with the
HTTP_PORT option. Note, launching the bank with 'serve-http',
will make the UWSGI_SERVE option to be ignored.


================== HOW TO RUN YOUR TESTS =================

From the repository's top directory, just issue

$ make check

in order to have test cases run.  A previous 'make install' is
NOT required.

NOTE: as tests do create a database (tipically named test_XYZ), the user
launching those must have some "write permissions" on the DMBS.

================= HOW TO FORCE MIGRATIONS =================

https://simpleisbetterthancomplex.com/tutorial/2016/07/26/how-to-reset-migrations.html
