New feature : Settle the bill

Update patch from @Lastpixl with current code and add unit tests.

It seems to work well ! However, we need a way to manage transfers (#43) but I think we can already merge this because it's a feature long overdue ...
Close #18.