summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_responses.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-06-19 00:00:21 +0200
committerChristian Grothoff <christian@grothoff.org>2017-06-19 00:17:16 +0200
commitdea0f7c411d6ae5c5410d30f6072478e905cabb4 (patch)
tree63fd5490d62d991f47148c5147c51d249d9d61b8 /src/exchange/taler-exchange-httpd_responses.c
parent4cb035cd298139f606562ed88f60ba89dff0febc (diff)
downloadexchange-dea0f7c411d6ae5c5410d30f6072478e905cabb4.tar.gz
exchange-dea0f7c411d6ae5c5410d30f6072478e905cabb4.tar.bz2
exchange-dea0f7c411d6ae5c5410d30f6072478e905cabb4.zip
fixing #5010 for /reserve/withdraw
Diffstat (limited to 'src/exchange/taler-exchange-httpd_responses.c')
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c91
1 files changed, 3 insertions, 88 deletions
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index 771b8adfe..48df955f7 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -685,9 +685,9 @@ TEH_RESPONSE_reply_coin_insufficient_funds (struct MHD_Connection *connection,
* @param[out] balance set to current reserve balance
* @return json representation of the @a rh, NULL on error
*/
-static json_t *
-compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHistory *rh,
- struct TALER_Amount *balance)
+json_t *
+TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHistory *rh,
+ struct TALER_Amount *balance)
{
struct TALER_Amount deposit_total;
struct TALER_Amount withdraw_total;
@@ -959,91 +959,6 @@ TEH_RESPONSE_reply_refund_success (struct MHD_Connection *connection,
/**
- * Send reserve status information to client.
- *
- * @param connection connection to the client
- * @param rh reserve history to return
- * @return MHD result code
- */
-int
-TEH_RESPONSE_reply_reserve_status_success (struct MHD_Connection *connection,
- const struct TALER_EXCHANGEDB_ReserveHistory *rh)
-{
- json_t *json_balance;
- json_t *json_history;
- struct TALER_Amount balance;
-
- json_history = compile_reserve_history (rh,
- &balance);
- if (NULL == json_history)
- return TEH_RESPONSE_reply_internal_error (connection,
- TALER_EC_RESERVE_STATUS_DB_ERROR,
- "balance calculation failure");
- json_balance = TALER_JSON_from_amount (&balance);
- return TEH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:o, s:o}",
- "balance", json_balance,
- "history", json_history);
-}
-
-
-/**
- * Send reserve status information to client with the
- * message that we have insufficient funds for the
- * requested /reserve/withdraw operation.
- *
- * @param connection connection to the client
- * @param rh reserve history to return
- * @return MHD result code
- */
-int
-TEH_RESPONSE_reply_reserve_withdraw_insufficient_funds (struct MHD_Connection *connection,
- const struct TALER_EXCHANGEDB_ReserveHistory *rh)
-{
- json_t *json_balance;
- json_t *json_history;
- struct TALER_Amount balance;
-
- json_history = compile_reserve_history (rh,
- &balance);
- if (NULL == json_history)
- return TEH_RESPONSE_reply_internal_error (connection,
- TALER_EC_WITHDRAW_HISTORY_DB_ERROR_INSUFFICIENT_FUNDS,
- "balance calculation failure");
- json_balance = TALER_JSON_from_amount (&balance);
- return TEH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_FORBIDDEN,
- "{s:s, s:I, s:o, s:o}",
- "error", "Insufficient funds",
- "code", (json_int_t) TALER_EC_WITHDRAW_INSUFFICIENT_FUNDS,
- "balance", json_balance,
- "history", json_history);
-}
-
-
-/**
- * Send blinded coin information to client.
- *
- * @param connection connection to the client
- * @param collectable blinded coin to return
- * @return MHD result code
- */
-int
-TEH_RESPONSE_reply_reserve_withdraw_success (struct MHD_Connection *connection,
- const struct TALER_EXCHANGEDB_CollectableBlindcoin *collectable)
-{
- json_t *sig_json;
-
- sig_json = GNUNET_JSON_from_rsa_signature (collectable->sig.rsa_signature);
- return TEH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:o}",
- "ev_sig", sig_json);
-}
-
-
-/**
* Send a response for a failed "/refresh/melt" request. The
* transaction history of the given coin demonstrates that the
* @a residual value of the coin is below the @a requested