From e095f81c0acf1ae21874eb50936b30111fefef89 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 9 Nov 2019 13:06:21 +0100 Subject: api update, not fully implemented --- src/include/taler_merchant_service.h | 6 +++++- src/lib/merchant_api_check_payment.c | 5 +++++ src/lib/testing_api_cmd_check_payment.c | 19 +++++++------------ src/merchant-tools/taler-merchant-benchmark.c | 5 ++++- 4 files changed, 21 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 1d424f22..0e36b981 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -28,7 +28,6 @@ #include #include -#define APIKEY_SANDBOX "Authorization: ApiKey sandbox" /* ********************* /refund ************************** */ @@ -987,6 +986,10 @@ typedef void * @param backend_url base URL of the merchant backend * @param order_id order id to identify the payment * @parem session_id sesion id for the payment (or NULL if the payment is not bound to a session) + * @param timeout timeout to use in long polling (how long may the server wait to reply + * before generating an unpaid response). Note that this is just provided to + * the server, we as client will block until the response comes back or until + * #TALER_MERCHANT_check_payment_cancel() is called. * @param check_payment_cb callback which will work the response gotten from the backend * @param check_payment_cb_cls closure to pass to @a check_payment_cb * @return handle for this operation, NULL upon errors @@ -996,6 +999,7 @@ TALER_MERCHANT_check_payment (struct GNUNET_CURL_Context *ctx, const char *backend_url, const char *order_id, const char *session_id, + struct GNUNET_TIME_Relative timeout, TALER_MERCHANT_CheckPaymentCallback check_payment_cb, void *check_payment_cls); diff --git a/src/lib/merchant_api_check_payment.c b/src/lib/merchant_api_check_payment.c index 35cd44ce..fe38a18a 100644 --- a/src/lib/merchant_api_check_payment.c +++ b/src/lib/merchant_api_check_payment.c @@ -178,6 +178,10 @@ handle_check_payment_finished (void *cls, * @param backend_url base URL of the merchant backend * @param order_id order id to identify the payment * @parem session_id sesion id for the payment (or NULL if the payment is not bound to a session) + * @param timeout timeout to use in long polling (how long may the server wait to reply + * before generating an unpaid response). Note that this is just provided to + * the server, we as client will block until the response comes back or until + * #TALER_MERCHANT_poll_payment_cancel() is called. * @param check_payment_cb callback which will work the response gotten from the backend * @param check_payment_cb_cls closure to pass to @a check_payment_cb * @return handle for this operation, NULL upon errors @@ -187,6 +191,7 @@ TALER_MERCHANT_check_payment (struct GNUNET_CURL_Context *ctx, const char *backend_url, const char *order_id, const char *session_id, + struct GNUNET_TIME_Relative timeout, TALER_MERCHANT_CheckPaymentCallback check_payment_cb, void *check_payment_cb_cls) diff --git a/src/lib/testing_api_cmd_check_payment.c b/src/lib/testing_api_cmd_check_payment.c index e74dbd12..a942c587 100644 --- a/src/lib/testing_api_cmd_check_payment.c +++ b/src/lib/testing_api_cmd_check_payment.c @@ -162,26 +162,21 @@ check_payment_run (void *cls, cps->is = is; proposal_cmd = TALER_TESTING_interpreter_lookup_command ( is, cps->proposal_reference); - if (NULL == proposal_cmd) TALER_TESTING_FAIL (is); - if (GNUNET_OK != TALER_TESTING_get_trait_order_id ( proposal_cmd, 0, &order_id)) TALER_TESTING_FAIL (is); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Checking for order id `%s'\n", order_id); - - cps->cpo = TALER_MERCHANT_check_payment - (is->ctx, - cps->merchant_url, - order_id, - NULL, - check_payment_cb, - cps); - + cps->cpo = TALER_MERCHANT_check_payment (is->ctx, + cps->merchant_url, + order_id, + NULL, + GNUNET_TIME_UNIT_ZERO, + check_payment_cb, + cps); GNUNET_assert (NULL != cps->cpo); } diff --git a/src/merchant-tools/taler-merchant-benchmark.c b/src/merchant-tools/taler-merchant-benchmark.c index dedcc220..49c3cdd7 100644 --- a/src/merchant-tools/taler-merchant-benchmark.c +++ b/src/merchant-tools/taler-merchant-benchmark.c @@ -23,7 +23,6 @@ * communication with the exchange * @author Marcello Stanisci */ - #include "platform.h" #include #include @@ -38,6 +37,10 @@ #include #include "taler_merchant_testing_lib.h" + +#define APIKEY_SANDBOX "Authorization: ApiKey sandbox" + + /* Error codes. */ enum PaymentGeneratorError { -- cgit v1.2.3