summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-05 22:05:50 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-05 22:05:50 +0200
commit76243c5398d79d370636d69df7368648e3e14770 (patch)
tree11a2cac2a7613350a36241aed8df12a8e804d820
parent45e65f85429ad4e78d0cb2ba43923468f0429ae5 (diff)
downloadmerchant-76243c5398d79d370636d69df7368648e3e14770.tar.gz
merchant-76243c5398d79d370636d69df7368648e3e14770.tar.bz2
merchant-76243c5398d79d370636d69df7368648e3e14770.zip
update to match latest exchange API
-rw-r--r--src/backend/taler-merchant-httpd_exchanges.c55
-rw-r--r--src/backend/taler-merchant-httpd_pay.c53
-rw-r--r--src/backend/taler-merchant-httpd_tip-pickup.c28
-rw-r--r--src/backend/taler-merchant-httpd_tip-reserve-helper.c25
-rw-r--r--src/backend/taler-merchant-httpd_track-transaction.c55
-rw-r--r--src/backend/taler-merchant-httpd_track-transfer.c27
-rw-r--r--src/lib/testing_api_cmd_pay_abort_refund.c22
-rw-r--r--src/lib/testing_api_cmd_tip_pickup.c33
8 files changed, 119 insertions, 179 deletions
diff --git a/src/backend/taler-merchant-httpd_exchanges.c b/src/backend/taler-merchant-httpd_exchanges.c
index 2ea00a1f..a7b9cdd6 100644
--- a/src/backend/taler-merchant-httpd_exchanges.c
+++ b/src/backend/taler-merchant-httpd_exchanges.c
@@ -261,20 +261,16 @@ json_t *TMH_trusted_exchanges;
* this callback is called. Thus, once 'pending' turns 'false',
* it is safe to call 'TALER_EXCHANGE_get_keys()' on the exchange's handle,
* in order to get the "good" keys.
+ * @param hr http response details
* @param keys information about the various keys used
* by the exchange
* @param compat version compatibility data
- * @param ec error code, #TALER_EC_NONE on success
- * @param http_status status returned by /keys, #MHD_HTTP_OK on success
- * @param full_reply JSON body of /keys request, NULL if reply was not in JSON
*/
static void
keys_mgmt_cb (void *cls,
+ const struct TALER_EXCHANGE_HttpResponse *hr,
const struct TALER_EXCHANGE_Keys *keys,
- enum TALER_EXCHANGE_VersionCompatibility compat,
- enum TALER_ErrorCode ec,
- unsigned int http_status,
- const json_t *full_reply);
+ enum TALER_EXCHANGE_VersionCompatibility compat);
/**
@@ -598,44 +594,39 @@ wire_task_cb (void *cls);
* that is #TALER_EXCHANGE_get_keys() will succeed.
*
* @param cls closure, a `struct Exchange`
- * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful request;
- * 0 if the exchange's reply is bogus (fails to follow the protocol)
- * @param ec taler-specific error code, #TALER_EC_NONE on success
+ * @param hr HTTP response details
* @param accounts_len length of the @a accounts array
* @param accounts list of wire accounts of the exchange, NULL on error
- * @param full_reply the complete response from the exchange (if it was in JSON)
*/
static void
handle_wire_data (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
+ const struct TALER_EXCHANGE_HttpResponse *hr,
unsigned int accounts_len,
- const struct TALER_EXCHANGE_WireAccount *accounts,
- const json_t *full_reply)
+ const struct TALER_EXCHANGE_WireAccount *accounts)
{
struct Exchange *exchange = cls;
const struct TALER_EXCHANGE_Keys *keys;
enum TALER_ErrorCode ecx;
exchange->wire_request = NULL;
- if (MHD_HTTP_OK != http_status)
+ if (MHD_HTTP_OK != hr->http_status)
{
struct TMH_EXCHANGES_FindOperation *fo;
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to obtain /wire details from `%s': %u/%d\n",
exchange->url,
- http_status,
- ec);
+ hr->http_status,
+ hr->ec);
while (NULL != (fo = exchange->fo_head))
{
fo->fc (fo->fc_cls,
NULL,
NULL,
GNUNET_NO,
- ec,
- http_status,
- full_reply);
+ hr->ec,
+ hr->http_status,
+ hr->reply);
TMH_EXCHANGES_find_exchange_cancel (fo);
}
return;
@@ -660,7 +651,7 @@ handle_wire_data (void *cls,
GNUNET_NO,
ecx,
0,
- full_reply);
+ hr->reply);
TMH_EXCHANGES_find_exchange_cancel (fo);
}
return;
@@ -729,20 +720,16 @@ wire_task_cb (void *cls)
* this callback is called. Thus, once 'pending' turns 'false',
* it is safe to call 'TALER_EXCHANGE_get_keys()' on the exchange's handle,
* in order to get the "good" keys.
+ * @param hr http response details
* @param keys information about the various keys used
* by the exchange
* @param compat version compatibility data
- * @param ec error code, #TALER_EC_NONE on success
- * @param http_status status returned by /keys, #MHD_HTTP_OK on success
- * @param full_reply JSON body of /keys request, NULL if reply was not in JSON
*/
static void
keys_mgmt_cb (void *cls,
+ const struct TALER_EXCHANGE_HttpResponse *hr,
const struct TALER_EXCHANGE_Keys *keys,
- enum TALER_EXCHANGE_VersionCompatibility compat,
- enum TALER_ErrorCode ec,
- unsigned int http_status,
- const json_t *full_reply)
+ enum TALER_EXCHANGE_VersionCompatibility compat)
{
struct Exchange *exchange = cls;
struct GNUNET_TIME_Absolute expire;
@@ -769,9 +756,9 @@ keys_mgmt_cb (void *cls,
NULL,
NULL,
GNUNET_NO,
- ec,
- http_status,
- full_reply);
+ hr->ec,
+ hr->http_status,
+ hr->reply);
TMH_EXCHANGES_find_exchange_cancel (fo);
}
if (TALER_EXCHANGE_VC_INCOMPATIBLE_NEWER == compat)
@@ -790,8 +777,8 @@ keys_mgmt_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to fetch /keys from `%s': %d/%u, retrying in %s\n",
exchange->url,
- (int) ec,
- http_status,
+ (int) hr->ec,
+ hr->http_status,
GNUNET_STRINGS_relative_time_to_string (exchange->retry_delay,
GNUNET_YES));
GNUNET_assert (NULL == exchange->retry_task);
diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c
index f8812026..e0f9915c 100644
--- a/src/backend/taler-merchant-httpd_pay.c
+++ b/src/backend/taler-merchant-httpd_pay.c
@@ -982,23 +982,15 @@ begin_transaction (struct PayContext *pc);
* in that array). That way, the last executed callback can detect
* that no other confirmations are on the way, and can pack a response
* for the wallet
- * @param http_status HTTP response code, #MHD_HTTP_OK
- * (200) for successful deposit; 0 if the exchange's reply is bogus (fails
- * to follow the protocol)
- * @param ec taler-specific error code, #TALER_EC_NONE on success
+ * @param hr HTTP response code details
* @param exchange_sig signature from the exchange over the deposit confirmation
* @param sign_key which key did the exchange use to sign the @a proof
- * @param proof the received JSON reply,
- * should be kept as proof (and, in case of errors, be forwarded to
- * the customer)
*/
static void
deposit_cb (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
+ const struct TALER_EXCHANGE_HttpResponse *hr,
const struct TALER_ExchangeSignatureP *exchange_sig,
- const struct TALER_ExchangePublicKeyP *sign_key,
- const json_t *proof)
+ const struct TALER_ExchangePublicKeyP *sign_key)
{
struct DepositConfirmation *dc = cls;
struct PayContext *pc = dc->pc;
@@ -1007,47 +999,52 @@ deposit_cb (void *cls,
dc->dh = NULL;
GNUNET_assert (GNUNET_YES == pc->suspended);
pc->pending_at_ce--;
- if (MHD_HTTP_OK != http_status)
+ if (MHD_HTTP_OK != hr->http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Deposit operation failed with HTTP code %u\n",
- http_status);
+ "Deposit operation failed with HTTP code %u/%d\n",
+ hr->http_status,
+ (int) hr->ec);
/* Transaction failed; stop all other ongoing deposits */
abort_deposit (pc);
- if (5 == http_status / 100)
+ if (5 == hr->http_status / 100)
{
/* internal server error at exchange */
resume_pay_with_response (pc,
MHD_HTTP_SERVICE_UNAVAILABLE,
TALER_MHD_make_json_pack (
- "{s:s, s:I, s:I}",
+ "{s:s, s:I, s:I, s:I}",
"hint",
"exchange had an internal server error",
"code",
(json_int_t) TALER_EC_PAY_EXCHANGE_FAILED,
+ "exchange-code",
+ (json_int_t) hr->ec,
"exchange-http-status",
- (json_int_t) http_status));
+ (json_int_t) hr->http_status));
}
- else if (NULL == proof)
+ else if (NULL == hr->reply)
{
/* We can't do anything meaningful here, the exchange did something wrong */
resume_pay_with_response (pc,
MHD_HTTP_FAILED_DEPENDENCY,
TALER_MHD_make_json_pack (
- "{s:s, s:I, s:I}",
+ "{s:s, s:I, s:I, s:I}",
"hint",
"exchange failed, response body not even in JSON",
"code",
(json_int_t) TALER_EC_PAY_EXCHANGE_FAILED,
+ "exchange-code",
+ (json_int_t) hr->ec,
"exchange-http-status",
- (json_int_t) http_status));
+ (json_int_t) hr->http_status));
}
else
{
/* Forward error, adding the "coin_pub" for which the
error was being generated */
- if (TALER_EC_DEPOSIT_INSUFFICIENT_FUNDS == ec)
+ if (TALER_EC_DEPOSIT_INSUFFICIENT_FUNDS == hr->ec)
resume_pay_with_response (
pc,
MHD_HTTP_CONFLICT,
@@ -1057,13 +1054,13 @@ deposit_cb (void *cls,
"code",
(json_int_t) TALER_EC_PAY_EXCHANGE_FAILED,
"exchange-code",
- (json_int_t) ec,
+ (json_int_t) hr->ec,
"exchange-http-status",
- (json_int_t) http_status,
+ (json_int_t) hr->http_status,
"coin_pub",
GNUNET_JSON_from_data_auto (&dc->coin_pub),
"exchange-reply",
- proof));
+ hr->reply));
else
resume_pay_with_response (
pc,
@@ -1074,13 +1071,13 @@ deposit_cb (void *cls,
"code",
(json_int_t) TALER_EC_PAY_EXCHANGE_FAILED,
"exchange-code",
- (json_int_t) ec,
+ (json_int_t) hr->ec,
"exchange-http-status",
- (json_int_t) http_status,
+ (json_int_t) hr->http_status,
"coin_pub",
GNUNET_JSON_from_data_auto (&dc->coin_pub),
"exchange-reply",
- proof));
+ hr->reply));
}
return;
}
@@ -1102,7 +1099,7 @@ deposit_cb (void *cls,
&dc->refund_fee,
&dc->wire_fee,
sign_key,
- proof);
+ hr->reply);
if (0 > qs)
{
/* Special report if retries insufficient */
diff --git a/src/backend/taler-merchant-httpd_tip-pickup.c b/src/backend/taler-merchant-httpd_tip-pickup.c
index 3ad062dd..c95ca08a 100644
--- a/src/backend/taler-merchant-httpd_tip-pickup.c
+++ b/src/backend/taler-merchant-httpd_tip-pickup.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2017 Taler Systems SA
+ (C) 2017-2020 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -302,6 +302,7 @@ exchange_found_cb (void *cls,
MHD_resume_connection (pc->connection);
if (NULL == eh)
{
+ // FIXME: #6014: forward error details!
pc->ec = TALER_EC_TIP_PICKUP_EXCHANGE_DOWN;
pc->error_hint = "failed to contact exchange, check URL";
pc->response_code = MHD_HTTP_FAILED_DEPENDENCY;
@@ -311,6 +312,7 @@ exchange_found_cb (void *cls,
keys = TALER_EXCHANGE_get_keys (eh);
if (NULL == keys)
{
+ // FIXME: #6014: forward error details!?
pc->ec = TALER_EC_TIP_PICKUP_EXCHANGE_LACKED_KEYS;
pc->error_hint =
"could not obtain denomination keys from exchange, check URL";
@@ -710,20 +712,16 @@ MH_handler_tip_pickup_get (struct TMH_RequestHandler *rh,
timestamp_expire = GNUNET_TIME_absolute_add (timestamp,
GNUNET_TIME_UNIT_DAYS);
- ret = TALER_MHD_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:s, s:o, s:o, s:o, s:o, s:o}",
- "exchange_url", exchange_url,
- "amount", TALER_JSON_from_amount (
- &tip_amount),
- "amount_left", TALER_JSON_from_amount (
- &tip_amount_left),
- "stamp_created",
- GNUNET_JSON_from_time_abs (timestamp),
- "stamp_expire",
- GNUNET_JSON_from_time_abs (
- timestamp_expire),
- "extra", extra);
+ ret = TALER_MHD_reply_json_pack (
+ connection,
+ MHD_HTTP_OK,
+ "{s:s, s:o, s:o, s:o, s:o, s:o}",
+ "exchange_url", exchange_url,
+ "amount", TALER_JSON_from_amount (&tip_amount),
+ "amount_left", TALER_JSON_from_amount (&tip_amount_left),
+ "stamp_created", GNUNET_JSON_from_time_abs (timestamp),
+ "stamp_expire", GNUNET_JSON_from_time_abs (timestamp_expire),
+ "extra", extra);
GNUNET_free (exchange_url);
json_decref (extra);
diff --git a/src/backend/taler-merchant-httpd_tip-reserve-helper.c b/src/backend/taler-merchant-httpd_tip-reserve-helper.c
index 67ba574b..564c1ffc 100644
--- a/src/backend/taler-merchant-httpd_tip-reserve-helper.c
+++ b/src/backend/taler-merchant-httpd_tip-reserve-helper.c
@@ -77,19 +77,14 @@ resume_with_response (struct TMH_CheckTipReserve *ctr,
* result.
*
* @param cls closure with a `struct TMH_CheckTipReserve *'
- * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
- * 0 if the exchange's reply is bogus (fails to follow the protocol)
- * @param ec taler-specific error code, #TALER_EC_NONE on success
- * @param[in] json original response in JSON format (useful only for diagnostics)
+ * @param hr HTTP response details
* @param balance current balance in the reserve, NULL on error
* @param history_length number of entries in the transaction history, 0 on error
* @param history detailed transaction history, NULL on error
*/
static void
handle_status (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
- const json_t *json,
+ const struct TALER_EXCHANGE_HttpResponse *hr,
const struct TALER_Amount *balance,
unsigned int history_length,
const struct TALER_EXCHANGE_ReserveHistory *history)
@@ -98,7 +93,7 @@ handle_status (void *cls,
ctr->rsh = NULL;
ctr->reserve_expiration = GNUNET_TIME_UNIT_ZERO_ABS;
- if (MHD_HTTP_NOT_FOUND == http_status)
+ if (MHD_HTTP_NOT_FOUND == hr->http_status)
{
resume_with_response (
ctr,
@@ -106,13 +101,13 @@ handle_status (void *cls,
TALER_MHD_make_json_pack (
"{s:I, s:I, s:s, s:I, s:O}",
"code", (json_int_t) TALER_EC_TIP_QUERY_RESERVE_UNKNOWN_TO_EXCHANGE,
- "exchange-http-status", http_status,
+ "exchange-http-status", hr->http_status,
"hint", "tipping reserve unknown at exchange",
- "exchange-code", TALER_JSON_get_error_code (json),
- "exchange-reply", json));
+ "exchange-code", hr->ec,
+ "exchange-reply", hr->reply));
return;
}
- if (MHD_HTTP_OK != http_status)
+ if (MHD_HTTP_OK != hr->http_status)
{
GNUNET_break_op (0);
resume_with_response (
@@ -121,10 +116,10 @@ handle_status (void *cls,
TALER_MHD_make_json_pack (
"{s:I, s:I, s:s, s:I, s:O}",
"code", (json_int_t) TALER_EC_TIP_QUERY_RESERVE_HISTORY_FAILED,
- "exchange-http-status", http_status,
+ "exchange-http-status", hr->http_status,
"hint", "exchange failed to provide reserve history",
- "exchange-code", TALER_JSON_get_error_code (json),
- "exchange-reply", json));
+ "exchange-code", (json_int_t) hr->ec,
+ "exchange-reply", hr->reply));
return;
}
diff --git a/src/backend/taler-merchant-httpd_track-transaction.c b/src/backend/taler-merchant-httpd_track-transaction.c
index 615736bf..c23b07f4 100644
--- a/src/backend/taler-merchant-httpd_track-transaction.c
+++ b/src/backend/taler-merchant-httpd_track-transaction.c
@@ -435,11 +435,8 @@ trace_coins (struct TrackTransactionContext *tctx);
* any coins of the original wire transfer not taken care of.
*
* @param cls closure
- * @param http_status HTTP status code we got, 0 on exchange protocol violation
- * @param ec taler-specific error code
+ * @param hr HTTP response details
* @param exchange_pub public key of the exchange used for signing
- * @param json original json reply (may include signatures, those have then been
- * validated already)
* @param execution_time time when the exchange claims to have performed the wire transfer
* @param wtid extracted wire transfer identifier, or NULL if the exchange could
* not provide any (set only if @a http_status is #MHD_HTTP_OK)
@@ -451,10 +448,8 @@ trace_coins (struct TrackTransactionContext *tctx);
*/
static void
wire_deposits_cb (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
+ const struct TALER_EXCHANGE_HttpResponse *hr,
const struct TALER_ExchangePublicKeyP *exchange_pub,
- const json_t *json,
const struct GNUNET_HashCode *h_wire,
struct GNUNET_TIME_Absolute execution_time,
const struct TALER_Amount *total_amount,
@@ -466,7 +461,7 @@ wire_deposits_cb (void *cls,
enum GNUNET_DB_QueryStatus qs;
tctx->wdh = NULL;
- if (MHD_HTTP_OK != http_status)
+ if (MHD_HTTP_OK != hr->http_status)
{
GNUNET_break_op (0);
resume_track_transaction_with_response (
@@ -477,11 +472,11 @@ wire_deposits_cb (void *cls,
"code",
(json_int_t) TALER_EC_TRACK_TRANSACTION_WIRE_TRANSFER_TRACE_ERROR,
"exchange-http-status",
- (json_int_t) http_status,
+ (json_int_t) hr->http_status,
"exchange-code",
- (json_int_t) ec,
- "details",
- json));
+ (json_int_t) hr->ec,
+ "exchange-reply",
+ hr->reply));
return;
}
for (unsigned int i = 0; i<MAX_RETRIES; i++)
@@ -492,7 +487,7 @@ wire_deposits_cb (void *cls,
&tctx->current_wtid,
tctx->current_execution_time,
exchange_pub,
- json);
+ hr->reply);
if (GNUNET_DB_STATUS_SOFT_ERROR != qs)
break;
}
@@ -592,12 +587,8 @@ proof_cb (void *cls,
* the other coins.
*
* @param cls closure with a `struct TrackCoinContext`
- * @param http_status HTTP status code we got, 0 on exchange protocol violation
- * @param ec taler-specific error code, #TALER_EC_NONE on success
+ * @param hr HTTP response details
* @param exchange_pub public key of the exchange used for signing @a json
- * @param json original json reply (may include signatures, those have then been
- * validated already), should be a `TrackTransactionResponse`
- * from the exchange API
* @param wtid wire transfer identifier used by the exchange, NULL if exchange did not
* yet execute the transaction
* @param execution_time actual or planned execution time for the wire transfer
@@ -605,10 +596,8 @@ proof_cb (void *cls,
*/
static void
wtid_cb (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
+ const struct TALER_EXCHANGE_HttpResponse *hr,
const struct TALER_ExchangePublicKeyP *exchange_pub,
- const json_t *json,
const struct TALER_WireTransferIdentifierRawP *wtid,
struct GNUNET_TIME_Absolute execution_time,
const struct TALER_Amount *coin_contribution)
@@ -619,15 +608,15 @@ wtid_cb (void *cls,
enum GNUNET_DB_QueryStatus qs;
tcc->dwh = NULL;
- if (MHD_HTTP_OK != http_status)
+ if (MHD_HTTP_OK != hr->http_status)
{
- if (MHD_HTTP_ACCEPTED == http_status)
+ if (MHD_HTTP_ACCEPTED == hr->http_status)
{
resume_track_transaction_with_response (
tcc->tctx,
MHD_HTTP_ACCEPTED,
/* Return verbatim what the exchange said. */
- TALER_MHD_make_json (json));
+ TALER_MHD_make_json (hr->reply));
return;
}
@@ -641,11 +630,11 @@ wtid_cb (void *cls,
"code",
(json_int_t) TALER_EC_TRACK_TRANSACTION_COIN_TRACE_ERROR,
"exchange-http-status",
- (json_int_t) http_status,
+ (json_int_t) hr->http_status,
"exchange-code",
- (json_int_t) ec,
- "details",
- json));
+ (json_int_t) hr->ec,
+ "exchange-reply",
+ hr->reply));
return;
}
tctx->current_wtid = *wtid;
@@ -667,11 +656,11 @@ wtid_cb (void *cls,
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
/* Always report on hard error as well to enable diagnostics */
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
- resume_track_transaction_with_response
- (tcc->tctx,
+ resume_track_transaction_with_response (
+ tcc->tctx,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_MHD_make_error
- (TALER_EC_TRACK_TRANSACTION_DB_FETCH_TRANSACTION_ERROR,
+ TALER_MHD_make_error (
+ TALER_EC_TRACK_TRANSACTION_DB_FETCH_TRANSACTION_ERROR,
"Fail to query database about proofs"));
return;
}
@@ -690,7 +679,7 @@ wtid_cb (void *cls,
"{s:I, s:s, s:O, s:o, s:o}",
"code", (json_int_t) TALER_EC_TRACK_TRANSACTION_CONFLICTING_REPORTS,
"hint", "conflicting transfer data from exchange",
- "transaction_tracking_claim", json,
+ "transaction_tracking_claim", hr->reply,
"wtid_tracking_claim", pcc.p_ret,
"coin_pub", GNUNET_JSON_from_data_auto (&tcc->coin_pub)));
return;
diff --git a/src/backend/taler-merchant-httpd_track-transfer.c b/src/backend/taler-merchant-httpd_track-transfer.c
index ad63d251..f82133a2 100644
--- a/src/backend/taler-merchant-httpd_track-transfer.c
+++ b/src/backend/taler-merchant-httpd_track-transfer.c
@@ -580,11 +580,8 @@ check_wire_fee (struct TrackTransferContext *rctx,
* of the coin transactions that were combined into the wire transfer.
*
* @param cls closure
- * @param http_status HTTP status code we got, 0 on exchange protocol violation
- * @param ec taler-specific error code for the operation, #TALER_EC_NONE on success
+ * @param hr HTTP response details
* @param exchange_pub public key of the exchange used to sign @a json
- * @param json original json reply (may include signatures, those have then been
- * validated already)
* @param h_wire hash of the wire transfer address the transfer went to, or NULL on error
* @param execution_time time when the exchange claims to have performed the wire transfer
* @param total_amount total amount of the wire transfer, or NULL if the exchange could
@@ -595,10 +592,8 @@ check_wire_fee (struct TrackTransferContext *rctx,
*/
static void
wire_transfer_cb (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
+ const struct TALER_EXCHANGE_HttpResponse *hr,
const struct TALER_ExchangePublicKeyP *exchange_pub,
- const json_t *json,
const struct GNUNET_HashCode *h_wire,
struct GNUNET_TIME_Absolute execution_time,
const struct TALER_Amount *total_amount,
@@ -613,8 +608,8 @@ wire_transfer_cb (void *cls,
rctx->wdh = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Got response code %u from exchange for /track/transfer\n",
- http_status);
- if (MHD_HTTP_OK != http_status)
+ hr->http_status);
+ if (MHD_HTTP_OK != hr->http_status)
{
resume_track_transfer_with_response (
rctx,
@@ -622,9 +617,9 @@ wire_transfer_cb (void *cls,
TALER_MHD_make_json_pack (
"{s:I, s:I, s:I, s:O}",
"code", (json_int_t) TALER_EC_TRACK_TRANSFER_EXCHANGE_ERROR,
- "exchange-code", (json_int_t) ec,
- "exchange-http-status", (json_int_t) http_status,
- "exchange-reply", details));
+ "exchange-code", (json_int_t) hr->ec,
+ "exchange-http-status", (json_int_t) hr->http_status,
+ "exchange-reply", hr->reply));
return;
}
for (unsigned int i = 0; i<MAX_RETRIES; i++)
@@ -635,7 +630,7 @@ wire_transfer_cb (void *cls,
&rctx->wtid,
execution_time,
exchange_pub,
- json);
+ hr->reply);
if (GNUNET_DB_STATUS_SOFT_ERROR != qs)
break;
}
@@ -656,11 +651,11 @@ wire_transfer_cb (void *cls,
"failed to store response from exchange to local database"));
return;
}
- rctx->original_response = json;
+ rctx->original_response = hr->reply;
if (GNUNET_SYSERR ==
check_wire_fee (rctx,
- json,
+ hr->reply,
execution_time,
wire_fee))
return;
@@ -778,7 +773,7 @@ wire_transfer_cb (void *cls,
"About to call tracks transformator.\n");
if (NULL == (jresponse =
- transform_response (json,
+ transform_response (hr->reply,
rctx)))
{
resume_track_transfer_with_response
diff --git a/src/lib/testing_api_cmd_pay_abort_refund.c b/src/lib/testing_api_cmd_pay_abort_refund.c
index 42bf00bb..0d811c1c 100644
--- a/src/lib/testing_api_cmd_pay_abort_refund.c
+++ b/src/lib/testing_api_cmd_pay_abort_refund.c
@@ -83,32 +83,24 @@ struct PayAbortRefundState
* code is as expected.
*
* @param cls closure
- * @param http_status HTTP response code, #MHD_HTTP_OK (200) for
- * successful deposit; 0 if the exchange's reply is bogus
- * (fails to follow the protocol)
- * @param ec taler-specific error code, #TALER_EC_NONE on success
+ * @param hr HTTP response code details
* @param sign_key exchange key used to sign @a obj, or NULL
- * @param obj the received JSON reply, should be kept as proof
- * (and, in particular, be forwarded to the customer)
*/
static void
abort_refund_cb (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
- const struct TALER_ExchangePublicKeyP *sign_key,
- const json_t *obj)
+ const struct TALER_EXCHANGE_HttpResponse *hr,
+ const struct TALER_ExchangePublicKeyP *sign_key)
{
struct PayAbortRefundState *pars = cls;
pars->rh = NULL;
- if (pars->http_status != http_status)
+ if (pars->http_status != hr->http_status)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u (%d) to command %s\n",
- http_status,
- ec,
- TALER_TESTING_interpreter_get_current_label
- (pars->is));
+ hr->http_status,
+ hr->ec,
+ TALER_TESTING_interpreter_get_current_label (pars->is));
TALER_TESTING_interpreter_fail (pars->is);
return;
}
diff --git a/src/lib/testing_api_cmd_tip_pickup.c b/src/lib/testing_api_cmd_tip_pickup.c
index c26b1cfa..fb243af6 100644
--- a/src/lib/testing_api_cmd_tip_pickup.c
+++ b/src/lib/testing_api_cmd_tip_pickup.c
@@ -154,20 +154,13 @@ struct WithdrawHandle
* from the exchange, that is the final step in getting the tip.
*
* @param cls closure, a `struct WithdrawHandle *`
- * @param http_status HTTP response code, #MHD_HTTP_OK (200)
- * for successful status request, 0 if the exchange's
- * reply is bogus (fails to follow the protocol)
- * @param ec taler-specific error code, #TALER_EC_NONE on success
+ * @param hr HTTP response details
* @param sig signature over the coin, NULL on error
- * @param full_response full response from the exchange
- * (for logging, in case of errors)
*/
static void
pickup_withdraw_cb (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
- const struct TALER_DenominationSignature *sig,
- const json_t *full_response)
+ const struct TALER_EXCHANGE_HttpResponse *hr,
+ const struct TALER_DenominationSignature *sig)
{
struct WithdrawHandle *wh = cls;
struct TALER_TESTING_Interpreter *is = wh->is;
@@ -178,17 +171,16 @@ pickup_withdraw_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Withdraw operation %u completed with %u (%d)\n",
wh->off,
- http_status,
- ec);
+ hr->http_status,
+ hr->ec);
GNUNET_assert (wh->off < tps->num_coins);
- if ( (MHD_HTTP_OK != http_status) ||
- (TALER_EC_NONE != ec) )
+ if ( (MHD_HTTP_OK != hr->http_status) ||
+ (TALER_EC_NONE != hr->ec) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Unexpected response code %u (%d)"
- " to command %s when withdrawing\n",
- http_status,
- ec,
+ "Unexpected response code %u (%d) to command %s when withdrawing\n",
+ hr->http_status,
+ hr->ec,
TALER_TESTING_interpreter_get_current_label (is));
TALER_TESTING_interpreter_fail (is);
return;
@@ -482,21 +474,16 @@ tip_pickup_traits (void *cls,
{
traits[i] = TALER_TESTING_make_trait_planchet_secrets
(i, &tps->psa[i]);
-
traits[i + tps->num_coins] =
TALER_TESTING_make_trait_coin_priv
(i, &tps->psa[i].coin_priv);
-
traits[i + (tps->num_coins * 2)] =
TALER_TESTING_make_trait_denom_pub (i, tps->dks[i]);
-
traits[i + (tps->num_coins * 3)] =
TALER_TESTING_make_trait_denom_sig (i, &tps->sigs[i]);
-
traits[i + (tps->num_coins * 4)] =
TALER_TESTING_make_trait_amount_obj
(i, &tps->amounts_obj[i]);
-
}
traits[NUM_TRAITS - 2] = TALER_TESTING_make_trait_url
(TALER_TESTING_UT_EXCHANGE_BASE_URL,