summaryrefslogtreecommitdiff
path: root/src/include/taler_merchant_service.h
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-06-17 21:35:09 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-06-17 21:35:09 -0400
commit6624576c0cdd81072256d8abbfe6dd1343f956c6 (patch)
treea7f19eae242d0ee3e889da9fb4f8a00efdaf4eed /src/include/taler_merchant_service.h
parent06010ba8681aa588c977410e0ae6f32879435432 (diff)
downloadmerchant-6624576c0cdd81072256d8abbfe6dd1343f956c6.tar.gz
merchant-6624576c0cdd81072256d8abbfe6dd1343f956c6.tar.bz2
merchant-6624576c0cdd81072256d8abbfe6dd1343f956c6.zip
implementations, tests, and renames for GET /tips/ & GET /private/tips/
Diffstat (limited to 'src/include/taler_merchant_service.h')
-rw-r--r--src/include/taler_merchant_service.h104
1 files changed, 92 insertions, 12 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index 740c213d..4d8c0ef5 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -2793,7 +2793,7 @@ TALER_MERCHANT_reserve_delete_cancel (
/**
* Handle for a GET /tips/$TIP_ID (public variant) operation.
*/
-struct TALER_MERCHANT_TipGetHandle;
+struct TALER_MERCHANT_TipWalletGetHandle;
/**
@@ -2806,12 +2806,12 @@ struct TALER_MERCHANT_TipGetHandle;
* @param amount_remaining total amount still available for the tip
*/
typedef void
-(*TALER_MERCHANT_TipGetCallback) (
+(*TALER_MERCHANT_TipWalletGetCallback) (
void *cls,
const struct TALER_MERCHANT_HttpResponse *hr,
struct GNUNET_TIME_Absolute expiration,
const char *exchange_url,
- struct TALER_Amount *amount_remaining);
+ const struct TALER_Amount *amount_remaining);
/**
@@ -2825,21 +2825,102 @@ typedef void
* @param cb_cls closure for @a cb
* @return handle for this operation, NULL upon errors
*/
-struct TALER_MERCHANT_TipGetHandle *
-TALER_MERCHANT_tip_get (struct GNUNET_CURL_Context *ctx,
- const char *backend_url,
- const struct GNUNET_HashCode *tip_id,
- TALER_MERCHANT_TipGetCallback cb,
- void *cb_cls);
+struct TALER_MERCHANT_TipWalletGetHandle *
+TALER_MERCHANT_wallet_tip_get (struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const struct GNUNET_HashCode *tip_id,
+ TALER_MERCHANT_TipWalletGetCallback cb,
+ void *cb_cls);
/**
- * Cancel a GET /tip-get request.
+ * Cancel a GET /tips/$TIP_ID request.
*
* @param tqo handle to the request to be canceled
*/
void
-TALER_MERCHANT_tip_get_cancel (struct TALER_MERCHANT_TipGetHandle *tqh);
+TALER_MERCHANT_wallet_tip_get_cancel (struct
+ TALER_MERCHANT_TipWalletGetHandle *tgh);
+
+
+/**
+ * Handle for a GET /private/tips/$TIP_ID (private variant) operation.
+ */
+struct TALER_MERCHANT_TipMerchantGetHandle;
+
+
+/**
+ * Summary information for a tip pickup.
+ */
+struct TALER_MERCHANT_PickupDetail
+{
+ /**
+ * Identifier of the pickup.
+ */
+ struct GNUNET_HashCode pickup_id;
+
+ /**
+ * Number of planchets involved.
+ */
+ uint64_t num_planchets;
+
+ /**
+ * Total amount requested for this pickup.
+ */
+ struct TALER_Amount requested_amount;
+};
+
+/**
+ * Callback to process a GET /private/tips/$TIP_ID request
+ *
+ * @param cls closure
+ * @param hr HTTP response details
+ * @param expiration when the tip will expire
+ * @param exchange_url exchange from which the coins should be withdrawn
+ * @param amount_remaining total amount still available for the tip
+ */
+typedef void
+(*TALER_MERCHANT_TipMerchantGetCallback) (
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr,
+ const struct TALER_Amount *total_authorized,
+ const struct TALER_Amount *total_picked_up,
+ const char *reason,
+ struct GNUNET_TIME_Absolute expiration,
+ const struct TALER_ReservePublicKeyP *reserve_pub,
+ unsigned int pickups_length,
+ const struct TALER_MERCHANT_PickupDetail pickups[]);
+
+
+/**
+ * Issue a GET /private/tips/$TIP_ID (private variant) request to the backend.
+ * Returns information needed to pick up a tip.
+ *
+ * @param ctx execution context
+ * @param backend_url base URL of the merchant backend
+ * @param tip_id which tip should we query
+ * @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_TipMerchantGetHandle *
+TALER_MERCHANT_merchant_tip_get (struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const struct GNUNET_HashCode *tip_id,
+ bool pickups,
+ TALER_MERCHANT_TipMerchantGetCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel a GET /private/tips/$TIP_ID request.
+ *
+ * @param tqo handle to the request to be canceled
+ */
+void
+TALER_MERCHANT_merchant_tip_get_cancel (struct
+ TALER_MERCHANT_TipMerchantGetHandle *tgh);
/**
@@ -2858,7 +2939,6 @@ struct TALER_MERCHANT_TipEntry
*/
uint64_t row_id;
-
/**
* Identifier for the tip.
*/