summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-03-22 14:05:42 +0100
committerChristian Grothoff <christian@grothoff.org>2024-03-22 14:05:42 +0100
commit6d41df4ffbc0d921aecb265ecb49b15df5c7178e (patch)
treec0423a7df97f57a41ab3dc2ea620b22d1cb133b0 /src/backend
parent110b61ff12208ffbb022296097b85d28cc1cfe7e (diff)
downloadmerchant-6d41df4ffbc0d921aecb265ecb49b15df5c7178e.tar.gz
merchant-6d41df4ffbc0d921aecb265ecb49b15df5c7178e.tar.bz2
merchant-6d41df4ffbc0d921aecb265ecb49b15df5c7178e.zip
add logic to preserve and possibly update minimum_age in contract terms
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd_private-post-orders.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c
index be8b8d1d..6be11f16 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -330,6 +330,11 @@ struct OrderContext
*/
const json_t *extra;
+ /**
+ * Minimum age required by the order.
+ */
+ uint32_t minimum_age;
+
} parse_order;
/**
@@ -1322,6 +1327,9 @@ serialize_order (struct OrderContext *oc)
GNUNET_JSON_pack_allow_null (
GNUNET_JSON_pack_string ("fulfillment_url",
oc->parse_order.fulfillment_url)),
+ GNUNET_JSON_pack_allow_null (
+ GNUNET_JSON_pack_uint64 ("minimum_age",
+ oc->parse_order.minimum_age)),
GNUNET_JSON_pack_array_incref ("products",
oc->merge_inventory.products),
GNUNET_JSON_pack_data_auto ("h_wire",
@@ -1576,6 +1584,10 @@ parse_order (struct OrderContext *oc)
&oc->parse_order.delivery_date),
NULL),
GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_uint32 ("minimum_age",
+ &oc->parse_order.minimum_age),
+ NULL),
+ GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_relative_time ("auto_refund",
&oc->parse_order.auto_refund),
NULL),
@@ -1996,6 +2008,9 @@ merge_inventory (struct OrderContext *oc)
ip->product_id);
return;
}
+ oc->parse_order.minimum_age
+ = GNUNET_MAX (oc->parse_order.minimum_age,
+ pd.minimum_age);
{
json_t *p;