summaryrefslogtreecommitdiff
path: root/src/exchange-lib/testing_api_cmd_fakebank_transfer.c
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-12-12 13:42:00 +0100
committerMarcello Stanisci <stanisci.m@gmail.com>2018-12-12 13:42:00 +0100
commit220e00696b268458ff2e011c172cff434a9553a3 (patch)
treeec1ee586527d7623503d23a0d6546da435c4e48c /src/exchange-lib/testing_api_cmd_fakebank_transfer.c
parent81d1b39343d98f7f5e8bdc501d79a31d418a365c (diff)
downloadexchange-220e00696b268458ff2e011c172cff434a9553a3.tar.gz
exchange-220e00696b268458ff2e011c172cff434a9553a3.tar.bz2
exchange-220e00696b268458ff2e011c172cff434a9553a3.zip
Traits.
Do not expose reserve priv trait if the user created a reserve specifying the wire transfer subject explicitly.
Diffstat (limited to 'src/exchange-lib/testing_api_cmd_fakebank_transfer.c')
-rw-r--r--src/exchange-lib/testing_api_cmd_fakebank_transfer.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/exchange-lib/testing_api_cmd_fakebank_transfer.c b/src/exchange-lib/testing_api_cmd_fakebank_transfer.c
index 6d826def1..3cf9aaeec 100644
--- a/src/exchange-lib/testing_api_cmd_fakebank_transfer.c
+++ b/src/exchange-lib/testing_api_cmd_fakebank_transfer.c
@@ -405,7 +405,6 @@ fakebank_transfer_cleanup (void *cls,
GNUNET_free (fts);
}
-
/**
* Offer internal data from a "fakebank transfer" CMD to other
* commands.
@@ -423,20 +422,31 @@ fakebank_transfer_traits (void *cls,
unsigned int index)
{
struct FakebankTransferState *fts = cls;
- struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_reserve_priv
- (0, &fts->reserve_priv),
+ #define MANDATORY 6
+ struct TALER_TESTING_Trait traits[MANDATORY + 1] = {
TALER_TESTING_MAKE_TRAIT_DEBIT_ACCOUNT
(&fts->debit_account_no),
TALER_TESTING_MAKE_TRAIT_CREDIT_ACCOUNT
(&fts->credit_account_no),
TALER_TESTING_make_trait_url (0, fts->exchange_url),
- TALER_TESTING_make_trait_transfer_subject (0, fts->subject),
TALER_TESTING_MAKE_TRAIT_ROW_ID (&fts->serial_id),
TALER_TESTING_make_trait_amount_obj (0, &fts->amount),
- TALER_TESTING_trait_end ()
};
+ /**
+ * The user gave explicit subject,
+ * there must be NO reserve priv. */
+ if (NULL != fts->subject)
+ traits[MANDATORY - 1] =
+ TALER_TESTING_make_trait_transfer_subject (0,
+ fts->subject);
+ /* A reserve priv must exist if no subject was given. */
+ else
+ traits[MANDATORY - 1] = TALER_TESTING_make_trait_reserve_priv
+ (0, &fts->reserve_priv),
+
+ traits[MANDATORY] = TALER_TESTING_trait_end ();
+
return TALER_TESTING_get_trait (traits,
ret,
trait,