diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-06-07 23:11:20 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-06-07 23:11:20 +0200 |
commit | 9725b7d42505d7820fea6e28a638c06b7e81f893 (patch) | |
tree | e1a3233e8f2dbe4f61a6c1d1cff4d83f98563594 /src/testing/testing_api_cmd_merchant_get_order.c | |
parent | 0e2148d63b85025c37d4212162a522e47445acab (diff) | |
download | merchant-9725b7d42505d7820fea6e28a638c06b7e81f893.tar.gz merchant-9725b7d42505d7820fea6e28a638c06b7e81f893.tar.bz2 merchant-9725b7d42505d7820fea6e28a638c06b7e81f893.zip |
major libtalertesting API refactoring, including no longer having taler-specific logic in the test engine core
Diffstat (limited to 'src/testing/testing_api_cmd_merchant_get_order.c')
-rw-r--r-- | src/testing/testing_api_cmd_merchant_get_order.c | 79 |
1 files changed, 33 insertions, 46 deletions
diff --git a/src/testing/testing_api_cmd_merchant_get_order.c b/src/testing/testing_api_cmd_merchant_get_order.c index b9a8a954..4b5bcb16 100644 --- a/src/testing/testing_api_cmd_merchant_get_order.c +++ b/src/testing/testing_api_cmd_merchant_get_order.c @@ -212,7 +212,7 @@ 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 != @@ -228,7 +228,7 @@ merchant_get_order_cb ( GNUNET_assert (GNUNET_OK == TALER_JSON_expand_path (ct, - *path, + path, &apply_forget, &res)); GNUNET_assert (GNUNET_OK == res); @@ -290,7 +290,7 @@ merchant_get_order_cb ( } } { - const char **exchange_url; + const char *exchange_url; if (GNUNET_OK != TALER_TESTING_get_trait_exchange_url (transfer_cmd, @@ -301,9 +301,9 @@ merchant_get_order_cb ( TALER_TESTING_interpreter_fail (gos->is); return; } - if (0 != strcmp (*exchange_url, - osr->details.ok.details.paid.wts[i]. - exchange_url)) + if (0 != strcmp ( + exchange_url, + osr->details.ok.details.paid.wts[i].exchange_url)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Wire transfer exchange url does not match\n"); @@ -370,7 +370,7 @@ merchant_get_order_cb ( } } { - const char **expected_reason; + const char *expected_reason; if (GNUNET_OK != TALER_TESTING_get_trait_reason (refund_cmd, @@ -381,8 +381,9 @@ merchant_get_order_cb ( TALER_TESTING_interpreter_fail (gos->is); return; } - if (0 != strcmp ( - *expected_reason, + if (0 != + strcmp ( + expected_reason, osr->details.ok.details.paid.refunds[i].reason)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -409,7 +410,7 @@ merchant_get_order_cb ( { 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 != @@ -444,29 +445,13 @@ merchant_get_order_cb ( TALER_TESTING_FAIL (gos->is); } { - char *port; char *host; - if (GNUNET_OK != - GNUNET_CONFIGURATION_get_value_string (gos->is->cfg, - "merchant", - "PORT", - &port)) - { - /* How did we get here without a configured port? */ - GNUNET_break (0); - TALER_TESTING_interpreter_fail (gos->is); - TALER_MERCHANT_parse_pay_uri_free (&pud); - return; - } - GNUNET_asprintf (&host, - "localhost:%s", - port); - GNUNET_free (port); + host = TALER_MERCHANT_TESTING_extract_host (gos->merchant_url); 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)) { @@ -474,7 +459,7 @@ merchant_get_order_cb ( "Order pay uri `%s' does not match, wanted %s/%s\n", osr->details.ok.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); @@ -528,7 +513,7 @@ merchant_get_order_run (void *cls, { struct MerchantGetOrderState *gos = cls; const struct TALER_TESTING_Command *order_cmd; - const char **order_id; + const char *order_id; const struct TALER_PrivateContractHashP *h_contract; order_cmd = TALER_TESTING_interpreter_lookup_command ( @@ -546,14 +531,15 @@ merchant_get_order_run (void *cls, TALER_TESTING_FAIL (is); gos->is = is; - gos->ogh = TALER_MERCHANT_merchant_order_get (is->ctx, - gos->merchant_url, - *order_id, - NULL, - true, - GNUNET_TIME_UNIT_ZERO, - &merchant_get_order_cb, - gos); + gos->ogh = TALER_MERCHANT_merchant_order_get ( + TALER_TESTING_interpreter_get_context (is), + gos->merchant_url, + order_id, + NULL, + true, + GNUNET_TIME_UNIT_ZERO, + &merchant_get_order_cb, + gos); } @@ -867,14 +853,15 @@ merchant_poll_order_start_run (void *cls, = GNUNET_TIME_absolute_add (GNUNET_TIME_relative_to_absolute (pos->timeout), GNUNET_TIME_UNIT_SECONDS); pos->is = is; - pos->ogh = TALER_MERCHANT_merchant_order_get (is->ctx, - pos->merchant_url, - pos->order_id, - NULL, - false, - pos->timeout, - &merchant_poll_order_cb, - pos); + pos->ogh = TALER_MERCHANT_merchant_order_get ( + TALER_TESTING_interpreter_get_context (is), + pos->merchant_url, + pos->order_id, + NULL, + false, + pos->timeout, + &merchant_poll_order_cb, + pos); GNUNET_assert (NULL != pos->ogh); /* We CONTINUE to run the interpreter while the long-polled command completes asynchronously! */ |