diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-04-06 16:08:23 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-04-06 16:08:23 +0200 |
commit | 64be1fe4863900091a085e20630a8049d1ee37c0 (patch) | |
tree | 6a0065b3b0df7a52daaf4862a701d5819776df8e /src | |
parent | efead477df2c8280e59862ea8a11a3cdbaf19971 (diff) | |
download | merchant-64be1fe4863900091a085e20630a8049d1ee37c0.tar.gz merchant-64be1fe4863900091a085e20630a8049d1ee37c0.tar.bz2 merchant-64be1fe4863900091a085e20630a8049d1ee37c0.zip |
add non-X variants to payment trigger to provide future-compatibility
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/taler-merchant-httpd_trigger-pay.c | 74 |
1 files changed, 60 insertions, 14 deletions
diff --git a/src/backend/taler-merchant-httpd_trigger-pay.c b/src/backend/taler-merchant-httpd_trigger-pay.c index 2187acbe..47c68157 100644 --- a/src/backend/taler-merchant-httpd_trigger-pay.c +++ b/src/backend/taler-merchant-httpd_trigger-pay.c @@ -42,8 +42,10 @@ * @param header_name name of the header to set */ static void -add_header_from_arg (struct MHD_Connection *connection, const char *arg_name, - struct MHD_Response *response, const char *header_name) +add_header_from_arg (struct MHD_Connection *connection, + const char *arg_name, + struct MHD_Response *response, + const char *header_name) { const char *arg = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, @@ -75,22 +77,66 @@ MH_handler_trigger_pay (struct TMH_RequestHandler *rh, size_t *upload_data_size) { struct MHD_Response *response; - - // FIXME: Taler wallet detection! char *data = "<html><body><p>Processing payment ...</p></body></html>"; - response = MHD_create_response_from_buffer (strlen (data), data, MHD_RESPMEM_PERSISTENT); + response = MHD_create_response_from_buffer (strlen (data), + data, + MHD_RESPMEM_PERSISTENT); + add_header_from_arg (connection, + "session_id", + response, + "Taler-Session-Id"); + add_header_from_arg (connection, + "contract_url", + response, + "Taler-Contract-Url"); + add_header_from_arg (connection, + "h_contract_terms", + response, + "Taler-Contract-Hash"); + add_header_from_arg (connection, + "tip_token", + response, + "Taler-Tip"); + add_header_from_arg (connection, + "refund_url", + response, + "Taler-Refund-Url"); + add_header_from_arg (connection, + "resource_url", + response, + "Taler-Resource-Url"); + /* FIXME: the X- variants should go away in the future, for now + preserved for backwards-compatibility only! */ + add_header_from_arg (connection, + "session_id", + response, + "X-Taler-Session-Id"); + add_header_from_arg (connection, + "contract_url", + response, + "X-Taler-Contract-Url"); + add_header_from_arg (connection, + "h_contract_terms", + response, + "X-Taler-Contract-Hash"); + add_header_from_arg (connection, + "tip_token", + response, + "X-Taler-Tip"); + add_header_from_arg (connection, + "refund_url", + response, + "X-Taler-Refund-Url"); + add_header_from_arg (connection, + "resource_url", + response, + "X-Taler-Resource-Url"); - add_header_from_arg (connection, "session_id", response, "X-Taler-Session-Id"); - add_header_from_arg (connection, "contract_url", response, "X-Taler-Contract-Url"); - add_header_from_arg (connection, "h_contract_terms", response, "X-Taler-Contract-Hash"); - add_header_from_arg (connection, "tip_token", response, "X-Taler-Tip"); - add_header_from_arg (connection, "refund_url", response, "X-Taler-Refund-Url"); - add_header_from_arg (connection, "resource_url", response, "X-Taler-Resource-Url"); - - MHD_queue_response (connection, 402, response); + MHD_queue_response (connection, + MHD_HTTP_PAYMENT_REQUIRED, + response); MHD_destroy_response (response); - return MHD_YES; } |