diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-02-12 18:04:30 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-02-12 18:04:30 +0100 |
commit | bf7fe7355d52461c9480979682e9c108f20a0822 (patch) | |
tree | b09cb526ac72b04e458c36fe7c9e96c64613a68b /src | |
parent | c078ae58ccb190dc340238347b15bf4b9e608ef4 (diff) | |
download | merchant-bf7fe7355d52461c9480979682e9c108f20a0822.tar.gz merchant-bf7fe7355d52461c9480979682e9c108f20a0822.tar.bz2 merchant-bf7fe7355d52461c9480979682e9c108f20a0822.zip |
add timestamp if missing
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/taler-merchant-httpd_proposal.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/taler-merchant-httpd_proposal.c b/src/backend/taler-merchant-httpd_proposal.c index ea05a201..86648dbb 100644 --- a/src/backend/taler-merchant-httpd_proposal.c +++ b/src/backend/taler-merchant-httpd_proposal.c @@ -160,8 +160,7 @@ proposal_put (struct MHD_Connection *connection, json_t *order) /* Add order_id if it doesn't exist. */ - order_id = json_string_value (json_object_get (order, "order_id")); - if (NULL == order_id) + if (NULL == json_string_value (json_object_get (order, "order_id"))) { char buf[256]; time_t timer; @@ -178,6 +177,11 @@ proposal_put (struct MHD_Connection *connection, json_t *order) json_object_set (order, "order_id", json_string (buf)); } + if (NULL == json_string_value (json_object_get (order, "timestamp"))) + { + json_object_set (order, "timestamp", GNUNET_JSON_from_time_abs (GNUNET_TIME_absolute_get ())); + } + /* extract fields we need to sign separately */ res = TMH_PARSE_json_data (connection, order, spec); if (GNUNET_NO == res) |