merchant

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

commit f4e7ff3c61700cdd3106e8b5fb50bf23f7e6abef
parent 399592ff65e78f56c2b51084d8f8eb3da8d00c58
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun,  2 Feb 2025 16:52:31 +0100

implement taler-docs::73b79526..93c6511c change to support output token validity in the future (addresses FIXMEs)

Diffstat:
Msrc/backend/taler-merchant-httpd_private-post-orders.c | 6++++--
Msrc/include/taler_merchant_util.h | 8++++++--
Msrc/util/contract_parse.c | 4++++
3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c @@ -3546,11 +3546,13 @@ parse_choices (struct OrderContext *oc) if (0 == output.details.token.count) continue; - // FIXME: no valid_at in choice->output, is NOW fine? + if (0 == output.details.token.valid_at.abs_time.abs_value_us) + output.details.token.valid_at + = GNUNET_TIME_timestamp_get (); if (GNUNET_OK != add_output_token_family (oc, output.details.token.token_family_slug, - GNUNET_TIME_timestamp_get (), + output.details.token.valid_at, &output.details.token.key_index)) { diff --git a/src/include/taler_merchant_util.h b/src/include/taler_merchant_util.h @@ -252,8 +252,12 @@ struct TALER_MERCHANT_ContractOutput */ unsigned int count; - // FIXME: add support for clients picking a validity - // period in the future for output tokens! + /** + * Determines when the output token should be valid. + * Optional, set to zero for not specified (then we + * use the current time). + */ + struct GNUNET_TIME_Timestamp valid_at; } token; diff --git a/src/util/contract_parse.c b/src/util/contract_parse.c @@ -248,6 +248,10 @@ TALER_MERCHANT_parse_choice_output ( GNUNET_JSON_spec_uint ("count", &output->details.token.count), NULL), + GNUNET_JSON_spec_mark_optional ( + GNUNET_JSON_spec_timestamp ("valid_at", + &output->details.token.valid_at), + NULL), (! order) ? GNUNET_JSON_spec_uint ("key_index", &output->details.token.key_index)