diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-05-26 15:21:50 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-05-26 15:21:50 +0200 |
commit | c4936ee74300fd2a8503530a3aa8c43cf04b455c (patch) | |
tree | 51831f4f21c597603cf13bae267e622250305e16 /src/include | |
parent | ffdfeb863a03cc2cf9a92731f7b44b0c058d6a2d (diff) |
-finish implementation of protocol v16, still undertested
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_merchantdb_plugin.h | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h index 12c00833..faccc55a 100644 --- a/src/include/taler_merchantdb_plugin.h +++ b/src/include/taler_merchantdb_plugin.h @@ -341,13 +341,18 @@ struct TALER_MERCHANTDB_ProductDetails * @param product_serial row ID of the product * @param product_id ID of the product * @param pd full product details + * @param num_categories length of @a categories array + * @param categories array of categories the + * product is in */ typedef void (*TALER_MERCHANTDB_ProductCallback)( void *cls, uint64_t product_serial, const char *product_id, - const struct TALER_MERCHANTDB_ProductDetails *pd); + const struct TALER_MERCHANTDB_ProductDetails *pd, + size_t num_categories, + const uint64_t *categories); /** @@ -1728,13 +1733,18 @@ struct TALER_MERCHANTDB_Plugin * @param product_id product to lookup * @param[out] pd set to the product details on success, can be NULL * (in that case we only want to check if the product exists) + * @param[out] num_categories set to length of @a categories array + * @param[out] categories set to array of categories the + * product is in, caller must free() it. * @return database result code */ enum GNUNET_DB_QueryStatus (*lookup_product)(void *cls, const char *instance_id, const char *product_id, - struct TALER_MERCHANTDB_ProductDetails *pd); + struct TALER_MERCHANTDB_ProductDetails *pd, + size_t *num_categories, + uint64_t **categories); /** * Delete information about a product. Note that the transaction must @@ -1786,21 +1796,31 @@ struct TALER_MERCHANTDB_Plugin * @param cls closure * @param instance_id instance to lookup products for * @param product_id product to lookup - * @param pd set to the product details on success, can be NULL - * (in that case we only want to check if the product exists); - * total_sold in @a pd is ignored (!), total_lost must not - * exceed total_stock minus the existing total_sold; - * total_sold and total_stock must be larger or equal to - * the existing value; - * @return database result code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the - * non-decreasing constraints are not met *or* if the product - * does not yet exist. + * @param pd product details with updated values + * @param num_cats length of @a cats array + * @param cats number of categories the product is in + * @param[out] no_instance the update failed as the instance is unknown + * @param[out] no_cat set to -1 on success, otherwise the update failed and this is set + * to the index of a category in @a cats that is unknown + * @param[out] no_product the @a product_id is unknown + * @param[out] lost_reduced the update failed as the counter of units lost would have been lowered + * @param[out] sold_reduced the update failed as the counter of units sold would have been lowered + * @param[out] stocked_reduced the update failed as the counter of units stocked would have been lowered + * @return database result code */ enum GNUNET_DB_QueryStatus (*update_product)(void *cls, const char *instance_id, const char *product_id, - const struct TALER_MERCHANTDB_ProductDetails *pd); + const struct TALER_MERCHANTDB_ProductDetails *pd, + size_t num_cats, + const uint64_t *cats, + bool *no_instance, + ssize_t *no_cat, + bool *no_product, + bool *lost_reduced, + bool *sold_reduced, + bool *stocked_reduced); /** * Lock stocks of a particular product. Note that the transaction must |