summaryrefslogtreecommitdiff
path: root/src/restclient/anastasis_api_truth_challenge.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/restclient/anastasis_api_truth_challenge.c')
-rw-r--r--src/restclient/anastasis_api_truth_challenge.c50
1 files changed, 38 insertions, 12 deletions
diff --git a/src/restclient/anastasis_api_truth_challenge.c b/src/restclient/anastasis_api_truth_challenge.c
index 92916d6..911eba6 100644
--- a/src/restclient/anastasis_api_truth_challenge.c
+++ b/src/restclient/anastasis_api_truth_challenge.c
@@ -123,6 +123,7 @@ handle_truth_challenge_finished (void *cls,
{
const char *ct;
const char *tan_hint = NULL;
+ const char *filename = NULL;
json_t *wire_details = NULL;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string (
@@ -132,6 +133,9 @@ handle_truth_challenge_finished (void *cls,
GNUNET_JSON_spec_string ("tan_address_hint",
&tan_hint)),
GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_string ("filename",
+ &filename)),
+ GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("wire_details",
&wire_details)),
GNUNET_JSON_spec_end ()
@@ -152,19 +156,34 @@ handle_truth_challenge_finished (void *cls,
{
tcd.details.success.cs = ANASTASIS_CS_TAN_SENT;
tcd.details.success.details.tan_address_hint = tan_hint;
+ break;
+ }
+ if ( (0 == strcmp (ct,
+ "FILE_WRITTEN")) &&
+ (NULL != filename) )
+ {
+ tcd.details.success.cs = ANASTASIS_CS_FILE_WRITTEN;
+ tcd.details.success.details.challenge_filename = filename;
+ break;
}
- else if ( (0 == strcmp (ct,
- "WIRE_FUNDS")) &&
- (NULL != wire_details) )
+ if ( (0 == strcmp (ct,
+ "IBAN_WIRE")) &&
+ (NULL != wire_details) )
{
struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_string (
- "target_account",
- &tcd.details.success.details.wire_funds.target_payto),
+ "credit_iban",
+ &tcd.details.success.details.wire_funds.target_iban),
+ GNUNET_JSON_spec_uint64 (
+ "answer_code",
+ &tcd.details.success.details.wire_funds.answer_code),
+ GNUNET_JSON_spec_string (
+ "business_name",
+ &tcd.details.success.details.wire_funds.target_business_name),
GNUNET_JSON_spec_string (
- "sender_hint",
- &tcd.details.success.details.wire_funds.sender_hint),
- TALER_JSON_spec_amount_any ("amount",
+ "wire_transfer_subject",
+ &tcd.details.success.details.wire_funds.wire_transfer_subject),
+ TALER_JSON_spec_amount_any ("challenge_amount",
&tcd.details.success.details.wire_funds.
amount),
GNUNET_JSON_spec_end ()
@@ -188,6 +207,12 @@ handle_truth_challenge_finished (void *cls,
ANASTASIS_truth_challenge_cancel (tco);
return;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unexpected challenge type `%s'\n",
+ ct);
+ tcd.http_status = 0;
+ tcd.ec = TALER_EC_GENERIC_REPLY_MALFORMED;
+ break;
}
case MHD_HTTP_BAD_REQUEST:
/* This should never happen, either us or the anastasis server is buggy
@@ -409,10 +434,11 @@ ANASTASIS_truth_challenge (
curl_easy_setopt (eh,
CURLOPT_HEADERDATA,
tco));
- tco->job = GNUNET_CURL_job_add (ctx,
- eh,
- &handle_truth_challenge_finished,
- tco);
+ tco->job = GNUNET_CURL_job_add2 (ctx,
+ eh,
+ tco->ctx.headers,
+ &handle_truth_challenge_finished,
+ tco);
return tco;
}