summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-05-22 14:30:56 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-05-22 14:30:56 +0200
commit7ca1490976ecff68fa57c37761cb4b9f1840ba7f (patch)
treeaa48c196f8e14379679f5cea97870425abee0bca /src/lib
parent7ada0ceb3ad58915ea677c75ba835cbb31f66828 (diff)
downloadmerchant-7ca1490976ecff68fa57c37761cb4b9f1840ba7f.tar.gz
merchant-7ca1490976ecff68fa57c37761cb4b9f1840ba7f.tar.bz2
merchant-7ca1490976ecff68fa57c37761cb4b9f1840ba7f.zip
Fix "insufficient funds" error case.
The test case didn't firstly create the tip reserve where the "insufficient funds" error was supposed to be caused.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/test_merchant_api.conf14
-rw-r--r--src/lib/test_merchant_api_new.c44
2 files changed, 54 insertions, 4 deletions
diff --git a/src/lib/test_merchant_api.conf b/src/lib/test_merchant_api.conf
index 7b79170b..2d4a36a1 100644
--- a/src/lib/test_merchant_api.conf
+++ b/src/lib/test_merchant_api.conf
@@ -62,6 +62,14 @@ TIP_EXCHANGE = http://localhost:8081/
TIP_RESERVE_PRIV_FILENAME = ${TALER_CONFIG_HOME}/merchant/reserve/dtip.priv
NAME = Test Tipping Merchant 2
+[instance-nulltip]
+KEYFILE = ${TALER_CONFIG_HOME}/merchant/nulltip.priv
+TIP_EXCHANGE = http://localhost:8081/
+# This key will NEVER be used to create a reserve, so
+# as to check tip authorization against a non-reserve
+# key.
+TIP_RESERVE_PRIV_FILENAME = ${TALER_CONFIG_HOME}/merchant/reserve/nulltip.priv
+NAME = Test Null-Tipping Merchant
# Account of the MERCHANT
[account-merchant]
@@ -94,6 +102,8 @@ HONOR_tip = YES
# Accept payments to this account in instance-dtip
HONOR_dtip = YES
+HONOR_nulltip = YES
+
# Advertise in new contracts of instance-default
ACTIVE_default = YES
@@ -104,9 +114,7 @@ ACTIVE_tor = YES
ACTIVE_tip = YES
# Advertise in new contracts of instance-default
-ACTIVE_dtip = YES
-
-
+ACTIVE_nulltip = YES
# Sections starting with "exchange-" specify trusted exchanges
# (by the merchant)
diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c
index b9028cf3..e2b1c985 100644
--- a/src/lib/test_merchant_api_new.c
+++ b/src/lib/test_merchant_api_new.c
@@ -651,6 +651,25 @@ run (void *cls,
"tip 2",
"EUR:5.01"),
+
+ #if 0
+ /* This command tests the authorization of tip
+ * against a reserve that does not exist. This is
+ * implemented by passing a "tip instance" that
+ * specifies a reserve key that was never used to
+ * actually create a reserve. */
+ TALER_TESTING_cmd_tip_authorize_with_ec
+ ("authorize-tip-null",
+ merchant_url,
+ exchange_url,
+ is->ctx,
+ MHD_HTTP_NOT_FOUND,
+ "nulltip",
+ "tip 2",
+ "EUR:5.01",
+ TALER_EC_TIP_AUTHORIZE_RESERVE_UNKNOWN),
+ #endif
+
TALER_TESTING_cmd_tip_query ("query-tip-1",
merchant_url,
is->ctx,
@@ -699,6 +718,29 @@ run (void *cls,
"EUR:10.02", // pick
"EUR:10.02", // auth
"EUR:10.02"), // ava
+
+ TALER_TESTING_cmd_fakebank_transfer_with_instance
+ ("create-reserve-insufficient-funds",
+ "EUR:1.01",
+ fakebank_url,
+ USER_ACCOUNT_NO,
+ EXCHANGE_ACCOUNT_NO,
+ USER_LOGIN_NAME,
+ USER_LOGIN_PASS,
+ "dtip",
+ EXCHANGE_URL,
+ CONFIG_FILE),
+
+ TALER_TESTING_cmd_check_bank_transfer
+ ("check_bank_transfer-insufficient-tip-funds",
+ EXCHANGE_URL,
+ "EUR:1.01",
+ USER_ACCOUNT_NO,
+ EXCHANGE_ACCOUNT_NO),
+
+ CMD_EXEC_WIREWATCH
+ ("wirewatch-insufficient-tip-funds"),
+
TALER_TESTING_cmd_tip_authorize_with_ec
("authorize-tip-3-insufficient-funds",
merchant_url,
@@ -707,7 +749,7 @@ run (void *cls,
MHD_HTTP_PRECONDITION_FAILED,
"dtip",
"tip 3",
- "EUR:5.01",
+ "EUR:2.02",
TALER_EC_TIP_AUTHORIZE_INSUFFICIENT_FUNDS),
TALER_TESTING_cmd_tip_authorize_with_ec