diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-11-01 22:18:48 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-11-01 22:18:48 +0100 |
commit | 3292bbb94f53b867c91ddcb22cce84c8af9d4449 (patch) | |
tree | 457f19114b89a2561beaad33d85c38959cc0e06a /src | |
parent | 8d5bb82d189de0263dbd7d572cab3e58bd676fcc (diff) |
check on order creation
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/taler-merchant-httpd_proposal.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/backend/taler-merchant-httpd_proposal.c b/src/backend/taler-merchant-httpd_proposal.c index bb9ccbb0..107f93cf 100644 --- a/src/backend/taler-merchant-httpd_proposal.c +++ b/src/backend/taler-merchant-httpd_proposal.c @@ -221,6 +221,7 @@ proposal_put (struct MHD_Connection *connection, json_t *merchant; struct GNUNET_TIME_Absolute timestamp; struct GNUNET_TIME_Absolute refund_deadline; + struct GNUNET_TIME_Absolute wire_transfer_deadline; struct GNUNET_TIME_Absolute pay_deadline; struct GNUNET_JSON_Specification spec[] = { TALER_JSON_spec_amount ("amount", &total), @@ -239,6 +240,8 @@ proposal_put (struct MHD_Connection *connection, &refund_deadline), GNUNET_JSON_spec_absolute_time ("pay_deadline", &pay_deadline), + GNUNET_JSON_spec_absolute_time ("wire_transfer_deadline", + &wire_transfer_deadline), GNUNET_JSON_spec_end () }; enum GNUNET_DB_QueryStatus qs; @@ -472,6 +475,17 @@ proposal_put (struct MHD_Connection *connection, "Impossible to parse the order"); } + if (wire_transfer_deadline.abs_value_us < + refund_deadline.abs_value_us) + { + GNUNET_JSON_parse_free (spec); + return TMH_RESPONSE_reply_arg_invalid + (connection, + TALER_EC_PARAMETER_MALFORMED, + "order:wire_transfer_deadline;order:refund_deadline"); + } + + /* check contract is well-formed */ if (GNUNET_OK != check_products (products)) { |