From 7283bdc7e95afc669ce4d2cd741b65efc985c13b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 5 Feb 2024 01:37:15 +0100 Subject: remove reserves/rewards from public C APIs and tests --- src/include/taler_merchant_service.h | 1133 +--------------------------------- 1 file changed, 2 insertions(+), 1131 deletions(-) (limited to 'src/include/taler_merchant_service.h') diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index b4dda615..78212d86 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2023 Taler Systems SA + Copyright (C) 2014-2024 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software @@ -34,7 +34,7 @@ /** * Library version (in hex) for compatibility tests. */ -#define TALER_MERCHANT_SERVICE_VERSION 0x00090401 +#define TALER_MERCHANT_SERVICE_VERSION 0x00090402 /** @@ -3948,1135 +3948,6 @@ TALER_MERCHANT_transfers_get_cancel ( struct TALER_MERCHANT_GetTransfersHandle *gth); -/* ******************* /reserves *************** */ - - -/** - * @brief Handle to a POST /reserves operation at a merchant's backend. - */ -struct TALER_MERCHANT_PostReservesHandle; - - -/** - * Response to a POST /reserves request. - */ -struct TALER_MERCHANT_PostReservesResponse -{ - /** - * HTTP response details. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on HTTP status. - */ - union - { - /** - * Response on #MHD_HTTP_OK. - */ - struct - { - /** - * Public key of the created reserve. - */ - struct TALER_ReservePublicKeyP reserve_pub; - - /** - * Accounts to credit to for filling the reserve. - * Array of accounts of the exchange. - */ - const struct TALER_EXCHANGE_WireAccount *accounts; - - /** - * Length of @e accounts array. - */ - unsigned int accounts_len; - - } ok; - } details; -}; - - -/** - * Callbacks of this type are used to work the result of submitting a - * POST /reserves request to a merchant - * - * @param cls closure - * @param prr response details - */ -typedef void -(*TALER_MERCHANT_PostReservesCallback) ( - void *cls, - const struct TALER_MERCHANT_PostReservesResponse *prr); - - -/** - * Request backend to create a reserve. - * - * @param ctx execution context - * @param backend_url base URL of the backend - * @param initial_balance desired initial balance for the reserve - * @param exchange_url what is the URL of the exchange where the reserve should be set up - * @param wire_method desired wire method, for example "iban" or "x-taler-bank" - * @param cb the callback to call when a reply for this request is available - * @param cb_cls closure for @a cb - * @return a handle for this request - */ -struct TALER_MERCHANT_PostReservesHandle * -TALER_MERCHANT_reserves_post ( - struct GNUNET_CURL_Context *ctx, - const char *backend_url, - const struct TALER_Amount *initial_balance, - const char *exchange_url, - const char *wire_method, - TALER_MERCHANT_PostReservesCallback cb, - void *cb_cls); - - -/** - * Cancel a POST /reserves request. This function cannot be used - * on a request handle if a response is already served for it. - * - * @param prh the operation to cancel - */ -void -TALER_MERCHANT_reserves_post_cancel ( - struct TALER_MERCHANT_PostReservesHandle *prh); - - -/** - * Handle for a GET /reserves operation. - */ -struct TALER_MERCHANT_ReservesGetHandle; - - -/** - * Information about a reserve. - */ -struct TALER_MERCHANT_ReserveSummary -{ - /** - * Public key of the reserve - */ - struct TALER_ReservePublicKeyP reserve_pub; - - /** - * Timestamp when it was established - */ - struct GNUNET_TIME_Timestamp creation_time; - - /** - * Timestamp when it expires - */ - struct GNUNET_TIME_Timestamp expiration_time; - - /** - * Initial amount as per reserve creation call - */ - struct TALER_Amount merchant_initial_amount; - - /** - * Initial amount as per exchange, 0 if exchange did - * not confirm reserve creation yet. - */ - struct TALER_Amount exchange_initial_amount; - - /** - * Amount picked up so far. - */ - struct TALER_Amount pickup_amount; - - /** - * Amount approved for rewards that exceeds the pickup_amount. - */ - struct TALER_Amount committed_amount; - - /** - * Is this reserve active (false if it was deleted but not purged) - */ - bool active; -}; - - -/** - * Response to a GET /reserves request. - */ -struct TALER_MERCHANT_ReservesGetResponse -{ - /** - * HTTP response details - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on status. - */ - union - { - - /** - * Details if status is #MHD_HTTP_OK. - */ - struct - { - /** - * length of the @e reserves array - */ - unsigned int reserves_length; - - /** - * array with details about the reserves - */ - const struct TALER_MERCHANT_ReserveSummary *reserves; - - } ok; - - } details; -}; - - -/** - * Callback to process a GET /reserves request - * - * @param cls closure - * @param rgr response details - */ -typedef void -(*TALER_MERCHANT_ReservesGetCallback) ( - void *cls, - const struct TALER_MERCHANT_ReservesGetResponse *rgr); - - -/** - * Issue a GET /reserves request to the backend. Informs the backend - * that a customer wants to pick up a reserves. - * - * @param ctx execution context - * @param backend_url base URL of the merchant backend - * @param after filter for reserves created after this date, use 0 for no filtering - * @param active filter for reserves that are active - * @param failures filter for reserves where we disagree about the balance with - * the exchange - * @param cb function to call with the result(s) - * @param cb_cls closure for @a cb - * @return handle for this operation, NULL upon errors - */ -struct TALER_MERCHANT_ReservesGetHandle * -TALER_MERCHANT_reserves_get (struct GNUNET_CURL_Context *ctx, - const char *backend_url, - struct GNUNET_TIME_Timestamp after, - enum TALER_EXCHANGE_YesNoAll active, - enum TALER_EXCHANGE_YesNoAll failures, - TALER_MERCHANT_ReservesGetCallback cb, - void *cb_cls); - - -/** - * Cancel a GET /reserves request. - * - * @param rgh handle to the request to be canceled - */ -void -TALER_MERCHANT_reserves_get_cancel ( - struct TALER_MERCHANT_ReservesGetHandle *rgh); - - -/** - * Handle for a request to obtain details on a specific - * (rewardping) reserve. - */ -struct TALER_MERCHANT_ReserveGetHandle; - - -/** - * Details about a reward granted by the merchant. - */ -struct TALER_MERCHANT_RewardDetails -{ - /** - * Identifier for the reward. - */ - struct TALER_RewardIdentifierP reward_id; - - /** - * Total value of the reward (including fees). - */ - struct TALER_Amount amount; - - /** - * Human-readable reason for why the reward was granted. - */ - const char *reason; - -}; - - -/** - * Response to a GET /reserves/$ID request. - */ -struct TALER_MERCHANT_ReserveGetResponse -{ - /** - * HTTP response. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on HTTP status. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * reserve summary for the reserve - */ - struct TALER_MERCHANT_ReserveSummary rs; - - /** - * URL of the exchange hosting the reserve, NULL if not @a active - */ - const char *exchange_url; - - /** - * Accounts to credit to for filling the reserve. - * Array of accounts of the exchange. Empty if - * already filled. - */ - const struct TALER_EXCHANGE_WireAccount *accounts; - - /** - * Length of @e accounts array. - */ - unsigned int accounts_len; - - /** - * Array with details about the rewards granted. - */ - const struct TALER_MERCHANT_RewardDetails *rewards; - - /** - * Length of the @e rewards array - */ - unsigned int rewards_length; - - /** - * Is this reserve active (false if it was deleted but not purged) - */ - bool active; - - } ok; - - } details; - -}; - - -/** - * Callback to process a GET /reserve/$RESERVE_PUB request - * - * @param cls closure - * @param rgr response details - */ -typedef void -(*TALER_MERCHANT_ReserveGetCallback) ( - void *cls, - const struct TALER_MERCHANT_ReserveGetResponse *rgr); - - -/** - * Issue a GET /reserve/$RESERVE_ID request to the backend. Queries the backend - * about the status of a reserve. - * - * @param ctx execution context - * @param backend_url base URL of the merchant backend - * @param reserve_pub which reserve should be queried - * @param fetch_rewards should we return details about the rewards issued from the reserve - * @param cb function to call with the result(s) - * @param cb_cls closure for @a cb - * @return handle for this operation, NULL upon errors - */ -struct TALER_MERCHANT_ReserveGetHandle * -TALER_MERCHANT_reserve_get (struct GNUNET_CURL_Context *ctx, - const char *backend_url, - const struct TALER_ReservePublicKeyP *reserve_pub, - bool fetch_rewards, - TALER_MERCHANT_ReserveGetCallback cb, - void *cb_cls); - - -/** - * Cancel a GET /reserve/$RESERVE_ID request. - * - * @param rgh handle to the request to be canceled - */ -void -TALER_MERCHANT_reserve_get_cancel ( - struct TALER_MERCHANT_ReserveGetHandle *rgh); - - -/** - * Handle for a /reward-authorize operation. - */ -struct TALER_MERCHANT_RewardAuthorizeHandle; - - -/** - * Response to a /reward-authorize request. - */ -struct TALER_MERCHANT_RewardAuthorizeResponse -{ - /** - * HTTP response details - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on HTTP status. - */ - union - { - - /** - * Details if status is #MHD_HTTP_OK. - */ - struct - { - - /** - * which reward ID should be used to pickup the reward - */ - struct TALER_RewardIdentifierP reward_id; - - /** - * URI for the reward - */ - const char *reward_uri; - - /** - * when does the reward expire - */ - struct GNUNET_TIME_Timestamp reward_expiration; - - } ok; - - } details; - -}; - - -/** - * Callback for a /reserves/$RESERVE_PUB/reward-authorize request. Returns the - * result of the operation. - * - * @param cls closure - * @param tar response - */ -typedef void -(*TALER_MERCHANT_RewardAuthorizeCallback) ( - void *cls, - const struct TALER_MERCHANT_RewardAuthorizeResponse *tar); - - -/** - * Issue a /reward-authorize request to the backend. Informs the backend - * that a reward should be created. - * - * @param ctx execution context - * @param backend_url base URL of the merchant backend - * @param reserve_pub public key of the reserve - * @param next_url where the browser should proceed after picking up the reward - * @param amount amount to be handed out as a reward - * @param justification which justification should be stored (human-readable reason for the reward) - * @param authorize_cb callback which will work the response gotten from the backend - * @param authorize_cb_cls closure to pass to @a authorize_cb - * @return handle for this operation, NULL upon errors - */ -struct TALER_MERCHANT_RewardAuthorizeHandle * -TALER_MERCHANT_reward_authorize2 ( - struct GNUNET_CURL_Context *ctx, - const char *backend_url, - const struct TALER_ReservePublicKeyP *reserve_pub, - const char *next_url, - const struct TALER_Amount *amount, - const char *justification, - TALER_MERCHANT_RewardAuthorizeCallback authorize_cb, - void *authorize_cb_cls); - - -/** - * Issue a POST /rewards request to the backend. Informs the backend that a reward - * should be created. In contrast to #TALER_MERCHANT_reward_authorize2(), the - * backend gets to pick the reserve with this API. - * - * @param ctx execution context - * @param backend_url base URL of the merchant backend - * @param next_url where the browser should proceed after picking up the reward - * @param amount amount to be handed out as a reward - * @param justification which justification should be stored (human-readable reason for the reward) - * @param authorize_cb callback which will work the response gotten from the backend - * @param authorize_cb_cls closure to pass to @a authorize_cb - * @return handle for this operation, NULL upon errors - */ -struct TALER_MERCHANT_RewardAuthorizeHandle * -TALER_MERCHANT_reward_authorize ( - struct GNUNET_CURL_Context *ctx, - const char *backend_url, - const char *next_url, - const struct TALER_Amount *amount, - const char *justification, - TALER_MERCHANT_RewardAuthorizeCallback authorize_cb, - void *authorize_cb_cls); - - -/** - * Cancel a pending /reward-authorize request - * - * @param ta handle from the operation to cancel - */ -void -TALER_MERCHANT_reward_authorize_cancel ( - struct TALER_MERCHANT_RewardAuthorizeHandle *ta); - - -/** - * Handle for a request to delete or purge a specific reserve. - */ -struct TALER_MERCHANT_ReserveDeleteHandle; - - -/** - * Callback to process a DELETE /reserve/$RESERVE_PUB request - * - * @param cls closure - * @param hr HTTP response details - */ -typedef void -(*TALER_MERCHANT_ReserveDeleteCallback) ( - void *cls, - const struct TALER_MERCHANT_HttpResponse *hr); - - -/** - * Issue a DELETE /reserve/$RESERVE_ID request to the backend. Only - * deletes the private key of the reserve, preserves rewardping data. - * - * @param ctx execution context - * @param backend_url base URL of the merchant backend - * @param reserve_pub which reserve should be queried - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return handle for this operation, NULL upon errors - */ -struct TALER_MERCHANT_ReserveDeleteHandle * -TALER_MERCHANT_reserve_delete ( - struct GNUNET_CURL_Context *ctx, - const char *backend_url, - const struct TALER_ReservePublicKeyP *reserve_pub, - TALER_MERCHANT_ReserveDeleteCallback cb, - void *cb_cls); - - -/** - * Issue a DELETE /reserve/$RESERVE_ID request to the backend. - * Purges the reserve, deleting all associated data. DANGEROUS. - * - * @param ctx execution context - * @param backend_url base URL of the merchant backend - * @param reserve_pub which reserve should be queried - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return handle for this operation, NULL upon errors - */ -struct TALER_MERCHANT_ReserveDeleteHandle * -TALER_MERCHANT_reserve_purge ( - struct GNUNET_CURL_Context *ctx, - const char *backend_url, - const struct TALER_ReservePublicKeyP *reserve_pub, - TALER_MERCHANT_ReserveDeleteCallback cb, - void *cb_cls); - - -/** - * Cancel a DELETE (or purge) /reserve/$RESERVE_ID request. - * - * @param[in] rdh handle to the request to be canceled - */ -void -TALER_MERCHANT_reserve_delete_cancel ( - struct TALER_MERCHANT_ReserveDeleteHandle *rdh); - - -/* ********************* /rewards ************************** */ - - -/** - * Handle for a GET /rewards/$REWARD_ID (public variant) operation. - */ -struct TALER_MERCHANT_RewardWalletGetHandle; - -/** - * Response to a wallet's GET /rewards/$REWARD_ID request. - */ -struct TALER_MERCHANT_RewardWalletGetResponse -{ - /** - * HTTP response details - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status code. - */ - union - { - - /** - * Details for #MHD_HTTP_OK status. - */ - struct - { - - /** - * when the reward will expire - */ - struct GNUNET_TIME_Timestamp expiration; - - /** - * exchange from which the coins should be withdrawn - */ - const char *exchange_url; - - /** - * URL where the wallet should navigate after withdrawing the reward. - */ - const char *next_url; - - /** - * total amount still available for the reward - */ - struct TALER_Amount amount_remaining; - } ok; - - } details; -}; - - -/** - * Callback to process a GET /rewards/$REWARD_ID request - * - * @param cls closure - * @param wgr response details - */ -typedef void -(*TALER_MERCHANT_RewardWalletGetCallback) ( - void *cls, - const struct TALER_MERCHANT_RewardWalletGetResponse *wgr); - - -/** - * Issue a GET /rewards/$REWARD_ID (public variant) request to the backend. Returns - * information needed to pick up a reward. - * - * @param ctx execution context - * @param backend_url base URL of the merchant backend - * @param reward_id which reward should we query - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return handle for this operation, NULL upon errors - */ -struct TALER_MERCHANT_RewardWalletGetHandle * -TALER_MERCHANT_wallet_reward_get ( - struct GNUNET_CURL_Context *ctx, - const char *backend_url, - const struct TALER_RewardIdentifierP *reward_id, - TALER_MERCHANT_RewardWalletGetCallback cb, - void *cb_cls); - - -/** - * Cancel a GET /rewards/$REWARD_ID request. - * - * @param[in] tgh handle to the request to be canceled - */ -void -TALER_MERCHANT_wallet_reward_get_cancel ( - struct TALER_MERCHANT_RewardWalletGetHandle *tgh); - - -/** - * Handle for a GET /private/rewards/$REWARD_ID (private variant) operation. - */ -struct TALER_MERCHANT_RewardMerchantGetHandle; - - -/** - * Summary information for a reward pickup. - */ -struct TALER_MERCHANT_PickupDetail -{ - /** - * Identifier of the pickup. - */ - struct TALER_PickupIdentifierP pickup_id; - - /** - * Number of planchets involved. - */ - uint64_t num_planchets; - - /** - * Total amount requested for this pickup. - */ - struct TALER_Amount requested_amount; -}; - - -/** - * Details returned about a reward by the merchant. - */ -struct TALER_MERCHANT_RewardStatusResponse -{ - /** - * HTTP status of the response. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on the HTTP status. - */ - union - { - - /** - * Details on #MHD_HTTP_OK. - */ - struct - { - - /** - * Amount that was authorized under this reward - */ - struct TALER_Amount total_authorized; - - /** - * Amount that has been picked up - */ - struct TALER_Amount total_picked_up; - - /** - * The reason given for the reward - */ - const char *reason; - - /** - * Time when the reward will expire - */ - struct GNUNET_TIME_Timestamp expiration; - - /** - * reserve which is funding this reward - */ - struct TALER_ReservePublicKeyP reserve_pub; - - /** - * Length of the @e pickups array - */ - unsigned int pickups_length; - - /** - * array of pickup operations performed for this reward - */ - struct TALER_MERCHANT_PickupDetail *pickups; - } ok; - - } details; - -}; - - -/** - * Callback to process a GET /private/rewards/$REWARD_ID request - * - * @param cls closure - * @param tsr response details - */ -typedef void -(*TALER_MERCHANT_RewardMerchantGetCallback) ( - void *cls, - const struct TALER_MERCHANT_RewardStatusResponse *tsr); - - -/** - * Issue a GET /private/rewards/$REWARD_ID (private variant) request to the backend. - * Returns information needed to pick up a reward. - * - * @param ctx execution context - * @param backend_url base URL of the merchant backend - * @param reward_id which reward should we query - * @param min_pick_up minimum amount picked up to notify about - * @param lp_timeout how long to wait for @a min_pick_up to be exceeded - * @param pickups whether to fetch associated pickups - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return handle for this operation, NULL upon errors - */ -struct TALER_MERCHANT_RewardMerchantGetHandle * -TALER_MERCHANT_merchant_reward_get ( - struct GNUNET_CURL_Context *ctx, - const char *backend_url, - const struct TALER_RewardIdentifierP *reward_id, - const struct TALER_Amount *min_pick_up, - struct GNUNET_TIME_Relative lp_timeout, - bool pickups, - TALER_MERCHANT_RewardMerchantGetCallback cb, - void *cb_cls); - - -/** - * Cancel a GET /private/rewards/$REWARD_ID request. - * - * @param[in] tgh handle to the request to be canceled - */ -void -TALER_MERCHANT_merchant_reward_get_cancel ( - struct TALER_MERCHANT_RewardMerchantGetHandle *tgh); - - -/** - * Handle for a GET /private/rewards request. - */ -struct TALER_MERCHANT_RewardsGetHandle; - - -/** - * Database entry information of a reward. - */ -struct TALER_MERCHANT_RewardEntry -{ - /** - * Row number of the reward in the database. - */ - uint64_t row_id; - - /** - * Identifier for the reward. - */ - struct TALER_RewardIdentifierP reward_id; - - /** - * Total value of the reward (including fees). - */ - struct TALER_Amount reward_amount; - -}; - - -/** - * Response to a GET /private/rewards request. - */ -struct TALER_MERCHANT_RewardsGetResponse -{ - /** - * HTTP response details - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on status. - */ - union - { - - /** - * Details if status is #MHD_HTTP_OK. - */ - struct - { - /** - * length of the @e rewards array - */ - unsigned int rewards_length; - - /** - * the array of rewards - */ - const struct TALER_MERCHANT_RewardEntry *rewards; - - } ok; - - } details; -}; - - -/** - * Callback to process a GET /private/rewards request. - * - * @param cls closure - * @param tgr response details - */ -typedef void -(*TALER_MERCHANT_RewardsGetCallback) ( - void *cls, - const struct TALER_MERCHANT_RewardsGetResponse *tgr); - - -/** - * Issue a GET /private/rewards request to the backend. - * - * @param ctx execution context - * @param backend_url base URL of the merchant backend - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return handle for this operation, NULL upon errors - */ -struct TALER_MERCHANT_RewardsGetHandle * -TALER_MERCHANT_rewards_get ( - struct GNUNET_CURL_Context *ctx, - const char *backend_url, - TALER_MERCHANT_RewardsGetCallback cb, - void *cb_cls); - - -/** - * Issue a GET /private/rewards request with filters to the backend. - * - * @param ctx execution context - * @param backend_url base URL of the merchant backend - * @param expired yes for expired rewards, no for unexpired rewards, all for all rewards - * @param limit number of results to return, negative for descending row id, positive for ascending - * @param offset row id to start returning results from - * @param cb function to call with the result - * @param cb_cls closure for @a cb - * @return handle for this operation, NULL upon errors - */ -struct TALER_MERCHANT_RewardsGetHandle * -TALER_MERCHANT_rewards_get2 ( - struct GNUNET_CURL_Context *ctx, - const char *backend_url, - enum TALER_EXCHANGE_YesNoAll expired, - int64_t limit, - uint64_t offset, - TALER_MERCHANT_RewardsGetCallback cb, - void *cb_cls); - - -/** - * Cancel a GET /private/rewards request. - * - * @param tgh the operation to cancel - */ -void -TALER_MERCHANT_rewards_get_cancel (struct TALER_MERCHANT_RewardsGetHandle *tgh); - - -/** - * Handle for a POST /rewards/$REWARD_ID/pickup operation. - */ -struct TALER_MERCHANT_RewardPickupHandle; - - -/** - * Details about a pickup operation, as returned to the application. - */ -struct TALER_MERCHANT_PickupDetails -{ - /** - * HTTP response data. - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details about the response. - */ - union - { - /** - * Details if the status is #MHD_HTTP_OK. - */ - struct - { - - /** - * Array of length @e num_sigs with details about each of the coins that - * were picked up. - */ - struct TALER_EXCHANGE_PrivateCoinDetails *pcds; - - /** - * Length of the @e pcds array. - */ - unsigned int num_sigs; - } ok; - - } details; - -}; - - -/** - * Callback for a POST /rewards/$REWARD_ID/pickup request. Returns the result of - * the operation. - * - * @param cls closure - * @param pd HTTP response details - */ -typedef void -(*TALER_MERCHANT_RewardPickupCallback) ( - void *cls, - const struct TALER_MERCHANT_PickupDetails *pd); - - -/** - * Information per planchet. - */ -struct TALER_MERCHANT_PlanchetData -{ - /** - * Planchet secrets. - */ - struct TALER_PlanchetMasterSecretP ps; - - /** - * Denomination key desired. - */ - const struct TALER_EXCHANGE_DenomPublicKey *pk; - -}; - -/** - * Issue a POST /rewards/$REWARD_ID/pickup request to the backend. Informs the - * backend that a customer wants to pick up a reward. - * - * @param ctx execution context - * @param exchange_url base URL of the exchange - * @param backend_url base URL of the merchant backend - * @param reward_id unique identifier for the reward - * @param num_planchets number of planchets provided in @a pds - * @param planchets array of planchet secrets to be signed into existence for the reward - * @param pickup_cb callback which will work the response gotten from the backend - * @param pickup_cb_cls closure to pass to @a pickup_cb - * @return handle for this operation, NULL upon errors - */ -struct TALER_MERCHANT_RewardPickupHandle * -TALER_MERCHANT_reward_pickup ( - struct GNUNET_CURL_Context *ctx, - const char *exchange_url, - const char *backend_url, - const struct TALER_RewardIdentifierP *reward_id, - unsigned int num_planchets, - const struct TALER_MERCHANT_PlanchetData planchets[static num_planchets], - TALER_MERCHANT_RewardPickupCallback pickup_cb, - void *pickup_cb_cls); - - -/** - * Cancel a pending /rewards/$REWARD_ID/pickup request - * - * @param tph handle from the operation to cancel - */ -void -TALER_MERCHANT_reward_pickup_cancel (struct - TALER_MERCHANT_RewardPickupHandle *tph); - - -/** - * Handle for a low-level /reward-pickup operation (without unblinding). - */ -struct TALER_MERCHANT_RewardPickup2Handle; - - -/** - * Response for a POST /rewards/$REWARD_ID/pickup request. - */ -struct TALER_MERCHANT_RewardPickup2Response -{ - /** - * HTTP response details - */ - struct TALER_MERCHANT_HttpResponse hr; - - /** - * Details depending on status. - */ - union - { - - /** - * Details if status is #MHD_HTTP_OK. - */ - struct - { - - /** - * length of the @a blind_sigs array - */ - unsigned int num_blind_sigs; - - /** - * array of blind signatures over the planchets - */ - const struct TALER_BlindedDenominationSignature *blind_sigs; - - } ok; - - } details; -}; - - -/** - * Callback for a POST /rewards/$REWARD_ID/pickup request. Returns the result of - * the operation. Note that the client MUST still do the unblinding. - * - * @param cls closure - * @param tpr response details - */ -typedef void -(*TALER_MERCHANT_RewardPickup2Callback) ( - void *cls, - const struct TALER_MERCHANT_RewardPickup2Response *tpr); - - -/** - * Issue a POST /rewards/$REWARD_ID/pickup request to the backend. Informs the - * backend that a customer wants to pick up a reward. - * - * @param ctx execution context - * @param backend_url base URL of the merchant backend - * @param reward_id unique identifier for the reward - * @param num_planchets number of planchets provided in @a planchets - * @param planchets array of planchets to be signed into existence for the reward - * @param pickup_cb callback which will work the response gotten from the backend - * @param pickup_cb_cls closure to pass to @a pickup_cb - * @return handle for this operation, NULL upon errors - */ -struct TALER_MERCHANT_RewardPickup2Handle * -TALER_MERCHANT_reward_pickup2 ( - struct GNUNET_CURL_Context *ctx, - const char *backend_url, - const struct TALER_RewardIdentifierP *reward_id, - unsigned int num_planchets, - const struct TALER_PlanchetDetail planchets[static num_planchets], - TALER_MERCHANT_RewardPickup2Callback pickup_cb, - void *pickup_cb_cls); - - -/** - * Cancel a pending /reward-pickup request. - * - * @param[in] tp handle from the operation to cancel - */ -void -TALER_MERCHANT_reward_pickup2_cancel ( - struct TALER_MERCHANT_RewardPickup2Handle *tp); - - /* ********************* /kyc ************************** */ /** -- cgit v1.2.3