summaryrefslogtreecommitdiff
path: root/src/include/taler_merchant_testing_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/taler_merchant_testing_lib.h')
-rw-r--r--src/include/taler_merchant_testing_lib.h246
1 files changed, 14 insertions, 232 deletions
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h
index 73a1be05..c02cf514 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -1468,247 +1468,29 @@ TALER_TESTING_cmd_tip_pickup (const char *label,
/* ****** Specific traits supported by this component ******* */
-/**
- * Offer a merchant signature over a contract.
- *
- * @param index which signature to offer if there are multiple
- * on offer
- * @param merchant_sig set to the offered signature.
- * @return the trait
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_merchant_sig (
- unsigned int index,
- const struct TALER_MerchantSignatureP *merchant_sig);
-
-
-/**
- * Obtain a merchant signature over a contract from a @a cmd.
- *
- * @param cmd command to extract trait from
- * @param index which signature to pick if @a cmd has multiple
- * on offer
- * @param[out] merchant_sig set to the wanted signature.
- *
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_merchant_sig (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- struct TALER_MerchantSignatureP **merchant_sig);
-
/**
- * Offer an order claim nonce.
- *
- * @param index which nonce to offer if there are
- * multiple on offer.
- * @param nonce set to the offered nonce.
- * @return the trait
+ * Call #op on all simple traits.
*/
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_claim_nonce (
- unsigned int index,
- const struct GNUNET_CRYPTO_EddsaPublicKey *nonce);
+// FIXME: rename: refund_entry->refund_detail
+#define TALER_MERCHANT_TESTING_SIMPLE_TRAITS(op) \
+ op (claim_nonce, const struct GNUNET_CRYPTO_EddsaPublicKey) \
+ op (tip_id, const struct GNUNET_HashCode) \
+ op (refund_entry, const struct TALER_MERCHANT_RefundDetail) \
+ op (h_contract_terms, const struct TALER_PrivateContractHash) \
+ op (proposal_reference, const char *)
/**
- * Obtain an order claim nonce from a @a cmd.
- *
- * @param cmd command to extract the trait from.
- * @param index which nonce to pick if @a
- * cmd has multiple on offer
- * @param[out] nonce set to the wanted data.
- * @return #GNUNET_OK on success
+ * Call #op on all indexed traits.
*/
-int
-TALER_TESTING_get_trait_claim_nonce (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct GNUNET_CRYPTO_EddsaPublicKey **nonce);
+#define TALER_MERCHANT_TESTING_INDEXED_TRAITS(op) \
+ op (coin_reference, const char *) \
+ op (planchet_secrets, struct TALER_PlanchetSecretsP *)
-/**
- * Obtain a reference to a proposal command. Any command that
- * works with proposals, might need to offer their reference to
- * it. Notably, the "pay" command, offers its proposal reference
- * to the "pay abort" command as the latter needs to reconstruct
- * the same data needed by the former in order to use the "pay
- * abort" API.
- *
- * @param cmd command to extract the trait from.
- * @param index which reference to pick if @a cmd has multiple
- * on offer.
- * @param[out] proposal_reference set to the wanted reference.
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_proposal_reference (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const char **proposal_reference);
-
-/**
- * Offer a proposal reference.
- *
- * @param index which reference to offer if there are
- * multiple on offer.
- * @param proposal_reference pointer to the reference to offer.
- *
- * @return the trait
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_proposal_reference (unsigned int index,
- const char *proposal_reference);
-
-/**
- * Offer a coin reference.
- *
- * @param index which reference to offer if there are
- * multiple on offer.
- * @param coin_reference set to the offered reference.
- *
- * @return the trait
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_coin_reference (unsigned int index,
- const char *coin_reference);
-
-/**
- * Obtain a reference to any command that can provide coins as
- * traits.
- *
- * @param cmd command to extract trait from
- * @param index which reference to pick if @a cmd has multiple
- * on offer
- * @param[out] coin_reference set to the wanted reference.
- * NOTE: a _single_ reference can contain
- * _multiple_ instances, using semi-colon as separator.
- * For example, a _single_ reference can be this:
- * "coin-ref-1", or even this: "coin-ref-1;coin-ref-2".
- * The "pay" command contains functions that can parse
- * such format.
- *
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_coin_reference (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const char **coin_reference);
-
-
-/**
- * Obtain planchet secrets from a @a cmd.
- *
- * @param cmd command to extract trait from.
- * @param index index of the trait.
- * @param[out] planchet_secrets set to the wanted secrets.
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_planchet_secrets (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- struct TALER_PlanchetSecretsP **planchet_secrets);
-
-
-/**
- * Offer planchet secrets.
- *
- * @param index of the trait.
- * @param planchet_secrets set to the offered secrets.
- * @return the trait
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_planchet_secrets (
- unsigned int index,
- const struct TALER_PlanchetSecretsP *planchet_secrets);
-
-
-/**
- * Offer tip id.
- *
- * @param index which tip id to offer if there are
- * multiple on offer.
- * @param tip_id set to the offered tip id.
- * @return the trait
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_tip_id (unsigned int index,
- const struct GNUNET_HashCode *tip_id);
-
-
-/**
- * Obtain tip id from a @a cmd.
- *
- * @param cmd command to extract the trait from.
- * @param index which tip id to pick if @a
- * cmd has multiple on offer
- * @param[out] tip_id set to the wanted data.
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_tip_id (const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct GNUNET_HashCode **tip_id);
-
-
-/**
- * Offer contract terms hash code.
- *
- * @param index which hashed contract terms to
- * offer if there are multiple on offer
- * @param h_contract_terms set to the offered hashed
- * contract terms.
- * @return the trait
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_h_contract_terms (
- unsigned int index,
- const struct GNUNET_HashCode *h_contract_terms);
-
-
-/**
- * Obtain contract terms hash from a @a cmd.
- *
- * @param cmd command to extract the trait from.
- * @param index index number of the trait to fetch.
- * @param[out] h_contract_terms set to the wanted data.
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_h_contract_terms (
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct GNUNET_HashCode **h_contract_terms);
-
-/**
- * Offer refund entry.
- *
- * @param index index number of the trait to offer.
- * @param refund_entry set to the offered refund entry.
- * @return the trait
- */
-struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_refund_entry ( // FIXME: rename: entry->detail
- unsigned int index,
- const struct TALER_MERCHANT_RefundDetail *refund_entry);
-
-
-/**
- * Obtain refund entry from a @a cmd.
- *
- * @param cmd command to extract the trait from.
- * @param index the trait index.
- * @param[out] refund_entry set to the wanted data.
- * @return #GNUNET_OK on success
- */
-int
-TALER_TESTING_get_trait_refund_entry ( // FIXME: rename: entry->detail
- const struct TALER_TESTING_Command *cmd,
- unsigned int index,
- const struct TALER_MERCHANT_RefundDetail **refund_entry);
+TALER_MERCHANT_TESTING_SIMPLE_TRAITS (TALER_TESTING_MAKE_DECL_SIMPLE_TRAIT)
+TALER_MERCHANT_TESTING_INDEXED_TRAITS (TALER_TESTING_MAKE_DECL_INDEXED_TRAIT)
#endif