merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 6548cc691d8c9fb443a46e12b10de922b6581f97
parent a376e29ef856bf2baf00ea0c871f9f852c2273bc
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 24 Apr 2020 20:32:10 +0200

fix tests

Diffstat:
Msrc/backend/taler-merchant-httpd.c | 8+++-----
Msrc/backend/taler-merchant-httpd_private-post-instances.c | 2+-
Msrc/lib/merchant_api_delete_instance.c | 2+-
Msrc/lib/merchant_api_delete_product.c | 2+-
Msrc/lib/merchant_api_get_instance.c | 2+-
Msrc/lib/merchant_api_get_instances.c | 2+-
Msrc/lib/merchant_api_get_product.c | 2+-
Msrc/lib/merchant_api_get_products.c | 2+-
Msrc/lib/merchant_api_lock_product.c | 2+-
Msrc/lib/merchant_api_patch_instance.c | 2+-
Msrc/lib/merchant_api_patch_product.c | 2+-
Msrc/lib/merchant_api_post_instances.c | 2+-
Msrc/lib/merchant_api_post_products.c | 2+-
Msrc/testing/testing_api_cmd_post_instances.c | 7++++++-
14 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c @@ -832,11 +832,9 @@ url_handler (void *cls, } }; static struct TMH_RequestHandler h404 = { - .mime_type = "text/html", - .data = "<html><title>404: not found</title>" - "<body>404: not found</body></html>", - .data_size = strlen ("<html><title>404: not found</title>" - "<body>404: not found</body></html>"), + .mime_type = "application/json", + .data = "{\"code\":10}", + .data_size = strlen ("{\"code\":10}"), .handler = &TMH_MHD_handler_static_response, .response_code = MHD_HTTP_NOT_FOUND }; diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c @@ -149,7 +149,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_json ("payto_uris", &payto_uris), - GNUNET_JSON_spec_string ("instance", + GNUNET_JSON_spec_string ("id", &id), GNUNET_JSON_spec_string ("name", &name), diff --git a/src/lib/merchant_api_delete_instance.c b/src/lib/merchant_api_delete_instance.c @@ -139,7 +139,7 @@ instance_delete (struct GNUNET_CURL_Context *ctx, char *path; GNUNET_asprintf (&path, - "instances/%s", + "private/instances/%s", instance_id); if (purge) idh->url = TALER_url_join (backend_url, diff --git a/src/lib/merchant_api_delete_product.c b/src/lib/merchant_api_delete_product.c @@ -144,7 +144,7 @@ TALER_MERCHANT_product_delete ( char *path; GNUNET_asprintf (&path, - "products/%s", + "private/products/%s", product_id); pdh->url = TALER_url_join (backend_url, path, diff --git a/src/lib/merchant_api_get_instance.c b/src/lib/merchant_api_get_instance.c @@ -244,7 +244,7 @@ TALER_MERCHANT_instance_get (struct GNUNET_CURL_Context *ctx, char *path; GNUNET_asprintf (&path, - "instances/%s", + "private/instances/%s", instance_id); igh->url = TALER_url_join (backend_url, path, diff --git a/src/lib/merchant_api_get_instances.c b/src/lib/merchant_api_get_instances.c @@ -249,7 +249,7 @@ TALER_MERCHANT_instances_get (struct GNUNET_CURL_Context *ctx, igh->cb = instances_cb; igh->cb_cls = instances_cb_cls; igh->url = TALER_url_join (backend_url, - "instances", + "private/instances", NULL); if (NULL == igh->url) { diff --git a/src/lib/merchant_api_get_product.c b/src/lib/merchant_api_get_product.c @@ -212,7 +212,7 @@ TALER_MERCHANT_product_get ( char *path; GNUNET_asprintf (&path, - "products/%s", + "private/products/%s", product_id); pgh->url = TALER_url_join (backend_url, path, diff --git a/src/lib/merchant_api_get_products.c b/src/lib/merchant_api_get_products.c @@ -222,7 +222,7 @@ TALER_MERCHANT_products_get ( pgh->cb = cb; pgh->cb_cls = cb_cls; pgh->url = TALER_url_join (backend_url, - "products", + "private/products", NULL); if (NULL == pgh->url) { diff --git a/src/lib/merchant_api_lock_product.c b/src/lib/merchant_api_lock_product.c @@ -197,7 +197,7 @@ TALER_MERCHANT_product_lock ( char *path; GNUNET_asprintf (&path, - "products/%s/lock", + "private/products/%s/lock", product_id); plh->url = TALER_url_join (backend_url, path, diff --git a/src/lib/merchant_api_patch_instance.c b/src/lib/merchant_api_patch_instance.c @@ -243,7 +243,7 @@ TALER_MERCHANT_instance_patch ( char *path; GNUNET_asprintf (&path, - "instances/%s", + "private/instances/%s", instance_id); iph->url = TALER_url_join (backend_url, path, diff --git a/src/lib/merchant_api_patch_product.c b/src/lib/merchant_api_patch_product.c @@ -235,7 +235,7 @@ TALER_MERCHANT_product_patch ( char *path; GNUNET_asprintf (&path, - "products/%s", + "private/products/%s", product_id); pph->url = TALER_url_join (backend_url, path, diff --git a/src/lib/merchant_api_post_instances.c b/src/lib/merchant_api_post_instances.c @@ -244,7 +244,7 @@ TALER_MERCHANT_instances_post ( iph->cb = cb; iph->cb_cls = cb_cls; iph->url = TALER_url_join (backend_url, - "/instances", + "private/instances", NULL); if (NULL == iph->url) { diff --git a/src/lib/merchant_api_post_products.c b/src/lib/merchant_api_post_products.c @@ -228,7 +228,7 @@ TALER_MERCHANT_products_post ( pph->cb = cb; pph->cb_cls = cb_cls; pph->url = TALER_url_join (backend_url, - "products", + "private/products", NULL); if (NULL == pph->url) { diff --git a/src/testing/testing_api_cmd_post_instances.c b/src/testing/testing_api_cmd_post_instances.c @@ -203,6 +203,7 @@ post_instances_cleanup (void *cls, } json_decref (pis->address); json_decref (pis->jurisdiction); + GNUNET_free (pis->payto_uris); GNUNET_free (pis); } @@ -251,7 +252,11 @@ TALER_TESTING_cmd_merchant_post_instances2 ( pis->instance_id = instance_id; pis->http_status = http_status; pis->payto_uris_length = payto_uris_length; - pis->payto_uris = payto_uris; + pis->payto_uris = GNUNET_new_array (payto_uris_length, + const char *); + memcpy (pis->payto_uris, + payto_uris, + sizeof (const char *) * payto_uris_length); pis->name = name; pis->address = address; /* ownership transfer! */ pis->jurisdiction = jurisdiction; /* ownership transfer! */