diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-10-28 00:24:03 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-10-28 00:24:03 +0200 |
commit | 9939a99f6c29876f4ad213febf3a0d29fc765cdb (patch) | |
tree | 4ed257f96ddccb4a948578d1eab929034cd61ff9 | |
parent | ca71aefbb1e1520b0e4b357c0b1d9c6aaf0d5128 (diff) | |
download | merchant-9939a99f6c29876f4ad213febf3a0d29fc765cdb.tar.gz merchant-9939a99f6c29876f4ad213febf3a0d29fc765cdb.tar.bz2 merchant-9939a99f6c29876f4ad213febf3a0d29fc765cdb.zip |
fix lib/ FTBFS
20 files changed, 114 insertions, 717 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 82e81b4b..9ba1b628 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -689,7 +689,7 @@ struct TALER_MERCHANT_Account /** * Hash of @e payto_uri and @e salt. */ - struct GNUNET_HashCode h_wire; + struct TALER_MerchantWireHash h_wire; /** * true if the account is active, @@ -1654,7 +1654,8 @@ struct TALER_MERCHANT_OrderWalletGetHandle * TALER_MERCHANT_wallet_order_get (struct GNUNET_CURL_Context *ctx, const char *backend_url, const char *order_id, - const struct GNUNET_HashCode *h_contract, + const struct + TALER_PrivateContractHash *h_contract, struct GNUNET_TIME_Relative timeout, const char *session_id, const struct TALER_Amount *min_refund, @@ -2071,7 +2072,7 @@ typedef void const struct TALER_MERCHANT_HttpResponse *hr, const json_t *contract_terms, const struct TALER_MerchantSignatureP *sig, - const struct GNUNET_HashCode *h_contract_terms); + const struct TALER_PrivateContractHash *h_contract_terms); /** @@ -2285,7 +2286,7 @@ struct TALER_MERCHANT_OrderPayHandle * TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx, const char *merchant_url, const char *session_id, - const struct GNUNET_HashCode *h_contract, + const struct TALER_PrivateContractHash *h_contract, const struct TALER_Amount *amount, const struct TALER_Amount *max_fee, const struct TALER_MerchantPublicKeyP *merchant_pub, @@ -2293,7 +2294,7 @@ TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx, struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute refund_deadline, struct GNUNET_TIME_Absolute pay_deadline, - const struct GNUNET_HashCode *h_wire, + const struct TALER_MerchantWireHash *h_wire, const char *order_id, unsigned int num_coins, const struct TALER_MERCHANT_PayCoin coins[], @@ -2357,7 +2358,7 @@ TALER_MERCHANT_order_paid ( const char *merchant_url, const char *order_id, const char *session_id, - const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_MerchantSignatureP *merchant_sig, TALER_MERCHANT_OrderPaidCallback paid_cb, void *paid_cb_cls); @@ -2461,7 +2462,7 @@ TALER_MERCHANT_order_abort (struct GNUNET_CURL_Context *ctx, const char *merchant_url, const char *order_id, const struct TALER_MerchantPublicKeyP *merchant_pub, - const struct GNUNET_HashCode *h_contract, + const struct TALER_PrivateContractHash *h_contract, unsigned int num_coins, const struct TALER_MERCHANT_AbortCoin coins[], TALER_MERCHANT_AbortCallback cb, @@ -2553,7 +2554,7 @@ typedef void void *cls, const struct TALER_MERCHANT_HttpResponse *hr, const char *taler_refund_uri, - const struct GNUNET_HashCode *h_contract); + const struct TALER_PrivateContractHash *h_contract); /** @@ -2669,7 +2670,7 @@ TALER_MERCHANT_wallet_post_order_refund ( struct GNUNET_CURL_Context *ctx, const char *backend_url, const char *order_id, - const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_PrivateContractHash *h_contract_terms, TALER_MERCHANT_WalletRefundCallback cb, void *cb_cls); @@ -3734,7 +3735,6 @@ TALER_MERCHANT_tip_pickup2_cancel ( struct TALER_MERCHANT_TipPickup2Handle *tp); - /* ********************* /kyc ************************** */ /** @@ -3866,7 +3866,7 @@ typedef void struct TALER_MERCHANT_KycGetHandle * TALER_MERCHANT_kyc_get (struct GNUNET_CURL_Context *ctx, const char *backend_url, - const struct GNUNET_HashCode *h_wire, + const struct TALER_MerchantWireHash *h_wire, const char *exchange_url, struct GNUNET_TIME_Relative timeout, TALER_MERCHANT_KycGetCallback cb, @@ -3891,7 +3891,7 @@ struct TALER_MERCHANT_KycGetHandle * TALER_MERCHANT_management_kyc_get (struct GNUNET_CURL_Context *ctx, const char *backend_url, const char *instance_id, - const struct GNUNET_HashCode *h_wire, + const struct TALER_MerchantWireHash *h_wire, const char *exchange_url, struct GNUNET_TIME_Relative timeout, TALER_MERCHANT_KycGetCallback cb, @@ -3908,7 +3908,4 @@ TALER_MERCHANT_kyc_get_cancel ( struct TALER_MERCHANT_KycGetHandle *kyc); - - - #endif /* _TALER_MERCHANT_SERVICE_H */ 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 diff --git a/src/lib/merchant_api_get_kyc.c b/src/lib/merchant_api_get_kyc.c index 816b3cc0..d793703e 100644 --- a/src/lib/merchant_api_get_kyc.c +++ b/src/lib/merchant_api_get_kyc.c @@ -189,7 +189,7 @@ handle_get_kyc_finished (void *cls, static struct TALER_MERCHANT_KycGetHandle * kyc_get (struct GNUNET_CURL_Context *ctx, char *url, - const struct GNUNET_HashCode *h_wire, + const struct TALER_MerchantWireHash *h_wire, const char *exchange_url, struct GNUNET_TIME_Relative timeout, TALER_MERCHANT_KycGetCallback cb, @@ -206,12 +206,14 @@ kyc_get (struct GNUNET_CURL_Context *ctx, GNUNET_snprintf (timeout_ms, sizeof (timeout_ms), "%llu", - (unsigned long long) (timeout.rel_value_us / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us)); + (unsigned long long) (timeout.rel_value_us + / GNUNET_TIME_UNIT_MILLISECONDS. + rel_value_us)); kyc->url = TALER_url_join (url, "h_wire", NULL == h_wire ? NULL - : GNUNET_h2s_full (h_wire), + : GNUNET_h2s_full (&h_wire->hash), "exchange_url", NULL == exchange_url ? NULL @@ -248,7 +250,7 @@ kyc_get (struct GNUNET_CURL_Context *ctx, struct TALER_MERCHANT_KycGetHandle * TALER_MERCHANT_kyc_get (struct GNUNET_CURL_Context *ctx, const char *backend_url, - const struct GNUNET_HashCode *h_wire, + const struct TALER_MerchantWireHash *h_wire, const char *exchange_url, struct GNUNET_TIME_Relative timeout, TALER_MERCHANT_KycGetCallback cb, @@ -273,7 +275,7 @@ struct TALER_MERCHANT_KycGetHandle * TALER_MERCHANT_management_kyc_get (struct GNUNET_CURL_Context *ctx, const char *backend_url, const char *instance_id, - const struct GNUNET_HashCode *h_wire, + const struct TALER_MerchantWireHash *h_wire, const char *exchange_url, struct GNUNET_TIME_Relative timeout, TALER_MERCHANT_KycGetCallback cb, diff --git a/src/lib/merchant_api_post_order_abort.c b/src/lib/merchant_api_post_order_abort.c index 47df8ec4..e179ade5 100644 --- a/src/lib/merchant_api_post_order_abort.c +++ b/src/lib/merchant_api_post_order_abort.c @@ -44,7 +44,7 @@ struct TALER_MERCHANT_OrderAbortHandle /** * Hash of the contract. */ - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; /** * Public key of the merchant. @@ -326,7 +326,7 @@ TALER_MERCHANT_order_abort (struct GNUNET_CURL_Context *ctx, const char *merchant_url, const char *order_id, const struct TALER_MerchantPublicKeyP *merchant_pub, - const struct GNUNET_HashCode *h_contract, + const struct TALER_PrivateContractHash *h_contract, unsigned int num_coins, const struct TALER_MERCHANT_AbortCoin coins[], TALER_MERCHANT_AbortCallback cb, diff --git a/src/lib/merchant_api_post_order_claim.c b/src/lib/merchant_api_post_order_claim.c index 442185b5..a933226b 100644 --- a/src/lib/merchant_api_post_order_claim.c +++ b/src/lib/merchant_api_post_order_claim.c @@ -87,7 +87,7 @@ handle_post_order_claim_finished (void *cls, struct TALER_MERCHANT_OrderClaimHandle *och = cls; json_t *contract_terms; struct TALER_MerchantSignatureP sig; - struct GNUNET_HashCode hash; + struct TALER_PrivateContractHash hash; const json_t *json = response; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_json ("contract_terms", diff --git a/src/lib/merchant_api_post_order_paid.c b/src/lib/merchant_api_post_order_paid.c index cb3a8379..8e9cf9ac 100644 --- a/src/lib/merchant_api_post_order_paid.c +++ b/src/lib/merchant_api_post_order_paid.c @@ -165,7 +165,7 @@ TALER_MERCHANT_order_paid ( const char *merchant_url, const char *order_id, const char *session_id, - const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_PrivateContractHash *h_contract_terms, const struct TALER_MerchantSignatureP *merchant_sig, TALER_MERCHANT_OrderPaidCallback paid_cb, void *paid_cb_cls) diff --git a/src/lib/merchant_api_post_order_pay.c b/src/lib/merchant_api_post_order_pay.c index e5d8cb5e..98e2f359 100644 --- a/src/lib/merchant_api_post_order_pay.c +++ b/src/lib/merchant_api_post_order_pay.c @@ -81,7 +81,7 @@ struct TALER_MERCHANT_OrderPayHandle * Hash of the contract we are paying, set * if @e am_wallet is true. */ - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; /** * Public key of the merchant (instance) being paid, set @@ -119,8 +119,8 @@ check_coin_history (const struct TALER_MERCHANT_PaidCoin *pc, { struct TALER_Amount spent; struct TALER_Amount spent_plus_contrib; - struct GNUNET_HashCode h_denom_pub; - struct GNUNET_HashCode h_denom_pub_pc; + struct TALER_DenominationHash h_denom_pub; + struct TALER_DenominationHash h_denom_pub_pc; if (GNUNET_OK != TALER_EXCHANGE_verify_coin_history (NULL, /* do not verify fees */ @@ -143,8 +143,8 @@ check_coin_history (const struct TALER_MERCHANT_PaidCoin *pc, GNUNET_break (0); return GNUNET_SYSERR; } - GNUNET_CRYPTO_rsa_public_key_hash (pc->denom_pub.rsa_public_key, - &h_denom_pub_pc); + TALER_denom_pub_hash (&pc->denom_pub, + &h_denom_pub_pc); if ( (-1 != TALER_amount_cmp (&pc->denom_value, &spent_plus_contrib)) && (0 != GNUNET_memcmp (&h_denom_pub, @@ -442,7 +442,7 @@ TALER_MERCHANT_order_pay_frontend ( json_t *j_coin; const struct TALER_MERCHANT_PaidCoin *pc = &coins[i]; struct TALER_Amount fee; - struct GNUNET_HashCode denom_hash; + struct TALER_DenominationHash denom_hash; if (0 > TALER_amount_subtract (&fee, @@ -478,8 +478,8 @@ TALER_MERCHANT_order_pay_frontend ( } } - GNUNET_CRYPTO_rsa_public_key_hash (pc->denom_pub.rsa_public_key, - &denom_hash); + TALER_denom_pub_hash (&pc->denom_pub, + &denom_hash); /* create JSON for this coin */ j_coin = GNUNET_JSON_PACK ( TALER_JSON_pack_amount ("contribution", @@ -490,8 +490,8 @@ TALER_MERCHANT_order_pay_frontend ( pc->exchange_url), GNUNET_JSON_pack_data_auto ("h_denom", &denom_hash), - TALER_JSON_pack_denomination_signature ("ub_sig", - &pc->denom_sig), + TALER_JSON_pack_denom_sig ("ub_sig", + &pc->denom_sig), GNUNET_JSON_pack_data_auto ("coin_sig", &pc->coin_sig)); if (0 != @@ -571,7 +571,8 @@ struct TALER_MERCHANT_OrderPayHandle * TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx, const char *merchant_url, const char *session_id, - const struct GNUNET_HashCode *h_contract_terms, + const struct + TALER_PrivateContractHash *h_contract_terms, const struct TALER_Amount *amount, const struct TALER_Amount *max_fee, const struct TALER_MerchantPublicKeyP *merchant_pub, @@ -579,7 +580,7 @@ TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx, struct GNUNET_TIME_Absolute timestamp, struct GNUNET_TIME_Absolute refund_deadline, struct GNUNET_TIME_Absolute pay_deadline, - const struct GNUNET_HashCode *h_wire, + const struct TALER_MerchantWireHash *h_wire, const char *order_id, unsigned int num_coins, const struct TALER_MERCHANT_PayCoin coins[], @@ -632,8 +633,8 @@ TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx, } TALER_amount_hton (&dr.deposit_fee, &fee); - GNUNET_CRYPTO_rsa_public_key_hash (coin->denom_pub.rsa_public_key, - &dr.h_denom_pub); + TALER_denom_pub_hash (&coin->denom_pub, + &dr.h_denom_pub); GNUNET_CRYPTO_eddsa_sign (&coin->coin_priv.eddsa_priv, &dr, &p->coin_sig.eddsa_signature); diff --git a/src/lib/merchant_api_post_order_refund.c b/src/lib/merchant_api_post_order_refund.c index 9829e187..e6104285 100644 --- a/src/lib/merchant_api_post_order_refund.c +++ b/src/lib/merchant_api_post_order_refund.c @@ -101,7 +101,7 @@ handle_refund_finished (void *cls, case MHD_HTTP_OK: { const char *taler_refund_uri; - struct GNUNET_HashCode h_contract; + struct TALER_PrivateContractHash h_contract; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("taler_refund_uri", &taler_refund_uri), diff --git a/src/lib/merchant_api_tip_pickup.c b/src/lib/merchant_api_tip_pickup.c index 956e07ab..5538d71c 100644 --- a/src/lib/merchant_api_tip_pickup.c +++ b/src/lib/merchant_api_tip_pickup.c @@ -50,7 +50,7 @@ struct PlanchetData /** * Hash of the public key of the coin we are signing. */ - struct GNUNET_HashCode c_hash; + struct TALER_CoinPubHash c_hash; }; @@ -160,8 +160,7 @@ pickup_done_cb (void *cls, NULL); } for (unsigned int i = 0; i<num_blind_sigs; i++) - if (NULL != sigs[i].rsa_signature) - GNUNET_CRYPTO_rsa_signature_free (sigs[i].rsa_signature); + TALER_denom_sig_free (&sigs[i]); } TALER_MERCHANT_tip_pickup_cancel (tp); } @@ -210,8 +209,8 @@ TALER_MERCHANT_tip_pickup (struct GNUNET_CURL_Context *ctx, for (unsigned int i = 0; i<num_planchets; i++) { tp->planchets[i].pk = *pds[i].pk; - tp->planchets[i].pk.key.rsa_public_key - = GNUNET_CRYPTO_rsa_public_key_dup (pds[i].pk->key.rsa_public_key); + TALER_denom_pub_deep_copy (&tp->planchets[i].pk.key, + &pds[i].pk->key); } tp->cb = pickup_cb; tp->cb_cls = pickup_cb_cls; @@ -238,7 +237,7 @@ void TALER_MERCHANT_tip_pickup_cancel (struct TALER_MERCHANT_TipPickupHandle *tp) { for (unsigned int i = 0; i<tp->num_planchets; i++) - GNUNET_CRYPTO_rsa_public_key_free (tp->planchets[i].pk.key.rsa_public_key); + TALER_denom_pub_free (&tp->planchets[i].pk.key); GNUNET_array_grow (tp->planchets, tp->num_planchets, 0); diff --git a/src/lib/merchant_api_wallet_get_order.c b/src/lib/merchant_api_wallet_get_order.c index 06806e0f..2ae9d14f 100644 --- a/src/lib/merchant_api_wallet_get_order.c +++ b/src/lib/merchant_api_wallet_get_order.c @@ -215,16 +215,17 @@ handle_wallet_get_order_finished (void *cls, struct TALER_MERCHANT_OrderWalletGetHandle * -TALER_MERCHANT_wallet_order_get (struct GNUNET_CURL_Context *ctx, - const char *backend_url, - const char *order_id, - const struct GNUNET_HashCode *h_contract, - struct GNUNET_TIME_Relative timeout, - const char *session_id, - const struct TALER_Amount *min_refund, - bool await_refund_obtained, - TALER_MERCHANT_OrderWalletGetCallback cb, - void *cb_cls) +TALER_MERCHANT_wallet_order_get ( + struct GNUNET_CURL_Context *ctx, + const char *backend_url, + const char *order_id, + const struct TALER_PrivateContractHash *h_contract, + struct GNUNET_TIME_Relative timeout, + const char *session_id, + const struct TALER_Amount *min_refund, + bool await_refund_obtained, + TALER_MERCHANT_OrderWalletGetCallback cb, + void *cb_cls) { struct TALER_MERCHANT_OrderWalletGetHandle *owgh; unsigned long long tms; @@ -249,7 +250,7 @@ TALER_MERCHANT_wallet_order_get (struct GNUNET_CURL_Context *ctx, struct GNUNET_CRYPTO_HashAsciiEncoded h_contract_s; char *path; - GNUNET_CRYPTO_hash_to_enc (h_contract, + GNUNET_CRYPTO_hash_to_enc (&h_contract->hash, &h_contract_s); GNUNET_snprintf (timeout_ms, sizeof (timeout_ms), diff --git a/src/lib/merchant_api_wallet_post_order_refund.c b/src/lib/merchant_api_wallet_post_order_refund.c index e2438cba..1ba8b33c 100644 --- a/src/lib/merchant_api_wallet_post_order_refund.c +++ b/src/lib/merchant_api_wallet_post_order_refund.c @@ -348,7 +348,7 @@ TALER_MERCHANT_wallet_post_order_refund ( struct GNUNET_CURL_Context *ctx, const char *backend_url, const char *order_id, - const struct GNUNET_HashCode *h_contract_terms, + const struct TALER_PrivateContractHash *h_contract_terms, TALER_MERCHANT_WalletRefundCallback cb, void *cb_cls) { diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index 057c7f81..80359f3e 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am @@ -63,12 +63,7 @@ libtalermerchanttesting_la_SOURCES = \ testing_api_cmd_wallet_get_tip.c \ testing_api_cmd_wallet_post_orders_refund.c \ testing_api_helpers.c \ - testing_api_trait_claim_nonce.c \ - testing_api_trait_merchant_sig.c \ - testing_api_trait_string.c \ - testing_api_trait_hash.c \ - testing_api_trait_planchet.c \ - testing_api_trait_refund_entry.c + testing_api_traits.c libtalermerchanttesting_la_LIBADD = \ $(top_srcdir)/src/lib/libtalermerchant.la \ diff --git a/src/testing/testing_api_cmd_abort_order.c b/src/testing/testing_api_cmd_abort_order.c index d515a361..966d93ff 100644 --- a/src/testing/testing_api_cmd_abort_order.c +++ b/src/testing/testing_api_cmd_abort_order.c @@ -151,10 +151,10 @@ build_coins (struct TALER_MERCHANT_AbortCoin **ac, &icoin->exchange_url)); { const struct TALER_Amount *denom_value; - GNUNET_assert (GNUNET_OK - == TALER_TESTING_get_trait_amount_obj (coin_cmd, - 0, - &denom_value)); + + GNUNET_assert (GNUNET_OK == + TALER_TESTING_get_trait_amount (coin_cmd, + &denom_value)); icoin->amount_with_fee = *denom_value; } @@ -235,7 +235,7 @@ abort_run (void *cls, const char *amount_with_fee; const struct TALER_TESTING_Command *proposal_cmd; const char *order_id; - const struct GNUNET_HashCode *h_proposal; + const struct TALER_PrivateContractHash *h_proposal; struct TALER_MerchantPublicKeyP merchant_pub; struct TALER_Amount total_amount; const char *error_name; @@ -251,7 +251,6 @@ abort_run (void *cls, TALER_TESTING_FAIL (is); if (GNUNET_OK != TALER_TESTING_get_trait_proposal_reference (pay_cmd, - 0, &proposal_reference)) TALER_TESTING_FAIL (is); if (GNUNET_OK != @@ -275,7 +274,6 @@ abort_run (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_contract_terms (proposal_cmd, - 0, &contract_terms)) TALER_TESTING_FAIL (is); { @@ -332,7 +330,6 @@ abort_run (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_h_contract_terms (proposal_cmd, - 0, &h_proposal)) TALER_TESTING_FAIL (is); as->oah = TALER_MERCHANT_order_abort (is->ctx, diff --git a/src/testing/testing_api_trait_claim_nonce.c b/src/testing/testing_api_trait_claim_nonce.c deleted file mode 100644 index 7a878812..00000000 --- a/src/testing/testing_api_trait_claim_nonce.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2020 Taler Systems SA - - 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 Foundation; either version 3, or - (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with TALER; see the file COPYING. If not, see - <http://www.gnu.org/licenses/> -*/ -/** - * @file testing_api_trait_claim_nonce.c - * @brief offer a trait that is the nonce used to claim an order. - * @author Jonathan Buchanan - */ -#include "platform.h" -#include <taler/taler_signatures.h> -#include <taler/taler_exchange_service.h> -#include <taler/taler_testing_lib.h> - -#define TALER_TESTING_TRAIT_CLAIM_NONCE "nonce" - - -int -TALER_TESTING_get_trait_claim_nonce - (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct GNUNET_CRYPTO_EddsaPublicKey **nonce) -{ - return cmd->traits (cmd->cls, - (const void **) nonce, - TALER_TESTING_TRAIT_CLAIM_NONCE, - index); -} - - -struct TALER_TESTING_Trait -TALER_TESTING_make_trait_claim_nonce - (unsigned int index, - const struct GNUNET_CRYPTO_EddsaPublicKey *nonce) -{ - struct TALER_TESTING_Trait ret = { - .index = index, - .trait_name = TALER_TESTING_TRAIT_CLAIM_NONCE, - .ptr = (const void *) nonce - }; - return ret; -} - - -/* end of testing_api_trait_claim_nonce.c */ diff --git a/src/testing/testing_api_trait_hash.c b/src/testing/testing_api_trait_hash.c deleted file mode 100644 index 17360626..00000000 --- a/src/testing/testing_api_trait_hash.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2018 Taler Systems SA - - 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 Foundation; either version 3, or - (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with TALER; see the file COPYING. If not, see - <http://www.gnu.org/licenses/> -*/ -/** - * @file testing_api_trait_hash.c - * @brief offer any trait that is passed over as a hash code. - * @author Marcello Stanisci - */ -#include "platform.h" -#include <taler/taler_signatures.h> -#include <taler/taler_exchange_service.h> -#include <taler/taler_testing_lib.h> - -/** - * FIXME: have _one_ pair of getter/setter for hash-coded - * traits and define the getters/setters for tip id and hashed - * contract terms as _macros_. - */ - -#define TALER_TESTING_TRAIT_TIP_ID "tip-id" -#define TALER_TESTING_TRAIT_H_CONTRACT_TERMS "h-contract-terms" - -int -TALER_TESTING_get_trait_tip_id - (const struct TALER_TESTING_Command *cmd, - unsigned int index, - struct GNUNET_HashCode **tip_id) -{ - return cmd->traits (cmd->cls, - (const void **) tip_id, - TALER_TESTING_TRAIT_TIP_ID, - index); -} - - -struct TALER_TESTING_Trait -TALER_TESTING_make_trait_tip_id - (unsigned int index, - const struct GNUNET_HashCode *tip_id) -{ - struct TALER_TESTING_Trait ret = { - .index = index, - .trait_name = TALER_TESTING_TRAIT_TIP_ID, - .ptr = (const void *) tip_id - }; - return ret; -} - - -int -TALER_TESTING_get_trait_h_contract_terms - (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct GNUNET_HashCode **h_contract_terms) -{ - return cmd->traits (cmd->cls, - (const void **) h_contract_terms, - TALER_TESTING_TRAIT_H_CONTRACT_TERMS, - index); -} - - -struct TALER_TESTING_Trait -TALER_TESTING_make_trait_h_contract_terms - (unsigned int index, - const struct GNUNET_HashCode *h_contract_terms) -{ - struct TALER_TESTING_Trait ret = { - .index = index, - .trait_name = TALER_TESTING_TRAIT_H_CONTRACT_TERMS, - .ptr = (const void *) h_contract_terms - }; - return ret; -} diff --git a/src/testing/testing_api_trait_merchant_sig.c b/src/testing/testing_api_trait_merchant_sig.c deleted file mode 100644 index 2662a870..00000000 --- a/src/testing/testing_api_trait_merchant_sig.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2018 Taler Systems SA - - 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 Foundation; either version 3, or - (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with TALER; see the file COPYING. If not, see - <http://www.gnu.org/licenses/> -*/ -/** - * @file testing_api_trait_merchant_sig.c - * @brief offer merchant signature over contract - * @author Marcello Stanisci - */ -#include "platform.h" -#include <taler/taler_signatures.h> -#include <taler/taler_exchange_service.h> -#include <taler/taler_testing_lib.h> - -#define TALER_TESTING_TRAIT_MERCHANT_SIG "reserve-private-key" - -int -TALER_TESTING_get_trait_merchant_sig - (const struct TALER_TESTING_Command *cmd, - unsigned int index, - struct TALER_MerchantSignatureP **merchant_sig) -{ - return cmd->traits (cmd->cls, - (const void **) merchant_sig, - TALER_TESTING_TRAIT_MERCHANT_SIG, - index); -} - - -struct TALER_TESTING_Trait -TALER_TESTING_make_trait_merchant_sig - (unsigned int index, - const struct TALER_MerchantSignatureP *merchant_sig) -{ - struct TALER_TESTING_Trait ret = { - .index = index, - .trait_name = TALER_TESTING_TRAIT_MERCHANT_SIG, - .ptr = (const void *) merchant_sig - }; - return ret; -} - - -/* end of testing_api_trait_merchant_sig.c */ diff --git a/src/testing/testing_api_trait_planchet.c b/src/testing/testing_api_trait_planchet.c deleted file mode 100644 index 97ee8881..00000000 --- a/src/testing/testing_api_trait_planchet.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2018 Taler Systems SA - - 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 Foundation; either version 3, or - (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with TALER; see the file COPYING. If not, see - <http://www.gnu.org/licenses/> -*/ -/** - * @file testing_api_trait_planchet.c - * @brief offer planchet secrets as trait. - * @author Marcello Stanisci - */ -#include "platform.h" -#include <taler/taler_signatures.h> -#include <taler/taler_exchange_service.h> -#include <taler/taler_testing_lib.h> - -#define TALER_TESTING_TRAIT_PLANCHET_SECRETS "planchet-secrets" - -int -TALER_TESTING_get_trait_planchet_secrets - (const struct TALER_TESTING_Command *cmd, - unsigned int index, - struct TALER_PlanchetSecretsP **planchet_secrets) -{ - return cmd->traits (cmd->cls, - (const void **) planchet_secrets, - TALER_TESTING_TRAIT_PLANCHET_SECRETS, - index); -} - - -struct TALER_TESTING_Trait -TALER_TESTING_make_trait_planchet_secrets - (unsigned int index, - const struct TALER_PlanchetSecretsP *planchet_secrets) -{ - struct TALER_TESTING_Trait ret = { - .index = index, - .trait_name = TALER_TESTING_TRAIT_PLANCHET_SECRETS, - .ptr = (const void *) planchet_secrets - }; - return ret; -} - - -/* end of testing_api_trait_planchet.c */ diff --git a/src/testing/testing_api_trait_refund_entry.c b/src/testing/testing_api_trait_refund_entry.c deleted file mode 100644 index 5c99bac2..00000000 --- a/src/testing/testing_api_trait_refund_entry.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2014-2018 Taler Systems SA - - 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 Foundation; either version 3, or - (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with TALER; see the file COPYING. If not, see - <http://www.gnu.org/licenses/> -*/ - -/** - * @file testing_api_trait_refund_entry.c - * @brief command to offer refund entry trait. - * @author Marcello Stanisci - */ - -#include "platform.h" -#include <taler/taler_signatures.h> -#include <taler/taler_exchange_service.h> -#include <taler/taler_testing_lib.h> -#include "taler_merchant_service.h" - -// FIXME: rename: entry->detail! - -#define TALER_TESTING_TRAIT_REFUND_ENTRY "refund-entry" - -int -TALER_TESTING_get_trait_refund_entry ( - const struct TALER_TESTING_Command *cmd, - unsigned int index, - const struct TALER_MERCHANT_RefundDetail **refund_entry) -{ - return cmd->traits (cmd->cls, - (const void **) refund_entry, - TALER_TESTING_TRAIT_REFUND_ENTRY, - index); -} - - -struct TALER_TESTING_Trait -TALER_TESTING_make_trait_refund_entry ( - unsigned int index, - const struct TALER_MERCHANT_RefundDetail *refund_entry) -{ - struct TALER_TESTING_Trait ret = { - .index = index, - .trait_name = TALER_TESTING_TRAIT_REFUND_ENTRY, - .ptr = (const void *) refund_entry - }; - return ret; -} - - -/* end of testing_api_trait_refund_entry.c */ diff --git a/src/testing/testing_api_trait_string.c b/src/testing/testing_api_trait_string.c deleted file mode 100644 index eae2e077..00000000 --- a/src/testing/testing_api_trait_string.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - This file is part of TALER - Copyright (C) 2018 Taler Systems SA - - 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 Foundation; either version 3, or - (at your option) any later version. - - TALER is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with TALER; see the file COPYING. If not, see - <http://www.gnu.org/licenses/> -*/ -/** - * @file testing_api_trait_string.c - * @brief offer traits that come as strings. - * @author Marcello Stanisci - */ -#include "platform.h" -#include <taler/taler_signatures.h> -#include <taler/taler_exchange_service.h> -#include <taler/taler_testing_lib.h> - -#define TALER_TESTING_TRAIT_PROPOSAL_REFERENCE "proposal-reference" -#define TALER_TESTING_TRAIT_COIN_REFERENCE "coin-reference" - - -int -TALER_TESTING_get_trait_proposal_reference - (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const char **proposal_reference) -{ - return cmd->traits (cmd->cls, - (const void **) proposal_reference, - TALER_TESTING_TRAIT_PROPOSAL_REFERENCE, - index); -} - - -struct TALER_TESTING_Trait -TALER_TESTING_make_trait_proposal_reference - (unsigned int index, - const char *proposal_reference) -{ - struct TALER_TESTING_Trait ret = { - .index = index, - .trait_name = TALER_TESTING_TRAIT_PROPOSAL_REFERENCE, - .ptr = (const void *) proposal_reference - }; - return ret; -} - - -int -TALER_TESTING_get_trait_coin_reference - (const struct TALER_TESTING_Command *cmd, - unsigned int index, - const char **coin_reference) -{ - return cmd->traits (cmd->cls, - (const void **) coin_reference, - TALER_TESTING_TRAIT_COIN_REFERENCE, - index); -} - - -struct TALER_TESTING_Trait -TALER_TESTING_make_trait_coin_reference - (unsigned int index, - const char *coin_reference) -{ - struct TALER_TESTING_Trait ret = { - .index = index, - .trait_name = TALER_TESTING_TRAIT_COIN_REFERENCE, - .ptr = (const void *) coin_reference - }; - return ret; -} - - -/* end of testing_api_trait_string.c */ diff --git a/src/testing/testing_api_traits.c b/src/testing/testing_api_traits.c new file mode 100644 index 00000000..a0eb0fc2 --- /dev/null +++ b/src/testing/testing_api_traits.c @@ -0,0 +1,37 @@ +/* + This file is part of TALER + Copyright (C) 2018, 2021 Taler Systems SA + + 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 Foundation; either version 3, or + (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with TALER; see the file COPYING. If not, see + <http://www.gnu.org/licenses/> +*/ +/** + * @file testing/testing_api_traits.c + * @brief loop for trait resolution + * @author Christian Grothoff + * @author Marcello Stanisci + */ +#include "platform.h" +#include "taler_json_lib.h" +#include <gnunet/gnunet_curl_lib.h> +#include "taler_signatures.h" +#include "taler_testing_lib.h" + + +TALER_MERCHANT_TESTING_SIMPLE_TRAITS (TALER_TESTING_MAKE_IMPL_SIMPLE_TRAIT) + +TALER_MERCHANT_TESTING_INDEXED_TRAITS (TALER_TESTING_MAKE_IMPL_INDEXED_TRAIT) + + +/* end of testing_api_traits.c */ |