[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] branch master updated (f0de247 -> 15ecd39)
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] branch master updated (f0de247 -> 15ecd39) |
Date: |
Thu, 10 May 2018 22:18:44 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a change to branch master
in repository merchant.
from f0de247 Importing CMDs.
new 354483f copy-and-paste fault.
new ea86956 rewinding payments within the generator.
new b4994bf comments
new 5b04334 no "check" CMDs in paygen.
new 9259ddb --with-pybank option removed.
new 9ebfdb1 Paygen /track preparation.
new bb59bad /track/transaction CMD stores WTID as trait.
new f30f711 previous change continued.
new 15ecd39 paygen has reached its (likely) final form.
The 9 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/backend/taler-merchant-httpd_exchanges.c | 2 +-
src/lib/testing_api_cmd_track.c | 62 +++++++++++
.../taler-merchant-generate-payments_new.c | 122 ++++++++++++++-------
3 files changed, 145 insertions(+), 41 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_exchanges.c
b/src/backend/taler-merchant-httpd_exchanges.c
index 65eccab..880f702 100644
--- a/src/backend/taler-merchant-httpd_exchanges.c
+++ b/src/backend/taler-merchant-httpd_exchanges.c
@@ -972,7 +972,7 @@ accept_exchanges (void *cls,
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
section,
- "URL");
+ "BASE_URL");
return;
}
if (GNUNET_OK !=
diff --git a/src/lib/testing_api_cmd_track.c b/src/lib/testing_api_cmd_track.c
index afcaf83..0fce026 100644
--- a/src/lib/testing_api_cmd_track.c
+++ b/src/lib/testing_api_cmd_track.c
@@ -46,6 +46,14 @@ 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;
+
+ const char *exchange_url;
+
};
struct TrackTransferState
@@ -87,8 +95,19 @@ 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_string ("exchange",
+ &tts->exchange_url),
+ GNUNET_JSON_spec_end ()
+ };
+
tts->tth = NULL;
if (tts->http_status != http_status)
{
@@ -104,6 +123,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);
}
@@ -290,10 +329,32 @@ track_transaction_cleanup (void *cls,
" did not complete\n");
TALER_MERCHANT_track_transaction_cancel (tts->tth);
}
+ /* WARNING: who frees tts->exchange_url ? */
GNUNET_free (tts);
}
+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_make_trait_url (0, tts->exchange_url),
+ TALER_TESTING_trait_end ()
+ };
+
+ return TALER_TESTING_get_trait (traits,
+ ret,
+ trait,
+ index);
+ return GNUNET_SYSERR;
+}
+
/**
* FIXME
*/
@@ -322,6 +383,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;
diff --git a/src/merchant-tools/taler-merchant-generate-payments_new.c
b/src/merchant-tools/taler-merchant-generate-payments_new.c
index a2df433..63531aa 100644
--- a/src/merchant-tools/taler-merchant-generate-payments_new.c
+++ b/src/merchant-tools/taler-merchant-generate-payments_new.c
@@ -38,17 +38,27 @@
#include <taler/taler_error_codes.h>
#include "taler_merchant_testing_lib.h"
+/* Error codes. */
#define MISSING_MERCHANT_URL 2
#define FAILED_TO_LAUNCH_MERCHANT 3
#define MISSING_BANK_URL 4
#define FAILED_TO_LAUNCH_BANK 5
+#define BAD_CLI_ARG 6
+/* Hard-coded params. Note, the bank is expected to
+ * have the Tor user with account number 3 and password 'x'.
+ *
+ * This is not a problem _so far_, as the fakebank mocks logins,
+ * and the Python bank makes that account by default. */
#define USER_ACCOUNT_NO 3
#define EXCHANGE_ACCOUNT_NO 2
#define USER_LOGIN_NAME "Tor"
#define USER_LOGIN_PASS "x"
#define EXCHANGE_URL "http://example.com/"
+#define FIRST_INSTRUCTION -1
+#define TRACKS_INSTRUCTION 10
+
#define CMD_TRANSFER_TO_EXCHANGE(label,amount) \
TALER_TESTING_cmd_fakebank_transfer (label, amount, \
bank_url, USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO, \
@@ -65,12 +75,6 @@ static unsigned int result;
static struct GNUNET_OS_Process *bankd;
/**
- * Indicates whether we'll use the Python bank (GNUNET_YES),
- * or the fakebank.
- */
-static int with_pybank;
-
-/**
* Merchant process.
*/
static struct GNUNET_OS_Process *merchantd;
@@ -135,13 +139,6 @@ run (void *cls,
"USD:5",
MHD_HTTP_OK),
- TALER_TESTING_cmd_status
- ("withdraw-status-1",
- is->exchange,
- "create-reserve-1",
- "USD:0",
- MHD_HTTP_OK),
-
TALER_TESTING_cmd_proposal
("create-proposal-1",
merchant_url,
@@ -163,39 +160,91 @@ run (void *cls,
\"value\":\"{USD:5}\"} ] }",
NULL),
- TALER_TESTING_cmd_check_payment
- ("check-payment-1",
+ TALER_TESTING_cmd_pay
+ ("deposit-simple",
merchant_url,
is->ctx,
MHD_HTTP_OK,
"create-proposal-1",
- GNUNET_NO),
+ "withdraw-coin-1",
+ "USD:5",
+ "USD:4.99",
+ "USD:0.01"),
+
+ TALER_TESTING_cmd_rewind_ip
+ ("rewind-payments",
+ FIRST_INSTRUCTION,
+ &payments_number),
+
+ /* Next proposal-pay cycle will be used by /track CMDs
+ * and so it will not have to be looped over, only /track
+ * CMDs will have to. */
+
+ TALER_TESTING_cmd_proposal
+ ("create-proposal-2",
+ merchant_url,
+ is->ctx,
+ MHD_HTTP_OK,
+ "{\"max_fee\":\
+ {\"currency\":\"USD\",\
+ \"value\":0,\
+ \"fraction\":50000000},\
+ \"refund_deadline\":\"\\/Date(0)\\/\",\
+ \"pay_deadline\":\"\\/Date(99999999999)\\/\",\
+ \"amount\":\
+ {\"currency\":\"USD\",\
+ \"value\":5,\
+ \"fraction\":0},\
+ \"summary\": \"merchant-lib testcase\",\
+ \"fulfillment_url\": \"https://example.com/\",\
+ \"products\": [ {\"description\":\"ice track cream\",\
+ \"value\":\"{USD:5}\"} ] }",
+ NULL),
TALER_TESTING_cmd_pay
- ("deposit-simple",
+ ("deposit-simple-2",
merchant_url,
is->ctx,
MHD_HTTP_OK,
- "create-proposal-1",
- "withdraw-coin-1",
+ "create-proposal-2",
+ "withdraw-coin-2",
"USD:5",
"USD:4.99",
"USD:0.01"),
+ /* /track/transaction over deposit-simple-2 */
+
+ TALER_TESTING_cmd_exec_aggregator
+ ("aggregate-1",
+ default_config_file),
+
+ TALER_TESTING_cmd_merchant_track_transaction
+ ("track-transaction-1",
+ merchant_url,
+ is->ctx,
+ MHD_HTTP_OK,
+ "dummy",
+ "deposit-simple-2",
+ "USD:0.01"),
+
+ TALER_TESTING_cmd_merchant_track_transfer
+ ("track-transfer-1",
+ merchant_url,
+ is->ctx,
+ MHD_HTTP_OK,
+ "track-transaction-1",
+ "deposit-simple-2"),
+
+ TALER_TESTING_cmd_rewind_ip
+ ("rewind-tracks",
+ TRACKS_INSTRUCTION,
+ &tracks_number),
+
TALER_TESTING_cmd_end ()
};
- if (GNUNET_YES == with_pybank)
- {
- TALER_TESTING_run (is,
- commands);
- return;
- }
-
- TALER_TESTING_run_with_fakebank
- (is,
- commands,
- bank_url);
+ TALER_TESTING_run (is,
+ commands);
}
/**
@@ -270,12 +319,6 @@ main (int argc,
"will log to file LF",
&logfile),
- GNUNET_GETOPT_option_flag
- ('p',
- "with-pybank",
- "Use the Python bank, if given",
- &with_pybank),
-
GNUNET_GETOPT_OPTION_END
};
@@ -309,10 +352,9 @@ main (int argc,
return MISSING_BANK_URL;
}
- if ((GNUNET_YES == with_pybank)
- && NULL == (bankd = TALER_TESTING_run_bank
- (default_config_file,
- bank_url)))
+ if ( NULL == (bankd = TALER_TESTING_run_bank
+ (default_config_file,
+ bank_url)))
{
TALER_LOG_ERROR ("Failed to run the bank\n");
terminate_process (bankd);
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [taler-merchant] branch master updated (f0de247 -> 15ecd39),
gnunet <=
- [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, 2018/05/10
- [GNUnet-SVN] [taler-merchant] 09/09: paygen has reached its (likely) final form., gnunet, 2018/05/10