summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-09-26 14:50:49 +0200
committerChristian Grothoff <christian@grothoff.org>2016-09-26 14:50:49 +0200
commit302a08b7018b18a18939d49e132ca8db78a2be9a (patch)
tree44ab352820b814d87663ccd33cb8c5727bc44b1d /src/exchange
parent265fc74b656910dda559f410aa140c57de261cc9 (diff)
downloadexchange-302a08b7018b18a18939d49e132ca8db78a2be9a.tar.gz
exchange-302a08b7018b18a18939d49e132ca8db78a2be9a.tar.bz2
exchange-302a08b7018b18a18939d49e132ca8db78a2be9a.zip
implement that /track/transaction returns execution time (#4578)
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd_db.c9
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c13
-rw-r--r--src/exchange/taler-exchange-httpd_responses.h24
3 files changed, 30 insertions, 16 deletions
diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c
index f1c69b7a9..d265f6f47 100644
--- a/src/exchange/taler-exchange-httpd_db.c
+++ b/src/exchange/taler-exchange-httpd_db.c
@@ -1773,6 +1773,11 @@ struct WtidTransactionContext
struct GNUNET_HashCode h_wire;
/**
+ * Execution time of the wire transfer
+ */
+ struct GNUNET_TIME_Absolute exec_time;
+
+ /**
* Head of DLL with details for /wire/deposit response.
*/
struct TMH_TrackTransferDetail *wdd_head;
@@ -1806,6 +1811,7 @@ struct WtidTransactionContext
* @param cls our context for transmission
* @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls)
* @param h_wire hash of wire transfer details of the merchant (should be same for all callbacks with the same @e cls)
+ * @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls)
* @param h_contract which contract was this payment about
* @param transaction_id merchant's transaction ID for the payment
* @param coin_pub which public key was this payment about
@@ -1816,6 +1822,7 @@ static void
handle_transaction_data (void *cls,
const struct TALER_MerchantPublicKeyP *merchant_pub,
const struct GNUNET_HashCode *h_wire,
+ struct GNUNET_TIME_Absolute exec_time,
const struct GNUNET_HashCode *h_contract,
uint64_t transaction_id,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
@@ -1832,6 +1839,7 @@ handle_transaction_data (void *cls,
{
ctx->merchant_pub = *merchant_pub;
ctx->h_wire = *h_wire;
+ ctx->exec_time = exec_time;
ctx->is_valid = GNUNET_YES;
if (GNUNET_OK !=
TALER_amount_subtract (&ctx->total,
@@ -1939,6 +1947,7 @@ TMH_DB_execute_track_transfer (struct MHD_Connection *connection,
&ctx.total,
&ctx.merchant_pub,
&ctx.h_wire,
+ ctx.exec_time,
ctx.wdd_head);
cleanup:
while (NULL != (wdd = ctx.wdd_head))
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index 5be8d1773..47a709a67 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -1181,15 +1181,17 @@ TMH_RESPONSE_reply_track_transaction (struct MHD_Connection *connection,
* @param total total amount that was transferred
* @param merchant_pub public key of the merchant
* @param h_wire destination account
+ * @param exec_time execution time of the wire transfer
* @param wdd_head linked list with details about the combined deposits
* @return MHD result code
*/
int
TMH_RESPONSE_reply_track_transfer_details (struct MHD_Connection *connection,
- const struct TALER_Amount *total,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct GNUNET_HashCode *h_wire,
- const struct TMH_TrackTransferDetail *wdd_head)
+ const struct TALER_Amount *total,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const struct GNUNET_HashCode *h_wire,
+ struct GNUNET_TIME_Absolute exec_time,
+ const struct TMH_TrackTransferDetail *wdd_head)
{
const struct TMH_TrackTransferDetail *wdd_pos;
json_t *deposits;
@@ -1235,10 +1237,11 @@ TMH_RESPONSE_reply_track_transfer_details (struct MHD_Connection *connection,
&sig);
return TMH_RESPONSE_reply_json_pack (connection,
MHD_HTTP_OK,
- "{s:o, s:o, s:o, s:o, s:o, s:o}",
+ "{s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
"total", TALER_JSON_from_amount (total),
"merchant_pub", GNUNET_JSON_from_data_auto (merchant_pub),
"H_wire", GNUNET_JSON_from_data_auto (h_wire),
+ "execution_time", GNUNET_JSON_from_time_abs (exec_time),
"deposits", deposits,
"exchange_sig", GNUNET_JSON_from_data_auto (&sig),
"exchange_pub", GNUNET_JSON_from_data_auto (&pub));
diff --git a/src/exchange/taler-exchange-httpd_responses.h b/src/exchange/taler-exchange-httpd_responses.h
index 82317d89a..0f99b7491 100644
--- a/src/exchange/taler-exchange-httpd_responses.h
+++ b/src/exchange/taler-exchange-httpd_responses.h
@@ -326,13 +326,13 @@ TMH_RESPONSE_reply_transfer_pending (struct MHD_Connection *connection,
*/
int
TMH_RESPONSE_reply_track_transaction (struct MHD_Connection *connection,
- const struct GNUNET_HashCode *h_contract,
- const struct GNUNET_HashCode *h_wire,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const struct TALER_Amount *coin_contribution,
- uint64_t transaction_id,
- const struct TALER_WireTransferIdentifierRawP *wtid,
- struct GNUNET_TIME_Absolute exec_time);
+ const struct GNUNET_HashCode *h_contract,
+ const struct GNUNET_HashCode *h_wire,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_Amount *coin_contribution,
+ uint64_t transaction_id,
+ const struct TALER_WireTransferIdentifierRawP *wtid,
+ struct GNUNET_TIME_Absolute exec_time);
/**
@@ -386,15 +386,17 @@ struct TMH_TrackTransferDetail
* @param total total amount that was transferred
* @param merchant_pub public key of the merchant
* @param h_wire destination account
+ * @param exec_time execution time of the wire transfer
* @param wdd_head linked list with details about the combined deposits
* @return MHD result code
*/
int
TMH_RESPONSE_reply_track_transfer_details (struct MHD_Connection *connection,
- const struct TALER_Amount *total,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct GNUNET_HashCode *h_wire,
- const struct TMH_TrackTransferDetail *wdd_head);
+ const struct TALER_Amount *total,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const struct GNUNET_HashCode *h_wire,
+ struct GNUNET_TIME_Absolute exec_time,
+ const struct TMH_TrackTransferDetail *wdd_head);
/**