summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-11-01 22:18:48 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-11-01 22:18:48 +0100
commit3292bbb94f53b867c91ddcb22cce84c8af9d4449 (patch)
tree457f19114b89a2561beaad33d85c38959cc0e06a
parent8d5bb82d189de0263dbd7d572cab3e58bd676fcc (diff)
downloadmerchant-3292bbb94f53b867c91ddcb22cce84c8af9d4449.tar.gz
merchant-3292bbb94f53b867c91ddcb22cce84c8af9d4449.tar.bz2
merchant-3292bbb94f53b867c91ddcb22cce84c8af9d4449.zip
check on order creation
-rw-r--r--src/backend/taler-merchant-httpd_proposal.c14
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))
{