[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: design for TALER_MERCHANT_order_
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: design for TALER_MERCHANT_order_paid API |
Date: |
Sun, 19 Jul 2020 13:56:14 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new ed7cd6c design for TALER_MERCHANT_order_paid API
ed7cd6c is described below
commit ed7cd6ce6d37212992c2c3eeffca404bbbd2d41e
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jul 19 00:45:25 2020 +0200
design for TALER_MERCHANT_order_paid API
---
.../taler-merchant-httpd_post-orders-ID-paid.c | 7 ++-
src/include/taler_merchant_service.h | 58 ++++++++++++++++++++++
2 files changed, 64 insertions(+), 1 deletion(-)
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
b/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
index 45f13c4..74328f5 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-paid.c
@@ -47,6 +47,7 @@ TMH_post_orders_ID_paid (const struct TMH_RequestHandler *rh,
.purpose.size = htonl (sizeof (pr))
};
struct TALER_MerchantSignatureP merchant_sig;
+ const char *session_id;
{
struct GNUNET_JSON_Specification spec[] = {
@@ -69,6 +70,9 @@ TMH_post_orders_ID_paid (const struct TMH_RequestHandler *rh,
: MHD_NO;
}
}
+ session_id = json_string_value (
+ json_object_get (hc->request_body,
+ "session_id"));
#if FIXME
if (GNUNET_OK !=
@@ -87,7 +91,8 @@ TMH_post_orders_ID_paid (const struct TMH_RequestHandler *rh,
}
// FIXME: check that h_contract_terms matches
- // this order-id (and that the order is known)
+ // this order-id (and that the order is known),
+ // and if it does, update 'session_id' (if non-NULL)
if (0)
{
return TALER_MHD_reply_json_pack (
diff --git a/src/include/taler_merchant_service.h
b/src/include/taler_merchant_service.h
index 213ea46..0e3ec5c 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -2025,6 +2025,64 @@ void
TALER_MERCHANT_order_pay_cancel (struct TALER_MERCHANT_OrderPayHandle *oph);
+/**
+ * @brief Handle to a POST /orders/$ID/paid operation at a merchant.
+ */
+struct TALER_MERCHANT_OrderPaidHandle;
+
+
+/**
+ * Callbacks of this type are used to serve the result of submitting a
+ * POST /orders/$ID/paid request to a merchant.
+ *
+ * @param cls closure
+ * @param hr HTTP response details
+ */
+typedef void
+(*TALER_MERCHANT_OrderPaidCallback) (
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr);
+
+
+/**
+ * Send proof of payment to a merchant.
+ *
+ * This is a PUBLIC API, albeit in this form useful for the frontend,
+ * in case the frontend is proxying the request.
+ *
+ * @param ctx execution context
+ * @param merchant_url base URL of the merchant
+ * @param order_id which order should be paid
+ * @param session_id session to pay for, or NULL for none
+ * @param h_contract_terms hash of the contract terms
+ * @param merchant_sig signature from the merchant
+ * affirming payment, or NULL on errors
+ * @param paid_cb the callback to call when a reply for this request is
available
+ * @param paid_cb_cls closure for @a paid_cb
+ * @return a handle for this request
+ */
+struct TALER_MERCHANT_OrderPaidHandle *
+TALER_MERCHANT_order_paid (
+ struct GNUNET_CURL_Context *ctx,
+ const char *merchant_url,
+ const char *order_id,
+ const char *session_id,
+ const struct GNUNET_HashCode *h_contract_terms,
+ const struct TALER_MerchantSignatureP *merchant_sig,
+ TALER_MERCHANT_OrderPaidCallback paid_cb,
+ void *paid_cb_cls);
+
+
+/**
+ * Cancel POST /orders/$ID/paid operation.
+ *
+ * @param oph operation to cancel
+ */
+void
+TALER_MERCHANT_order_paid_cancel (
+ struct TALER_MERCHANT_OrderPaidHandle *oph);
+
+
/**
* Handle for an POST /orders/$ID/abort operation.
*/
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: design for TALER_MERCHANT_order_paid API,
gnunet <=