summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-06-04 12:28:55 +0200
committerChristian Grothoff <christian@grothoff.org>2023-06-04 12:28:55 +0200
commit0e2148d63b85025c37d4212162a522e47445acab (patch)
treedda8b3afdfb014d5c55482587957c086f159757c /src/backend/taler-merchant-httpd_post-orders-ID-pay.c
parent3c262a6c8bae2c6f494572c51d899339958de8c8 (diff)
downloadmerchant-0e2148d63b85025c37d4212162a522e47445acab.tar.gz
merchant-0e2148d63b85025c37d4212162a522e47445acab.tar.bz2
merchant-0e2148d63b85025c37d4212162a522e47445acab.zip
-code cleanupv0.9.3-dev.1
Diffstat (limited to 'src/backend/taler-merchant-httpd_post-orders-ID-pay.c')
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-pay.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
index bd68278c..04224ac5 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -2219,10 +2219,10 @@ static enum GNUNET_GenericReturnValue
parse_pay (struct PayContext *pc)
{
const char *session_id = NULL;
- json_t *coins;
+ const json_t *coins;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_json ("coins",
- &coins),
+ GNUNET_JSON_spec_array_const ("coins",
+ &coins),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("session_id",
&session_id),
@@ -2253,25 +2253,10 @@ parse_pay (struct PayContext *pc)
/* use empty string as default if client didn't specify it */
pc->session_id = GNUNET_strdup ("");
}
-
- if (! json_is_array (coins))
- {
- GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
- return (MHD_YES ==
- TALER_MHD_reply_with_error (pc->connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_PARAMETER_MISSING,
- "'coins' must be an array"))
- ? GNUNET_NO
- : GNUNET_SYSERR;
- }
-
pc->coins_cnt = json_array_size (coins);
if (pc->coins_cnt > MAX_COIN_ALLOWED_COINS)
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return (MHD_YES ==
TALER_MHD_reply_with_error (
pc->connection,
@@ -2336,7 +2321,6 @@ parse_pay (struct PayContext *pc)
if (GNUNET_YES != res)
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return res;
}
@@ -2347,7 +2331,6 @@ parse_pay (struct PayContext *pc)
&pc->dc[j].cdd.coin_pub))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return (MHD_YES ==
TALER_MHD_reply_with_error (pc->connection,
MHD_HTTP_BAD_REQUEST,
@@ -2367,7 +2350,6 @@ parse_pay (struct PayContext *pc)
TMH_currency))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return (MHD_YES ==
TALER_MHD_reply_with_error (pc->connection,
MHD_HTTP_CONFLICT,
@@ -2382,7 +2364,6 @@ parse_pay (struct PayContext *pc)
if (dc->no_age_commitment != dc->no_minimum_age_sig)
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return (MHD_YES ==
TALER_MHD_reply_with_error (
pc->connection,
@@ -2419,7 +2400,6 @@ parse_pay (struct PayContext *pc)
}
}
}
- GNUNET_JSON_parse_free (spec);
return GNUNET_OK;
}