[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated (f160682f -> 06ba46d7)
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated (f160682f -> 06ba46d7) |
Date: |
Tue, 06 Dec 2022 15:31:13 +0100 |
This is an automated email from the git hooks/post-receive script.
priscilla-huang pushed a change to branch master
in repository merchant.
from f160682f update
new b0a95a94 update
new e90fc21a update
new 06ba46d7 update
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/backend/taler-merchant-httpd.c | 187 +++++++++++++--------------
src/backenddb/plugin_merchantdb_postgres.c | 2 +-
src/testing/#Makefile# | 12 +-
src/testing/Makefile.am | 1 +
src/testing/test_merchant_api.c | 74 +++++++++++
src/testing/testing_api_cmd_post_templates.c | 3 +-
6 files changed, 180 insertions(+), 99 deletions(-)
diff --git a/src/backend/taler-merchant-httpd.c
b/src/backend/taler-merchant-httpd.c
index 6dd48ea1..1e3de641 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -931,6 +931,98 @@ url_handler (void *cls,
.allow_deleted_instance = true,
.handler = &TMH_private_get_transfers
},
+ /* POST /templates: */
+ {
+ .url_prefix = "/templates/",
+ .method = MHD_HTTP_METHOD_POST,
+ .handler = &TMH_private_post_templates,
+ /* allow template data of up to 8 MB, that should be plenty;
+ note that exceeding #GNUNET_MAX_MALLOC_CHECKED (40 MB)
+ would require further changes to the allocation logic
+ in the code... */
+ .max_upload = 1024 * 1024 * 8
+ },
+ /* GET /templates: */
+ {
+ .url_prefix = "/templates",
+ .method = MHD_HTTP_METHOD_GET,
+ .handler = &TMH_private_get_templates
+ },
+ /* GET /templates/$ID/: */
+ {
+ .url_prefix = "/templates/",
+ .method = MHD_HTTP_METHOD_GET,
+ .have_id_segment = true,
+ .allow_deleted_instance = true,
+ .handler = &TMH_private_get_templates_ID
+ },
+ /* DELETE /templates/$ID/: */
+ {
+ .url_prefix = "/templates/",
+ .method = MHD_HTTP_METHOD_DELETE,
+ .have_id_segment = true,
+ .allow_deleted_instance = true,
+ .handler = &TMH_private_delete_templates_ID
+ },
+ /* PATCH /templates/$ID/: */
+ {
+ .url_prefix = "/templates/",
+ .method = MHD_HTTP_METHOD_PATCH,
+ .have_id_segment = true,
+ .allow_deleted_instance = true,
+ .handler = &TMH_private_patch_templates_ID,
+ /* allow template data of up to 8 MB, that should be plenty;
+ note that exceeding #GNUNET_MAX_MALLOC_CHECKED (40 MB)
+ would require further changes to the allocation logic
+ in the code... */
+ .max_upload = 1024 * 1024 * 8
+ },
+ /* GET /webhooks: */
+ {
+ .url_prefix = "/webhooks/",
+ .method = MHD_HTTP_METHOD_GET,
+ .handler = &TMH_private_get_webhooks
+ },
+ /* POST /webhooks: */
+ {
+ .url_prefix = "/webhooks/",
+ .method = MHD_HTTP_METHOD_POST,
+ .handler = &TMH_private_post_webhooks,
+ /* allow webhook data of up to 8 MB, that should be plenty;
+ note that exceeding #GNUNET_MAX_MALLOC_CHECKED (40 MB)
+ would require further changes to the allocation logic
+ in the code... */
+ .max_upload = 1024 * 1024 * 8
+ },
+ /* GET /webhooks/$ID/: */
+ {
+ .url_prefix = "/webhooks/",
+ .method = MHD_HTTP_METHOD_GET,
+ .have_id_segment = true,
+ .allow_deleted_instance = true,
+ .handler = &TMH_private_get_webhooks_ID
+ },
+ /* DELETE /webhooks/$ID/: */
+ {
+ .url_prefix = "/webhooks/",
+ .method = MHD_HTTP_METHOD_DELETE,
+ .have_id_segment = true,
+ .allow_deleted_instance = true,
+ .handler = &TMH_private_delete_webhooks_ID
+ },
+ /* PATCH /webhooks/$ID/: */
+ {
+ .url_prefix = "/webhooks/",
+ .method = MHD_HTTP_METHOD_PATCH,
+ .have_id_segment = true,
+ .allow_deleted_instance = true,
+ .handler = &TMH_private_patch_webhooks_ID,
+ /* allow webhook data of up to 8 MB, that should be plenty;
+ note that exceeding #GNUNET_MAX_MALLOC_CHECKED (40 MB)
+ would require further changes to the allocation logic
+ in the code... */
+ .max_upload = 1024 * 1024 * 8
+ },
{
.url_prefix = NULL
}
@@ -1062,101 +1154,6 @@ url_handler (void *cls,
.method = MHD_HTTP_METHOD_OPTIONS,
.handler = &handle_server_options
},
- /* GET /templates: */
- {
- .url_prefix = "/templates/",
- .method = MHD_HTTP_METHOD_GET,
- .handler = &TMH_private_get_templates
- },
- /* POST /templates: */
- {
- .url_prefix = "/templates/",
- .method = MHD_HTTP_METHOD_POST,
- .handler = &TMH_private_post_templates,
- /* allow template data of up to 8 MB, that should be plenty;
- note that exceeding #GNUNET_MAX_MALLOC_CHECKED (40 MB)
- would require further changes to the allocation logic
- in the code... */
- .max_upload = 1024 * 1024 * 8
- },
- /* GET /templates/$ID/: */
- {
- .url_prefix = "/templates/",
- .method = MHD_HTTP_METHOD_GET,
- .have_id_segment = true,
- .allow_deleted_instance = true,
- .handler = &TMH_private_get_templates_ID
- },
- /* DELETE /templates/$ID/: */
- {
- .url_prefix = "/templates/",
- .method = MHD_HTTP_METHOD_DELETE,
- .have_id_segment = true,
- .allow_deleted_instance = true,
- .handler = &TMH_private_delete_templates_ID
- },
- /* PATCH /templates/$ID/: */
- {
- .url_prefix = "/templates/",
- .method = MHD_HTTP_METHOD_PATCH,
- .have_id_segment = true,
- .allow_deleted_instance = true,
- .handler = &TMH_private_patch_templates_ID,
- /* allow template data of up to 8 MB, that should be plenty;
- note that exceeding #GNUNET_MAX_MALLOC_CHECKED (40 MB)
- would require further changes to the allocation logic
- in the code... */
- .max_upload = 1024 * 1024 * 8
- },
- {
- .url_prefix = NULL
- },
- /* GET /webhooks: */
- {
- .url_prefix = "/webhooks/",
- .method = MHD_HTTP_METHOD_GET,
- .handler = &TMH_private_get_webhooks
- },
- /* POST /webhooks: */
- {
- .url_prefix = "/webhooks/",
- .method = MHD_HTTP_METHOD_POST,
- .handler = &TMH_private_post_webhooks,
- /* allow webhook data of up to 8 MB, that should be plenty;
- note that exceeding #GNUNET_MAX_MALLOC_CHECKED (40 MB)
- would require further changes to the allocation logic
- in the code... */
- .max_upload = 1024 * 1024 * 8
- },
- /* GET /webhooks/$ID/: */
- {
- .url_prefix = "/webhooks/",
- .method = MHD_HTTP_METHOD_GET,
- .have_id_segment = true,
- .allow_deleted_instance = true,
- .handler = &TMH_private_get_webhooks_ID
- },
- /* DELETE /webhooks/$ID/: */
- {
- .url_prefix = "/webhooks/",
- .method = MHD_HTTP_METHOD_DELETE,
- .have_id_segment = true,
- .allow_deleted_instance = true,
- .handler = &TMH_private_delete_webhooks_ID
- },
- /* PATCH /webhooks/$ID/: */
- {
- .url_prefix = "/webhooks/",
- .method = MHD_HTTP_METHOD_PATCH,
- .have_id_segment = true,
- .allow_deleted_instance = true,
- .handler = &TMH_private_patch_webhooks_ID,
- /* allow webhook data of up to 8 MB, that should be plenty;
- note that exceeding #GNUNET_MAX_MALLOC_CHECKED (40 MB)
- would require further changes to the allocation logic
- in the code... */
- .max_upload = 1024 * 1024 * 8
- },
{
.url_prefix = NULL
}
diff --git a/src/backenddb/plugin_merchantdb_postgres.c
b/src/backenddb/plugin_merchantdb_postgres.c
index 1176cdd5..32f0b1be 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -9865,7 +9865,7 @@ postgres_connect (void *cls)
GNUNET_PQ_make_prepare ("delete_webhook",
"DELETE"
" FROM merchant_webhook"
- " WHERE merchant_template.merchant_serial="
+ " WHERE merchant_webhook.merchant_serial="
" (SELECT merchant_serial "
" FROM merchant_instances"
" WHERE merchant_id=$1)"
diff --git a/src/testing/#Makefile# b/src/testing/#Makefile#
index e3663766..db183000 100644
--- a/src/testing/#Makefile#
+++ b/src/testing/#Makefile#
@@ -654,7 +654,7 @@ abs_srcdir = /home/priscilla/merchant/src/testing
abs_top_builddir = /home/priscilla/merchant
abs_top_srcdir = /home/priscilla/merchant
ac_ct_AR = ar
-ac_ct_CC = gcc
+ac_ct_CC = gcc
ac_ct_DUMPBIN =
ac_ct_OBJC = gcc
am__include = include
@@ -717,6 +717,7 @@ check_SCRIPTS = \
test_merchant_instance_purge.sh \
test_merchant_reserve_creation.sh \
test_merchant_product_creation.sh \
+ test_merchant_template_creation.sh \
test_merchant_order_creation.sh \
test_merchant_transfer_tracking.sh
@@ -1393,6 +1394,13 @@ test_merchant_product_creation.sh.log:
test_merchant_product_creation.sh
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS)
-- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+test_merchant_template_creation.sh.log: test_merchant_template_creation.sh
+ @p='test_merchant_template_creation.sh'; \
+ b='test_merchant_template_creation.sh'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS)
-- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
test_merchant_order_creation.sh.log: test_merchant_order_creation.sh
@p='test_merchant_order_creation.sh'; \
b='test_merchant_order_creation.sh'; \
@@ -1457,7 +1465,7 @@ distdir-am: $(DISTFILES)
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS)
- $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index af98f4e1..d13e342b 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -14,6 +14,7 @@ check_SCRIPTS = \
test_merchant_instance_purge.sh \
test_merchant_reserve_creation.sh \
test_merchant_product_creation.sh \
+ test_merchant_template_creation.sh \
test_merchant_order_creation.sh \
test_merchant_transfer_tracking.sh
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 9759f417..1b7cba30 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -1293,6 +1293,78 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
+ struct TALER_TESTING_Command templates[] = {
+ TALER_TESTING_cmd_merchant_get_templates ("get-templates-empty",
+ merchant_url,
+ MHD_HTTP_OK,
+ NULL),
+ TALER_TESTING_cmd_merchant_post_templates ("post-templates-t1",
+ merchant_url,
+ "template-1",
+ "a template",
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_post_templates ("post-templates-t1-idem",
+ merchant_url,
+ "template-1",
+ "a template",
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_post_templates ("post-templates-t1-non-idem",
+ merchant_url,
+ "template-1",
+ "a different template",
+ MHD_HTTP_CONFLICT),
+ TALER_TESTING_cmd_merchant_get_templates ("get-templates-t1",
+ merchant_url,
+ MHD_HTTP_OK,
+ "post-templates-t1",
+ NULL),
+ TALER_TESTING_cmd_merchant_get_template ("get-template-t1",
+ merchant_url,
+ "template-1",
+ MHD_HTTP_OK,
+ "post-templates-t1"),
+ TALER_TESTING_cmd_merchant_post_templates ("post-templates-t2",
+ merchant_url,
+ "template-2",
+ "a template",
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_patch_template ("patch-templates-t2",
+ merchant_url,
+ "template-2",
+ "another template",
+ "data:image/jpeg;base64,RAWDATA",
+ json_pack ("summary",
+ "EUR:1"),
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_merchant_get_template ("get-template-t2",
+ merchant_url,
+ "template-2",
+ MHD_HTTP_OK,
+ "patch-templates-t2"),
+ TALER_TESTING_cmd_merchant_get_template ("get-template-nx",
+ merchant_url,
+ "template-nx",
+ MHD_HTTP_NOT_FOUND,
+ NULL),
+ TALER_TESTING_cmd_merchant_patch_template ("patch-templates-t3-nx",
+ merchant_url,
+ "template-3",
+ "nx updated template",
+ "data:image/jpeg;base64,RAWDATA",
+ json_pack ("summary",
+ "EUR:1"),
+ MHD_HTTP_NOT_FOUND),
+ TALER_TESTING_cmd_merchant_delete_template ("get-templates-empty",
+ merchant_url,
+ "t1",
+ MHD_HTTP_NOT_FOUND),
+ TALER_TESTING_cmd_merchant_delete_template ("get-templates-empty",
+ merchant_url,
+ "template-1",
+ MHD_HTTP_NO_CONTENT),
+ TALER_TESTING_cmd_end ()
+ };
+
struct TALER_TESTING_Command commands[] = {
/* general setup */
TALER_TESTING_cmd_auditor_add ("add-auditor-OK",
@@ -1643,6 +1715,8 @@ run (void *cls,
tip),
TALER_TESTING_cmd_batch ("auth",
auth),
+ TALER_TESTING_cmd_batch ("templates",
+ templates),
/**
* End the suite.
*/
diff --git a/src/testing/testing_api_cmd_post_templates.c
b/src/testing/testing_api_cmd_post_templates.c
index 4cc5a3bd..7bdd2e97 100644
--- a/src/testing/testing_api_cmd_post_templates.c
+++ b/src/testing/testing_api_cmd_post_templates.c
@@ -233,6 +233,7 @@ TALER_TESTING_cmd_merchant_post_templates2 (
.label = label,
.run = &post_templates_run,
.cleanup = &post_templates_cleanup,
+
.traits = &post_templates_traits
};
@@ -254,7 +255,7 @@ TALER_TESTING_cmd_merchant_post_templates (const char
*label,
template_id,
template_description,
"",
- json_pack ("merchant 1", "5e", "minimum 10"),
+ json_pack ("{s:I}", "merchant", "1"),
http_status);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-merchant] branch master updated (f160682f -> 06ba46d7),
gnunet <=