diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-04-19 22:22:46 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-04-19 22:22:46 +0200 |
commit | 458dc3653b4aef54130c580fd41610aa03f61d68 (patch) | |
tree | 9f49ddad43c95495344d997294c96be7d25ad0aa /src/include/taler_merchantdb_plugin.h | |
parent | 3817d2e6cccdcee6021eccb6a1adcff4f0dce2ef (diff) | |
download | merchant-458dc3653b4aef54130c580fd41610aa03f61d68.tar.gz merchant-458dc3653b4aef54130c580fd41610aa03f61d68.tar.bz2 merchant-458dc3653b4aef54130c580fd41610aa03f61d68.zip |
implement POST products/lock
Diffstat (limited to 'src/include/taler_merchantdb_plugin.h')
-rw-r--r-- | src/include/taler_merchantdb_plugin.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h index 28913f59..353997db 100644 --- a/src/include/taler_merchantdb_plugin.h +++ b/src/include/taler_merchantdb_plugin.h @@ -571,14 +571,19 @@ struct TALER_MERCHANTDB_Plugin const struct TALER_MERCHANTDB_ProductDetails *pd); /** - * Update details about a particular product. + * Update details about a particular product. Note that the + * transaction must enforce that the sold/stocked/lost counters + * are not reduced (i.e. by expanding the WHERE clause on the existing + * values). * * @param cls closure * @param instance_id instance to lookup products for * @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) - * @return database result code + * @return database result code, #GNUNET_DB_SUCCESS_NO_RESULTS if the + * non-decreasing constraints are not met *or* if the product + * does not yet exist. */ enum GNUNET_DB_QueryStatus (*update_product)(void *cls, @@ -586,6 +591,27 @@ struct TALER_MERCHANTDB_Plugin const char *product_id, struct TALER_MERCHANTDB_ProductDetails *pd); + /** + * Lock stocks of a particular product. Note that the transaction must + * enforce that the "stocked-sold-lost >= locked" constraint holds. + * + * @param cls closure + * @param instance_id instance to lookup products for + * @param product_id product to lookup + * @param uuid the UUID that holds the lock + * @param quantity how many units should be locked + * @param expiration_time when should the lock expire + * @return database result code, #GNUNET_DB_SUCCESS_NO_RESULTS if the + * product is unknown OR if there insufficient stocks remaining + */ + enum GNUNET_DB_QueryStatus + (*lock_product)(void *cls, + const char *instance_id, + const char *product_id, + const struct GNUNET_Uuid *uuid, + uint32_t quantity, + struct GNUNET_TIME_Absolute expiration_time); + /* ****************** OLD API ******************** */ |