summaryrefslogtreecommitdiff
path: root/src/include/taler_merchant_service.h
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-08-17 21:03:45 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-08-17 21:03:45 -0400
commitd8e64ae258b911d4243a0fd62e46585f54bb445b (patch)
tree45955e85655a3cbeb5d776738ed9ca271c762eaf /src/include/taler_merchant_service.h
parent14dda234f724e59eefb49d9d98b048ce1ce9059f (diff)
downloadmerchant-d8e64ae258b911d4243a0fd62e46585f54bb445b.tar.gz
merchant-d8e64ae258b911d4243a0fd62e46585f54bb445b.tar.bz2
merchant-d8e64ae258b911d4243a0fd62e46585f54bb445b.zip
testing and lib sources for new endpoint
Diffstat (limited to 'src/include/taler_merchant_service.h')
-rw-r--r--src/include/taler_merchant_service.h144
1 files changed, 95 insertions, 49 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index 46d14ead..2da5e03c 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -1456,48 +1456,6 @@ struct TALER_MERCHANT_OrderWalletGetHandle;
/**
- * Detail about a refund lookup result.
- */
-struct TALER_MERCHANT_RefundDetail
-{
-
- /**
- * Exchange response details. Full details are only included
- * upon failure (HTTP status is not #MHD_HTTP_OK).
- */
- struct TALER_EXCHANGE_HttpResponse hr;
-
- /**
- * Coin this detail is about.
- */
- struct TALER_CoinSpendPublicKeyP coin_pub;
-
- /**
- * Refund transaction ID used.
- */
- uint64_t rtransaction_id;
-
- /**
- * Amount to be refunded for this coin.
- */
- struct TALER_Amount refund_amount;
-
- /**
- * Public key of the exchange affirming the refund,
- * only valid if the @e hr http_status is #MHD_HTTP_OK.
- */
- struct TALER_ExchangePublicKeyP exchange_pub;
-
- /**
- * Signature of the exchange affirming the refund,
- * only valid if the @e hr http_status is #MHD_HTTP_OK.
- */
- struct TALER_ExchangeSignatureP exchange_sig;
-
-};
-
-
-/**
* Callback to process a GET /orders/$ID request
*
* @param cls closure
@@ -1513,9 +1471,6 @@ struct TALER_MERCHANT_RefundDetail
* the payment
* @param already_paid_order_id equivalent order that this customer
* paid already, or NULL for none
- * @param merchant_pub public key of the merchant
- * @param num_refunds length of the @a refunds array
- * @param refunds details about the refund processing
*/
typedef void
(*TALER_MERCHANT_OrderWalletGetCallback) (
@@ -1525,10 +1480,7 @@ typedef void
enum GNUNET_GenericReturnValue refunded,
struct TALER_Amount *refund_amount,
const char *taler_pay_uri,
- const char *already_paid_order_id,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- unsigned int num_refunds,
- const struct TALER_MERCHANT_RefundDetail *refunds);
+ const char *already_paid_order_id);
/**
@@ -2433,6 +2385,100 @@ TALER_MERCHANT_post_order_refund_cancel (
struct TALER_MERCHANT_OrderRefundHandle *orh);
+/**
+ * Handle for a (public) POST /orders/ID/refund operation.
+ */
+struct TALER_MERCHANT_WalletOrderRefundHandle;
+
+
+/**
+ * Detail about a refund lookup result.
+ */
+struct TALER_MERCHANT_RefundDetail
+{
+
+ /**
+ * Exchange response details. Full details are only included
+ * upon failure (HTTP status is not #MHD_HTTP_OK).
+ */
+ struct TALER_EXCHANGE_HttpResponse hr;
+
+ /**
+ * Coin this detail is about.
+ */
+ struct TALER_CoinSpendPublicKeyP coin_pub;
+
+ /**
+ * Refund transaction ID used.
+ */
+ uint64_t rtransaction_id;
+
+ /**
+ * Amount to be refunded for this coin.
+ */
+ struct TALER_Amount refund_amount;
+
+ /**
+ * Public key of the exchange affirming the refund,
+ * only valid if the @e hr http_status is #MHD_HTTP_OK.
+ */
+ struct TALER_ExchangePublicKeyP exchange_pub;
+
+ /**
+ * Signature of the exchange affirming the refund,
+ * only valid if the @e hr http_status is #MHD_HTTP_OK.
+ */
+ struct TALER_ExchangeSignatureP exchange_sig;
+
+};
+
+
+/**
+ * Callback to process a (public) POST /orders/ID/refund request
+ *
+ * @param cls closure
+ * @param http_status HTTP status code for this request
+ * @param ec taler-specific error code
+ */
+typedef void
+(*TALER_MERCHANT_WalletRefundCallback) (
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr,
+ const struct TALER_Amount *refund_amount,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ struct TALER_MERCHANT_RefundDetail refunds[],
+ unsigned int refunds_length);
+
+
+/**
+ * Obtain the refunds that have been granted for an order.
+ *
+ * @param ctx the CURL context used to connect to the backend
+ * @param backend_url backend's base URL, including final "/"
+ * @param order_id id of the order whose refund is to be increased
+ * @param h_contract_terms hash of the contract terms of the order
+ * @param cb callback processing the response from /refund
+ * @param cb_cls closure for cb
+ */
+struct TALER_MERCHANT_WalletOrderRefundHandle *
+TALER_MERCHANT_wallet_post_order_refund (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *order_id,
+ const struct GNUNET_HashCode *h_contract_terms,
+ TALER_MERCHANT_WalletRefundCallback cb,
+ void *cb_cls);
+
+/**
+ * Cancel a (public) POST /refund request.
+ *
+ * @param orh the refund operation to cancel
+ */
+void
+TALER_MERCHANT_wallet_post_order_refund_cancel (
+ struct TALER_MERCHANT_WalletOrderRefundHandle *orh);
+
+
/* ********************* /transfers *********************** */
/**