summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-get-tips.c
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-16 02:18:22 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-07-16 02:18:22 -0400
commitadd99bf305d986cf14805cc99767cf665a1ccacb (patch)
tree4b14c62cce38bf0f8997c49946aa039cf2fd94d4 /src/backend/taler-merchant-httpd_private-get-tips.c
parent46fdfc6cf7001a1e158690ca30468b68ab887a02 (diff)
downloadmerchant-add99bf305d986cf14805cc99767cf665a1ccacb.tar.gz
merchant-add99bf305d986cf14805cc99767cf665a1ccacb.tar.bz2
merchant-add99bf305d986cf14805cc99767cf665a1ccacb.zip
more fixes/tests for claim order and get tips
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-get-tips.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-get-tips.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/backend/taler-merchant-httpd_private-get-tips.c b/src/backend/taler-merchant-httpd_private-get-tips.c
index 8aff670f..47fe3054 100644
--- a/src/backend/taler-merchant-httpd_private-get-tips.c
+++ b/src/backend/taler-merchant-httpd_private-get-tips.c
@@ -80,57 +80,60 @@ TMH_private_get_tips (const struct TMH_RequestHandler *rh,
TALER_EC_PARAMETER_MALFORMED,
"expired");
{
- const char *offset_str;
+ const char *limit_str;
- offset_str = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "offset");
- if (NULL == offset_str)
+ limit_str = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "limit");
+ if (NULL == limit_str)
{
- offset = INT64_MAX;
+ limit = -20;
}
else
{
char dummy[2];
- unsigned long long ull;
+ long long ll;
if (1 !=
- sscanf (offset_str,
- "%llu%1s",
- &ull,
+ sscanf (limit_str,
+ "%lld%1s",
+ &ll,
dummy))
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_PARAMETER_MALFORMED,
- "date");
- offset = (uint64_t) ull;
+ "limit");
+ limit = (uint64_t) ll;
}
}
{
- const char *limit_str;
+ const char *offset_str;
- limit_str = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "limit");
- if (NULL == limit_str)
+ offset_str = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "offset");
+ if (NULL == offset_str)
{
- limit = -20;
+ if (limit > 0)
+ offset = 0;
+ else
+ offset = INT64_MAX;
}
else
{
char dummy[2];
- long long ll;
+ unsigned long long ull;
if (1 !=
- sscanf (limit_str,
- "%lld%1s",
- &ll,
+ sscanf (offset_str,
+ "%llu%1s",
+ &ull,
dummy))
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_PARAMETER_MALFORMED,
- "limit");
- limit = (uint64_t) ll;
+ "offset");
+ offset = (uint64_t) ull;
}
}