merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit e095f81c0acf1ae21874eb50936b30111fefef89
parent edfc078b18effea43865a093df69e5fcb1c3475d
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  9 Nov 2019 13:06:21 +0100

api update, not fully implemented

Diffstat:
Msrc/include/taler_merchant_service.h | 6+++++-
Msrc/lib/merchant_api_check_payment.c | 5+++++
Msrc/lib/testing_api_cmd_check_payment.c | 19+++++++------------
Msrc/merchant-tools/taler-merchant-benchmark.c | 5++++-
4 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h @@ -28,7 +28,6 @@ #include <gnunet/gnunet_curl_lib.h> #include <jansson.h> -#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 @@ -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 @@ -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 @@ -23,7 +23,6 @@ * communication with the exchange * @author Marcello Stanisci */ - #include "platform.h" #include <taler/taler_util.h> #include <taler/taler_signatures.h> @@ -38,6 +37,10 @@ #include <taler/taler_error_codes.h> #include "taler_merchant_testing_lib.h" + +#define APIKEY_SANDBOX "Authorization: ApiKey sandbox" + + /* Error codes. */ enum PaymentGeneratorError {