diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-get-tips.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_private-get-tips.c | 51 |
1 files changed, 5 insertions, 46 deletions
diff --git a/src/backend/taler-merchant-httpd_private-get-tips.c b/src/backend/taler-merchant-httpd_private-get-tips.c index dc4beac0..42651d06 100644 --- a/src/backend/taler-merchant-httpd_private-get-tips.c +++ b/src/backend/taler-merchant-httpd_private-get-tips.c @@ -53,48 +53,6 @@ add_tip (void *cls, /** - * Convert query argument to @a yna value. - * - * @param connection connection to take query argument from - * @param arg argument to try for - * @param[out] value to set - * @return true on success, false if the parameter was malformed - */ -static bool -arg_to_yna (struct MHD_Connection *connection, - const char *arg, - enum TALER_MERCHANTDB_YesNoAll *yna) -{ - const char *str; - - str = MHD_lookup_connection_value (connection, - MHD_GET_ARGUMENT_KIND, - arg); - if (NULL == str) - { - *yna = TALER_MERCHANTDB_YNA_NO; - return true; - } - if (0 == strcasecmp (str, "yes")) - { - *yna = TALER_MERCHANTDB_YNA_YES; - return true; - } - if (0 == strcasecmp (str, "no")) - { - *yna = TALER_MERCHANTDB_YNA_NO; - return true; - } - if (0 == strcasecmp (str, "all")) - { - *yna = TALER_MERCHANTDB_YNA_ALL; - return true; - } - return false; -} - - -/** * Handle a GET "/tips/$ID" request. * * @param rh context of the handler @@ -109,7 +67,7 @@ TMH_private_get_tips (const struct TMH_RequestHandler *rh, { json_t *pa; enum GNUNET_DB_QueryStatus qs; - enum TALER_MERCHANTDB_YesNoAll expired; + enum TALER_EXCHANGE_YesNoAll expired; uint64_t offset; int64_t limit; @@ -117,9 +75,10 @@ TMH_private_get_tips (const struct TMH_RequestHandler *rh, // - also change TALER_MERCHANTDB_YNA to TALER_EXCHANGE_YNA, // - code can go into src/util/ of exchange.git // - please look for other places where the same logic is duplicated to de-dup - if (! (arg_to_yna (connection, /* TODO: put this method in a header somewhere */ - "expired", - &expired)) ) + if (! (TALER_arg_to_yna (connection, /* TODO: put this method in a header somewhere */ + "expired", + TALER_EXCHANGE_YNA_NO, + &expired)) ) return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_PARAMETER_MALFORMED, |