summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_deposit.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-16 20:22:30 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-16 20:23:45 +0100
commitcd83daaeae915e0c1b6170cb11f40aa1cfbfece4 (patch)
tree72852006cbe2cf1aad854ced1c773384a95462b6 /src/exchange/taler-exchange-httpd_deposit.c
parentc04bcb0a828e739f0b23a98748d81a9f0993cc06 (diff)
downloadexchange-cd83daaeae915e0c1b6170cb11f40aa1cfbfece4.tar.gz
exchange-cd83daaeae915e0c1b6170cb11f40aa1cfbfece4.tar.bz2
exchange-cd83daaeae915e0c1b6170cb11f40aa1cfbfece4.zip
simplify refund processing, add additional checks for matching currency
Diffstat (limited to 'src/exchange/taler-exchange-httpd_deposit.c')
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index 4008ed27..039ca9f9 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -417,8 +417,8 @@ TEH_handler_deposit (struct MHD_Connection *connection,
&hc);
if (NULL == dki)
{
- TEH_KS_release (key_state);
TALER_LOG_WARNING ("Unknown denomination key in /deposit request\n");
+ TEH_KS_release (key_state);
GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
hc,
@@ -427,6 +427,18 @@ TEH_handler_deposit (struct MHD_Connection *connection,
}
TALER_amount_ntoh (&deposit.deposit_fee,
&dki->issue.properties.fee_deposit);
+ if (GNUNET_YES !=
+ TALER_amount_cmp_currency (&deposit.amount_with_fee,
+ &deposit.deposit_fee) )
+ {
+ GNUNET_break_op (0);
+ TEH_KS_release (key_state);
+ GNUNET_JSON_parse_free (spec);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_DEPOSIT_CURRENCY_MISSMATCH,
+ "contribution");
+ }
/* check coin signature */
if (GNUNET_YES !=
TALER_test_coin_valid (&deposit.coin,