summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-05-17 13:07:56 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-05-17 13:07:56 +0200
commite94e8c34c58343001dfe84ed8f5a87f1516c687d (patch)
tree9efeb074a4683c6a96d0c95564bb6ab67c6672bf /src
parentb898399507f37ee20249da7168ea41b86f867d65 (diff)
downloadexchange-e94e8c34c58343001dfe84ed8f5a87f1516c687d.tar.gz
exchange-e94e8c34c58343001dfe84ed8f5a87f1516c687d.tar.bz2
exchange-e94e8c34c58343001dfe84ed8f5a87f1516c687d.zip
Trigger deposit to refund not found
Diffstat (limited to 'src')
-rw-r--r--src/exchange-lib/test_exchange_api_twisted.c39
-rw-r--r--src/exchange/taler-exchange-httpd_refund.c1
2 files changed, 35 insertions, 5 deletions
diff --git a/src/exchange-lib/test_exchange_api_twisted.c b/src/exchange-lib/test_exchange_api_twisted.c
index 369aabafd..6b044a8e6 100644
--- a/src/exchange-lib/test_exchange_api_twisted.c
+++ b/src/exchange-lib/test_exchange_api_twisted.c
@@ -198,14 +198,15 @@ run (void *cls,
"refresh-melt",
MHD_HTTP_CONFLICT),
- /* Next chunk, refund conflicts (contract hash missmatch,
- original deposit does not exist,
- currency missmatch);
+ /* Next chunk, refund conflicts
+
+ (contract hash missmatch [!],
+ original deposit does not exist,
+ currency missmatch) V;
'refund_transaction()' has many of the relevant cases;
*/
-
CMD_TRANSFER_TO_EXCHANGE
("create-reserve-r1",
"EUR:5.01"),
@@ -262,11 +263,39 @@ run (void *cls,
TALER_TESTING_cmd_refund
("refund-bad-sig",
- MHD_HTTP_BAD_REQUEST,
+ MHD_HTTP_UNAUTHORIZED,
"EUR:5",
"EUR:0.01",
"deposit-refund-1"),
+ /* This deposit CMD is used to provide "good" traits
+ * to the next refund CMD, where 'good' means that the
+ * POST /refund will pass the signature verification,
+ * but the handler will then NOT judge the deposit as
+ * refundable - actually it won't be found since it will
+ * fail as double-spending attempt. */
+
+ TALER_TESTING_cmd_deposit
+ ("deposit-refund-to-fail",
+ is->exchange,
+ "withdraw-coin-r1",
+ 0, /* coin index. */
+ TALER_TESTING_make_wire_details
+ (42,
+ fakebank_url),
+ "{\"items\":[{\"name\":\"ice skate\","
+ "\"value\":\"EUR:5\"}]}",
+ GNUNET_TIME_UNIT_MINUTES,
+ "EUR:5",
+ MHD_HTTP_FORBIDDEN),
+
+ TALER_TESTING_cmd_refund
+ ("refund-deposit-not-found",
+ MHD_HTTP_BAD_REQUEST,
+ "EUR:5",
+ "EUR:0.01",
+ "deposit-refund-to-fail"),
+
TALER_TESTING_cmd_end ()
};
diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c
index 97cd9351f..8d573e473 100644
--- a/src/exchange/taler-exchange-httpd_refund.c
+++ b/src/exchange/taler-exchange-httpd_refund.c
@@ -243,6 +243,7 @@ refund_transaction (void *cls,
/* handle if deposit was NOT found */
if (GNUNET_NO == deposit_found)
{
+ TALER_LOG_WARNING ("Deposit to /refund was not found\n");
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
*mhd_ret = TEH_RESPONSE_reply_transaction_unknown (connection,