merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 9e9dd55378307cc60af60a1bd4d7212ac2cdead6
parent 2ce7e1622375cffa53701dd40e5e24b120fb8e89
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed,  1 Nov 2017 10:54:04 +0100

starting with testing tipping

Diffstat:
Msrc/lib/test_merchant_api.c | 34++++++++++++++++++++++++----------
Msrc/lib/test_merchant_api.conf | 10+++++++++-
2 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c @@ -2338,7 +2338,7 @@ interpreter_run (void *cls) if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, section, - "tipping-reserve-priv", + "TIP_RESERVE_PRIV", &keys)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -2561,19 +2561,20 @@ interpreter_run (void *cls) /* Token syntax is "LABEL[/NUMBER]" */ ctok = strchr (token, '/'); + ci = 0; if (NULL != ctok) { *ctok = '\0'; ctok++; - } - if (1 != sscanf (ctok, - "%u", - &ci)) - { - GNUNET_break (0); - fail (is); - return; - } + if (1 != sscanf (ctok, + "%u", + &ci)) + { + GNUNET_break (0); + fail (is); + return; + } + } GNUNET_assert (coin_ref = find_command (is, token)); switch (coin_ref->oc) @@ -3096,6 +3097,19 @@ run (void *cls) struct InterpreterState *is; static struct Command commands[] = { + /* Test tipping */ + { .oc = OC_ADMIN_ADD_INCOMING, + .label = "create-reserve-tip-1", + .expected_response_code = MHD_HTTP_OK, + .details.admin_add_incoming.instance = "tip", + .details.admin_add_incoming.sender_details + = "{ \"type\":\"test\", \"bank_uri\":\"" BANK_URI "\", \ + \"account_number\":62, \"uuid\":100 }", + .details.admin_add_incoming.transfer_details + = "{ \"uuid\": 100}", + .details.admin_add_incoming.amount = "EUR:10.02" }, + + /* Fill reserve with EUR:5.01, as withdraw fee is 1 ct per config */ { .oc = OC_ADMIN_ADD_INCOMING, diff --git a/src/lib/test_merchant_api.conf b/src/lib/test_merchant_api.conf @@ -33,7 +33,7 @@ WIREFORMAT = test # during the tests. 'default' instance should explicitly be given. # The instance "token" X must match the corresponding substring in # section like X-wireformat and merchant-instance-X -INSTANCES = tor default +INSTANCES = tor default tip # Default choice for maximum wire fee. DEFAULT_MAX_WIRE_FEE = EUR:0.10 @@ -82,9 +82,17 @@ TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/merchant/wire/test.json [merchant-instance-tor] KEYFILE = tor_merchant.priv +[merchant-instance-tip] +KEYFILE = reserve_tip.priv +TIP_EXCHANGE = http://127.0.0.1:8081/ +TIP_RESERVE_PRIV = RKEJM3J3K8D02V6WFHWY14WM2RKFVBW35ZJ0FHWTEJDPN0T7CPYG + [merchant-instance-wireformat-tor] TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/merchant/wire/test.json +[merchant-instance-wireformat-tip] +TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/merchant/wire/test.json + # Auditors must be in sections "auditor-", the rest of the section # name could be anything. [merchant-auditor-ezb]