diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-10-28 21:05:53 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-10-28 21:05:53 +0200 |
commit | 7d23dbe6ee21afc6d28df50516e694f205aada29 (patch) | |
tree | c703abe21ce038f68b12c1653df9049a856446df | |
parent | ca87a98695221ea3b8beb08c40cf04f6afe7bd2c (diff) |
-work on FTBFS
-rw-r--r-- | src/include/taler_merchant_testing_lib.h | 9 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_get_instance.c | 4 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_merchant_get_order.c | 76 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_merchant_get_tip.c | 45 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_pay_order.c | 110 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_post_instances.c | 27 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_post_orders.c | 50 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_post_orders_paid.c | 13 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_post_products.c | 22 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_post_reserves.c | 6 | ||||
-rw-r--r-- | src/testing/testing_api_cmd_post_transfers.c | 17 |
11 files changed, 185 insertions, 194 deletions
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h index 94010bb4..8b6724f1 100644 --- a/src/include/taler_merchant_testing_lib.h +++ b/src/include/taler_merchant_testing_lib.h @@ -1487,14 +1487,17 @@ TALER_TESTING_cmd_tip_pickup (const char *label, op (reason, const char *) \ op (lock_uuid, const char *) \ op (auth_token, const char *) \ - op (paths_length, uint32_t) \ + 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) \ op (max_wire_fee, const struct TALER_Amount) \ op (max_deposit_fee, const struct TALER_Amount) \ op (wire_fee_amortization, const uint32_t) \ - op (jurisdiction, const json_t *) \ + op (jurisdiction, const json_t) \ op (wire_delay, const struct GNUNET_TIME_Relative) \ op (pay_delay, const struct GNUNET_TIME_Relative) \ op (refund_entry, const struct TALER_MERCHANT_RefundDetail) \ @@ -1508,6 +1511,8 @@ TALER_TESTING_cmd_tip_pickup (const char *label, #define TALER_MERCHANT_TESTING_INDEXED_TRAITS(op) \ op (coin_reference, const char *) \ op (paths, const char *) \ + op (payto_uris, const char *) \ + op (amounts, const struct TALER_Amount) \ op (planchet_secrets, struct TALER_PlanchetSecretsP *) diff --git a/src/testing/testing_api_cmd_get_instance.c b/src/testing/testing_api_cmd_get_instance.c index 28f34091..f328cc75 100644 --- a/src/testing/testing_api_cmd_get_instance.c +++ b/src/testing/testing_api_cmd_get_instance.c @@ -165,14 +165,14 @@ get_instance_cb (void *cls, } } { - const struct json_t **jurisdiction; + const struct json_t *jurisdiction; if (GNUNET_OK != TALER_TESTING_get_trait_jurisdiction (instance_cmd, &jurisdiction)) TALER_TESTING_interpreter_fail (gis->is); if (1 != json_equal (details->jurisdiction, - *jurisdiction)) + jurisdiction)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Instance jurisdiction does not match\n"); diff --git a/src/testing/testing_api_cmd_merchant_get_order.c b/src/testing/testing_api_cmd_merchant_get_order.c index 34c2b0b0..1977f792 100644 --- a/src/testing/testing_api_cmd_merchant_get_order.c +++ b/src/testing/testing_api_cmd_merchant_get_order.c @@ -185,7 +185,6 @@ merchant_get_order_cb ( if (GNUNET_OK != TALER_TESTING_get_trait_contract_terms (order_cmd, - 0, &expected_contract_terms)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -200,16 +199,15 @@ merchant_get_order_cb ( for (unsigned int i = 0; i < gos->forgets_length; ++i) { const struct TALER_TESTING_Command *forget_cmd; - const unsigned int *paths_length; + const uint32_t *paths_length; forget_cmd = TALER_TESTING_interpreter_lookup_command ( gos->is, gos->forgets[i]); if (GNUNET_OK != - TALER_TESTING_get_trait_uint32 (forget_cmd, - 0, - &paths_length)) + TALER_TESTING_get_trait_paths_length (forget_cmd, + &paths_length)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Couldn't fetch forget paths length\n"); @@ -219,13 +217,13 @@ merchant_get_order_cb ( for (unsigned int j = 0; j < *paths_length; ++j) { - const char *path; + const char **path; int res = GNUNET_OK; if (GNUNET_OK != - TALER_TESTING_get_trait_string (forget_cmd, - j, - &path)) + TALER_TESTING_get_trait_paths (forget_cmd, + j, + &path)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Couldn't fetch forget path\n"); @@ -235,7 +233,7 @@ merchant_get_order_cb ( GNUNET_assert (GNUNET_OK == TALER_JSON_expand_path (ct, - path, + *path, &apply_forget, &res)); GNUNET_assert (GNUNET_OK == res); @@ -279,7 +277,6 @@ merchant_get_order_cb ( if (GNUNET_OK != TALER_TESTING_get_trait_wtid (transfer_cmd, - 0, &wtid)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -297,19 +294,18 @@ merchant_get_order_cb ( } } { - const char *exchange_url; + const char **exchange_url; if (GNUNET_OK != - TALER_TESTING_get_trait_string (transfer_cmd, - 1, - &exchange_url)) + TALER_TESTING_get_trait_exchange_url (transfer_cmd, + &exchange_url)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not fetch wire transfer exchange url\n"); TALER_TESTING_interpreter_fail (gos->is); return; } - if (0 != strcmp (exchange_url, + if (0 != strcmp (*exchange_url, osr->details.paid.wts[i].exchange_url)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -324,13 +320,11 @@ merchant_get_order_cb ( const struct TALER_Amount *transfer_fee; if ((GNUNET_OK != - TALER_TESTING_get_trait_amount_obj (transfer_cmd, - 0, - &transfer_amount)) || + TALER_TESTING_get_trait_amount (transfer_cmd, + &transfer_amount)) || (GNUNET_OK != - TALER_TESTING_get_trait_amount_obj (transfer_cmd, - 1, - &transfer_fee))) + TALER_TESTING_get_trait_fee (transfer_cmd, + &transfer_fee))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not fetch wire transfer amount/fee\n"); @@ -387,31 +381,26 @@ merchant_get_order_cb ( gos->is, gos->refunds[i]); { - const char *expected_amount_str; - struct TALER_Amount expected_amount; + const struct TALER_Amount *expected_amount; struct TALER_Amount *amount_found = &osr->details.paid.refunds[i].refund_amount; 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 (gos->is); return; } - GNUNET_assert (GNUNET_OK == - TALER_string_to_amount (expected_amount_str, - &expected_amount)); GNUNET_assert (0 <= TALER_amount_add (&refunded_total, &refunded_total, amount_found)); 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, @@ -421,11 +410,10 @@ merchant_get_order_cb ( } } { - const char *expected_reason; + const char **expected_reason; if (GNUNET_OK != - TALER_TESTING_get_trait_string (refund_cmd, - 1, + TALER_TESTING_get_trait_reason (refund_cmd, &expected_reason)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -433,7 +421,7 @@ merchant_get_order_cb ( TALER_TESTING_interpreter_fail (gos->is); return; } - if (0 != strcmp (expected_reason, + if (0 != strcmp (*expected_reason, osr->details.paid.refunds[i].reason)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -461,7 +449,7 @@ merchant_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 != @@ -481,7 +469,6 @@ merchant_get_order_cb ( if (GNUNET_OK != TALER_TESTING_get_trait_order_id (order_cmd, - 0, &order_id)) { TALER_MERCHANT_parse_pay_uri_free (&pud); @@ -490,7 +477,6 @@ merchant_get_order_cb ( if (GNUNET_OK != TALER_TESTING_get_trait_claim_token (order_cmd, - 0, &claim_token)) { TALER_MERCHANT_parse_pay_uri_free (&pud); @@ -519,7 +505,7 @@ merchant_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)) { @@ -527,7 +513,7 @@ merchant_get_order_cb ( "Order pay uri `%s' does not match, wanted %s/%s\n", osr->details.unpaid.taler_pay_uri, host, - order_id); + *order_id); TALER_TESTING_interpreter_fail (gos->is); TALER_MERCHANT_parse_pay_uri_free (&pud); GNUNET_free (host); @@ -581,8 +567,8 @@ merchant_get_order_run (void *cls, { struct MerchantGetOrderState *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, @@ -590,20 +576,18 @@ merchant_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_merchant_order_get (is->ctx, gos->merchant_url, - order_id, + *order_id, NULL, true, GNUNET_TIME_UNIT_ZERO, diff --git a/src/testing/testing_api_cmd_merchant_get_tip.c b/src/testing/testing_api_cmd_merchant_get_tip.c index 7c3daac2..791fc731 100644 --- a/src/testing/testing_api_cmd_merchant_get_tip.c +++ b/src/testing/testing_api_cmd_merchant_get_tip.c @@ -127,13 +127,14 @@ merchant_get_tip_cb (void *cls, // check if the data returned matches that from the POST / PATCH { const struct TALER_Amount *initial_amount; + if (GNUNET_OK != - TALER_TESTING_get_trait_amount_obj (authorize_cmd, - 0, - &initial_amount)) + TALER_TESTING_get_trait_amount (authorize_cmd, + &initial_amount)) TALER_TESTING_FAIL (gts->is); - if ((GNUNET_OK != TALER_amount_cmp_currency (total_authorized, - initial_amount)) || + if ((GNUNET_OK != + TALER_amount_cmp_currency (total_authorized, + initial_amount)) || (0 != TALER_amount_cmp (total_authorized, initial_amount))) { @@ -144,14 +145,14 @@ merchant_get_tip_cb (void *cls, } } { - const char *justification; + const char **justification; + if (GNUNET_OK != - TALER_TESTING_get_trait_string (authorize_cmd, - 0, + TALER_TESTING_get_trait_reason (authorize_cmd, &justification)) TALER_TESTING_FAIL (gts->is); if (0 != strcmp (reason, - justification)) + *justification)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Tip authorized reason does not match\n"); @@ -161,6 +162,7 @@ merchant_get_tip_cb (void *cls, } { const struct GNUNET_TIME_Absolute *tip_expiration; + if (GNUNET_OK != TALER_TESTING_get_trait_absolute_time (authorize_cmd, 0, @@ -189,12 +191,11 @@ merchant_get_tip_cb (void *cls, pickup_cmd = TALER_TESTING_interpreter_lookup_command (gts->is, gts->pickups[i]); { - const uint64_t *num_planchets; + const uint32_t *num_planchets; if (GNUNET_OK != - TALER_TESTING_get_trait_uint64 (pickup_cmd, - 0, - &num_planchets)) + TALER_TESTING_get_trait_num_planchets (pickup_cmd, + &num_planchets)) TALER_TESTING_FAIL (gts->is); if (*num_planchets != pickups[i].num_planchets) @@ -209,16 +210,17 @@ merchant_get_tip_cb (void *cls, const struct TALER_Amount *total; if (GNUNET_OK != - TALER_TESTING_get_trait_amount_obj (pickup_cmd, - pickups[i].num_planchets, - &total)) + TALER_TESTING_get_trait_amounts (pickup_cmd, + pickups[i].num_planchets, + &total)) TALER_TESTING_FAIL (gts->is); - if ((GNUNET_OK != TALER_amount_cmp_currency (total, - &pickups[i]. - requested_amount)) || - (0 != TALER_amount_cmp (total, - &pickups[i].requested_amount))) + if ( (GNUNET_OK != + TALER_amount_cmp_currency (total, + &pickups[i]. + requested_amount)) || + (0 != TALER_amount_cmp (total, + &pickups[i].requested_amount))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Pickup planchet sum does not match\n"); @@ -271,7 +273,6 @@ merchant_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_pay_order.c b/src/testing/testing_api_cmd_pay_order.c index 05776afa..697f0694 100644 --- a/src/testing/testing_api_cmd_pay_order.c +++ b/src/testing/testing_api_cmd_pay_order.c @@ -38,7 +38,7 @@ struct PayState /** * Contract terms hash code. */ - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; /** * The interpreter state. @@ -108,7 +108,7 @@ struct PayState * per-contract fee, only per-coin exists. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue build_coins (struct TALER_MERCHANT_PayCoin **pc, unsigned int *npc, char *coins, @@ -127,6 +127,7 @@ build_coins (struct TALER_MERCHANT_PayCoin **pc, unsigned int ci; struct TALER_MERCHANT_PayCoin *icoin; const struct TALER_EXCHANGE_DenomPublicKey *dpk; + const char **exchange_url; /* Token syntax is "LABEL[/NUMBER]" */ ctok = strchr (token, '/'); @@ -165,22 +166,21 @@ build_coins (struct TALER_MERCHANT_PayCoin **pc, const struct TALER_Amount *denom_value; const struct TALER_EXCHANGE_DenomPublicKey *denom_pub; - GNUNET_assert - (GNUNET_OK == TALER_TESTING_get_trait_coin_priv - (coin_cmd, 0, &coin_priv)); - - GNUNET_assert - (GNUNET_OK == TALER_TESTING_get_trait_denom_pub - (coin_cmd, 0, &denom_pub)); - - GNUNET_assert - (GNUNET_OK == TALER_TESTING_get_trait_denom_sig - (coin_cmd, 0, &denom_sig)); - - GNUNET_assert - (GNUNET_OK == TALER_TESTING_get_trait_amount_obj - (coin_cmd, 0, &denom_value)); - + GNUNET_assert (GNUNET_OK == + TALER_TESTING_get_trait_coin_priv (coin_cmd, + 0, + &coin_priv)); + GNUNET_assert (GNUNET_OK == + TALER_TESTING_get_trait_denom_pub (coin_cmd, + 0, + &denom_pub)); + GNUNET_assert (GNUNET_OK == + TALER_TESTING_get_trait_denom_sig (coin_cmd, + 0, + &denom_sig)); + GNUNET_assert (GNUNET_OK == + TALER_TESTING_get_trait_amount (coin_cmd, + &denom_value)); icoin->coin_priv = *coin_priv; icoin->denom_pub = denom_pub->key; icoin->denom_sig = *denom_sig; @@ -196,9 +196,9 @@ build_coins (struct TALER_MERCHANT_PayCoin **pc, &icoin->denom_value, &dpk->fee_deposit)); GNUNET_assert (GNUNET_OK == - TALER_TESTING_get_trait_url (coin_cmd, - TALER_TESTING_UT_EXCHANGE_BASE_URL, - &icoin->exchange_url)); + TALER_TESTING_get_trait_exchange_url (coin_cmd, + &exchange_url)); + icoin->exchange_url = *exchange_url; } return GNUNET_OK; @@ -260,15 +260,15 @@ pay_run (void *cls, struct GNUNET_TIME_Absolute pay_deadline; struct GNUNET_TIME_Absolute timestamp; struct TALER_MerchantPublicKeyP merchant_pub; - struct GNUNET_HashCode h_wire; - const struct GNUNET_HashCode *h_proposal; + struct TALER_MerchantWireHash h_wire; + const struct TALER_PrivateContractHash *h_proposal; struct TALER_Amount total_amount; struct TALER_Amount max_fee; const char *error_name; unsigned int error_line; struct TALER_MERCHANT_PayCoin *pay_coins; unsigned int npay_coins; - struct TALER_MerchantSignatureP *merchant_sig; + const struct TALER_MerchantSignatureP *merchant_sig; ps->is = is; proposal_cmd = TALER_TESTING_interpreter_lookup_command ( @@ -280,7 +280,6 @@ pay_run (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_contract_terms (proposal_cmd, - 0, &contract_terms)) TALER_TESTING_FAIL (is); { @@ -350,13 +349,11 @@ pay_run (void *cls, } if (GNUNET_OK != TALER_TESTING_get_trait_merchant_sig (proposal_cmd, - 0, &merchant_sig)) TALER_TESTING_FAIL (is); if (GNUNET_OK != TALER_TESTING_get_trait_h_contract_terms (proposal_cmd, - 0, &h_proposal)) TALER_TESTING_FAIL (is); ps->h_contract_terms = *h_proposal; @@ -427,54 +424,57 @@ pay_traits (void *cls, { struct PayState *ps = cls; - const char *order_id; + const char **order_id; const struct TALER_TESTING_Command *proposal_cmd; const struct TALER_MerchantPublicKeyP *merchant_pub; if (NULL == - (proposal_cmd = TALER_TESTING_interpreter_lookup_command - (ps->is, ps->proposal_reference))) + (proposal_cmd = + TALER_TESTING_interpreter_lookup_command (ps->is, + ps->proposal_reference))) { GNUNET_break (0); return GNUNET_SYSERR; } - if (GNUNET_OK != TALER_TESTING_get_trait_order_id - (proposal_cmd, 0, &order_id)) + if (GNUNET_OK != + TALER_TESTING_get_trait_order_id (proposal_cmd, + &order_id)) { GNUNET_break (0); return GNUNET_SYSERR; } - if (GNUNET_OK != TALER_TESTING_get_trait_merchant_pub - (proposal_cmd, - 0, - &merchant_pub)) + if (GNUNET_OK != + TALER_TESTING_get_trait_merchant_pub (proposal_cmd, + &merchant_pub)) { GNUNET_break (0); return GNUNET_SYSERR; } { - struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_proposal_reference (0, - ps->proposal_reference), - TALER_TESTING_make_trait_coin_reference (0, - ps->coin_reference), - TALER_TESTING_make_trait_order_id (0, - order_id), - TALER_TESTING_make_trait_merchant_pub (0, - merchant_pub), - TALER_TESTING_make_trait_merchant_sig (0, - &ps->merchant_sig), - TALER_TESTING_make_trait_string (0, - ps->amount_with_fee), - TALER_TESTING_trait_end () - }; + struct TALER_Amount amount_with_fee; - return TALER_TESTING_get_trait (traits, - ret, - trait, - index); + GNUNET_assert (GNUNET_OK == + TALER_string_to_amount (ps->amount_with_fee, + &amount_with_fee)); + { + struct TALER_TESTING_Trait traits[] = { + TALER_TESTING_make_trait_proposal_reference (&ps->proposal_reference), + TALER_TESTING_make_trait_coin_reference (0, + &ps->coin_reference), + TALER_TESTING_make_trait_order_id (order_id), + TALER_TESTING_make_trait_merchant_pub (merchant_pub), + TALER_TESTING_make_trait_merchant_sig (&ps->merchant_sig), + TALER_TESTING_make_trait_amount (&amount_with_fee), + TALER_TESTING_trait_end () + }; + + return TALER_TESTING_get_trait (traits, + ret, + trait, + index); + } } } diff --git a/src/testing/testing_api_cmd_post_instances.c b/src/testing/testing_api_cmd_post_instances.c index b2e345bc..5e6d0c93 100644 --- a/src/testing/testing_api_cmd_post_instances.c +++ b/src/testing/testing_api_cmd_post_instances.c @@ -215,7 +215,7 @@ post_instances_run (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue post_instances_traits (void *cls, const void **ret, const char *trait, @@ -225,32 +225,33 @@ 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_string (0, pis->name); + TALER_TESTING_make_trait_product_id (&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_post_orders.c b/src/testing/testing_api_cmd_post_orders.c index f7c00388..1813385d 100644 --- a/src/testing/testing_api_cmd_post_orders.c +++ b/src/testing/testing_api_cmd_post_orders.c @@ -63,7 +63,7 @@ struct OrdersState /** * Contract terms hash code. */ - struct GNUNET_HashCode h_contract_terms; + struct TALER_PrivateContractHash h_contract_terms; /** * The /orders operation handle. @@ -149,23 +149,21 @@ struct OrdersState * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue orders_traits (void *cls, const void **ret, const char *trait, unsigned int index) { struct OrdersState *ps = cls; - struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_order_id (0, ps->order_id), - TALER_TESTING_make_trait_contract_terms (0, ps->contract_terms), - TALER_TESTING_make_trait_h_contract_terms (0, &ps->h_contract_terms), - TALER_TESTING_make_trait_merchant_sig (0, &ps->merchant_sig), - TALER_TESTING_make_trait_merchant_pub (0, &ps->merchant_pub), - TALER_TESTING_make_trait_claim_nonce (0, &ps->nonce), - TALER_TESTING_make_trait_claim_token (0, &ps->claim_token), - TALER_TESTING_make_trait_string (0, ps->order), + TALER_TESTING_make_trait_order_id (&ps->order_id), + TALER_TESTING_make_trait_contract_terms (ps->contract_terms), + TALER_TESTING_make_trait_h_contract_terms (&ps->h_contract_terms), + TALER_TESTING_make_trait_merchant_sig (&ps->merchant_sig), + TALER_TESTING_make_trait_merchant_pub (&ps->merchant_pub), + TALER_TESTING_make_trait_claim_nonce (&ps->nonce), + TALER_TESTING_make_trait_claim_token (&ps->claim_token), TALER_TESTING_trait_end () }; @@ -192,7 +190,7 @@ orders_claim_cb (void *cls, const struct TALER_MERCHANT_HttpResponse *hr, const json_t *contract_terms, const struct TALER_MerchantSignatureP *sig, - const struct GNUNET_HashCode *hash) + const struct TALER_PrivateContractHash *hash) { struct OrdersState *ps = cls; struct TALER_MerchantPublicKeyP merchant_pub; @@ -292,7 +290,6 @@ order_cb (void *cls, ps->duplicate_of); if (GNUNET_OK != TALER_TESTING_get_trait_claim_token (order_cmd, - 0, &prev_token)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -446,23 +443,28 @@ orders_run2 (void *cls, if (NULL != ps->duplicate_of) { const struct TALER_TESTING_Command *order_cmd; + const json_t *ct; + order_cmd = TALER_TESTING_interpreter_lookup_command ( is, ps->duplicate_of); if (GNUNET_OK != - TALER_TESTING_get_trait_string (order_cmd, - 0, - &order_str)) + TALER_TESTING_get_trait_contract_terms (order_cmd, + &ct)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not fetch previous order string\n"); TALER_TESTING_interpreter_fail (is); return; } + order = json_incref ((json_t *) ct); + } + else + { + order = json_loads (order_str, + JSON_REJECT_DUPLICATES, + &error); } - order = json_loads (order_str, - JSON_REJECT_DUPLICATES, - &error); if (NULL == order) { // human error here. @@ -527,16 +529,15 @@ orders_run2 (void *cls, token = strtok (NULL, ";")) { const struct TALER_TESTING_Command *lock_cmd; - const char *uuid; + const char **uuid; lock_cmd = TALER_TESTING_interpreter_lookup_command ( is, token); if (GNUNET_OK != - TALER_TESTING_get_trait_string (lock_cmd, - 0, - &uuid)) + TALER_TESTING_get_trait_lock_uuid (lock_cmd, + &uuid)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not fetch lock uuid\n"); @@ -546,7 +547,7 @@ orders_run2 (void *cls, GNUNET_array_append (locks, locks_length, - uuid); + *uuid); } ps->po = TALER_MERCHANT_orders_post2 (is->ctx, ps->merchant_url, @@ -777,7 +778,6 @@ TALER_TESTING_cmd_merchant_post_orders2 ( pay_deadline, amount, &ps->order); - ps->http_status = http_status; ps->expected_order_id = order_id; ps->merchant_url = merchant_url; diff --git a/src/testing/testing_api_cmd_post_orders_paid.c b/src/testing/testing_api_cmd_post_orders_paid.c index 713e2505..2050478f 100644 --- a/src/testing/testing_api_cmd_post_orders_paid.c +++ b/src/testing/testing_api_cmd_post_orders_paid.c @@ -110,30 +110,27 @@ paid_run (void *cls, { struct PostOrdersPaidState *ops = cls; const struct TALER_TESTING_Command *pay_cmd; - const char *proposal_reference; + const char **proposal_reference; const struct TALER_TESTING_Command *proposal_cmd; const char *order_id; - const struct GNUNET_HashCode *h_contract_terms; - struct TALER_MerchantSignatureP *merchant_sig; + const struct TALER_PrivateContractHash *h_contract_terms; + const struct TALER_MerchantSignatureP *merchant_sig; ops->is = is; - pay_cmd = TALER_TESTING_interpreter_lookup_command (is, ops->pay_reference); if (NULL == pay_cmd) TALER_TESTING_FAIL (is); if (GNUNET_OK != TALER_TESTING_get_trait_merchant_sig (pay_cmd, - 0, &merchant_sig)) TALER_TESTING_FAIL (is); if (GNUNET_OK != TALER_TESTING_get_trait_proposal_reference (pay_cmd, - 0, &proposal_reference)) TALER_TESTING_FAIL (is); proposal_cmd = TALER_TESTING_interpreter_lookup_command (is, - proposal_reference); + *proposal_reference); if (NULL == proposal_cmd) TALER_TESTING_FAIL (is); @@ -145,7 +142,6 @@ paid_run (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_contract_terms (proposal_cmd, - 0, &contract_terms)) TALER_TESTING_FAIL (is); { @@ -180,7 +176,6 @@ paid_run (void *cls, if (GNUNET_OK != TALER_TESTING_get_trait_h_contract_terms (proposal_cmd, - 0, &h_contract_terms)) TALER_TESTING_FAIL (is); diff --git a/src/testing/testing_api_cmd_post_products.c b/src/testing/testing_api_cmd_post_products.c index 8216318f..372a5fab 100644 --- a/src/testing/testing_api_cmd_post_products.c +++ b/src/testing/testing_api_cmd_post_products.c @@ -204,16 +204,18 @@ post_products_traits (void *cls, { struct PostProductsState *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_reserves.c b/src/testing/testing_api_cmd_post_reserves.c index 31866384..b2167534 100644 --- a/src/testing/testing_api_cmd_post_reserves.c +++ b/src/testing/testing_api_cmd_post_reserves.c @@ -133,7 +133,7 @@ post_reserves_cb (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue post_reserves_traits (void *cls, const void **ret, const char *trait, @@ -141,8 +141,8 @@ post_reserves_traits (void *cls, { struct PostReservesState *prs = cls; struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_reserve_pub (0, &prs->reserve_pub), - TALER_TESTING_make_trait_amount_obj (0, &prs->initial_balance), + TALER_TESTING_make_trait_reserve_pub (&prs->reserve_pub), + TALER_TESTING_make_trait_amount (&prs->initial_balance), TALER_TESTING_trait_end (), }; diff --git a/src/testing/testing_api_cmd_post_transfers.c b/src/testing/testing_api_cmd_post_transfers.c index 40f1d595..77a2456b 100644 --- a/src/testing/testing_api_cmd_post_transfers.c +++ b/src/testing/testing_api_cmd_post_transfers.c @@ -332,7 +332,7 @@ transfers_cb (void *cls, * @param index index number of the object to extract. * @return #GNUNET_OK on success */ -static int +static enum GNUNET_GenericReturnValue post_transfers_traits (void *cls, const void **ret, const char *trait, @@ -340,12 +340,15 @@ post_transfers_traits (void *cls, { struct PostTransfersState *pts = cls; struct TALER_TESTING_Trait traits[] = { - TALER_TESTING_make_trait_wtid (0, &pts->wtid), - TALER_TESTING_make_trait_string (0, pts->credit_account), - TALER_TESTING_make_trait_amount_obj (0, &pts->credit_amount), - TALER_TESTING_make_trait_amount_obj (1, &pts->wire_fee), - TALER_TESTING_make_trait_string (1, pts->exchange_url), - TALER_TESTING_make_trait_absolute_time (0, &pts->execution_time), + TALER_TESTING_make_trait_wtid (&pts->wtid), + TALER_TESTING_make_trait_credit_payto_uri ( + (const char **) &pts->credit_account), + TALER_TESTING_make_trait_amount (&pts->credit_amount), + TALER_TESTING_make_trait_fee (&pts->wire_fee), + TALER_TESTING_make_trait_exchange_url ( + (const char **) &pts->exchange_url), + TALER_TESTING_make_trait_absolute_time (0, + &pts->execution_time), TALER_TESTING_make_trait_bank_row (&pts->serial), TALER_TESTING_trait_end (), }; |