diff options
author | Florian Dold <florian@dold.me> | 2021-03-01 23:25:21 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-03-01 23:25:21 +0100 |
commit | e29a6603fd830338742d295b426728cfd7c9c4af (patch) | |
tree | ca60f138b4a7a9e2765571c197b165ce41e0e009 /src/lib/merchant_api_post_instances.c | |
parent | c18d676333c148a3c9fb5eea75089c1cff599c21 (diff) |
towards updated auth API (tests still missing)
Diffstat (limited to 'src/lib/merchant_api_post_instances.c')
-rw-r--r-- | src/lib/merchant_api_post_instances.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/lib/merchant_api_post_instances.c b/src/lib/merchant_api_post_instances.c index a6452045..8aede243 100644 --- a/src/lib/merchant_api_post_instances.c +++ b/src/lib/merchant_api_post_instances.c @@ -178,6 +178,7 @@ TALER_MERCHANT_instances_post ( struct TALER_MERCHANT_InstancesPostHandle *iph; json_t *jpayto_uris; json_t *req_obj; + json_t *auth_obj; if (NULL != auth_token) { @@ -190,11 +191,27 @@ TALER_MERCHANT_instances_post ( RFC_8959_PREFIX); return NULL; } - auth_token += strlen (RFC_8959_PREFIX); + auth_obj = json_pack ("{s:s, s:s}", + "method", + "token", + "token", + auth_token); + } + else + { + auth_obj = json_pack ("{s:s}", + "method", + "external"); + } + if (NULL == auth_obj) + { + GNUNET_break (0); + return NULL; } jpayto_uris = json_array (); if (NULL == jpayto_uris) { + json_decref (auth_obj); GNUNET_break (0); return NULL; } @@ -205,13 +222,14 @@ TALER_MERCHANT_instances_post ( json_string (payto_uris[i]))) { GNUNET_break (0); + json_decref (auth_obj); json_decref (jpayto_uris); return NULL; } } req_obj = json_pack ("{s:o, s:s, s:s, s:O, s:O" ",s:o, s:I: s:o, s:o, s:o" - ",s:s?}", + ",s:o}", "payto_uris", jpayto_uris, "id", @@ -233,10 +251,11 @@ TALER_MERCHANT_instances_post ( GNUNET_JSON_from_time_rel (default_wire_transfer_delay), "default_pay_delay", GNUNET_JSON_from_time_rel (default_pay_delay), - "auth_token", - auth_token); + "auth", + auth_obj); if (NULL == req_obj) { + json_decref (auth_obj); GNUNET_break (0); return NULL; } |