[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] 07/09: /track/transaction CMD stores WTID
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] 07/09: /track/transaction CMD stores WTID as trait. |
Date: |
Thu, 10 May 2018 22:18:51 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository merchant.
commit bb59bad7a87502af889f00c352e51a4512ec0a86
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu May 10 21:59:47 2018 +0200
/track/transaction CMD stores WTID as trait.
This is needed because the real bank does not provide
a "bank check" CMD as the fakebank does, making it impossible
to get any WTID while running the paygen against the real
bank. This way, whenever we use the /track/transaction CMD
we get the WTID stored by it, and usable by future CMDs.
---
src/lib/testing_api_cmd_track.c | 56 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/src/lib/testing_api_cmd_track.c b/src/lib/testing_api_cmd_track.c
index afcaf83..b56ddc3 100644
--- a/src/lib/testing_api_cmd_track.c
+++ b/src/lib/testing_api_cmd_track.c
@@ -46,6 +46,12 @@ struct TrackTransactionState
const char *pay_reference;
const char *wire_fee;
+
+ /* This only accounts for the *first* wire transfer that
+ * payed back this transaction. So far, this suffices to
+ * make the paygen work. */
+ struct TALER_WireTransferIdentifierRawP wtid;
+
};
struct TrackTransferState
@@ -87,8 +93,17 @@ track_transaction_cb (void *cls,
enum TALER_ErrorCode ec,
const json_t *json)
{
+ const char *error_json_name;
+ unsigned int error_line;
struct TrackTransactionState *tts = cls;
+ struct GNUNET_JSON_Specification spec[] = {
+
+ GNUNET_JSON_spec_fixed_auto ("wtid",
+ &tts->wtid),
+ GNUNET_JSON_spec_end ()
+ };
+
tts->tth = NULL;
if (tts->http_status != http_status)
{
@@ -104,6 +119,26 @@ track_transaction_cb (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"/track/transaction, response code: %u\n",
http_status);
+
+ /* Only storing first element's wtid, as this works around
+ * the disability of the real bank to provide a "bank check"
+ * CMD as the fakebank does. */
+ if (GNUNET_SYSERR == GNUNET_JSON_parse (json_array_get (json, 0),
+ spec,
+ &error_json_name,
+ &error_line))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "wtid field absent %s/%u, (%s)\n",
+ error_json_name,
+ error_line,
+ json_dumps (json, JSON_INDENT (2)));
+
+ TALER_TESTING_interpreter_fail (tts->is);
+ return;
+ }
+
+
TALER_TESTING_interpreter_next (tts->is);
}
@@ -294,6 +329,26 @@ track_transaction_cleanup (void *cls,
}
+static int
+track_transaction_traits (void *cls,
+ void **ret,
+ const char *trait,
+ unsigned int index)
+{
+ struct TrackTransactionState *tts = cls;
+
+ struct TALER_TESTING_Trait traits[] = {
+ TALER_TESTING_make_trait_wtid (0, &tts->wtid),
+ TALER_TESTING_trait_end ()
+ };
+
+ return TALER_TESTING_get_trait (traits,
+ ret,
+ trait,
+ index);
+ return GNUNET_SYSERR;
+}
+
/**
* FIXME
*/
@@ -322,6 +377,7 @@ TALER_TESTING_cmd_merchant_track_transaction
cmd.label = label;
cmd.run = &track_transaction_run;
cmd.cleanup = &track_transaction_cleanup;
+ cmd.traits = &track_transaction_traits;
// traits?
return cmd;
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [taler-merchant] branch master updated (f0de247 -> 15ecd39), gnunet, 2018/05/10
- [GNUnet-SVN] [taler-merchant] 03/09: comments, gnunet, 2018/05/10
- [GNUnet-SVN] [taler-merchant] 06/09: Paygen /track preparation., gnunet, 2018/05/10
- [GNUnet-SVN] [taler-merchant] 04/09: no "check" CMDs in paygen., gnunet, 2018/05/10
- [GNUnet-SVN] [taler-merchant] 05/09: --with-pybank option removed., gnunet, 2018/05/10
- [GNUnet-SVN] [taler-merchant] 02/09: rewinding payments within the generator., gnunet, 2018/05/10
- [GNUnet-SVN] [taler-merchant] 08/09: previous change continued., gnunet, 2018/05/10
- [GNUnet-SVN] [taler-merchant] 01/09: copy-and-paste fault., gnunet, 2018/05/10
- [GNUnet-SVN] [taler-merchant] 07/09: /track/transaction CMD stores WTID as trait.,
gnunet <=
- [GNUnet-SVN] [taler-merchant] 09/09: paygen has reached its (likely) final form., gnunet, 2018/05/10