diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_merchant_service.h | 68 |
1 files changed, 66 insertions, 2 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 52070860..540261b9 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -17,6 +17,7 @@ * @file include/taler_merchant_service.h * @brief C interface of libtalermerchant, a C library to use merchant's HTTP API * @author Christian Grothoff + * @author Marcello Stanisci */ #ifndef _TALER_MERCHANT_SERVICE_H #define _TALER_MERCHANT_SERVICE_H @@ -25,6 +26,49 @@ #include <gnunet/gnunet_curl_lib.h> #include <jansson.h> +/* ********************* /track/deposit *********************** */ + +/** + * @brief Handle to a /contract operation at a merchant's backend. + */ +struct TALER_MERCHANT_TrackDepositOperation; + +/** + * Callbacks of this type are used to work the result of submitting a /track/deposit request to a merchant + */ +typedef void +(*TALER_MERCHANT_TrackDepositCallback) (void *cls, + unsigned int http_status, + const json_t *obj); + +/** + * Request backend to return deposits associated with a given wtid. + * + * @param ctx execution context + * @param backend_uri URI of the backend (having /track/deposit appended) + * @param wtid base32 string indicating a wtid + * @param exchange base URL of the exchange in charge of returning the wanted information + * @param trackdeposit_cb the callback to call when a reply for this request is available + * @param trackdeposit_cb_cls closure for @a contract_cb + * @return a handle for this request + */ +struct TALER_MERCHANT_TrackDepositOperation * +TALER_MERCHANT_track_deposit (struct GNUNET_CURL_Context *ctx, + const char *backend_uri, + const char *wtid, + const char *exchange_uri, + TALER_MERCHANT_TrackDepositCallback trackdeposit_cb, + void *trackdeposit_cb_cls); + +/** + * Cancel a /track/deposit request. This function cannot be used + * on a request handle if a response is already served for it. + * + * @param co the deposit's tracking operation + */ +void +TALER_MERCHANT_track_deposit_cancel (struct TALER_MERCHANT_TrackDepositOperation *tdo); + /* ********************* /contract *********************** */ @@ -196,8 +240,8 @@ TALER_MERCHANT_pay_wallet (struct GNUNET_CURL_Context *ctx, /** - * Information we need from the frontend when forwarding - * a payment to the backend. + * Information we need from the frontend (ok, the frontend sends just JSON) + * when forwarding a payment to the backend. */ struct TALER_MERCHANT_PaidCoin { @@ -295,4 +339,24 @@ void TALER_MERCHANT_pay_cancel (struct TALER_MERCHANT_Pay *ph); + +/** + * Request backend to return deposits associated with a given wtid. + * + * @param ctx execution context + * @param backend_uri URI of the backend + * @param wtid base32 string indicating a wtid + * @param exchange_uri base URL of the exchange in charge of returning the wanted information + * @param trackdeposit_cb the callback to call when a reply for this request is available + * @param trackdeposit_cb_cls closure for @a contract_cb + * @return a handle for this request + */ +struct TALER_MERCHANT_TrackDepositOperation * +TALER_MERCHANT_track_deposit (struct GNUNET_CURL_Context *ctx, + const char *backend_uri, + const char *wtid, + const char *exchange_uri, + TALER_MERCHANT_TrackDepositCallback trackdeposit_cb, + void *trackdeposit_cb_cls); + #endif /* _TALER_MERCHANT_SERVICE_H */ |