diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd_pay.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_pay.c | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/src/backend/taler-merchant-httpd_pay.c b/src/backend/taler-merchant-httpd_pay.c index 4e19e6f0..1bd68d31 100644 --- a/src/backend/taler-merchant-httpd_pay.c +++ b/src/backend/taler-merchant-httpd_pay.c | |||
@@ -287,8 +287,7 @@ struct PayContext | |||
287 | 287 | ||
288 | /** | 288 | /** |
289 | * Wire transfer deadline. How soon would the merchant like the | 289 | * Wire transfer deadline. How soon would the merchant like the |
290 | * wire transfer to be executed? (Can be given by the frontend | 290 | * wire transfer to be executed? |
291 | * or be determined by our configuration via #wire_transfer_delay.) | ||
292 | */ | 291 | */ |
293 | struct GNUNET_TIME_Absolute wire_transfer_deadline; | 292 | struct GNUNET_TIME_Absolute wire_transfer_deadline; |
294 | 293 | ||
@@ -1445,7 +1444,6 @@ parse_pay (struct MHD_Connection *connection, | |||
1445 | }; | 1444 | }; |
1446 | enum GNUNET_DB_QueryStatus qs; | 1445 | enum GNUNET_DB_QueryStatus qs; |
1447 | const char *session_id; | 1446 | const char *session_id; |
1448 | struct GNUNET_TIME_Relative used_wire_transfer_delay; | ||
1449 | 1447 | ||
1450 | res = TMH_PARSE_json_data (connection, | 1448 | res = TMH_PARSE_json_data (connection, |
1451 | root, | 1449 | root, |
@@ -1551,6 +1549,8 @@ parse_pay (struct MHD_Connection *connection, | |||
1551 | &pc->refund_deadline), | 1549 | &pc->refund_deadline), |
1552 | GNUNET_JSON_spec_absolute_time ("pay_deadline", | 1550 | GNUNET_JSON_spec_absolute_time ("pay_deadline", |
1553 | &pc->pay_deadline), | 1551 | &pc->pay_deadline), |
1552 | GNUNET_JSON_spec_absolute_time ("wire_transfer_deadline", | ||
1553 | &pc->wire_transfer_deadline), | ||
1554 | GNUNET_JSON_spec_absolute_time ("timestamp", | 1554 | GNUNET_JSON_spec_absolute_time ("timestamp", |
1555 | &pc->timestamp), | 1555 | &pc->timestamp), |
1556 | TALER_JSON_spec_amount ("max_fee", | 1556 | TALER_JSON_spec_amount ("max_fee", |
@@ -1576,39 +1576,10 @@ parse_pay (struct MHD_Connection *connection, | |||
1576 | 1576 | ||
1577 | pc->fulfillment_url = GNUNET_strdup (fulfillment_url); | 1577 | pc->fulfillment_url = GNUNET_strdup (fulfillment_url); |
1578 | 1578 | ||
1579 | /* Use the value from config as default. */ | ||
1580 | used_wire_transfer_delay = wire_transfer_delay; | ||
1581 | |||
1582 | if (NULL != json_object_get (pc->contract_terms, | ||
1583 | "wire_transfer_delay")) | ||
1584 | { | ||
1585 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
1586 | "Frontend specified wire transfer delay\n"); | ||
1587 | |||
1588 | struct GNUNET_JSON_Specification wspec[] = { | ||
1589 | GNUNET_JSON_spec_relative_time ("wire_transfer_delay", | ||
1590 | &used_wire_transfer_delay), | ||
1591 | GNUNET_JSON_spec_end () | ||
1592 | }; | ||
1593 | |||
1594 | res = TMH_PARSE_json_data (connection, | ||
1595 | pc->contract_terms, | ||
1596 | wspec); | ||
1597 | if (GNUNET_YES != res) | ||
1598 | { | ||
1599 | GNUNET_JSON_parse_free (spec); | ||
1600 | GNUNET_break (0); | ||
1601 | return (GNUNET_NO == res) ? MHD_YES : MHD_NO; | ||
1602 | } | ||
1603 | } | ||
1604 | |||
1605 | pc->wire_transfer_deadline | ||
1606 | = GNUNET_TIME_absolute_add (pc->timestamp, | ||
1607 | used_wire_transfer_delay); | ||
1608 | |||
1609 | if (pc->wire_transfer_deadline.abs_value_us < | 1579 | if (pc->wire_transfer_deadline.abs_value_us < |
1610 | pc->refund_deadline.abs_value_us) | 1580 | pc->refund_deadline.abs_value_us) |
1611 | { | 1581 | { |
1582 | /* This should already have been checked when creating the order! */ | ||
1612 | GNUNET_break (0); | 1583 | GNUNET_break (0); |
1613 | GNUNET_JSON_parse_free (spec); | 1584 | GNUNET_JSON_parse_free (spec); |
1614 | return TMH_RESPONSE_reply_external_error (connection, | 1585 | return TMH_RESPONSE_reply_external_error (connection, |