formatting, comments

This commit is contained in:
Christian Grothoff 2020-01-16 15:45:25 +01:00
parent 649d95adc3
commit cb853d6513
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -115,15 +115,15 @@ run (void *cls,
* Test withdrawal plus spending. * Test withdrawal plus spending.
*/ */
struct TALER_TESTING_Command withdraw[] = { struct TALER_TESTING_Command withdraw[] = {
/** /**
* Move money to the exchange's bank account. * Move money to the exchange's bank account.
*/ */
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-1", CMD_TRANSFER_TO_EXCHANGE ("create-reserve-1",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer TALER_TESTING_cmd_check_bank_admin_transfer ("check-create-reserve-1",
("check-create-reserve-1", "EUR:5.01",
"EUR:5.01", bc.user42_payto, bc.exchange_payto, bc.user42_payto,
bc.exchange_payto,
"create-reserve-1"), "create-reserve-1"),
/** /**
* Make a reserve exist, according to the previous * Make a reserve exist, according to the previous
@ -144,7 +144,6 @@ run (void *cls,
"create-reserve-1", "create-reserve-1",
"EUR:0", "EUR:0",
MHD_HTTP_OK), MHD_HTTP_OK),
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
@ -152,12 +151,14 @@ run (void *cls,
/** /**
* Spend the coin. * Spend the coin.
*/ */
TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit ("deposit-simple",
("deposit-simple", "withdraw-coin-1", 0, "withdraw-coin-1",
0,
bc.user42_payto, bc.user42_payto,
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_OK), GNUNET_TIME_UNIT_ZERO,
"EUR:5",
MHD_HTTP_OK),
/** /**
* Try to overdraw. * Try to overdraw.
*/ */
@ -165,43 +166,46 @@ run (void *cls,
"create-reserve-1", "create-reserve-1",
"EUR:5", "EUR:5",
MHD_HTTP_CONFLICT), MHD_HTTP_CONFLICT),
/** /**
* Try to double spend using different wire details. * Try to double spend using different wire details.
*/ */
TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit ("deposit-double-1",
("deposit-double-1", "withdraw-coin-1", 0, "withdraw-coin-1",
0,
bc.user43_payto, bc.user43_payto,
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_CONFLICT), GNUNET_TIME_UNIT_ZERO,
"EUR:5",
/** MHD_HTTP_CONFLICT),
* Try to double spend using a different transaction id. /* Try to double spend using a different transaction id.
* (copied verbatim from old exchange-lib tests.) * (copied verbatim from old exchange-lib tests.)
* FIXME: how can it get a different transaction id? There * FIXME: how can it get a different transaction id? There
* isn't such a thing actually, the exchange only knows about * isn't such a thing actually, the exchange only knows about
* contract terms' hashes. So since the contract terms are * contract terms' hashes. So since the contract terms are
* exactly the same as the previous command, * exactly the same as the previous command,
* how can a different id be generated? * how can a different id be generated? *///
*/TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit ("deposit-double-1",
("deposit-double-1", "withdraw-coin-1", 0, "withdraw-coin-1",
0,
bc.user43_payto, bc.user43_payto,
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_CONFLICT), GNUNET_TIME_UNIT_ZERO,
"EUR:5",
MHD_HTTP_CONFLICT),
/** /**
* Try to double spend with different proposal. * Try to double spend with different proposal.
*/ */
TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit ("deposit-double-2",
("deposit-double-2", "withdraw-coin-1", 0, "withdraw-coin-1",
0,
bc.user43_payto, bc.user43_payto,
"{\"items\":[{\"name\":\"ice cream\",\"value\":2}]}", "{\"items\":[{\"name\":\"ice cream\",\"value\":2}]}",
GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_CONFLICT), GNUNET_TIME_UNIT_ZERO,
"EUR:5",
MHD_HTTP_CONFLICT),
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
struct TALER_TESTING_Command refresh[] = { struct TALER_TESTING_Command refresh[] = {
/* Fill reserve with EUR:5, 1ct is for fees. NOTE: the old /* Fill reserve with EUR:5, 1ct is for fees. NOTE: the old
* test-suite gave a account number of _424_ to the user at * test-suite gave a account number of _424_ to the user at
@ -209,40 +213,38 @@ run (void *cls,
* Does this change the tests semantics? */ * Does this change the tests semantics? */
CMD_TRANSFER_TO_EXCHANGE ("refresh-create-reserve-1", CMD_TRANSFER_TO_EXCHANGE ("refresh-create-reserve-1",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer TALER_TESTING_cmd_check_bank_admin_transfer (
("check-refresh-create-reserve-1", "check-refresh-create-reserve-1",
"EUR:5.01", bc.user42_payto, bc.exchange_payto, "EUR:5.01",
bc.user42_payto,
bc.exchange_payto,
"refresh-create-reserve-1"), "refresh-create-reserve-1"),
/** /**
* Make previous command effective. * Make previous command effective.
*/ */
CMD_EXEC_WIREWATCH ("wirewatch-2"), CMD_EXEC_WIREWATCH ("wirewatch-2"),
/** /**
* Withdraw EUR:5. * Withdraw EUR:5.
*/ */
TALER_TESTING_cmd_withdraw_amount TALER_TESTING_cmd_withdraw_amount ("refresh-withdraw-coin-1",
("refresh-withdraw-coin-1",
"refresh-create-reserve-1", "refresh-create-reserve-1",
"EUR:5", "EUR:5",
MHD_HTTP_OK), MHD_HTTP_OK),
/** /* Try to partially spend (deposit) 1 EUR of the 5 EUR coin
* Try to partially spend (deposit) 1 EUR of the 5 EUR coin
* (in full) (merchant would receive EUR:0.99 due to 1 ct * (in full) (merchant would receive EUR:0.99 due to 1 ct
* deposit fee) * deposit fee) *///
*/TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit ("refresh-deposit-partial",
("refresh-deposit-partial", "refresh-withdraw-coin-1",
"refresh-withdraw-coin-1", 0, 0,
bc.user42_payto, bc.user42_payto,
"{\"items\":[{\"name\":\"ice cream\",\ "{\"items\":[{\"name\":\"ice cream\",\"value\":\"EUR:1\"}]}",
\"value\":\"EUR:1\"}]}", GNUNET_TIME_UNIT_ZERO,
GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_OK), "EUR:1",
MHD_HTTP_OK),
/** /**
* Melt the rest of the coin's value * Melt the rest of the coin's value
* (EUR:4.00 = 3x EUR:1.03 + 7x EUR:0.13) */ * (EUR:4.00 = 3x EUR:1.03 + 7x EUR:0.13) */
TALER_TESTING_cmd_refresh_melt_double TALER_TESTING_cmd_refresh_melt_double ("refresh-melt-1",
("refresh-melt-1",
"refresh-withdraw-coin-1", "refresh-withdraw-coin-1",
MHD_HTTP_OK, MHD_HTTP_OK,
NULL), NULL),
@ -250,128 +252,128 @@ run (void *cls,
* Complete (successful) melt operation, and * Complete (successful) melt operation, and
* withdraw the coins * withdraw the coins
*/ */
TALER_TESTING_cmd_refresh_reveal TALER_TESTING_cmd_refresh_reveal ("refresh-reveal-1",
("refresh-reveal-1", "refresh-melt-1",
"refresh-melt-1", MHD_HTTP_OK), MHD_HTTP_OK),
/** /**
* Do it again to check idempotency * Do it again to check idempotency
*/ */
TALER_TESTING_cmd_refresh_reveal TALER_TESTING_cmd_refresh_reveal ("refresh-reveal-1-idempotency",
("refresh-reveal-1-idempotency", "refresh-melt-1",
"refresh-melt-1", MHD_HTTP_OK), MHD_HTTP_OK),
/** /**
* Test that /refresh/link works * Test that /refresh/link works
*/ */
TALER_TESTING_cmd_refresh_link TALER_TESTING_cmd_refresh_link ("refresh-link-1",
("refresh-link-1", "refresh-reveal-1",
"refresh-reveal-1", MHD_HTTP_OK), MHD_HTTP_OK),
/** /**
* Try to spend a refreshed EUR:1 coin * Try to spend a refreshed EUR:1 coin
*/ */
TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit ("refresh-deposit-refreshed-1a",
("refresh-deposit-refreshed-1a", "refresh-reveal-1-idempotency",
"refresh-reveal-1-idempotency", 0, 0,
bc.user42_payto, bc.user42_payto,
"{\"items\":[{\"name\":\"ice cream\",\ "{\"items\":[{\"name\":\"ice cream\",\"value\":3}]}",
\"value\":3}]}", GNUNET_TIME_UNIT_ZERO,
GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_OK), "EUR:1",
MHD_HTTP_OK),
/** /**
* Try to spend a refreshed EUR:0.1 coin * Try to spend a refreshed EUR:0.1 coin
*/ */
TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit ("refresh-deposit-refreshed-1b",
("refresh-deposit-refreshed-1b", "refresh-reveal-1",
"refresh-reveal-1", 3, 3,
bc.user43_payto, bc.user43_payto,
"{\"items\":[{\"name\":\"ice cream\",\ "{\"items\":[{\"name\":\"ice cream\",\"value\":3}]}",
\"value\":3}]}", GNUNET_TIME_UNIT_ZERO,
GNUNET_TIME_UNIT_ZERO, "EUR:0.1", MHD_HTTP_OK), "EUR:0.1",
MHD_HTTP_OK),
/* Test running a failing melt operation (same operation /* Test running a failing melt operation (same operation
* again must fail) */ * again must fail) */
TALER_TESTING_cmd_refresh_melt TALER_TESTING_cmd_refresh_melt ("refresh-melt-failing",
("refresh-melt-failing",
"refresh-withdraw-coin-1", "refresh-withdraw-coin-1",
MHD_HTTP_CONFLICT, MHD_HTTP_CONFLICT,
NULL), NULL),
/* FIXME: also test with coin that was already melted /* FIXME: also test with coin that was already melted
* (signature differs from coin that was deposited...) */ * (signature differs from coin that was deposited...) */
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
struct TALER_TESTING_Command track[] = { struct TALER_TESTING_Command track[] = {
/** /* Try resolving a deposit's WTID, as we never triggered
* Try resolving a deposit's WTID, as we never triggered
* execution of transactions, the answer should be that * execution of transactions, the answer should be that
* the exchange knows about the deposit, but has no WTID yet. * the exchange knows about the deposit, but has no WTID yet.
*/TALER_TESTING_cmd_track_transaction *///
("deposit-wtid-found", TALER_TESTING_cmd_track_transaction ("deposit-wtid-found",
"deposit-simple", 0, MHD_HTTP_ACCEPTED, NULL), "deposit-simple",
0,
/** MHD_HTTP_ACCEPTED,
* Try resolving a deposit's WTID for a failed deposit. NULL),
/* Try resolving a deposit's WTID for a failed deposit.
* As the deposit failed, the answer should be that the * As the deposit failed, the answer should be that the
* exchange does NOT know about the deposit. * exchange does NOT know about the deposit.
*/TALER_TESTING_cmd_track_transaction *///
("deposit-wtid-failing", TALER_TESTING_cmd_track_transaction ("deposit-wtid-failing",
"deposit-double-2", 0, MHD_HTTP_NOT_FOUND, NULL), "deposit-double-2",
0,
/** MHD_HTTP_NOT_FOUND,
* Try resolving an undefined (all zeros) WTID; this NULL),
/* Try resolving an undefined (all zeros) WTID; this
* should fail as obviously the exchange didn't use that * should fail as obviously the exchange didn't use that
* WTID value for any transaction. * WTID value for any transaction.
*/TALER_TESTING_cmd_track_transfer_empty *///
("wire-deposit-failing", TALER_TESTING_cmd_track_transfer_empty ("wire-deposit-failing",
NULL, 0, MHD_HTTP_NOT_FOUND), NULL,
0,
/** MHD_HTTP_NOT_FOUND),
* Run transfers. Note that _actual_ aggregation will NOT /* Run transfers. Note that _actual_ aggregation will NOT
* happen here, as each deposit operation is run with a * happen here, as each deposit operation is run with a
* fresh merchant public key! NOTE: this comment comes * fresh merchant public key, so the aggregator will treat
* "verbatim" from the old test-suite, and IMO does not explain * them as "different" merchants and do the wire transfers
* a lot! * individually. *///
*/CMD_EXEC_AGGREGATOR ("run-aggregator"), CMD_EXEC_AGGREGATOR ("run-aggregator"),
/** /**
* Check all the transfers took place. * Check all the transfers took place.
*/ */
TALER_TESTING_cmd_check_bank_transfer TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-499c",
("check_bank_transfer-499c", ec.exchange_url, ec.exchange_url,
"EUR:4.98", bc.exchange_payto, bc.user42_payto), "EUR:4.98",
bc.exchange_payto,
TALER_TESTING_cmd_check_bank_transfer bc.user42_payto),
("check_bank_transfer-99c1", ec.exchange_url, TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-99c1",
"EUR:0.98", bc.exchange_payto, bc.user42_payto), ec.exchange_url,
"EUR:0.98",
TALER_TESTING_cmd_check_bank_transfer bc.exchange_payto,
("check_bank_transfer-99c2", ec.exchange_url, bc.user42_payto),
"EUR:0.98", bc.exchange_payto, bc.user42_payto), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-99c2",
ec.exchange_url,
TALER_TESTING_cmd_check_bank_transfer "EUR:0.98",
("check_bank_transfer-99c", ec.exchange_url, bc.exchange_payto,
"EUR:0.08", bc.exchange_payto, bc.user43_payto), bc.user42_payto),
TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-99c",
ec.exchange_url,
"EUR:0.08",
bc.exchange_payto,
bc.user43_payto),
TALER_TESTING_cmd_check_bank_empty ("check_bank_empty"), TALER_TESTING_cmd_check_bank_empty ("check_bank_empty"),
TALER_TESTING_cmd_track_transaction ("deposit-wtid-ok",
TALER_TESTING_cmd_track_transaction "deposit-simple",
("deposit-wtid-ok", 0,
"deposit-simple", 0, MHD_HTTP_OK, "check_bank_transfer-499c"), MHD_HTTP_OK,
"check_bank_transfer-499c"),
TALER_TESTING_cmd_track_transfer TALER_TESTING_cmd_track_transfer ("wire-deposit-success-bank",
("wire-deposit-success-bank", "check_bank_transfer-99c1",
"check_bank_transfer-99c1", 0, MHD_HTTP_OK, "EUR:0.98", 0,
MHD_HTTP_OK,
"EUR:0.98",
"EUR:0.01"), "EUR:0.01"),
TALER_TESTING_cmd_track_transfer ("wire-deposits-success-wtid",
TALER_TESTING_cmd_track_transfer "deposit-wtid-ok",
("wire-deposits-success-wtid", 0,
"deposit-wtid-ok", 0, MHD_HTTP_OK, "EUR:4.98", MHD_HTTP_OK,
"EUR:4.98",
"EUR:0.01"), "EUR:0.01"),
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
@ -385,27 +387,27 @@ run (void *cls,
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-unaggregated", CMD_TRANSFER_TO_EXCHANGE ("create-reserve-unaggregated",
"EUR:5.01"), "EUR:5.01"),
/* "consume" reserve creation transfer. */ /* "consume" reserve creation transfer. */
TALER_TESTING_cmd_check_bank_admin_transfer TALER_TESTING_cmd_check_bank_admin_transfer (
("check-create-reserve-unaggregated", "check-create-reserve-unaggregated",
"EUR:5.01", bc.user42_payto, bc.exchange_payto, "EUR:5.01",
bc.user42_payto,
bc.exchange_payto,
"create-reserve-unaggregated"), "create-reserve-unaggregated"),
CMD_EXEC_WIREWATCH ("wirewatch-unaggregated"), CMD_EXEC_WIREWATCH ("wirewatch-unaggregated"),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-unaggregated", TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-unaggregated",
"create-reserve-unaggregated", "create-reserve-unaggregated",
"EUR:5", "EUR:5",
MHD_HTTP_OK), MHD_HTTP_OK),
TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit ("deposit-unaggregated",
("deposit-unaggregated",
"withdraw-coin-unaggregated", "withdraw-coin-unaggregated",
0, 0,
bc.user43_payto, bc.user43_payto,
"{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}", "{\"items\":[{\"name\":\"ice cream\",\"value\":1}]}",
GNUNET_TIME_relative_multiply GNUNET_TIME_relative_multiply (
(GNUNET_TIME_UNIT_YEARS, GNUNET_TIME_UNIT_YEARS,
3000), 3000),
"EUR:5", "EUR:5",
MHD_HTTP_OK), MHD_HTTP_OK),
CMD_EXEC_AGGREGATOR ("aggregation-attempt"), CMD_EXEC_AGGREGATOR ("aggregation-attempt"),
TALER_TESTING_cmd_check_bank_empty TALER_TESTING_cmd_check_bank_empty
@ -414,25 +416,22 @@ run (void *cls,
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
struct TALER_TESTING_Command refund[] = { struct TALER_TESTING_Command refund[] = {
/** /**
* Fill reserve with EUR:5.01, as withdraw fee is 1 ct per * Fill reserve with EUR:5.01, as withdraw fee is 1 ct per
* config. * config.
*/ */
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-r1", CMD_TRANSFER_TO_EXCHANGE ("create-reserve-r1",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer TALER_TESTING_cmd_check_bank_admin_transfer ("check-create-reserve-r1",
("check-create-reserve-r1", "EUR:5.01",
"EUR:5.01", bc.user42_payto, bc.exchange_payto, bc.user42_payto,
bc.exchange_payto,
"create-reserve-r1"), "create-reserve-r1"),
/** /**
* Run wire-watch to trigger the reserve creation. * Run wire-watch to trigger the reserve creation.
*/ */
CMD_EXEC_WIREWATCH ("wirewatch-3"), CMD_EXEC_WIREWATCH ("wirewatch-3"),
/* Withdraw a 5 EUR coin, at fee of 1 ct */ /* Withdraw a 5 EUR coin, at fee of 1 ct */
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-r1", TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-r1",
"create-reserve-r1", "create-reserve-r1",
@ -442,117 +441,115 @@ run (void *cls,
* Spend 5 EUR of the 5 EUR coin (in full) (merchant would * Spend 5 EUR of the 5 EUR coin (in full) (merchant would
* receive EUR:4.99 due to 1 ct deposit fee) * receive EUR:4.99 due to 1 ct deposit fee)
*/ */
TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit ("deposit-refund-1",
("deposit-refund-1", "withdraw-coin-r1", 0, "withdraw-coin-r1",
0,
bc.user42_payto, bc.user42_payto,
"{\"items\":[{\"name\":\"ice cream\"," "{\"items\":[{\"name\":\"ice cream\",\"value\":\"EUR:5\"}]}",
"\"value\":\"EUR:5\"}]}", GNUNET_TIME_UNIT_MINUTES,
GNUNET_TIME_UNIT_MINUTES, "EUR:5", MHD_HTTP_OK), "EUR:5",
MHD_HTTP_OK),
/** /**
* Run transfers. Should do nothing as refund deadline blocks * Run transfers. Should do nothing as refund deadline blocks it
* it
*/ */
CMD_EXEC_AGGREGATOR ("run-aggregator-refund"), CMD_EXEC_AGGREGATOR ("run-aggregator-refund"),
/* Check that aggregator didn't do anything, as expected. /* Check that aggregator didn't do anything, as expected.
* Note, this operation takes two commands: one to "flush" * Note, this operation takes two commands: one to "flush"
* the preliminary transfer (used to withdraw) from the * the preliminary transfer (used to withdraw) from the
* fakebank and the second to actually check there are not * fakebank and the second to actually check there are not
* other transfers around. */// * other transfers around. *///
TALER_TESTING_cmd_check_bank_empty TALER_TESTING_cmd_check_bank_empty ("check_bank_transfer-pre-refund"),
("check_bank_transfer-pre-refund"), TALER_TESTING_cmd_refund ("refund-ok",
MHD_HTTP_OK,
TALER_TESTING_cmd_refund "EUR:5",
("refund-ok", MHD_HTTP_OK, "EUR:0.01",
"EUR:5", "EUR:0.01", "deposit-refund-1"), "deposit-refund-1"),
TALER_TESTING_cmd_refund ("refund-ok-double",
TALER_TESTING_cmd_refund MHD_HTTP_OK,
("refund-ok-double", MHD_HTTP_OK, "EUR:5",
"EUR:5", "EUR:0.01", "deposit-refund-1"), "EUR:0.01",
"deposit-refund-1"),
/* Previous /refund(s) had id == 0. */ /* Previous /refund(s) had id == 0. */
TALER_TESTING_cmd_refund_with_id TALER_TESTING_cmd_refund_with_id ("refund-conflicting",
("refund-conflicting", MHD_HTTP_CONFLICT, MHD_HTTP_CONFLICT,
"EUR:5", "EUR:0.01", "deposit-refund-1", 1), "EUR:5",
"EUR:0.01",
"deposit-refund-1",
1),
/** /**
* Spend 4.99 EUR of the refunded 4.99 EUR coin (1ct gone * Spend 4.99 EUR of the refunded 4.99 EUR coin (1ct gone
* due to refund) (merchant would receive EUR:4.98 due to * due to refund) (merchant would receive EUR:4.98 due to
* 1 ct deposit fee) */ * 1 ct deposit fee) */
TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit ("deposit-refund-2",
("deposit-refund-2", "withdraw-coin-r1", 0, "withdraw-coin-r1",
0,
bc.user42_payto, bc.user42_payto,
"{\"items\":[{\"name\":\"more ice cream\"," "{\"items\":[{\"name\":\"more ice cream\",\"value\":\"EUR:5\"}]}",
"\"value\":\"EUR:5\"}]}", GNUNET_TIME_UNIT_ZERO,
GNUNET_TIME_UNIT_ZERO, "EUR:4.99", MHD_HTTP_OK), "EUR:4.99",
MHD_HTTP_OK),
/** /**
* Run transfers. This will do the transfer as refund deadline * Run transfers. This will do the transfer as refund deadline
* was 0 * was 0
*/ */
CMD_EXEC_AGGREGATOR ("run-aggregator-3"), CMD_EXEC_AGGREGATOR ("run-aggregator-3"),
/** /**
* Check that deposit did run. * Check that deposit did run.
*/ */
TALER_TESTING_cmd_check_bank_transfer TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-pre-refund",
("check_bank_transfer-pre-refund", ec.exchange_url, ec.exchange_url,
"EUR:4.97", bc.exchange_payto, bc.user42_payto), "EUR:4.97",
bc.exchange_payto,
bc.user42_payto),
/** /**
* Run failing refund, as past deadline & aggregation. * Run failing refund, as past deadline & aggregation.
*/ */
TALER_TESTING_cmd_refund TALER_TESTING_cmd_refund ("refund-fail",
("refund-fail", MHD_HTTP_GONE, MHD_HTTP_GONE,
"EUR:4.99", "EUR:0.01", "deposit-refund-2"), "EUR:4.99",
"EUR:0.01",
TALER_TESTING_cmd_check_bank_empty "deposit-refund-2"),
("check-empty-after-refund"), TALER_TESTING_cmd_check_bank_empty ("check-empty-after-refund"),
/** /**
* Test refunded coins are never executed, even past * Test refunded coins are never executed, even past
* refund deadline * refund deadline
*/ */
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-rb", CMD_TRANSFER_TO_EXCHANGE ("create-reserve-rb",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer TALER_TESTING_cmd_check_bank_admin_transfer ("check-create-reserve-rb",
("check-create-reserve-rb", "EUR:5.01",
"EUR:5.01", bc.user42_payto, bc.exchange_payto, bc.user42_payto,
bc.exchange_payto,
"create-reserve-rb"), "create-reserve-rb"),
CMD_EXEC_WIREWATCH ("wirewatch-rb"), CMD_EXEC_WIREWATCH ("wirewatch-rb"),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-rb", TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-rb",
"create-reserve-rb", "create-reserve-rb",
"EUR:5", "EUR:5",
MHD_HTTP_OK), MHD_HTTP_OK),
TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit ("deposit-refund-1b",
("deposit-refund-1b", "withdraw-coin-rb", 0, "withdraw-coin-rb",
0,
bc.user42_payto, bc.user42_payto,
"{\"items\":[{\"name\":\"ice cream\"," "{\"items\":[{\"name\":\"ice cream\",\"value\":\"EUR:5\"}]}",
"\"value\":\"EUR:5\"}]}", GNUNET_TIME_UNIT_ZERO,
GNUNET_TIME_UNIT_ZERO, "EUR:5", MHD_HTTP_OK), "EUR:5",
MHD_HTTP_OK),
/** /**
* Trigger refund (before aggregator had a chance to execute * Trigger refund (before aggregator had a chance to execute
* deposit, even though refund deadline was zero). * deposit, even though refund deadline was zero).
*/ */
TALER_TESTING_cmd_refund TALER_TESTING_cmd_refund ("refund-ok-fast",
("refund-ok-fast", MHD_HTTP_OK, MHD_HTTP_OK,
"EUR:5", "EUR:0.01", "deposit-refund-1b"), "EUR:5",
"EUR:0.01",
"deposit-refund-1b"),
/** /**
* Run transfers. This will do the transfer as refund deadline * Run transfers. This will do the transfer as refund deadline
* was 0, except of course because the refund succeeded, the * was 0, except of course because the refund succeeded, the
* transfer should no longer be done. * transfer should no longer be done.
*/CMD_EXEC_AGGREGATOR ("run-aggregator-3b"), */CMD_EXEC_AGGREGATOR ("run-aggregator-3b"),
/* check that aggregator didn't do anything, as expected */ /* check that aggregator didn't do anything, as expected */
TALER_TESTING_cmd_check_bank_empty TALER_TESTING_cmd_check_bank_empty ("check-refund-fast-not-run"),
("check-refund-fast-not-run"),
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
@ -563,15 +560,15 @@ run (void *cls,
*/ */
CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-1", CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-1",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer TALER_TESTING_cmd_check_bank_admin_transfer ("payback-create-reserve-1",
("payback-create-reserve-1", "EUR:5.01",
"EUR:5.01", bc.user42_payto, bc.exchange_payto, bc.user42_payto,
bc.exchange_payto,
"payback-create-reserve-1"), "payback-create-reserve-1"),
/** /**
* Run wire-watch to trigger the reserve creation. * Run wire-watch to trigger the reserve creation.
*/ */
CMD_EXEC_WIREWATCH ("wirewatch-4"), CMD_EXEC_WIREWATCH ("wirewatch-4"),
/* Withdraw a 5 EUR coin, at fee of 1 ct */ /* Withdraw a 5 EUR coin, at fee of 1 ct */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-1", TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-1",
"payback-create-reserve-1", "payback-create-reserve-1",
@ -582,36 +579,30 @@ run (void *cls,
MHD_HTTP_OK, MHD_HTTP_OK,
"payback-withdraw-coin-1", "payback-withdraw-coin-1",
CONFIG_FILE), CONFIG_FILE),
/* Refund coin to bank account */ /* Refund coin to bank account */
TALER_TESTING_cmd_payback ("payback-1", TALER_TESTING_cmd_payback ("payback-1",
MHD_HTTP_OK, MHD_HTTP_OK,
"payback-withdraw-coin-1", "payback-withdraw-coin-1",
"EUR:5", "EUR:5",
NULL), NULL),
/* Check the money is back with the reserve */ /* Check the money is back with the reserve */
TALER_TESTING_cmd_status ("payback-reserve-status-1", TALER_TESTING_cmd_status ("payback-reserve-status-1",
"payback-create-reserve-1", "payback-create-reserve-1",
"EUR:5.0", "EUR:5.0",
MHD_HTTP_OK), MHD_HTTP_OK),
/* Re-withdraw from this reserve */ /* Re-withdraw from this reserve */
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2", TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2",
"payback-create-reserve-1", "payback-create-reserve-1",
"EUR:1", "EUR:1",
MHD_HTTP_OK), MHD_HTTP_OK),
/** /**
* This withdrawal will test the logic to create a "payback" * This withdrawal will test the logic to create a "payback"
* element to insert into the reserve's history. * element to insert into the reserve's history.
*/ */
TALER_TESTING_cmd_withdraw_amount TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-2-over",
("payback-withdraw-coin-2-over",
"payback-create-reserve-1", "payback-create-reserve-1",
"EUR:10", "EUR:10",
MHD_HTTP_CONFLICT), MHD_HTTP_CONFLICT),
TALER_TESTING_cmd_status ("payback-reserve-status-2", TALER_TESTING_cmd_status ("payback-reserve-status-2",
"payback-create-reserve-1", "payback-create-reserve-1",
"EUR:3.99", "EUR:3.99",
@ -620,29 +611,24 @@ run (void *cls,
/* These commands should close the reserve because /* These commands should close the reserve because
* the aggregator is given a config file that ovverrides * the aggregator is given a config file that ovverrides
* the reserve expiration time (making it now-ish) */ * the reserve expiration time (making it now-ish) */
CMD_TRANSFER_TO_EXCHANGE CMD_TRANSFER_TO_EXCHANGE ("short-lived-reserve",
("short-lived-reserve",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer TALER_TESTING_cmd_check_bank_admin_transfer ("check-short-lived-reserve",
("check-short-lived-reserve", "EUR:5.01",
"EUR:5.01", bc.user42_payto, bc.exchange_payto, bc.user42_payto,
bc.exchange_payto,
"short-lived-reserve"), "short-lived-reserve"),
TALER_TESTING_cmd_exec_wirewatch ("short-lived-aggregation",
TALER_TESTING_cmd_exec_wirewatch
("short-lived-aggregation",
CONFIG_FILE_EXPIRE_RESERVE_NOW), CONFIG_FILE_EXPIRE_RESERVE_NOW),
TALER_TESTING_cmd_exec_aggregator TALER_TESTING_cmd_exec_aggregator ("close-reserves",
("close-reserves",
CONFIG_FILE_EXPIRE_RESERVE_NOW), CONFIG_FILE_EXPIRE_RESERVE_NOW),
TALER_TESTING_cmd_status ("short-lived-status", TALER_TESTING_cmd_status ("short-lived-status",
"short-lived-reserve", "short-lived-reserve",
"EUR:0", "EUR:0",
MHD_HTTP_OK), MHD_HTTP_OK),
TALER_TESTING_cmd_withdraw_amount ("expired-withdraw",
TALER_TESTING_cmd_withdraw_amount
("expired-withdraw",
"short-lived-reserve", "short-lived-reserve",
"EUR:1", "EUR:1",
MHD_HTTP_CONFLICT), MHD_HTTP_CONFLICT),
@ -677,44 +663,40 @@ run (void *cls,
"payback-create-reserve-2", "payback-create-reserve-2",
"EUR:1", "EUR:1",
MHD_HTTP_OK), MHD_HTTP_OK),
TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit
("payback-deposit-partial", ("payback-deposit-partial",
"payback-withdraw-coin-2a", 0, "payback-withdraw-coin-2a", 0,
bc.user42_payto, bc.user42_payto,
"{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}", "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO, "EUR:0.5", MHD_HTTP_OK), GNUNET_TIME_UNIT_ZERO, "EUR:0.5", MHD_HTTP_OK),
TALER_TESTING_cmd_revoke ("revoke-2",
MHD_HTTP_OK,
TALER_TESTING_cmd_revoke ("revoke-2", MHD_HTTP_OK,
"payback-withdraw-coin-2a", "payback-withdraw-coin-2a",
CONFIG_FILE), CONFIG_FILE),
TALER_TESTING_cmd_payback ("payback-2",
TALER_TESTING_cmd_payback ("payback-2", MHD_HTTP_OK, MHD_HTTP_OK,
"payback-withdraw-coin-2a", "payback-withdraw-coin-2a",
"EUR:0.5", "EUR:0.5",
NULL), NULL),
TALER_TESTING_cmd_payback ("payback-2b",
TALER_TESTING_cmd_payback ("payback-2b", MHD_HTTP_CONFLICT, MHD_HTTP_CONFLICT,
"payback-withdraw-coin-2a", "payback-withdraw-coin-2a",
"EUR:0.5", "EUR:0.5",
NULL), NULL),
TALER_TESTING_cmd_deposit ("payback-deposit-revoked",
TALER_TESTING_cmd_deposit "payback-withdraw-coin-2b",
("payback-deposit-revoked", 0,
"payback-withdraw-coin-2b", 0,
bc.user42_payto, bc.user42_payto,
"{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}", "{\"items\":[{\"name\":\"more ice cream\",\"value\":1}]}",
GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_NOT_FOUND), GNUNET_TIME_UNIT_ZERO,
"EUR:1",
MHD_HTTP_NOT_FOUND),
/* Test deposit fails after payback, with proof in payback */ /* Test deposit fails after payback, with proof in payback */
/* FIXME: #3887: right now, the exchange will never return the /* FIXME: #3887: right now, the exchange will never return the
* coin's transaction history with payback data, as we get a * coin's transaction history with payback data, as we get a
* 404 on the DK! */ * 404 on the DK! */
TALER_TESTING_cmd_deposit TALER_TESTING_cmd_deposit ("payback-deposit-partial-after-payback",
("payback-deposit-partial-after-payback",
"payback-withdraw-coin-2a", "payback-withdraw-coin-2a",
0, 0,
bc.user42_payto, bc.user42_payto,
@ -722,26 +704,22 @@ run (void *cls,
GNUNET_TIME_UNIT_ZERO, GNUNET_TIME_UNIT_ZERO,
"EUR:0.5", "EUR:0.5",
MHD_HTTP_NOT_FOUND), MHD_HTTP_NOT_FOUND),
/* Test that revoked coins cannot be withdrawn */ /* Test that revoked coins cannot be withdrawn */
CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-3", CMD_TRANSFER_TO_EXCHANGE ("payback-create-reserve-3",
"EUR:1.01"), "EUR:1.01"),
TALER_TESTING_cmd_check_bank_admin_transfer TALER_TESTING_cmd_check_bank_admin_transfer (
("check-payback-create-reserve-3", "check-payback-create-reserve-3",
"EUR:1.01", bc.user42_payto, bc.exchange_payto, "EUR:1.01",
bc.user42_payto,
bc.exchange_payto,
"payback-create-reserve-3"), "payback-create-reserve-3"),
CMD_EXEC_WIREWATCH ("wirewatch-6"), CMD_EXEC_WIREWATCH ("wirewatch-6"),
TALER_TESTING_cmd_withdraw_amount ("payback-withdraw-coin-3-revoked",
TALER_TESTING_cmd_withdraw_amount
("payback-withdraw-coin-3-revoked",
"payback-create-reserve-3", "payback-create-reserve-3",
"EUR:1", "EUR:1",
MHD_HTTP_NOT_FOUND), MHD_HTTP_NOT_FOUND),
/* check that we are empty before the rejection test */ /* check that we are empty before the rejection test */
TALER_TESTING_cmd_check_bank_empty TALER_TESTING_cmd_check_bank_empty ("check-empty-again"),
("check-empty-again"),
TALER_TESTING_cmd_end () TALER_TESTING_cmd_end ()
}; };
@ -753,9 +731,10 @@ run (void *cls,
*/ */
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-1", CMD_TRANSFER_TO_EXCHANGE ("create-reserve-1",
"EUR:5.01"), "EUR:5.01"),
TALER_TESTING_cmd_check_bank_admin_transfer TALER_TESTING_cmd_check_bank_admin_transfer ("check-create-reserve-1",
("check-create-reserve-1", "EUR:5.01",
"EUR:5.01", bc.user42_payto, bc.exchange_payto, bc.user42_payto,
bc.exchange_payto,
"create-reserve-1"), "create-reserve-1"),
/** /**
* Run wire-watch to trigger the reserve creation. * Run wire-watch to trigger the reserve creation.
@ -766,31 +745,29 @@ run (void *cls,
"create-reserve-1", "create-reserve-1",
"EUR:5", "EUR:5",
MHD_HTTP_OK), MHD_HTTP_OK),
/** /* Try to partially spend (deposit) 1 EUR of the 5 EUR coin (in full)
* Try to partially spend (deposit) 1 EUR of the 5 EUR coin * (merchant would receive EUR:0.99 due to 1 ct deposit fee) *///
* (in full) (merchant would receive EUR:0.99 due to 1 ct TALER_TESTING_cmd_deposit ("deposit-partial",
* deposit fee) "withdraw-revocation-coin-1",
*/TALER_TESTING_cmd_deposit 0,
("deposit-partial",
"withdraw-revocation-coin-1", 0,
bc.user42_payto, bc.user42_payto,
"{\"items\":[{\"name\":\"ice cream\",\ "{\"items\":[{\"name\":\"ice cream\",\"value\":\"EUR:1\"}]}",
\"value\":\"EUR:1\"}]}", GNUNET_TIME_UNIT_ZERO,
GNUNET_TIME_UNIT_ZERO, "EUR:1", MHD_HTTP_OK), "EUR:1",
MHD_HTTP_OK),
/** /**
* Melt SOME of the rest of the coin's value * Melt SOME of the rest of the coin's value
* (EUR:3.17 = 3x EUR:1.03 + 7x EUR:0.13) */ * (EUR:3.17 = 3x EUR:1.03 + 7x EUR:0.13) */
TALER_TESTING_cmd_refresh_melt TALER_TESTING_cmd_refresh_melt ("refresh-melt-1",
("refresh-melt-1",
"withdraw-revocation-coin-1", "withdraw-revocation-coin-1",
MHD_HTTP_OK, MHD_HTTP_OK,
NULL), NULL),
/** /**
* Complete (successful) melt operation, and withdraw the coins * Complete (successful) melt operation, and withdraw the coins
*/ */
TALER_TESTING_cmd_refresh_reveal TALER_TESTING_cmd_refresh_reveal ("refresh-reveal-1",
("refresh-reveal-1", "refresh-melt-1",
"refresh-melt-1", MHD_HTTP_OK), MHD_HTTP_OK),
/* Make refreshed coin invalid */ /* Make refreshed coin invalid */
TALER_TESTING_cmd_revoke ("revoke-1", TALER_TESTING_cmd_revoke ("revoke-1",
MHD_HTTP_OK, MHD_HTTP_OK,
@ -816,8 +793,7 @@ run (void *cls,
/* Melt original coin AGAIN, but only create one 0.1 EUR coin; /* Melt original coin AGAIN, but only create one 0.1 EUR coin;
This costs EUR:0.03 in refresh and EUR:01 in withdraw fees, This costs EUR:0.03 in refresh and EUR:01 in withdraw fees,
leaving EUR:3.69. */ leaving EUR:3.69. */
TALER_TESTING_cmd_refresh_melt TALER_TESTING_cmd_refresh_melt ("refresh-melt-2",
("refresh-melt-2",
"withdraw-revocation-coin-1", "withdraw-revocation-coin-1",
MHD_HTTP_OK, MHD_HTTP_OK,
"EUR:0.1", "EUR:0.1",
@ -825,9 +801,9 @@ run (void *cls,
/** /**
* Complete (successful) melt operation, and withdraw the coins * Complete (successful) melt operation, and withdraw the coins
*/ */
TALER_TESTING_cmd_refresh_reveal TALER_TESTING_cmd_refresh_reveal ("refresh-reveal-2",
("refresh-reveal-2", "refresh-melt-2",
"refresh-melt-2", MHD_HTTP_OK), MHD_HTTP_OK),
/* Revokes refreshed EUR:0.1 coin */ /* Revokes refreshed EUR:0.1 coin */
TALER_TESTING_cmd_revoke ("revoke-2", TALER_TESTING_cmd_revoke ("revoke-2",
MHD_HTTP_OK, MHD_HTTP_OK,
@ -870,16 +846,13 @@ run (void *cls,
i++) i++)
{ {
reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 0] reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 0]
= CMD_TRANSFER_TO_EXCHANGE = CMD_TRANSFER_TO_EXCHANGE ("reserve-open-close-key",
("reserve-open-close-key",
"EUR:20"); "EUR:20");
reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 1] reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 1]
= TALER_TESTING_cmd_exec_wirewatch = TALER_TESTING_cmd_exec_wirewatch ("reserve-open-close-wirewatch",
("reserve-open-close-wirewatch",
CONFIG_FILE_EXPIRE_RESERVE_NOW); CONFIG_FILE_EXPIRE_RESERVE_NOW);
reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 2] reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 2]
= TALER_TESTING_cmd_exec_aggregator = TALER_TESTING_cmd_exec_aggregator ("reserve-open-close-aggregation",
("reserve-open-close-aggregation",
CONFIG_FILE_EXPIRE_RESERVE_NOW); CONFIG_FILE_EXPIRE_RESERVE_NOW);
reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 3] reserve_open_close[(i * RESERVE_OPEN_CLOSE_CHUNK) + 3]
= TALER_TESTING_cmd_status ("reserve-open-close-status", = TALER_TESTING_cmd_status ("reserve-open-close-status",
@ -890,7 +863,7 @@ run (void *cls,
reserve_open_close[RESERVE_OPEN_CLOSE_ITERATIONS * RESERVE_OPEN_CLOSE_CHUNK] reserve_open_close[RESERVE_OPEN_CLOSE_ITERATIONS * RESERVE_OPEN_CLOSE_CHUNK]
= TALER_TESTING_cmd_end (); = TALER_TESTING_cmd_end ();
{
struct TALER_TESTING_Command commands[] = { struct TALER_TESTING_Command commands[] = {
TALER_TESTING_cmd_batch ("wire", TALER_TESTING_cmd_batch ("wire",
wire), wire),
@ -923,6 +896,7 @@ run (void *cls,
commands, commands,
bc.bank_url); bc.bank_url);
} }
}
int int