diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-10-28 21:41:46 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-10-28 21:41:46 +0200 |
commit | e1d16d11269a1fae896e200afd70e38d0040928d (patch) | |
tree | 91f80a2f58dd1dc41ffbbd82df09fb37df22eaa6 | |
parent | 7d23dbe6ee21afc6d28df50516e694f205aada29 (diff) | |
download | merchant-e1d16d11269a1fae896e200afd70e38d0040928d.tar.gz merchant-e1d16d11269a1fae896e200afd70e38d0040928d.tar.bz2 merchant-e1d16d11269a1fae896e200afd70e38d0040928d.zip |
fix FTBFS
-rw-r--r-- | src/include/taler_merchant_testing_lib.h | 3 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_patch_instance.c | 25 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_patch_product.c | 24 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_post_instances.c | 4 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_refund_order.c | 21 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_tip_authorize.c | 31 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_tip_pickup.c | 40 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_wallet_get_order.c | 22 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_wallet_get_tip.c | 1 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_wallet_post_orders_refund.c | 19 | ||||
-rw-r--r-- | src/testing/testing_api_traits.c | 5 |
11 files changed, 85 insertions, 110 deletions
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h index 8b6724f1..9fbb4f56 100644 --- a/src/include/taler_merchant_testing_lib.h +++ b/src/include/taler_merchant_testing_lib.h @@ -1490,7 +1490,6 @@ TALER_TESTING_cmd_tip_pickup (const char *label, op (paths_length, const uint32_t) \ op (payto_length, const uint32_t) \ op (num_planchets, const uint32_t) \ - op (tip_id, const struct GNUNET_HashCode) \ op (i18n_description, const json_t) \ op (taxes, const json_t) \ op (fee, const struct TALER_Amount) \ @@ -1513,7 +1512,7 @@ TALER_TESTING_cmd_tip_pickup (const char *label, op (paths, const char *) \ op (payto_uris, const char *) \ op (amounts, const struct TALER_Amount) \ - op (planchet_secrets, struct TALER_PlanchetSecretsP *) + op (planchet_secrets, const struct TALER_PlanchetSecretsP) TALER_MERCHANT_TESTING_SIMPLE_TRAITS (TALER_TESTING_MAKE_DECL_SIMPLE_TRAIT) diff --git a/src/testing/testing_api_cmd_patch_instance.c b/src/testing/testing_api_cmd_patch_instance.c index 44ae355e..348163af 100644 --- a/src/testing/testing_api_cmd_patch_instance.c +++ b/src/testing/testing_api_cmd_patch_instance.c @@ -212,32 +212,33 @@ patch_instance_traits (void *cls, #define NUM_TRAITS (pis->payto_uris_length) + 11 struct TALER_TESTING_Trait traits[NUM_TRAITS]; traits[0] = - TALER_TESTING_make_trait_string (0, pis->name); + TALER_TESTING_make_trait_instance_name (&pis->name); traits[1] = - TALER_TESTING_make_trait_string (1, pis->instance_id); + TALER_TESTING_make_trait_instance_id (&pis->instance_id); traits[2] = - TALER_TESTING_make_trait_json (0, pis->address); + TALER_TESTING_make_trait_address (pis->address); traits[3] = - TALER_TESTING_make_trait_json (1, pis->jurisdiction); + TALER_TESTING_make_trait_jurisdiction (pis->jurisdiction); traits[4] = - TALER_TESTING_make_trait_amount_obj (0, &pis->default_max_wire_fee); + TALER_TESTING_make_trait_max_wire_fee (&pis->default_max_wire_fee); traits[5] = - TALER_TESTING_make_trait_uint32 (0, &pis->default_wire_fee_amortization); + TALER_TESTING_make_trait_wire_fee_amortization ( + &pis->default_wire_fee_amortization); traits[6] = - TALER_TESTING_make_trait_amount_obj (1, &pis->default_max_deposit_fee); + TALER_TESTING_make_trait_max_deposit_fee (&pis->default_max_deposit_fee); traits[7] = - TALER_TESTING_make_trait_relative_time (0, - &pis->default_wire_transfer_delay); + TALER_TESTING_make_trait_wire_delay (&pis->default_wire_transfer_delay); traits[8] = - TALER_TESTING_make_trait_relative_time (1, &pis->default_pay_delay); + TALER_TESTING_make_trait_pay_delay (&pis->default_pay_delay); traits[9] = - TALER_TESTING_make_trait_uint32 (1, &pis->payto_uris_length); + TALER_TESTING_make_trait_payto_length (&pis->payto_uris_length); traits[NUM_TRAITS - 1] = TALER_TESTING_trait_end (); for (unsigned int i = 0; i < pis->payto_uris_length; ++i) { traits[10 + i] = - TALER_TESTING_make_trait_string (2 + i, pis->payto_uris[i]); + TALER_TESTING_make_trait_payto_uris (i, + &pis->payto_uris[i]); } return TALER_TESTING_get_trait (traits, diff --git a/src/testing/testing_api_cmd_patch_product.c b/src/testing/testing_api_cmd_patch_product.c index fd0b8d49..41d992e2 100644 --- a/src/testing/testing_api_cmd_patch_product.c +++ b/src/testing/testing_api_cmd_patch_product.c @@ -201,7 +201,7 @@ patch_product_run (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue patch_product_traits (void *cls, const void **ret, const char *trait, @@ -209,16 +209,18 @@ patch_product_traits (void *cls, { struct PatchProductState *pps = cls; struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_string (0, pps->description), - TALER_TESTING_make_trait_json (0, pps->description_i18n), - TALER_TESTING_make_trait_string (1, pps->unit), - TALER_TESTING_make_trait_amount_obj (0, &pps->price), - TALER_TESTING_make_trait_string (3, pps->image), - TALER_TESTING_make_trait_json (2, pps->taxes), - TALER_TESTING_make_trait_int64 (0, &pps->total_stock), - TALER_TESTING_make_trait_json (3, pps->address), - TALER_TESTING_make_trait_absolute_time (0, &pps->next_restock), - TALER_TESTING_make_trait_string (2, pps->product_id), + TALER_TESTING_make_trait_product_description (&pps->description), + TALER_TESTING_make_trait_i18n_description (pps->description_i18n), + TALER_TESTING_make_trait_product_unit (&pps->unit), + TALER_TESTING_make_trait_amount (&pps->price), + TALER_TESTING_make_trait_product_image ( + (const char **) &pps->image), + TALER_TESTING_make_trait_taxes (pps->taxes), + TALER_TESTING_make_trait_product_stock (&pps->total_stock), + TALER_TESTING_make_trait_address (pps->address), + TALER_TESTING_make_trait_absolute_time (0, + &pps->next_restock), + TALER_TESTING_make_trait_product_id (&pps->product_id), TALER_TESTING_trait_end (), }; diff --git a/src/testing/testing_api_cmd_post_instances.c b/src/testing/testing_api_cmd_post_instances.c index 5e6d0c93..4d1f0d26 100644 --- a/src/testing/testing_api_cmd_post_instances.c +++ b/src/testing/testing_api_cmd_post_instances.c @@ -225,7 +225,7 @@ post_instances_traits (void *cls, #define NUM_TRAITS (pis->payto_uris_length) + 11 struct TALER_TESTING_Trait traits[NUM_TRAITS]; traits[0] = - TALER_TESTING_make_trait_product_id (&pis->name); + TALER_TESTING_make_trait_instance_name (&pis->name); traits[1] = TALER_TESTING_make_trait_instance_id (&pis->instance_id); traits[2] = @@ -251,7 +251,7 @@ post_instances_traits (void *cls, { traits[10 + i] = TALER_TESTING_make_trait_payto_uris (i, - pis->payto_uris[i]); + &pis->payto_uris[i]); } return TALER_TESTING_get_trait (traits, diff --git a/src/testing/testing_api_cmd_refund_order.c b/src/testing/testing_api_cmd_refund_order.c index fd06f887..15154149 100644 --- a/src/testing/testing_api_cmd_refund_order.c +++ b/src/testing/testing_api_cmd_refund_order.c @@ -52,7 +52,7 @@ struct RefundState /** * The amount to refund. */ - const char *refund_amount; + struct TALER_Amount refund_amount; /** * Human-readable justification for the refund. @@ -85,7 +85,7 @@ static void refund_cb (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) { struct RefundState *ris = cls; @@ -184,17 +184,12 @@ refund_increase_run (void *cls, struct TALER_TESTING_Interpreter *is) { struct RefundState *ris = cls; - struct TALER_Amount refund_amount; ris->is = is; - if (GNUNET_OK != - TALER_string_to_amount (ris->refund_amount, - &refund_amount)) - TALER_TESTING_FAIL (is); ris->orh = TALER_MERCHANT_post_order_refund (is->ctx, ris->merchant_url, ris->order_id, - &refund_amount, + &ris->refund_amount, ris->reason, &refund_cb, ris); @@ -221,10 +216,8 @@ refund_increase_traits (void *cls, { struct RefundState *ris = cls; struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_string (0, - ris->refund_amount), - TALER_TESTING_make_trait_string (1, - ris->reason), + TALER_TESTING_make_trait_amount (&ris->refund_amount), + TALER_TESTING_make_trait_reason (&ris->reason), TALER_TESTING_trait_end () }; @@ -270,7 +263,9 @@ TALER_TESTING_cmd_merchant_order_refund (const char *label, ris = GNUNET_new (struct RefundState); ris->merchant_url = merchant_url; ris->order_id = order_id; - ris->refund_amount = refund_amount; + GNUNET_assert (GNUNET_OK == + TALER_string_to_amount (refund_amount, + &ris->refund_amount)); ris->reason = reason; ris->http_code = http_code; { diff --git a/src/testing/testing_api_cmd_tip_authorize.c b/src/testing/testing_api_cmd_tip_authorize.c index 3fb4c1bc..4be6b30a 100644 --- a/src/testing/testing_api_cmd_tip_authorize.c +++ b/src/testing/testing_api_cmd_tip_authorize.c @@ -198,28 +198,26 @@ tip_authorize_cb (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue tip_authorize_traits (void *cls, const void **ret, const char *trait, unsigned int index) { struct TipAuthorizeState *tas = cls; - - { - struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_tip_id (0, &tas->tip_id), - TALER_TESTING_make_trait_amount_obj (0, &tas->amount), - TALER_TESTING_make_trait_string (0, tas->justification), - TALER_TESTING_make_trait_absolute_time (0, &tas->tip_expiration), - TALER_TESTING_trait_end (), - }; - - return TALER_TESTING_get_trait (traits, - ret, - trait, - index); - } + struct TALER_TESTING_Trait traits[] = { + TALER_TESTING_make_trait_tip_id (&tas->tip_id), + TALER_TESTING_make_trait_amount (&tas->amount), + TALER_TESTING_make_trait_reason (&tas->justification), + TALER_TESTING_make_trait_absolute_time (0, + &tas->tip_expiration), + TALER_TESTING_trait_end (), + }; + + return TALER_TESTING_get_trait (traits, + ret, + trait, + index); } @@ -270,7 +268,6 @@ do_retry (void *cls) tas->reserve_reference); GNUNET_assert (GNUNET_OK == TALER_TESTING_get_trait_reserve_pub (reserve_cmd, - 0, &reserve_pub)); tas->tao = TALER_MERCHANT_tip_authorize2 (tas->is->ctx, tas->merchant_url, diff --git a/src/testing/testing_api_cmd_tip_pickup.c b/src/testing/testing_api_cmd_tip_pickup.c index 019113ae..1c72f02b 100644 --- a/src/testing/testing_api_cmd_tip_pickup.c +++ b/src/testing/testing_api_cmd_tip_pickup.c @@ -92,7 +92,7 @@ struct TipPickupState /** * How many coins are involved in the tipping operation. */ - uint64_t num_coins; + uint32_t num_coins; /** * The array of denomination keys, in the same order of @a @@ -165,8 +165,8 @@ pickup_cb (void *cls, tps->sigs = GNUNET_new_array (tps->num_coins, struct TALER_DenominationSignature); for (unsigned int i = 0; i<num_sigs; i++) - tps->sigs[i].rsa_signature - = GNUNET_CRYPTO_rsa_signature_dup (sigs[i].rsa_signature); + TALER_denom_sig_deep_copy (&tps->sigs[i], + &sigs[i]); TALER_TESTING_interpreter_next (tps->is); } @@ -203,7 +203,7 @@ tip_pickup_run (void *cls, } else { - const unsigned int *np; + const uint32_t *np; if (NULL == /* looking for "parent" tip-pickup command */ (replay_cmd @@ -212,9 +212,8 @@ tip_pickup_run (void *cls, TALER_TESTING_FAIL (is); if (GNUNET_OK != - TALER_TESTING_get_trait_uint (replay_cmd, - 0, - &np)) + TALER_TESTING_get_trait_num_planchets (replay_cmd, + &np)) TALER_TESTING_FAIL (is); num_planchets = *np; } @@ -259,7 +258,7 @@ tip_pickup_run (void *cls, } else { - struct TALER_PlanchetSecretsP *ps; + const struct TALER_PlanchetSecretsP *ps; if (GNUNET_OK != TALER_TESTING_get_trait_denom_pub (replay_cmd, @@ -278,7 +277,6 @@ tip_pickup_run (void *cls, } if (GNUNET_OK != TALER_TESTING_get_trait_tip_id (authorize_cmd, - 0, &tip_id)) TALER_TESTING_FAIL (is); @@ -313,8 +311,7 @@ tip_pickup_cleanup (void *cls, if (NULL != tps->sigs) { for (unsigned int i = 0; i<tps->num_coins; i++) - if (NULL != tps->sigs[i].rsa_signature) - GNUNET_CRYPTO_rsa_signature_free (tps->sigs[i].rsa_signature); + TALER_denom_sig_free (&tps->sigs[i]); GNUNET_free (tps->sigs); } if (NULL != tps->tpo) @@ -341,23 +338,24 @@ tip_pickup_traits (void *cls, traits[i] = TALER_TESTING_make_trait_planchet_secrets (i, &tps->psa[i]); traits[i + tps->num_coins] = - TALER_TESTING_make_trait_coin_priv (i, &tps->psa[i].coin_priv); + TALER_TESTING_make_trait_coin_priv (i, + &tps->psa[i].coin_priv); traits[i + (tps->num_coins * 2)] = - TALER_TESTING_make_trait_denom_pub (i, tps->dks[i]); + TALER_TESTING_make_trait_denom_pub (i, + tps->dks[i]); traits[i + (tps->num_coins * 3)] = - TALER_TESTING_make_trait_denom_sig (i, &tps->sigs[i]); + TALER_TESTING_make_trait_denom_sig (i, + &tps->sigs[i]); traits[i + (tps->num_coins * 4)] = - TALER_TESTING_make_trait_amount_obj (i, &tps->amounts_obj[i]); + TALER_TESTING_make_trait_amounts (i, + &tps->amounts_obj[i]); } traits[NUM_TRAITS - 4] - = TALER_TESTING_make_trait_amount_obj (tps->num_coins, - &tps->total_amount); + = TALER_TESTING_make_trait_amount (&tps->total_amount); traits[NUM_TRAITS - 3] - = TALER_TESTING_make_trait_uint64 (0, - &tps->num_coins); + = TALER_TESTING_make_trait_num_planchets (&tps->num_coins); traits[NUM_TRAITS - 2] - = TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BASE_URL, - tps->exchange_url); + = TALER_TESTING_make_trait_exchange_url (&tps->exchange_url); traits[NUM_TRAITS - 1] = TALER_TESTING_trait_end (); return TALER_TESTING_get_trait (traits, ret, diff --git a/src/testing/testing_api_cmd_wallet_get_order.c b/src/testing/testing_api_cmd_wallet_get_order.c index a58dda80..1d43c20e 100644 --- a/src/testing/testing_api_cmd_wallet_get_order.c +++ b/src/testing/testing_api_cmd_wallet_get_order.c @@ -154,7 +154,7 @@ wallet_get_order_cb ( /* FIXME: Check all of the members of `pud` */ struct TALER_MERCHANT_PayUriData pud; const struct TALER_TESTING_Command *order_cmd; - const char *order_id; + const char **order_id; const struct TALER_ClaimTokenP *claim_token; if (GNUNET_OK != @@ -174,7 +174,6 @@ wallet_get_order_cb ( if (GNUNET_OK != TALER_TESTING_get_trait_order_id (order_cmd, - 0, &order_id)) { TALER_MERCHANT_parse_pay_uri_free (&pud); @@ -183,7 +182,6 @@ wallet_get_order_cb ( if (GNUNET_OK != TALER_TESTING_get_trait_claim_token (order_cmd, - 0, &claim_token)) { TALER_MERCHANT_parse_pay_uri_free (&pud); @@ -213,7 +211,7 @@ wallet_get_order_cb ( if ((0 != strcmp (host, pud.merchant_host)) || (NULL != pud.merchant_prefix_path) || - (0 != strcmp (order_id, + (0 != strcmp (*order_id, pud.order_id)) || (NULL != pud.ssid)) { @@ -268,8 +266,8 @@ wallet_get_order_run (void *cls, { struct WalletGetOrderState *gos = cls; const struct TALER_TESTING_Command *order_cmd; - const char *order_id; - const struct GNUNET_HashCode *h_contract; + const char **order_id; + const struct TALER_PrivateContractHash *h_contract; order_cmd = TALER_TESTING_interpreter_lookup_command ( is, @@ -277,20 +275,18 @@ wallet_get_order_run (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_order_id (order_cmd, - 0, &order_id)) TALER_TESTING_FAIL (is); if (GNUNET_OK != TALER_TESTING_get_trait_h_contract_terms (order_cmd, - 0, &h_contract)) TALER_TESTING_FAIL (is); gos->is = is; gos->ogh = TALER_MERCHANT_wallet_order_get (is->ctx, gos->merchant_url, - order_id, + *order_id, h_contract, GNUNET_TIME_UNIT_ZERO, NULL, @@ -643,8 +639,8 @@ wallet_poll_order_start_run (void *cls, { struct WalletPollOrderStartState *pos = cls; const struct TALER_TESTING_Command *order_cmd; - const char *order_id; - const struct GNUNET_HashCode *h_contract; + const char **order_id; + const struct TALER_PrivateContractHash *h_contract; order_cmd = TALER_TESTING_interpreter_lookup_command ( is, @@ -652,13 +648,11 @@ wallet_poll_order_start_run (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_order_id (order_cmd, - 0, &order_id)) TALER_TESTING_FAIL (is); if (GNUNET_OK != TALER_TESTING_get_trait_h_contract_terms (order_cmd, - 0, &h_contract)) TALER_TESTING_FAIL (is); @@ -669,7 +663,7 @@ wallet_poll_order_start_run (void *cls, pos->is = is; pos->ogh = TALER_MERCHANT_wallet_order_get (is->ctx, pos->merchant_url, - order_id, + *order_id, h_contract, pos->timeout, pos->session_id, diff --git a/src/testing/testing_api_cmd_wallet_get_tip.c b/src/testing/testing_api_cmd_wallet_get_tip.c index e6d28ff8..d08e4bcb 100644 --- a/src/testing/testing_api_cmd_wallet_get_tip.c +++ b/src/testing/testing_api_cmd_wallet_get_tip.c @@ -172,7 +172,6 @@ wallet_get_tip_run (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_tip_id (tip_cmd, - 0, &tip_id)) TALER_TESTING_FAIL (is); diff --git a/src/testing/testing_api_cmd_wallet_post_orders_refund.c b/src/testing/testing_api_cmd_wallet_post_orders_refund.c index 7befb828..b138b327 100644 --- a/src/testing/testing_api_cmd_wallet_post_orders_refund.c +++ b/src/testing/testing_api_cmd_wallet_post_orders_refund.c @@ -115,35 +115,30 @@ refund_cb ( for (unsigned int i = 0; i < refunds_length; ++i) { const struct TALER_TESTING_Command *refund_cmd; - const char *expected_amount_str; - struct TALER_Amount expected_amount; + const struct TALER_Amount *expected_amount; refund_cmd = TALER_TESTING_interpreter_lookup_command ( wrs->is, wrs->refunds[i]); if (GNUNET_OK != - TALER_TESTING_get_trait_string (refund_cmd, - 0, - &expected_amount_str)) + TALER_TESTING_get_trait_amount (refund_cmd, + &expected_amount)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not fetch refund amount\n"); TALER_TESTING_interpreter_fail (wrs->is); return; } - GNUNET_assert (GNUNET_OK == - TALER_string_to_amount (expected_amount_str, - &expected_amount)); /* The most recent refunds are returned first */ GNUNET_assert (0 <= TALER_amount_add (&refunded_total, &refunded_total, &refunds[refunds_length - 1 - i].refund_amount)); if ((GNUNET_OK != - TALER_amount_cmp_currency (&expected_amount, + TALER_amount_cmp_currency (expected_amount, &refunded_total)) || - (0 != TALER_amount_cmp (&expected_amount, + (0 != TALER_amount_cmp (expected_amount, &refunded_total))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -178,14 +173,13 @@ obtain_refunds_run (void *cls, const struct TALER_TESTING_Command *proposal_cmd = TALER_TESTING_interpreter_lookup_command (is, wrs->proposal_reference); - const struct GNUNET_HashCode *h_contract_terms; + const struct TALER_PrivateContractHash *h_contract_terms; const char *order_id; if (NULL == proposal_cmd) TALER_TESTING_FAIL (is); if (GNUNET_OK != TALER_TESTING_get_trait_h_contract_terms (proposal_cmd, - 0, &h_contract_terms)) TALER_TESTING_FAIL (is); @@ -196,7 +190,6 @@ obtain_refunds_run (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_contract_terms (proposal_cmd, - 0, &contract_terms)) TALER_TESTING_FAIL (is); { diff --git a/src/testing/testing_api_traits.c b/src/testing/testing_api_traits.c index a0eb0fc2..efeb012c 100644 --- a/src/testing/testing_api_traits.c +++ b/src/testing/testing_api_traits.c @@ -23,10 +23,7 @@ * @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" +#include "taler_merchant_testing_lib.h" TALER_MERCHANT_TESTING_SIMPLE_TRAITS (TALER_TESTING_MAKE_IMPL_SIMPLE_TRAIT) |