diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2023-12-16 17:54:16 +0800 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2023-12-16 17:54:30 +0800 |
commit | 7891e62bf98bd884c8c993ae698f9a985dbacfbd (patch) | |
tree | 0294420f02463fb7d516c95a6b04736c64058274 /src/include | |
parent | 1c1ec9c54e09e9b90ea7a91e81bf5a6eb878c53b (diff) |
partial implementation of protocol v6: GET with additional filters, POST not done
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_merchant_service.h | 79 | ||||
-rw-r--r-- | src/include/taler_merchantdb_plugin.h | 12 |
2 files changed, 91 insertions, 0 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 0abef2a8..e8aad3d0 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -29,6 +29,11 @@ #include <gnunet/gnunet_curl_lib.h> #include <jansson.h> +/** + * Library version (in hex) for compatibility tests. + */ +#define TALER_MERCHANT_SERVICE_VERSION 0x00090400 + /** * General information about the HTTP response we obtained @@ -1979,6 +1984,43 @@ TALER_MERCHANT_orders_post2 ( /** + * POST to /orders at the backend to setup an order and obtain + * the order ID (which may have been set by the front-end). + * + * @param ctx execution context + * @param backend_url URL of the backend + * @param order basic information about this purchase, to be extended by the backend + * @param session_id session ID to set for the order + * @param refund_delay how long can refunds happen for this order; 0 to use + * absolute value from contract (or not allow refunds). + * @param payment_target desired payment target identifier (to select merchant bank details) + * @param inventory_products_length length of the @a inventory_products array + * @param inventory_products products to add to the order from the inventory + * @param uuids_length length of the @a uuids array + * @param uuids array of UUIDs with locks on @a inventory_products + * @param create_token whether to create a claim token + * @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, NULL on error + */ +struct TALER_MERCHANT_PostOrdersHandle * +TALER_MERCHANT_orders_post3 ( + struct GNUNET_CURL_Context *ctx, + const char *backend_url, + const json_t *order, + const char *session_id, + struct GNUNET_TIME_Relative refund_delay, + const char *payment_target, + unsigned int inventory_products_length, + const struct TALER_MERCHANT_InventoryProduct inventory_products[], + unsigned int uuids_length, + const char *uuids[static uuids_length], + bool create_token, + TALER_MERCHANT_PostOrdersCallback cb, + void *cb_cls); + + +/** * Cancel a POST /orders request. This function cannot be used * on a request handle if a response is already served for it. * @@ -2138,6 +2180,43 @@ TALER_MERCHANT_orders_get2 ( /** + * Make a GET /orders request with more filters. + * + * @param ctx the context + * @param backend_url HTTP base URL for the backend + * @param paid filter on payment status + * @param refunded filter on refund status + * @param wired filter on wire transfer status + * @param session_id filter by session ID + * @param fulfillment_url filter by fulfillment URL + * @param date range limit by date + * @param start_row range limit by order table row + * @param delta range from which @a date and @a start_row apply, positive + * to return delta items after the given limit(s), negative to + * return delta items before the given limit(s) + * @param timeout how long to wait (long polling) of zero results match the query + * @param cb function to call with the backend's inventory information + * @param cb_cls closure for @a cb + * @return the request handle; NULL upon error + */ +struct TALER_MERCHANT_OrdersGetHandle * +TALER_MERCHANT_orders_get3 ( + struct GNUNET_CURL_Context *ctx, + const char *backend_url, + enum TALER_EXCHANGE_YesNoAll paid, + enum TALER_EXCHANGE_YesNoAll refunded, + enum TALER_EXCHANGE_YesNoAll wired, + const char *session_id, + const char *fulfillment_url, + struct GNUNET_TIME_Timestamp date, + uint64_t start_row, + int64_t delta, + struct GNUNET_TIME_Relative timeout, + TALER_MERCHANT_OrdersGetCallback cb, + void *cb_cls); + + +/** * Cancel GET /orders operation. * * @param[in] pgh operation to cancel diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h index 7d589123..8aea7aac 100644 --- a/src/include/taler_merchantdb_plugin.h +++ b/src/include/taler_merchantdb_plugin.h @@ -544,6 +544,16 @@ struct TALER_MERCHANTDB_PendingWebhookDetails struct TALER_MERCHANTDB_OrderFilter { /** + * Filter orders by this fulfillment URL. + */ + const char *fulfillment_url; + + /** + * Filter orders by this session ID. + */ + const char *session_id; + + /** * Filter by payment status. */ enum TALER_EXCHANGE_YesNoAll paid; @@ -1733,6 +1743,7 @@ struct TALER_MERCHANTDB_Plugin * @param cls closure * @param instance_id identifies the instance responsible for the order * @param order_id alphanumeric string that uniquely identifies the order + * @param session_id session ID for the order * @param h_post_data hash of the POST data for idempotency checks * @param pay_deadline how long does the customer have to pay for the order * @param claim_token token to use for access control @@ -1745,6 +1756,7 @@ struct TALER_MERCHANTDB_Plugin (*insert_order)(void *cls, const char *instance_id, const char *order_id, + const char *session_id, const struct TALER_MerchantPostDataHashP *h_post_data, struct GNUNET_TIME_Timestamp pay_deadline, const struct TALER_ClaimTokenP *claim_token, |