merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit a1b7ba46bc4f809048533beaa2e9981fccae797f
parent 2449ec004f0bde70e24fe4ddd160a92830d223d9
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed, 20 May 2026 11:42:42 +0200

bump protocol version, was forgotten before

Diffstat:
Msrc/backend/taler-merchant-httpd_get-config.c | 2+-
Msrc/backend/taler-merchant-httpd_post-private-orders.c | 10+++++++---
Msrc/backenddb/lock_product.c | 16+++++++++-------
Msrc/include/merchant-database/lookup_product.h | 14+++++++-------
Msrc/lib/merchant_api_get-config.c | 4++--
5 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_get-config.c b/src/backend/taler-merchant-httpd_get-config.c @@ -44,7 +44,7 @@ * #MERCHANT_PROTOCOL_CURRENT and #MERCHANT_PROTOCOL_AGE in * merchant_api_get_config.c! */ -#define MERCHANT_PROTOCOL_VERSION "27:0:15" +#define MERCHANT_PROTOCOL_VERSION "30:0:18" /** diff --git a/src/backend/taler-merchant-httpd_post-private-orders.c b/src/backend/taler-merchant-httpd_post-private-orders.c @@ -1044,9 +1044,10 @@ clean_order (void *cls) * @param[out] available_frac remaining fractional units (0..TALER_MERCHANT_UNIT_FRAC_BASE-1) */ static void -compute_available_quantity (const struct TALER_MERCHANTDB_ProductDetails *pd, - uint64_t *available_value, - uint32_t *available_frac) +compute_available_quantity ( + const struct TALER_MERCHANTDB_ProductDetails *pd, + uint64_t *available_value, + uint32_t *available_frac) { int64_t value; int64_t frac; @@ -1073,18 +1074,21 @@ compute_available_quantity (const struct TALER_MERCHANTDB_ProductDetails *pd, { int64_t borrow = ((-frac) + TALER_MERCHANT_UNIT_FRAC_BASE - 1) / TALER_MERCHANT_UNIT_FRAC_BASE; + value -= borrow; frac += borrow * (int64_t) TALER_MERCHANT_UNIT_FRAC_BASE; } else if (frac >= TALER_MERCHANT_UNIT_FRAC_BASE) { int64_t carry = frac / TALER_MERCHANT_UNIT_FRAC_BASE; + value += carry; frac -= carry * (int64_t) TALER_MERCHANT_UNIT_FRAC_BASE; } if (value < 0) { + GNUNET_break (0); value = 0; frac = 0; } diff --git a/src/backenddb/lock_product.c b/src/backenddb/lock_product.c @@ -25,14 +25,16 @@ #include "merchant-database/lock_product.h" #include "helper.h" + enum GNUNET_DB_QueryStatus -TALER_MERCHANTDB_lock_product (struct TALER_MERCHANTDB_PostgresContext *pg, - const char *instance_id, - const char *product_id, - const struct GNUNET_Uuid *uuid, - uint64_t quantity, - uint32_t quantity_frac, - struct GNUNET_TIME_Timestamp expiration_time) +TALER_MERCHANTDB_lock_product ( + struct TALER_MERCHANTDB_PostgresContext *pg, + const char *instance_id, + const char *product_id, + const struct GNUNET_Uuid *uuid, + uint64_t quantity, + uint32_t quantity_frac, + struct GNUNET_TIME_Timestamp expiration_time) { struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_string (instance_id), diff --git a/src/include/merchant-database/lookup_product.h b/src/include/merchant-database/lookup_product.h @@ -26,7 +26,6 @@ #include "merchantdb_lib.h" -struct TALER_MERCHANTDB_PostgresContext; /** * Lookup details about a particular product. * @@ -41,11 +40,12 @@ struct TALER_MERCHANTDB_PostgresContext; * @return database result code */ enum GNUNET_DB_QueryStatus -TALER_MERCHANTDB_lookup_product (struct TALER_MERCHANTDB_PostgresContext *pg, - const char *instance_id, - const char *product_id, - struct TALER_MERCHANTDB_ProductDetails *pd, - size_t *num_categories, - uint64_t **categories); +TALER_MERCHANTDB_lookup_product ( + struct TALER_MERCHANTDB_PostgresContext *pg, + const char *instance_id, + const char *product_id, + struct TALER_MERCHANTDB_ProductDetails *pd, + size_t *num_categories, + uint64_t **categories); #endif diff --git 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 27 +#define MERCHANT_PROTOCOL_CURRENT 30 /** * How many configs are we backwards-compatible with? */ -#define MERCHANT_PROTOCOL_AGE 3 +#define MERCHANT_PROTOCOL_AGE 6 /** * How many exchanges do we allow at most per merchant?