summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-04-03 15:37:33 +0200
committerChristian Grothoff <christian@grothoff.org>2017-04-03 15:37:33 +0200
commit5b867c4b8ece4b4f92ff206fa75a4ea29d870221 (patch)
tree84f7271bde2cd4623c6c0f4ad5d82afa9f041e2c
parentc9995bd758985f6e970e53a62804a423b889994e (diff)
downloadexchange-5b867c4b8ece4b4f92ff206fa75a4ea29d870221.tar.gz
exchange-5b867c4b8ece4b4f92ff206fa75a4ea29d870221.tar.bz2
exchange-5b867c4b8ece4b4f92ff206fa75a4ea29d870221.zip
handle TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK in DB balance calulations
-rw-r--r--src/exchange/taler-exchange-httpd_db.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c
index f2cd2b3ce..3dc4a3248 100644
--- a/src/exchange/taler-exchange-httpd_db.c
+++ b/src/exchange/taler-exchange-httpd_db.c
@@ -781,6 +781,23 @@ execute_reserve_withdraw_transaction (struct MHD_Connection *connection,
}
res |= 1;
break;
+
+ case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
+ if (0 == (res & 2))
+ withdraw_total = pos->details.bank->amount;
+ else
+ if (GNUNET_OK !=
+ TALER_amount_add (&withdraw_total,
+ &withdraw_total,
+ &pos->details.bank->amount))
+ {
+ TEH_plugin->rollback (TEH_plugin->cls,
+ session);
+ return TEH_RESPONSE_reply_internal_db_error (connection,
+ TALER_EC_WITHDRAW_AMOUNT_WITHDRAWALS_OVERFLOW);
+ }
+ res |= 2;
+ break;
}
}
if (0 == (res & 1))