summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_purses_deposit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/exchange/taler-exchange-httpd_purses_deposit.c')
-rw-r--r--src/exchange/taler-exchange-httpd_purses_deposit.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/exchange/taler-exchange-httpd_purses_deposit.c b/src/exchange/taler-exchange-httpd_purses_deposit.c
index 291807aaa..8e4d5e41a 100644
--- a/src/exchange/taler-exchange-httpd_purses_deposit.c
+++ b/src/exchange/taler-exchange-httpd_purses_deposit.c
@@ -329,12 +329,12 @@ TEH_handler_purses_deposit (
.purse_pub = purse_pub,
.exchange_timestamp = GNUNET_TIME_timestamp_get ()
};
- json_t *deposits;
+ const json_t *deposits;
json_t *deposit;
unsigned int idx;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("deposits",
- &deposits),
+ GNUNET_JSON_spec_array_const ("deposits",
+ &deposits),
GNUNET_JSON_spec_end ()
};
@@ -363,7 +363,6 @@ TEH_handler_purses_deposit (
(pcc.num_coins > TALER_MAX_FRESH_COINS) )
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -375,6 +374,7 @@ TEH_handler_purses_deposit (
struct GNUNET_TIME_Timestamp create_timestamp;
struct GNUNET_TIME_Timestamp merge_timestamp;
bool was_deleted;
+ bool was_refunded;
qs = TEH_plugin->select_purse (
TEH_plugin->cls,
@@ -385,7 +385,8 @@ TEH_handler_purses_deposit (
&pcc.deposit_total,
&pcc.h_contract_terms,
&merge_timestamp,
- &was_deleted);
+ &was_deleted,
+ &was_refunded);
switch (qs)
{
case GNUNET_DB_STATUS_HARD_ERROR:
@@ -408,7 +409,7 @@ TEH_handler_purses_deposit (
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
break; /* handled below */
}
- if (GNUNET_TIME_absolute_is_past (pcc.purse_expiration.abs_time) ||
+ if (was_refunded ||
was_deleted)
{
return TALER_MHD_reply_with_error (
@@ -435,7 +436,6 @@ TEH_handler_purses_deposit (
deposit);
if (GNUNET_OK != res)
{
- GNUNET_JSON_parse_free (spec);
for (unsigned int i = 0; i<idx; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
@@ -447,7 +447,6 @@ TEH_handler_purses_deposit (
TEH_plugin->preflight (TEH_plugin->cls))
{
GNUNET_break (0);
- GNUNET_JSON_parse_free (spec);
for (unsigned int i = 0; i<pcc.num_coins; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
@@ -469,7 +468,6 @@ TEH_handler_purses_deposit (
&deposit_transaction,
&pcc))
{
- GNUNET_JSON_parse_free (spec);
for (unsigned int i = 0; i<pcc.num_coins; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
@@ -501,7 +499,6 @@ TEH_handler_purses_deposit (
for (unsigned int i = 0; i<pcc.num_coins; i++)
TEH_common_purse_deposit_free_coin (&pcc.coins[i]);
GNUNET_free (pcc.coins);
- GNUNET_JSON_parse_free (spec);
return res;
}
}