summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-post-templates.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-post-templates.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-post-templates.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-templates.c b/src/backend/taler-merchant-httpd_private-post-templates.c
index a064769c..70052f02 100644
--- a/src/backend/taler-merchant-httpd_private-post-templates.c
+++ b/src/backend/taler-merchant-httpd_private-post-templates.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2022 Taler Systems SA
+ (C) 2022-2024 Taler Systems SA
TALER is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
@@ -47,6 +47,18 @@ templates_equal (const struct TALER_MERCHANTDB_TemplateDetails *t1,
(NULL != t2->otp_id) &&
(0 == strcmp (t1->otp_id,
t2->otp_id))) ) &&
+ ( ( (NULL == t1->required_currency) &&
+ (NULL == t2->required_currency) ) ||
+ ( (NULL != t1->required_currency) &&
+ (NULL != t2->required_currency) &&
+ (0 == strcmp (t1->required_currency,
+ t2->required_currency))) ) &&
+ ( ( (NULL == t1->editable_defaults) &&
+ (NULL == t2->editable_defaults) ) ||
+ ( (NULL != t1->editable_defaults) &&
+ (NULL != t2->editable_defaults) &&
+ (1 == json_equal (t1->editable_defaults,
+ t2->editable_defaults))) ) &&
(1 == json_equal (t1->template_contract,
t2->template_contract)) );
}
@@ -72,6 +84,14 @@ TMH_private_post_templates (const struct TMH_RequestHandler *rh,
NULL),
GNUNET_JSON_spec_json ("template_contract",
&tp.template_contract),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_string ("required_currency",
+ (const char **) &tp.required_currency),
+ NULL),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_json ("editable_defaults",
+ &tp.editable_defaults),
+ NULL),
GNUNET_JSON_spec_end ()
};
uint64_t otp_serial = 0;
@@ -104,6 +124,9 @@ TMH_private_post_templates (const struct TMH_RequestHandler *rh,
"template_contract");
}
+ // FIXME: sanity check on required_currency
+ // FIXME: sanity check on editable_defaults
+
if (NULL != tp.otp_id)
{
qs = TMH_db->select_otp_serial (TMH_db->cls,