diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-01-16 19:00:15 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-01-16 19:00:15 +0100 |
commit | be1daf172c17cd60c7b8493d1f723db5ded0f8c1 (patch) | |
tree | f369099ff993fc1c8378a4fc01fc1a3157b4775d /src | |
parent | 3de9e044eddbe4d7054df875d516be1273f5be7c (diff) |
code clean up and get KYC test to pass again with recent exchange changes
Diffstat (limited to 'src')
36 files changed, 137 insertions, 118 deletions
diff --git a/src/backend/taler-merchant-httpd_post-using-templates.h b/src/backend/taler-merchant-httpd_post-using-templates.h index 5087da67..2f788c40 100644 --- a/src/backend/taler-merchant-httpd_post-using-templates.h +++ b/src/backend/taler-merchant-httpd_post-using-templates.h @@ -26,6 +26,7 @@ /** * Generate a template that customer can use it. Returns an MHD_RESULT. * + * @param rh details about this request handler * @param connection the MHD connection to handle * @param[in,out] hc context with further information about the request * @return MHD result code diff --git a/src/backend/taler-merchant-httpd_private-delete-pending-webhooks-ID.c b/src/backend/taler-merchant-httpd_private-delete-pending-webhooks-ID.c index 0e6a3bfb..16b7e3ce 100644 --- a/src/backend/taler-merchant-httpd_private-delete-pending-webhooks-ID.c +++ b/src/backend/taler-merchant-httpd_private-delete-pending-webhooks-ID.c @@ -23,14 +23,6 @@ #include <taler/taler_json_lib.h> -/** - * Handle a DELETE "/pending-webhooks/$ID" request. - * - * @param rh context of the handler - * @param connection the MHD connection to handle - * @param[in,out] hc context with further information about the request - * @return MHD result code - */ MHD_RESULT TMH_private_delete_pending_webhooks_ID (const struct TMH_RequestHandler *rh, struct MHD_Connection *connection, diff --git a/src/backend/taler-merchant-httpd_private-get-templates.c b/src/backend/taler-merchant-httpd_private-get-templates.c index c1d72a55..e59e47c9 100644 --- a/src/backend/taler-merchant-httpd_private-get-templates.c +++ b/src/backend/taler-merchant-httpd_private-get-templates.c @@ -27,6 +27,7 @@ * * @param cls a `json_t *` JSON array to build * @param template_id ID of the template + * @param template_description human-readable description for the template */ static void add_template (void *cls, @@ -48,8 +49,8 @@ add_template (void *cls, MHD_RESULT TMH_private_get_templates (const struct TMH_RequestHandler *rh, - struct MHD_Connection *connection, - struct TMH_HandlerContext *hc) + struct MHD_Connection *connection, + struct TMH_HandlerContext *hc) { json_t *pa; enum GNUNET_DB_QueryStatus qs; @@ -57,9 +58,9 @@ TMH_private_get_templates (const struct TMH_RequestHandler *rh, pa = json_array (); GNUNET_assert (NULL != pa); qs = TMH_db->lookup_templates (TMH_db->cls, - hc->instance->settings.id, - &add_template, - pa); + hc->instance->settings.id, + &add_template, + pa); if (0 > qs) { GNUNET_break (0); diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 37c7f56e..9b38c2bf 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -107,37 +107,6 @@ struct TALER_MERCHANT_HttpResponse /** - * Take a @a response from the merchant API that (presumably) contains - * error details and setup the corresponding @a hr structure. Internally - * used to convert merchant's responses in to @a hr. - * - * @param response if NULL we will report #TALER_EC_GENERIC_INVALID_RESPONSE in `ec` - * @param http_status http status to use - * @param[out] hr response object to initialize, fields will - * only be valid as long as @a response is valid as well - */ -void -TALER_MERCHANT_parse_error_details_ (const json_t *response, - unsigned int http_status, - struct TALER_MERCHANT_HttpResponse *hr); - - -/** - * Construct a new base URL using the existing @a base_url - * and the given @a instance_id. The result WILL end with - * '/'. - * - * @param base_url a merchant base URL without "/instances/" in it, - * must not be the empty string; MAY end with '/'. - * @param instance_id ID of an instance - * @return "${base_url}/instances/${instance_id}/" - */ -char * -TALER_MERCHANT_baseurl_add_instance (const char *base_url, - const char *instance_id); - - -/** * Contains information gathered from parsing a taler://pay URI. */ struct TALER_MERCHANT_PayUriData @@ -187,7 +156,7 @@ struct TALER_MERCHANT_PayUriData * @param[out] parse_data data extracted from the URI. Must be free'd. * @return #GNUNET_SYSERR if @e pay_uri is malformed, #GNUNET_OK otherwise. */ -int +enum GNUNET_GenericReturnValue TALER_MERCHANT_parse_pay_uri (const char *pay_uri, struct TALER_MERCHANT_PayUriData *parse_data); @@ -4370,11 +4339,13 @@ void TALER_MERCHANT_template_delete_cancel ( struct TALER_MERCHANT_TemplateDeleteHandle *tdh); + /** * Make a POST /using-templates request to add an using template * * @param ctx the context * @param backend_url HTTP base URL for the backend + * @param template_id which template should be used * @param summary summary of the using template * @param amount to pay given by the customer * @param cb function to call with the backend's result @@ -4401,20 +4372,6 @@ void TALER_MERCHANT_using_templates_post_cancel ( struct TALER_MERCHANT_UsingTemplatesPostHandle *utph); -/** - * Function called when we're done processing the - * HTTP POST /using-template request to create an order. - * - * @param cls the `struct TALER_MERCHANT_PostOrdersHandle or TALER_MERCHANT_UsingTemplatesPostHandle` - * @param response_code HTTP response code, 0 on error - * @param response response body, NULL if not JSON - */ -void -TALER_MERCHANT_handle_post_using_templates_create_order (void *cb_cls, - TALER_MERCHANT_PostOrdersCallback cb, - long response_code, - const json_t *json); - /* ********************* /webhooks *********************** */ diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 7451b24d..36e249ed 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -15,7 +15,7 @@ libtalermerchant_la_LDFLAGS = \ libtalermerchant_la_SOURCES = \ merchant_api_curl_defaults.c merchant_api_curl_defaults.h \ - merchant_api_common.c \ + merchant_api_common.c merchant_api_common.h \ merchant_api_delete_instance.c \ merchant_api_delete_order.c \ merchant_api_delete_product.c \ diff --git a/src/lib/merchant_api_common.c b/src/lib/merchant_api_common.c index 7c0918f9..00e0358d 100644 --- a/src/lib/merchant_api_common.c +++ b/src/lib/merchant_api_common.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2020 to 2022 Taler Systems SA + Copyright (C) 2020-2023 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software @@ -23,6 +23,7 @@ #include "platform.h" #include <curl/curl.h> #include "taler_merchant_service.h" +#include "merchant_api_common.h" #include <gnunet/gnunet_uri_lib.h> #include <taler/taler_json_lib.h> @@ -106,31 +107,7 @@ TALER_MERCHANT_parse_error_details_ (const json_t *response, } -char * -TALER_MERCHANT_baseurl_add_instance (const char *base_url, - const char *instance_id) -{ - char *ret; - bool end_sl; - - if ('\0' == *base_url) - { - GNUNET_break (0); - return NULL; - } - end_sl = '/' == base_url[strlen (base_url) - 1]; - - GNUNET_asprintf (&ret, - (end_sl) - ? "%sinstances/%s/" - : "%s/instances/%s/", - base_url, - instance_id); - return ret; -} - - -int +enum GNUNET_GenericReturnValue TALER_MERCHANT_parse_pay_uri (const char *pay_uri, struct TALER_MERCHANT_PayUriData *parse_data) { @@ -374,20 +351,12 @@ TALER_MERCHANT_parse_refund_uri_free ( } -/** - * Function called when we're done processing the - * HTTP POST /using-template request to create an order. - * - * @param cb_cls closure - * @param cb callback - * @param response_code HTTP response code, 0 on error - * @param json for reply - */ void -TALER_MERCHANT_handle_post_using_templates_create_order (void *cb_cls, - TALER_MERCHANT_PostOrdersCallback cb, - long response_code, - const json_t *json) +TALER_MERCHANT_handle_order_creation_response_ ( + TALER_MERCHANT_PostOrdersCallback cb, + void *cb_cls, + long response_code, + const json_t *json) { struct TALER_MERCHANT_PostOrdersReply por = { .hr.http_status = (unsigned int) response_code, @@ -513,5 +482,5 @@ TALER_MERCHANT_handle_post_using_templates_create_order (void *cb_cls, break; } // end of switch cb (cb_cls, - &por); + &por); } diff --git a/src/lib/merchant_api_common.h b/src/lib/merchant_api_common.h new file mode 100644 index 00000000..0ffe953d --- /dev/null +++ b/src/lib/merchant_api_common.h @@ -0,0 +1,61 @@ +/* + This file is part of TALER + Copyright (C) 2020-2023 Taler Systems SA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2.1, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + TALER; see the file COPYING.LGPL. If not, see + <http://www.gnu.org/licenses/> +*/ +/** + * @file merchant_api_common.h + * @brief Implementation of common logic for libtalermerchant + * @author Christian Grothoff + * @author Priscilla Huang + */ +#ifndef MERCHANT_API_COMMON_H +#define MERCHANT_API_COMMON_H +#include "taler_merchant_service.h" + + +/** + * Function called when we're done processing a + * HTTP POST request to create an order. + * + * @param cb callback + * @param cb_cls closure for @a cb + * @param response_code HTTP response code, 0 on error + * @param response response body, NULL if not JSON + */ +void +TALER_MERCHANT_handle_order_creation_response_ ( + TALER_MERCHANT_PostOrdersCallback cb, + void *cb_cls, + long response_code, + const json_t *json); + + +/** + * Take a @a response from the merchant API that (presumably) contains + * error details and setup the corresponding @a hr structure. Internally + * used to convert merchant's responses in to @a hr. + * + * @param response if NULL we will report #TALER_EC_GENERIC_INVALID_RESPONSE in `ec` + * @param http_status http status to use + * @param[out] hr response object to initialize, fields will + * only be valid as long as @a response is valid as well + */ +void +TALER_MERCHANT_parse_error_details_ (const json_t *response, + unsigned int http_status, + struct TALER_MERCHANT_HttpResponse *hr); + + +#endif diff --git a/src/lib/merchant_api_get_reserve.c b/src/lib/merchant_api_get_reserve.c index cc6bc562..6c970db8 100644 --- a/src/lib/merchant_api_get_reserve.c +++ b/src/lib/merchant_api_get_reserve.c @@ -27,6 +27,7 @@ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" +#include "merchant_api_common.h" #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> diff --git a/src/lib/merchant_api_get_reserves.c b/src/lib/merchant_api_get_reserves.c index 570fc4e5..9b3b45e9 100644 --- a/src/lib/merchant_api_get_reserves.c +++ b/src/lib/merchant_api_get_reserves.c @@ -27,6 +27,7 @@ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" +#include "merchant_api_common.h" #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> diff --git a/src/lib/merchant_api_get_transfers.c b/src/lib/merchant_api_get_transfers.c index 275990fc..f2f1186d 100644 --- a/src/lib/merchant_api_get_transfers.c +++ b/src/lib/merchant_api_get_transfers.c @@ -27,6 +27,7 @@ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" +#include "merchant_api_common.h" #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> diff --git a/src/lib/merchant_api_lock_product.c b/src/lib/merchant_api_lock_product.c index de4da906..4f7c8be4 100644 --- a/src/lib/merchant_api_lock_product.c +++ b/src/lib/merchant_api_lock_product.c @@ -28,6 +28,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include "taler_merchant_service.h" +#include "merchant_api_common.h" #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> #include <taler/taler_curl_lib.h> diff --git a/src/lib/merchant_api_merchant_get_tip.c b/src/lib/merchant_api_merchant_get_tip.c index 9c21377e..7466fccc 100644 --- a/src/lib/merchant_api_merchant_get_tip.c +++ b/src/lib/merchant_api_merchant_get_tip.c @@ -26,6 +26,7 @@ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" +#include "merchant_api_common.h" #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> @@ -249,8 +250,8 @@ TALER_MERCHANT_merchant_tip_get (struct GNUNET_CURL_Context *ctx, sizeof (timeout_str), "%llu", ((unsigned long long) - lp_timeout.rel_value_us / - GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us)); + lp_timeout.rel_value_us + / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us)); tgh->url = TALER_url_join (backend_url, arg_str, "pickups", diff --git a/src/lib/merchant_api_patch_instance.c b/src/lib/merchant_api_patch_instance.c index 7a6c390a..0613a852 100644 --- a/src/lib/merchant_api_patch_instance.c +++ b/src/lib/merchant_api_patch_instance.c @@ -29,6 +29,7 @@ #include <gnunet/gnunet_util_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_curl_lib.h> diff --git a/src/lib/merchant_api_patch_order_forget.c b/src/lib/merchant_api_patch_order_forget.c index 565a66f3..572f00e6 100644 --- a/src/lib/merchant_api_patch_order_forget.c +++ b/src/lib/merchant_api_patch_order_forget.c @@ -28,6 +28,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include "taler_merchant_service.h" +#include "merchant_api_common.h" #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> #include <taler/taler_curl_lib.h> diff --git a/src/lib/merchant_api_patch_product.c b/src/lib/merchant_api_patch_product.c index 7f931655..48db078f 100644 --- a/src/lib/merchant_api_patch_product.c +++ b/src/lib/merchant_api_patch_product.c @@ -28,6 +28,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include "taler_merchant_service.h" +#include "merchant_api_common.h" #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> #include <taler/taler_curl_lib.h> diff --git a/src/lib/merchant_api_patch_template.c b/src/lib/merchant_api_patch_template.c index 3f5027c8..44357cc0 100644 --- a/src/lib/merchant_api_patch_template.c +++ b/src/lib/merchant_api_patch_template.c @@ -20,7 +20,7 @@ * @file merchant_api_patch_template.c * @brief Implementation of the PATCH /templates/$ID request * of the merchant's HTTP API - * @author Priscilla HUANG + * @author Priscilla HUANG */ #include "platform.h" #include <curl/curl.h> @@ -28,6 +28,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include "taler_merchant_service.h" +#include "merchant_api_common.h" #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> #include <taler/taler_curl_lib.h> @@ -82,8 +83,8 @@ struct TALER_MERCHANT_TemplatePatchHandle */ static void handle_patch_template_finished (void *cls, - long response_code, - const void *response) + long response_code, + const void *response) { struct TALER_MERCHANT_TemplatePatchHandle *tph = cls; const json_t *json = response; @@ -173,8 +174,8 @@ TALER_MERCHANT_template_patch ( GNUNET_JSON_pack_string ("template_description", template_description), GNUNET_JSON_pack_allow_null ( - GNUNET_JSON_pack_string ("image", - image)), + GNUNET_JSON_pack_string ("image", + image)), GNUNET_JSON_pack_object_incref ("template_contract", (json_t *) template_contract)); tph = GNUNET_new (struct TALER_MERCHANT_TemplatePatchHandle); diff --git a/src/lib/merchant_api_patch_webhook.c b/src/lib/merchant_api_patch_webhook.c index 9bb17cc0..6d8b6340 100644 --- a/src/lib/merchant_api_patch_webhook.c +++ b/src/lib/merchant_api_patch_webhook.c @@ -20,7 +20,7 @@ * @file merchant_api_patch_webhook.c * @brief Implementation of the PATCH /webhooks/$ID request * of the merchant's HTTP API - * @author Priscilla HUANG + * @author Priscilla HUANG */ #include "platform.h" #include <curl/curl.h> @@ -29,6 +29,7 @@ #include <gnunet/gnunet_util_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_curl_lib.h> diff --git a/src/lib/merchant_api_post_instances.c b/src/lib/merchant_api_post_instances.c index 89b7d2fb..183b3400 100644 --- a/src/lib/merchant_api_post_instances.c +++ b/src/lib/merchant_api_post_instances.c @@ -29,6 +29,7 @@ #include <gnunet/gnunet_util_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_curl_lib.h> diff --git a/src/lib/merchant_api_post_order_abort.c b/src/lib/merchant_api_post_order_abort.c index 406a6015..b5a7a00b 100644 --- a/src/lib/merchant_api_post_order_abort.c +++ b/src/lib/merchant_api_post_order_abort.c @@ -31,6 +31,7 @@ #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> #include <taler/taler_exchange_service.h> diff --git a/src/lib/merchant_api_post_order_paid.c b/src/lib/merchant_api_post_order_paid.c index 2c398f90..a42b1255 100644 --- a/src/lib/merchant_api_post_order_paid.c +++ b/src/lib/merchant_api_post_order_paid.c @@ -30,6 +30,7 @@ #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> #include <taler/taler_exchange_service.h> diff --git a/src/lib/merchant_api_post_order_pay.c b/src/lib/merchant_api_post_order_pay.c index 720681e1..765ca1a6 100644 --- a/src/lib/merchant_api_post_order_pay.c +++ b/src/lib/merchant_api_post_order_pay.c @@ -30,6 +30,7 @@ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" +#include "merchant_api_common.h" #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> diff --git a/src/lib/merchant_api_post_order_refund.c b/src/lib/merchant_api_post_order_refund.c index c59bd762..be996dc2 100644 --- a/src/lib/merchant_api_post_order_refund.c +++ b/src/lib/merchant_api_post_order_refund.c @@ -28,6 +28,7 @@ #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> #include <taler/taler_curl_lib.h> diff --git a/src/lib/merchant_api_post_orders.c b/src/lib/merchant_api_post_orders.c index 39f44904..c0fd5fcb 100644 --- a/src/lib/merchant_api_post_orders.c +++ b/src/lib/merchant_api_post_orders.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2021 Taler Systems SA + Copyright (C) 2014-2023 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -30,6 +30,7 @@ #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> #include <taler/taler_curl_lib.h> @@ -88,8 +89,12 @@ handle_post_order_finished (void *cls, { struct TALER_MERCHANT_PostOrdersHandle *po = cls; const json_t *json = response; + po->job = NULL; - TALER_MERCHANT_handle_post_using_templates_create_order (po->cb_cls, po->cb, response_code, json); + TALER_MERCHANT_handle_order_creation_response_ (po->cb, + po->cb_cls, + response_code, + json); TALER_MERCHANT_orders_post_cancel (po); } diff --git a/src/lib/merchant_api_post_products.c b/src/lib/merchant_api_post_products.c index 43799032..2a5b9a9b 100644 --- a/src/lib/merchant_api_post_products.c +++ b/src/lib/merchant_api_post_products.c @@ -29,6 +29,7 @@ #include <gnunet/gnunet_util_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_curl_lib.h> diff --git a/src/lib/merchant_api_post_reserves.c b/src/lib/merchant_api_post_reserves.c index 7942e3e0..65239dfb 100644 --- a/src/lib/merchant_api_post_reserves.c +++ b/src/lib/merchant_api_post_reserves.c @@ -27,6 +27,7 @@ #include <gnunet/gnunet_util_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_curl_lib.h> #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post_templates.c b/src/lib/merchant_api_post_templates.c index 87b252f1..9592a5e3 100644 --- a/src/lib/merchant_api_post_templates.c +++ b/src/lib/merchant_api_post_templates.c @@ -29,6 +29,7 @@ #include <gnunet/gnunet_util_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_curl_lib.h> diff --git a/src/lib/merchant_api_post_transfers.c b/src/lib/merchant_api_post_transfers.c index 01144833..450b46d9 100644 --- a/src/lib/merchant_api_post_transfers.c +++ b/src/lib/merchant_api_post_transfers.c @@ -27,6 +27,7 @@ #include <gnunet/gnunet_util_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_curl_lib.h> #include <taler/taler_json_lib.h> diff --git a/src/lib/merchant_api_post_using_templates.c b/src/lib/merchant_api_post_using_templates.c index 372f5eb5..d72768f3 100644 --- a/src/lib/merchant_api_post_using_templates.c +++ b/src/lib/merchant_api_post_using_templates.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2022 Taler Systems SA + Copyright (C) 2022-2023 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -28,6 +28,7 @@ #include <microhttpd.h> /* just for HTTP status codes */ #include <gnunet/gnunet_util_lib.h> #include "taler_merchant_service.h" +#include "merchant_api_common.h" #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> #include <taler/taler_curl_lib.h> @@ -85,8 +86,12 @@ handle_post_using_templates_finished (void *cls, { struct TALER_MERCHANT_UsingTemplatesPostHandle *utph = cls; const json_t *json = response; + utph->job = NULL; - TALER_MERCHANT_handle_post_using_templates_create_order (utph->cb_cls, utph->cb, response_code, json); + TALER_MERCHANT_handle_order_creation_response_ (utph->cb, + utph->cb_cls, + response_code, + json); TALER_MERCHANT_using_templates_post_cancel (utph); } diff --git a/src/lib/merchant_api_post_webhooks.c b/src/lib/merchant_api_post_webhooks.c index 2a31006c..a23ce2c3 100644 --- a/src/lib/merchant_api_post_webhooks.c +++ b/src/lib/merchant_api_post_webhooks.c @@ -29,6 +29,7 @@ #include <gnunet/gnunet_util_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_curl_lib.h> diff --git a/src/lib/merchant_api_tip_authorize.c b/src/lib/merchant_api_tip_authorize.c index f8990b4c..036d40af 100644 --- a/src/lib/merchant_api_tip_authorize.c +++ b/src/lib/merchant_api_tip_authorize.c @@ -28,6 +28,7 @@ #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> #include <taler/taler_curl_lib.h> diff --git a/src/lib/merchant_api_tip_pickup2.c b/src/lib/merchant_api_tip_pickup2.c index 58e2987d..33457024 100644 --- a/src/lib/merchant_api_tip_pickup2.c +++ b/src/lib/merchant_api_tip_pickup2.c @@ -28,6 +28,7 @@ #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> #include <taler/taler_curl_lib.h> diff --git a/src/lib/merchant_api_wallet_get_order.c b/src/lib/merchant_api_wallet_get_order.c index 9c24204a..61bed534 100644 --- a/src/lib/merchant_api_wallet_get_order.c +++ b/src/lib/merchant_api_wallet_get_order.c @@ -29,6 +29,7 @@ #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> diff --git a/src/lib/merchant_api_wallet_get_tip.c b/src/lib/merchant_api_wallet_get_tip.c index 07a46ab7..49e507d0 100644 --- a/src/lib/merchant_api_wallet_get_tip.c +++ b/src/lib/merchant_api_wallet_get_tip.c @@ -27,6 +27,7 @@ #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" #include "merchant_api_curl_defaults.h" +#include "merchant_api_common.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> diff --git a/src/lib/merchant_api_wallet_post_order_refund.c b/src/lib/merchant_api_wallet_post_order_refund.c index 1bc28e2d..fc4b0abd 100644 --- a/src/lib/merchant_api_wallet_post_order_refund.c +++ b/src/lib/merchant_api_wallet_post_order_refund.c @@ -26,6 +26,7 @@ #include <gnunet/gnunet_util_lib.h> #include <gnunet/gnunet_curl_lib.h> #include "taler_merchant_service.h" +#include "merchant_api_common.h" #include "merchant_api_curl_defaults.h" #include <taler/taler_json_lib.h> #include <taler/taler_signatures.h> diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c index 5d47d9ba..507338e4 100644 --- a/src/testing/test_kyc_api.c +++ b/src/testing/test_kyc_api.c @@ -6,7 +6,7 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. - + TALER is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -248,7 +248,6 @@ run (void *cls, "kyc-pending", "kyc-provider-test-oauth2", "pass", - "state", MHD_HTTP_SEE_OTHER), CMD_EXEC_AGGREGATOR ("run-aggregator"), TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-498c", diff --git a/src/testing/testing_api_cmd_kyc_get.c b/src/testing/testing_api_cmd_kyc_get.c index 16788113..96d0b58c 100644 --- a/src/testing/testing_api_cmd_kyc_get.c +++ b/src/testing/testing_api_cmd_kyc_get.c @@ -160,16 +160,20 @@ kyc_get_cb (void *cls, TALER_TESTING_FAIL (cs->is); } eq += strlen ("/kyc-proof/"); - nq = strchr (eq, '/'); - if (NULL == nq) + eq = strstr (eq, "state="); + if (NULL == eq) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Received unexpected KYC URL `%s' (%s)\n", + "Received unexpected 'state'-less KYC URL `%s' (%s)\n", url, dec); GNUNET_free (dec); TALER_TESTING_FAIL (cs->is); } + eq += strlen ("state="); + nq = strchr (eq, '&'); + if (NULL == nq) + nq = eq + strlen (eq); if (GNUNET_OK != GNUNET_STRINGS_string_to_data (eq, nq - eq, @@ -177,7 +181,7 @@ kyc_get_cb (void *cls, sizeof (cs->h_payto))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Received unexpected KYC URL `%s' (%s)\n", + "Received unexpected KYC URL `%s' (%s) - no h_payto in state\n", url, dec); GNUNET_free (dec); |