aboutsummaryrefslogtreecommitdiff
path: root/src/exchange-lib/test_exchange_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-06-11 15:25:59 +0200
committerChristian Grothoff <christian@grothoff.org>2017-06-11 15:25:59 +0200
commit16b7c266057cbfc6d235b6a1c3fe914b14944a25 (patch)
tree8d35fb560e52d54c01b12ca476112027c296fa0f /src/exchange-lib/test_exchange_api.c
parent1eb739c670ffdb3363f54b1efdcb8343cb1bd272 (diff)
modify fakebank API to allow arbitrary subjects, not just well-fromed WTIDs
Diffstat (limited to 'src/exchange-lib/test_exchange_api.c')
-rw-r--r--src/exchange-lib/test_exchange_api.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/exchange-lib/test_exchange_api.c b/src/exchange-lib/test_exchange_api.c
index 53bfbd19b..e435ed77c 100644
--- a/src/exchange-lib/test_exchange_api.c
+++ b/src/exchange-lib/test_exchange_api.c
@@ -636,9 +636,9 @@ struct Command
const char *exchange_base_url;
/**
- * Set (!) to the wire transfer identifier observed.
+ * Set (!) to the wire transfer subject observed.
*/
- struct TALER_WireTransferIdentifierRawP wtid;
+ char *subject;
} check_bank_transfer;
@@ -1805,18 +1805,24 @@ deposit_wtid_cb (void *cls,
if (NULL != cmd->details.deposit_wtid.bank_transfer_ref)
{
const struct Command *ref;
+ char *ws;
+
+ ws = GNUNET_STRINGS_data_to_string_alloc (wtid,
+ sizeof (*wtid));
+
ref = find_command (is,
cmd->details.deposit_wtid.bank_transfer_ref);
GNUNET_assert (NULL != ref);
- if (0 != memcmp (wtid,
- &ref->details.check_bank_transfer.wtid,
- sizeof (struct TALER_WireTransferIdentifierRawP)))
+ if (0 != strcmp (ws,
+ ref->details.check_bank_transfer.subject))
{
GNUNET_break (0);
+ GNUNET_free (ws);
fail (is);
return;
}
+ GNUNET_free (ws);
}
break;
case MHD_HTTP_ACCEPTED:
@@ -2496,7 +2502,11 @@ interpreter_run (void *cls)
cmd->details.wire_deposits.wtid = ref->details.deposit_wtid.wtid;
break;
case OC_CHECK_BANK_TRANSFER:
- cmd->details.wire_deposits.wtid = ref->details.check_bank_transfer.wtid;
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_STRINGS_string_to_data (ref->details.check_bank_transfer.subject,
+ strlen (ref->details.check_bank_transfer.subject),
+ &cmd->details.wire_deposits.wtid,
+ sizeof (cmd->details.wire_deposits.wtid)));
break;
default:
GNUNET_break (0);
@@ -2597,7 +2607,7 @@ interpreter_run (void *cls)
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))
+ &cmd->details.check_bank_transfer.subject))
{
GNUNET_break (0);
fail (is);
@@ -2951,6 +2961,8 @@ do_shutdown (void *cls)
}
break;
case OC_CHECK_BANK_TRANSFER:
+ GNUNET_free_non_null (cmd->details.check_bank_transfer.subject);
+ cmd->details.check_bank_transfer.subject = NULL;
break;
case OC_CHECK_BANK_TRANSFERS_EMPTY:
break;