diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-03-05 14:36:49 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-03-05 14:36:55 +0100 |
commit | 7ff58c3d8f2351c57142b4b65ab75304f355fc4f (patch) | |
tree | 4d5de28cbc2cb51b9946c924b7dd228cfe0d0634 /src/testing | |
parent | 8a906bf96c9c418dbd58727284eb5cfdd6fdff24 (diff) |
refactor /wire to include logic to return the wad fee (for W2W payments)
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/test_auditor_api.c | 1 | ||||
-rw-r--r-- | src/testing/test_exchange_api.c | 1 | ||||
-rw-r--r-- | src/testing/test_exchange_api_keys_cherry_picking.c | 1 | ||||
-rw-r--r-- | src/testing/test_exchange_management_api.c | 5 | ||||
-rw-r--r-- | src/testing/test_kyc_api.c | 1 | ||||
-rw-r--r-- | src/testing/test_taler_exchange_aggregator.c | 1 | ||||
-rw-r--r-- | src/testing/test_taler_exchange_wirewatch.c | 1 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_offline_sign_fees.c | 10 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_set_wire_fee.c | 25 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_wire.c | 2 |
10 files changed, 37 insertions, 11 deletions
diff --git a/src/testing/test_auditor_api.c b/src/testing/test_auditor_api.c index 9ab78664d..e103697e5 100644 --- a/src/testing/test_auditor_api.c +++ b/src/testing/test_auditor_api.c @@ -651,6 +651,7 @@ run (void *cls, TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", config_file, "EUR:0.01", + "EUR:0.01", "EUR:0.01"), TALER_TESTING_cmd_auditor_add ("add-auditor-OK", MHD_HTTP_NO_CONTENT, diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c index 46419193d..f3a9fdd53 100644 --- a/src/testing/test_exchange_api.c +++ b/src/testing/test_exchange_api.c @@ -1169,6 +1169,7 @@ run (void *cls, TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", config_file, "EUR:0.01", + "EUR:0.01", "EUR:0.01"), TALER_TESTING_cmd_check_keys_pull_all_keys ("refetch /keys", 1), diff --git a/src/testing/test_exchange_api_keys_cherry_picking.c b/src/testing/test_exchange_api_keys_cherry_picking.c index 63114c60c..25bdad06d 100644 --- a/src/testing/test_exchange_api_keys_cherry_picking.c +++ b/src/testing/test_exchange_api_keys_cherry_picking.c @@ -69,6 +69,7 @@ run (void *cls, TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", config_file, "EUR:0.01", + "EUR:0.01", "EUR:0.01"), TALER_TESTING_cmd_exec_offline_sign_keys ("offline-sign-future-keys", config_file), diff --git a/src/testing/test_exchange_management_api.c b/src/testing/test_exchange_management_api.c index 71251a57f..9fe5cf595 100644 --- a/src/testing/test_exchange_management_api.c +++ b/src/testing/test_exchange_management_api.c @@ -85,30 +85,35 @@ run (void *cls, "foo-method", "EUR:1", "EUR:5", + "EUR:3", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_set_wire_fee ("set-fee-conflicting", "foo-method", "EUR:1", "EUR:1", + "EUR:3", MHD_HTTP_CONFLICT, false), TALER_TESTING_cmd_set_wire_fee ("set-fee-bad-signature", "bar-method", "EUR:1", "EUR:1", + "EUR:3", MHD_HTTP_FORBIDDEN, true), TALER_TESTING_cmd_set_wire_fee ("set-fee-other-method", "bar-method", "EUR:1", "EUR:1", + "EUR:3", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_set_wire_fee ("set-fee-idempotent", "bar-method", "EUR:1", "EUR:1", + "EUR:3", MHD_HTTP_NO_CONTENT, false), TALER_TESTING_cmd_wire_add ("add-wire-account", diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c index 3a8286462..669101d88 100644 --- a/src/testing/test_kyc_api.c +++ b/src/testing/test_kyc_api.c @@ -210,6 +210,7 @@ run (void *cls, TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", CONFIG_FILE, "EUR:0.01", + "EUR:0.01", "EUR:0.01"), TALER_TESTING_cmd_auditor_add ("add-auditor-OK", MHD_HTTP_NO_CONTENT, diff --git a/src/testing/test_taler_exchange_aggregator.c b/src/testing/test_taler_exchange_aggregator.c index bf28375b2..ce0c73404 100644 --- a/src/testing/test_taler_exchange_aggregator.c +++ b/src/testing/test_taler_exchange_aggregator.c @@ -99,6 +99,7 @@ run (void *cls, TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", config_filename, "EUR:0.01", + "EUR:0.01", "EUR:0.01"), // check no aggregation happens on a empty database CMD_EXEC_AGGREGATOR ("run-aggregator-on-empty-db", diff --git a/src/testing/test_taler_exchange_wirewatch.c b/src/testing/test_taler_exchange_wirewatch.c index 30c2cf27f..ad5151e2d 100644 --- a/src/testing/test_taler_exchange_wirewatch.c +++ b/src/testing/test_taler_exchange_wirewatch.c @@ -85,6 +85,7 @@ run (void *cls, TALER_TESTING_cmd_exec_offline_sign_fees ("offline-sign-fees", config_filename, "EUR:0.01", + "EUR:0.01", "EUR:0.01"), TALER_TESTING_cmd_auditor_add ("add-auditor-OK", MHD_HTTP_NO_CONTENT, diff --git a/src/testing/testing_api_cmd_offline_sign_fees.c b/src/testing/testing_api_cmd_offline_sign_fees.c index 95f52a00b..8cf9fffe4 100644 --- a/src/testing/testing_api_cmd_offline_sign_fees.c +++ b/src/testing/testing_api_cmd_offline_sign_fees.c @@ -52,6 +52,11 @@ struct OfflineSignState const char *wire_fee_s; /** + * The wad fee to sign. + */ + const char *wad_fee_s; + + /** * The closing fee to sign. */ const char *closing_fee_s; @@ -86,6 +91,7 @@ offlinesign_run (void *cls, "x-taler-bank", ks->wire_fee_s, ks->closing_fee_s, + ks->wad_fee_s, "upload", NULL); if (NULL == ks->offlinesign_proc) @@ -157,13 +163,15 @@ struct TALER_TESTING_Command TALER_TESTING_cmd_exec_offline_sign_fees (const char *label, const char *config_filename, const char *wire_fee, - const char *closing_fee) + const char *closing_fee, + const char *wad_fee) { struct OfflineSignState *ks; ks = GNUNET_new (struct OfflineSignState); ks->config_filename = config_filename; ks->wire_fee_s = wire_fee; + ks->wad_fee_s = wad_fee; ks->closing_fee_s = closing_fee; { struct TALER_TESTING_Command cmd = { diff --git a/src/testing/testing_api_cmd_set_wire_fee.c b/src/testing/testing_api_cmd_set_wire_fee.c index b458d10c1..8eb993878 100644 --- a/src/testing/testing_api_cmd_set_wire_fee.c +++ b/src/testing/testing_api_cmd_set_wire_fee.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2020 Taler Systems SA + Copyright (C) 2020, 2022 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 @@ -61,6 +61,11 @@ struct WireFeeState const char *closing_fee; /** + * Wad fee amount to use. + */ + const char *wad_fee; + + /** * Expected HTTP response code. */ unsigned int expected_response_code; @@ -121,8 +126,7 @@ wire_add_run (void *cls, struct GNUNET_TIME_Absolute now; struct GNUNET_TIME_Timestamp start_time; struct GNUNET_TIME_Timestamp end_time; - struct TALER_Amount wire_fee; - struct TALER_Amount closing_fee; + struct TALER_WireFeeSet fees; (void) cmd; ds->is = is; @@ -135,10 +139,13 @@ wire_add_run (void *cls, GNUNET_TIME_UNIT_HOURS)); if ( (GNUNET_OK != TALER_string_to_amount (ds->closing_fee, - &closing_fee)) || + &fees.closing)) || + (GNUNET_OK != + TALER_string_to_amount (ds->wad_fee, + &fees.wad)) || (GNUNET_OK != TALER_string_to_amount (ds->wire_fee, - &wire_fee)) ) + &fees.wire)) ) { GNUNET_break (0); TALER_TESTING_interpreter_fail (is); @@ -156,8 +163,7 @@ wire_add_run (void *cls, TALER_exchange_offline_wire_fee_sign (ds->wire_method, start_time, end_time, - &wire_fee, - &closing_fee, + &fees, &is->master_priv, &master_sig); } @@ -167,8 +173,7 @@ wire_add_run (void *cls, ds->wire_method, start_time, end_time, - &wire_fee, - &closing_fee, + &fees, &master_sig, &wire_add_cb, ds); @@ -212,6 +217,7 @@ TALER_TESTING_cmd_set_wire_fee (const char *label, const char *wire_method, const char *wire_fee, const char *closing_fee, + const char *wad_fee, unsigned int expected_http_status, bool bad_sig) { @@ -223,6 +229,7 @@ TALER_TESTING_cmd_set_wire_fee (const char *label, ds->wire_method = wire_method; ds->wire_fee = wire_fee; ds->closing_fee = closing_fee; + ds->wad_fee = wad_fee; { struct TALER_TESTING_Command cmd = { .cls = ds, diff --git a/src/testing/testing_api_cmd_wire.c b/src/testing/testing_api_cmd_wire.c index 66d018c79..4b0a177b5 100644 --- a/src/testing/testing_api_cmd_wire.c +++ b/src/testing/testing_api_cmd_wire.c @@ -119,7 +119,7 @@ wire_cb (void *cls, NULL != waf; waf = waf->next) { - if (0 != TALER_amount_cmp (&waf->wire_fee, + if (0 != TALER_amount_cmp (&waf->fees.wire, &expected_fee)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |