aboutsummaryrefslogtreecommitdiff
path: root/src/exchange-lib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-02 06:26:12 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-02 06:26:12 +0100
commit397c718809f2f53f3e0714ea6433083ea7379124 (patch)
tree1a16c756aa9c43c6d1f49c9ae4366b3342a3cacd /src/exchange-lib
parent4d8942b8188e5d2ddd6d3d8a31b141e59a82f771 (diff)
implementing #4921: add base URL to wire transfers
Diffstat (limited to 'src/exchange-lib')
-rw-r--r--src/exchange-lib/test_exchange_api.c35
-rw-r--r--src/exchange-lib/test_exchange_api.conf4
2 files changed, 28 insertions, 11 deletions
diff --git a/src/exchange-lib/test_exchange_api.c b/src/exchange-lib/test_exchange_api.c
index aa18f6527..2456d77a7 100644
--- a/src/exchange-lib/test_exchange_api.c
+++ b/src/exchange-lib/test_exchange_api.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014, 2015, 2016 GNUnet e.V. and Inria
+ Copyright (C) 2014-2017 GNUnet e.V. and Inria
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -605,6 +605,11 @@ struct Command
uint64_t account_credit;
/**
+ * Which exchange base URL is expected?
+ */
+ const char *exchange_base_url;
+
+ /**
* Set (!) to the wire transfer identifier observed.
*/
struct TALER_WireTransferIdentifierRawP wtid;
@@ -906,9 +911,10 @@ reserve_status_cb (void *cls,
(0 == strcmp (cmd->details.reserve_status.reserve_reference,
rel->details.admin_add_incoming.reserve_reference) ) ) )
{
- if (GNUNET_OK !=
- compare_admin_add_incoming_history (&history[j],
- rel))
+ if ( (j >= history_length) ||
+ (GNUNET_OK !=
+ compare_admin_add_incoming_history (&history[j],
+ rel)) )
{
GNUNET_break (0);
fail (is);
@@ -921,9 +927,10 @@ reserve_status_cb (void *cls,
if (0 == strcmp (cmd->details.reserve_status.reserve_reference,
rel->details.reserve_withdraw.reserve_reference))
{
- if (GNUNET_OK !=
- compare_reserve_withdraw_history (&history[j],
- rel))
+ if ( (j >= history_length) ||
+ (GNUNET_OK !=
+ compare_reserve_withdraw_history (&history[j],
+ rel)) )
{
GNUNET_break (0);
fail (is);
@@ -2280,10 +2287,11 @@ interpreter_run (void *cls)
}
if (GNUNET_OK !=
TALER_FAKEBANK_check (fakebank,
- &amount,
- cmd->details.check_bank_transfer.account_debit,
- cmd->details.check_bank_transfer.account_credit,
- &cmd->details.check_bank_transfer.wtid))
+ &amount,
+ cmd->details.check_bank_transfer.account_debit,
+ cmd->details.check_bank_transfer.account_credit,
+ cmd->details.check_bank_transfer.exchange_base_url,
+ &cmd->details.check_bank_transfer.wtid))
{
GNUNET_break (0);
fail (is);
@@ -2914,24 +2922,28 @@ run (void *cls)
{ .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-499c",
+ .details.check_bank_transfer.exchange_base_url = "https://exchange.com/",
.details.check_bank_transfer.amount = "EUR:4.99",
.details.check_bank_transfer.account_debit = 2,
.details.check_bank_transfer.account_credit = 42
},
{ .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-99c1",
+ .details.check_bank_transfer.exchange_base_url = "https://exchange.com/",
.details.check_bank_transfer.amount = "EUR:0.99",
.details.check_bank_transfer.account_debit = 2,
.details.check_bank_transfer.account_credit = 42
},
{ .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-99c2",
+ .details.check_bank_transfer.exchange_base_url = "https://exchange.com/",
.details.check_bank_transfer.amount = "EUR:0.99",
.details.check_bank_transfer.account_debit = 2,
.details.check_bank_transfer.account_credit = 42
},
{ .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-9c",
+ .details.check_bank_transfer.exchange_base_url = "https://exchange.com/",
.details.check_bank_transfer.amount = "EUR:0.09",
.details.check_bank_transfer.account_debit = 2,
.details.check_bank_transfer.account_credit = 43
@@ -3017,6 +3029,7 @@ run (void *cls)
/* Check that deposit did run */
{ .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-pre-refund",
+ .details.check_bank_transfer.exchange_base_url = "https://exchange.com/",
.details.check_bank_transfer.amount = "EUR:4.98",
.details.check_bank_transfer.account_debit = 2,
.details.check_bank_transfer.account_credit = 42
diff --git a/src/exchange-lib/test_exchange_api.conf b/src/exchange-lib/test_exchange_api.conf
index e815a0bbf..83be7c410 100644
--- a/src/exchange-lib/test_exchange_api.conf
+++ b/src/exchange-lib/test_exchange_api.conf
@@ -24,6 +24,10 @@ MASTER_PUBLIC_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
# How to access our database
DB = postgres
+# Base URL of the exchange. Note that the test expects exactly this
+# value in the wire transfers.
+BASE_URL = "https://exchange.com/"
+
[exchangedb-postgres]
DB_CONN_STR = "postgres:///talercheck"