diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-06-11 20:25:50 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-06-11 20:25:50 +0200 |
commit | 16abbebef705c31af9731fff5cd619227e92b680 (patch) | |
tree | 8bc4a86eddbde0227d7ed01a5cc1272d56d4dbd9 /src | |
parent | e6d9c810c6049ef77f84f6e33ecf310b86ce0bd9 (diff) | |
download | merchant-16abbebef705c31af9731fff5cd619227e92b680.tar.gz merchant-16abbebef705c31af9731fff5cd619227e92b680.tar.bz2 merchant-16abbebef705c31af9731fff5cd619227e92b680.zip |
return time of wire transfer in /trace/transaction
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/taler-merchant-httpd_responses.c | 1 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_track-transaction.c | 18 | ||||
-rw-r--r-- | src/include/taler_merchant_service.h | 5 | ||||
-rw-r--r-- | src/lib/merchant_api_track_transaction.c | 1 |
4 files changed, 23 insertions, 2 deletions
diff --git a/src/backend/taler-merchant-httpd_responses.c b/src/backend/taler-merchant-httpd_responses.c index 3a75c0b2..31e0d6d6 100644 --- a/src/backend/taler-merchant-httpd_responses.c +++ b/src/backend/taler-merchant-httpd_responses.c @@ -402,6 +402,7 @@ TMH_RESPONSE_make_track_transaction_ok (unsigned int num_transfers, json_array_append_new (j_transfers, json_pack ("{s:o, s:o}", "wtid", GNUNET_JSON_from_data_auto (&transfer->wtid), + "execution_time", GNUNET_JSON_from_time_abs (transfer->execution_time), "coins", j_coins))); } ret = TMH_RESPONSE_make_json (j_transfers); diff --git a/src/backend/taler-merchant-httpd_track-transaction.c b/src/backend/taler-merchant-httpd_track-transaction.c index 4d6e76d4..37c0a5f9 100644 --- a/src/backend/taler-merchant-httpd_track-transaction.c +++ b/src/backend/taler-merchant-httpd_track-transaction.c @@ -80,6 +80,11 @@ struct TrackCoinContext struct TALER_WireTransferIdentifierRawP wtid; /** + * Execution time of the wire transfer @e wtid. + */ + struct GNUNET_TIME_Absolute execution_time; + + /** * Value of the coin including deposit fee. */ struct TALER_Amount amount_with_fee; @@ -161,6 +166,11 @@ struct TrackTransactionContext struct TALER_WireTransferIdentifierRawP current_wtid; /** + * Execution time of the wire transfer we are currently looking up in @e wdh. + */ + struct GNUNET_TIME_Absolute current_execution_time; + + /** * Hash of wire details for the transaction. */ struct GNUNET_HashCode h_wire; @@ -364,6 +374,7 @@ wire_deposits_cb (void *cls, sizeof (struct TALER_CoinSpendPublicKeyP))) continue; tcc->wtid = tctx->current_wtid; + tcc->execution_time = tctx->current_execution_time; tcc->have_wtid = GNUNET_YES; if (GNUNET_OK != db->store_coin_to_transfer (db->cls, @@ -377,7 +388,7 @@ wire_deposits_cb (void *cls, } } } - /* Continue traceing (will also handle case that we are done) */ + /* Continue tracing (will also handle case that we are done) */ trace_coins (tctx); } @@ -393,6 +404,7 @@ static void proof_cb (void *cls, const json_t *proof) { + /* FIXME #4577: store @a proof in @a cls to return with error message */ GNUNET_break_op (0); } @@ -443,6 +455,7 @@ wtid_cb (void *cls, return; } tctx->current_wtid = *wtid; + tctx->current_execution_time = execution_time; if (GNUNET_YES == db->find_proof_by_wtid (db->cls, @@ -452,7 +465,7 @@ wtid_cb (void *cls, NULL)) { GNUNET_break_op (0); - /* FIXME: report error: we got this WTID before, and the + /* FIXME #4577: report error: we got this WTID before, and the transaction was NOT in the list. So exchange is lying to us! (or our DB is internally inconsistent.) */ } @@ -534,6 +547,7 @@ trace_coins (struct TrackTransactionContext *tctx) wt = &wts[wtid_off++]; wt->wtid = tcc->wtid; + wt->execution_time = tcc->execution_time; /* count number of coins with this wtid */ num_coins = 0; for (tcc2 = tctx->tcc_head; NULL != tcc2; tcc2 = tcc2->next) diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index d97d065e..dbcd3104 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -401,6 +401,11 @@ struct TALER_MERCHANT_TransactionWireTransfer struct TALER_WireTransferIdentifierRawP wtid; /** + * When was this wire transfer executed? + */ + struct GNUNET_TIME_Absolute execution_time; + + /** * Number of coins of the selected transaction that * is covered by this wire transfer. */ diff --git a/src/lib/merchant_api_track_transaction.c b/src/lib/merchant_api_track_transaction.c index 4c684d16..b52b4295 100644 --- a/src/lib/merchant_api_track_transaction.c +++ b/src/lib/merchant_api_track_transaction.c @@ -111,6 +111,7 @@ parse_track_transaction_ok (struct TALER_MERCHANT_TrackTransactionHandle *tdo, unsigned int j; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("wtid", &transfer->wtid), + GNUNET_JSON_spec_absolute_time ("execution_time", &transfer->execution_time), GNUNET_JSON_spec_json ("coins", &coins), GNUNET_JSON_spec_end() }; |