From 8a3f0e3f8d998d1badc9767fb207e7a07d645150 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 15 Jan 2020 13:22:28 +0100 Subject: clean up payto credit/debit distincition --- src/include/taler_testing_lib.h | 48 +++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'src/include') diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 9499526af..7e097ff13 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -49,30 +49,15 @@ } while (0) +// FIXME: replace these #define TALER_TESTING_GET_TRAIT_ROW_ID(cmd,out) \ TALER_TESTING_get_trait_uint64 (cmd, 3, out) +// FIXME: replace these #define TALER_TESTING_MAKE_TRAIT_ROW_ID(data) \ TALER_TESTING_make_trait_uint64 (3, data) -// FIXME: replace these! -#define TALER_TESTING_GET_TRAIT_CREDIT_ACCOUNT(cmd,out) \ - TALER_TESTING_get_trait_string (cmd, 4, out) - -// FIXME: replace these! -#define TALER_TESTING_MAKE_TRAIT_CREDIT_ACCOUNT(data) \ - TALER_TESTING_make_trait_string (4, data) - -// FIXME: replace these! -#define TALER_TESTING_GET_TRAIT_DEBIT_ACCOUNT(cmd,out) \ - TALER_TESTING_get_trait_string (cmd, 5, out) - -// FIXME: replace these! -#define TALER_TESTING_MAKE_TRAIT_DEBIT_ACCOUNT(data) \ - TALER_TESTING_make_trait_string (5, data) - - /** * Allocate and return a piece of wire-details. Combines * a @a payto -URL and adds some salt to create the JSON. @@ -2357,16 +2342,37 @@ TALER_TESTING_get_trait_url (const struct TALER_TESTING_Command *cmd, const char **url); +/** + * Used as the "index" in payto traits, to identify what kind of + * payto URL we are returning. + */ +enum TALER_TESTING_PaytoType +{ + /** + * We don't know / not credit or debit. + */ + TALER_TESTING_PT_NEUTRAL, + /** + * Credit side of a transaction. + */ + TALER_TESTING_PT_CREDIT, + /** + * Debit side of a transaction. + */ + TALER_TESTING_PT_DEBIT +}; + + /** * Offer PAYTO url in a trait. * - * @param index which url is to be picked, + * @param pt which url is to be picked, * in case multiple are offered. * @param url the url to offer. * @return the trait. */ struct TALER_TESTING_Trait -TALER_TESTING_make_trait_payto (unsigned int index, +TALER_TESTING_make_trait_payto (enum TALER_TESTING_PaytoType pt, const char *url); @@ -2374,14 +2380,14 @@ TALER_TESTING_make_trait_payto (unsigned int index, * Obtain a PAYTO url from @a cmd. * * @param cmd command to extract the url from. - * @param index which url is to be picked, in case + * @param pt which url is to be picked, in case * multiple are offered. * @param url[out] where to write the url. * @return #GNUNET_OK on success. */ int TALER_TESTING_get_trait_payto (const struct TALER_TESTING_Command *cmd, - unsigned int index, + enum TALER_TESTING_PaytoType pt, const char **url); -- cgit v1.2.3