diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-11-09 15:39:31 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-11-09 15:39:31 +0100 |
commit | a9b2140b1ece806847aa45a6b95a959c9ddaa7bf (patch) | |
tree | 1e99fa21fa001dac1aa9934830c0fd3f2c84b26a /src/lib | |
parent | a79cc16067285cee7de72d889eaf8152cc17739d (diff) |
get first KYC test to pass
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/exchange_api_kyc_proof.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/lib/exchange_api_kyc_proof.c b/src/lib/exchange_api_kyc_proof.c index 802152277..f8e84d7ca 100644 --- a/src/lib/exchange_api_kyc_proof.c +++ b/src/lib/exchange_api_kyc_proof.c @@ -75,15 +75,16 @@ struct TALER_EXCHANGE_KycProofHandle * * @param cls the `struct TALER_EXCHANGE_KycProofHandle` * @param response_code HTTP response code, 0 on error - * @param response parsed JSON result, NULL on error + * @param body response body + * @param body_size number of bytes in @a body */ static void handle_kyc_proof_finished (void *cls, long response_code, - const void *response) + const void *body, + size_t body_size) { struct TALER_EXCHANGE_KycProofHandle *kph = cls; - const json_t *j = response; struct TALER_EXCHANGE_KycProofResponse kpr = { .http_status = (unsigned int) response_code }; @@ -92,9 +93,8 @@ handle_kyc_proof_finished (void *cls, switch (response_code) { case 0: - kpr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; break; - case MHD_HTTP_FOUND: + case MHD_HTTP_SEE_OTHER: { char *redirect_url; @@ -106,34 +106,29 @@ handle_kyc_proof_finished (void *cls, break; } case MHD_HTTP_BAD_REQUEST: - kpr.ec = TALER_JSON_get_error_code (j); /* This should never happen, either us or the exchange is buggy (or API version conflict); just pass JSON reply to the application */ break; case MHD_HTTP_UNAUTHORIZED: - kpr.ec = TALER_JSON_get_error_code (j); + break; + case MHD_HTTP_FORBIDDEN: break; case MHD_HTTP_NOT_FOUND: - kpr.ec = TALER_JSON_get_error_code (j); break; case MHD_HTTP_BAD_GATEWAY: - kpr.ec = TALER_JSON_get_error_code (j); /* Server had an internal issue; we should retry, but this API leaves this to the application */ break; case MHD_HTTP_GATEWAY_TIMEOUT: - kpr.ec = TALER_JSON_get_error_code (j); /* Server had an internal issue; we should retry, but this API leaves this to the application */ break; default: /* unexpected response code */ GNUNET_break_op (0); - kpr.ec = TALER_JSON_get_error_code (j); GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Unexpected response code %u/%d for exchange kyc_proof\n", - (unsigned int) response_code, - (int) kpr.ec); + "Unexpected response code %u for exchange kyc_proof\n", + (unsigned int) response_code); break; } kph->cb (kph->cb_cls, @@ -187,16 +182,17 @@ TALER_EXCHANGE_kyc_proof (struct TALER_EXCHANGE_Handle *exchange, return NULL; } /* disable location following, we want to learn the - result of a 302 redirect! */ + result of a 303 redirect! */ GNUNET_assert (CURLE_OK == curl_easy_setopt (kph->eh, CURLOPT_FOLLOWLOCATION, 0L)); ctx = TEAH_handle_to_context (exchange); - kph->job = GNUNET_CURL_job_add_with_ct_json (ctx, - kph->eh, - &handle_kyc_proof_finished, - kph); + kph->job = GNUNET_CURL_job_add_raw (ctx, + kph->eh, + NULL, + &handle_kyc_proof_finished, + kph); return kph; } |