diff options
-rw-r--r-- | src/backend/taler-merchant-httpd_get-orders-ID.c | 19 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_get-orders-ID.h | 5 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_private-get-orders-ID.c | 10 | ||||
-rw-r--r-- | src/testing/test_merchant_api.conf | 1 | ||||
-rw-r--r-- | src/testing/testing_api_helpers.c | 3 |
5 files changed, 29 insertions, 9 deletions
diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c b/src/backend/taler-merchant-httpd_get-orders-ID.c index a6912b79..8d75bbf2 100644 --- a/src/backend/taler-merchant-httpd_get-orders-ID.c +++ b/src/backend/taler-merchant-httpd_get-orders-ID.c @@ -626,13 +626,15 @@ suspend_god (struct GetOrderData *god) * @param order_id the order id * @param session_id session, may be NULL * @param instance_id instance, may be "default" + * @param claim_token claim token for the order, may be NULL * @return corresponding taler://pay/ URI, or NULL on missing "host" */ char * TMH_make_taler_pay_uri (struct MHD_Connection *con, const char *order_id, const char *session_id, - const char *instance_id) + const char *instance_id, + struct TALER_ClaimTokenP *claim_token) { const char *host; const char *forwarded_host; @@ -686,6 +688,15 @@ TMH_make_taler_pay_uri (struct MHD_Connection *con, order_id); GNUNET_buffer_write_path (&buf, (session_id == NULL) ? "" : session_id); + if ((NULL != claim_token) && + (GNUNET_NO == GNUNET_is_zero (claim_token))) + { + GNUNET_buffer_write_str (&buf, + "&c="); + GNUNET_buffer_write_data_encoded (&buf, + (char *) claim_token, + sizeof (struct TALER_ClaimTokenP)); + } return GNUNET_buffer_reap_str (&buf); } @@ -724,7 +735,8 @@ send_pay_request (struct GetOrderData *god, taler_pay_uri = TMH_make_taler_pay_uri (god->sc.con, god->order_id, god->session_id, - god->hc->instance->settings.id); + god->hc->instance->settings.id, + &god->claim_token); if (god->generate_html) { struct MHD_Response *reply; @@ -799,7 +811,8 @@ send_pay_request (struct GetOrderData *god, ret = TALER_MHD_reply_json_pack (god->sc.con, MHD_HTTP_PAYMENT_REQUIRED, "{s:s, s:s?}", - "taler_pay_uri", taler_pay_uri, + "taler_pay_uri", + taler_pay_uri, "already_paid_order_id", already_paid_order_id); } diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.h b/src/backend/taler-merchant-httpd_get-orders-ID.h index 1d2d61f2..6f1e7731 100644 --- a/src/backend/taler-merchant-httpd_get-orders-ID.h +++ b/src/backend/taler-merchant-httpd_get-orders-ID.h @@ -32,13 +32,16 @@ * @param order_id the order id * @param session_id session, may be NULL * @param instance_id instance, may be "default" + * @param claim_token claim token for the order, may be NULL * @return corresponding taler://pay/ URI, or NULL on missing "host" */ char * TMH_make_taler_pay_uri (struct MHD_Connection *con, const char *order_id, const char *session_id, - const char *instance_id); + const char *instance_id, + struct TALER_ClaimTokenP *claim_token); + /** diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c b/src/backend/taler-merchant-httpd_private-get-orders-ID.c index 3d6c930b..27527034 100644 --- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c +++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c @@ -753,6 +753,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh, bool paid; bool wired; bool order_only = false; + struct TALER_ClaimTokenP claim_token = { 0 }; if (NULL == gorc) { @@ -832,7 +833,7 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh, qs = TMH_db->lookup_order (TMH_db->cls, hc->instance->settings.id, hc->infix, - NULL, + &claim_token, &gorc->contract_terms); order_only = true; } @@ -965,10 +966,12 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh, char *taler_pay_uri; MHD_RESULT ret; + /* Claim token is NULL, as order has already been claimed anyway. */ taler_pay_uri = TMH_make_taler_pay_uri (connection, hc->infix, gorc->session_id, - hc->instance->settings.id); + hc->instance->settings.id, + &claim_token); ret = TALER_MHD_reply_json_pack (connection, MHD_HTTP_OK, "{s:s, s:s, s:s}", @@ -1035,7 +1038,8 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh, taler_pay_uri = TMH_make_taler_pay_uri (connection, hc->infix, gorc->session_id, - hc->instance->settings.id); + hc->instance->settings.id, + &claim_token); ret = TALER_MHD_reply_json_pack (connection, MHD_HTTP_OK, "{s:s, s:O, s:s}", diff --git a/src/testing/test_merchant_api.conf b/src/testing/test_merchant_api.conf index 955f5c69..9dbaf4ea 100644 --- a/src/testing/test_merchant_api.conf +++ b/src/testing/test_merchant_api.conf @@ -33,7 +33,6 @@ PORT = 8080 # Which plugin (backend) do we use for the DB. DB = postgres - # This specifies which database the postgres backend uses. [merchantdb-postgres] CONFIG = postgres:///talercheck diff --git a/src/testing/testing_api_helpers.c b/src/testing/testing_api_helpers.c index 2564c72f..5160d627 100644 --- a/src/testing/testing_api_helpers.c +++ b/src/testing/testing_api_helpers.c @@ -51,7 +51,8 @@ TALER_TESTING_run_merchant (const char *config_filename, merchant_proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ALL, NULL, NULL, NULL, - "taler-merchant-httpd", + "valgrind", + "valgrind", "taler-merchant-httpd", "--log=INFO", "-c", config_filename, |