summaryrefslogtreecommitdiff
path: root/src/lib/merchant_api_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/merchant_api_common.c')
-rw-r--r--src/lib/merchant_api_common.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/lib/merchant_api_common.c b/src/lib/merchant_api_common.c
index 55d4209f..8e5c896f 100644
--- a/src/lib/merchant_api_common.c
+++ b/src/lib/merchant_api_common.c
@@ -159,7 +159,7 @@ TALER_MERCHANT_baseurl_add_instance (const char *base_url,
* @param uri the uri to parse.
* @param[out] action the action the URI is indicating.
* @param[out] rest the substring of the URI following the action.
- * @return GNUNET_SYSERR if the URI is malformed, GNUNET_OK otherwise.
+ * @return #GNUNET_SYSERR if the URI is malformed, #GNUNET_OK otherwise.
*/
static int
parse_taler_uri_scheme_action (const char *uri,
@@ -170,6 +170,7 @@ parse_taler_uri_scheme_action (const char *uri,
/* Check that the uri starts with "taler://pay" or "taler+http://pay" and
then remove it */
char *path = strchr (scheme, ':');
+
if ((NULL == path) ||
(strlen (path) < 3))
{
@@ -414,6 +415,49 @@ TALER_MERCHANT_parse_refund_uri (
*order_id = '\0';
++order_id;
+
+ {
+ char *ct_str = strchr (last_seg,
+ '?');
+ char *ct_data;
+
+ if (NULL != ct_str)
+ {
+ *ct_str = '\0';
+ ++ct_str;
+
+ ct_data = strchr (ct_str,
+ '=');
+ if (NULL == ct_data)
+ {
+ GNUNET_break_op (0);
+ GNUNET_free (path);
+ return GNUNET_SYSERR;
+ }
+ *ct_data = '\0';
+ ++ct_data;
+ if ((0 != strcmp ("h_contract",
+ ct_str)) ||
+ (GNUNET_OK !=
+ GNUNET_STRINGS_string_to_data (ct_data,
+ strlen (ct_data),
+ &parse_data->h_contract,
+ sizeof (struct GNUNET_HashCode))))
+ {
+ GNUNET_break_op (0);
+ GNUNET_free (path);
+ return GNUNET_SYSERR;
+ }
+ }
+ else
+ {
+ memset (&parse_data->h_contract,
+ 0,
+ sizeof (struct GNUNET_HashCode));
+ }
+ }
+
+
ssid = strchr (last_seg,
'#');
if (NULL != ssid)