summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Makefile.am2
-rw-r--r--src/lib/merchant_api_get_config.c4
-rw-r--r--src/lib/merchant_api_post_products.c59
3 files changed, 61 insertions, 4 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 1e7430d4..d997b767 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -10,7 +10,7 @@ lib_LTLIBRARIES = \
libtalermerchant.la
libtalermerchant_la_LDFLAGS = \
- -version-info 5:2:0 \
+ -version-info 5:3:0 \
-no-undefined
libtalermerchant_la_SOURCES = \
diff --git a/src/lib/merchant_api_get_config.c b/src/lib/merchant_api_get_config.c
index cf5147fe..9b501342 100644
--- a/src/lib/merchant_api_get_config.c
+++ b/src/lib/merchant_api_get_config.c
@@ -34,12 +34,12 @@
* Which version of the Taler protocol is implemented
* by this library? Used to determine compatibility.
*/
-#define MERCHANT_PROTOCOL_CURRENT 15
+#define MERCHANT_PROTOCOL_CURRENT 16
/**
* How many configs are we backwards-compatible with?
*/
-#define MERCHANT_PROTOCOL_AGE 3
+#define MERCHANT_PROTOCOL_AGE 4
/**
* How many exchanges do we allow at most per merchant?
diff --git a/src/lib/merchant_api_post_products.c b/src/lib/merchant_api_post_products.c
index 0f09f397..5d0ad27e 100644
--- a/src/lib/merchant_api_post_products.c
+++ b/src/lib/merchant_api_post_products.c
@@ -159,7 +159,7 @@ handle_post_products_finished (void *cls,
struct TALER_MERCHANT_ProductsPostHandle *
-TALER_MERCHANT_products_post2 (
+TALER_MERCHANT_products_post3 (
struct GNUNET_CURL_Context *ctx,
const char *backend_url,
const char *product_id,
@@ -173,12 +173,28 @@ TALER_MERCHANT_products_post2 (
const json_t *address,
struct GNUNET_TIME_Timestamp next_restock,
uint32_t minimum_age,
+ unsigned int num_cats,
+ const uint64_t *cats,
TALER_MERCHANT_ProductsPostCallback cb,
void *cb_cls)
{
struct TALER_MERCHANT_ProductsPostHandle *pph;
json_t *req_obj;
+ json_t *categories;
+ if (0 == num_cats)
+ {
+ categories = NULL;
+ }
+ else
+ {
+ categories = json_array ();
+ GNUNET_assert (NULL != categories);
+ for (unsigned int i = 0; i<num_cats; i++)
+ GNUNET_assert (0 ==
+ json_array_append_new (categories,
+ json_integer (cats[i])));
+ }
req_obj = GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("product_id",
product_id),
@@ -187,6 +203,9 @@ TALER_MERCHANT_products_post2 (
GNUNET_JSON_pack_allow_null (
GNUNET_JSON_pack_object_incref ("description_i18n",
(json_t *) description_i18n)),
+ GNUNET_JSON_pack_allow_null (
+ GNUNET_JSON_pack_array_steal ("categories",
+ categories)),
GNUNET_JSON_pack_string ("unit",
unit),
TALER_JSON_pack_amount ("price",
@@ -243,6 +262,44 @@ TALER_MERCHANT_products_post2 (
struct TALER_MERCHANT_ProductsPostHandle *
+TALER_MERCHANT_products_post2 (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *product_id,
+ const char *description,
+ const json_t *description_i18n,
+ const char *unit,
+ const struct TALER_Amount *price,
+ const char *image,
+ const json_t *taxes,
+ int64_t total_stock,
+ const json_t *address,
+ struct GNUNET_TIME_Timestamp next_restock,
+ uint32_t minimum_age,
+ TALER_MERCHANT_ProductsPostCallback cb,
+ void *cb_cls)
+{
+ return TALER_MERCHANT_products_post3 (ctx,
+ backend_url,
+ product_id,
+ description,
+ description_i18n,
+ unit,
+ price,
+ image,
+ taxes,
+ total_stock,
+ address,
+ next_restock,
+ minimum_age,
+ 0,
+ NULL,
+ cb,
+ cb_cls);
+}
+
+
+struct TALER_MERCHANT_ProductsPostHandle *
TALER_MERCHANT_products_post (
struct GNUNET_CURL_Context *ctx,
const char *backend_url,