aboutsummaryrefslogtreecommitdiff
path: root/src/include/taler_merchant_service.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-26 12:17:10 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-26 12:17:10 +0200
commitfa640a10c6b9bf2e9ec688bb5ab59b9e8a4d599a (patch)
tree13051b044339469e3b3e17eed4670d36f702e6ac /src/include/taler_merchant_service.h
parentdcbac9e63f37f9a5dd8b47a2cfc068d73068d4fc (diff)
downloadmerchant-fa640a10c6b9bf2e9ec688bb5ab59b9e8a4d599a.tar.gz
merchant-fa640a10c6b9bf2e9ec688bb5ab59b9e8a4d599a.tar.bz2
merchant-fa640a10c6b9bf2e9ec688bb5ab59b9e8a4d599a.zip
implement POST /orders client with all optional arguments
Diffstat (limited to 'src/include/taler_merchant_service.h')
-rw-r--r--src/include/taler_merchant_service.h48
1 files changed, 47 insertions, 1 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index 9321aa76..8976210e 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -1139,7 +1139,53 @@ TALER_MERCHANT_orders_post (struct GNUNET_CURL_Context *ctx,
TALER_MERCHANT_PostOrdersCallback cb,
void *cb_cls);
-// TODO: implement orders_post2 with the OPTIONAL arguments!
+/**
+ * Information needed per product for constructing orders from
+ * the inventory.
+ */
+struct TALER_MERCHANT_InventoryProduct
+{
+
+ /**
+ * Identifier of the product.
+ */
+ char *product_id;
+
+ /**
+ * How many units of this product should be ordered.
+ */
+ unsigned int quantity;
+};
+
+
+/**
+ * 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 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 lock_uuids_length length of the @a uuids array
+ * @param uuids array of UUIDs with locks on @a inventory_products
+ * @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_PostOrdersOperation *
+TALER_MERCHANT_orders_post2 (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const json_t *order,
+ const char *payment_target,
+ unsigned int inventory_products_length,
+ const struct TALER_MERCHANT_InventoryProduct inventory_products[],
+ unsigned int uuids_length,
+ const struct GNUNET_Uuid uuids[],
+ TALER_MERCHANT_PostOrdersCallback cb,
+ void *cb_cls);
/**