diff options
-rw-r--r-- | src/backend/taler-merchant-httpd_get-templates-ID.c | 3 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_private-get-templates-ID.c | 3 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_private-patch-templates-ID.c | 26 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_private-post-templates.c | 32 | ||||
-rw-r--r-- | src/backenddb/merchant-0009.sql | 33 | ||||
-rw-r--r-- | src/backenddb/merchantdb_helper.c | 1 | ||||
-rw-r--r-- | src/backenddb/pg_insert_template.c | 6 | ||||
-rw-r--r-- | src/backenddb/pg_lookup_template.c | 5 | ||||
-rw-r--r-- | src/backenddb/pg_update_template.c | 4 | ||||
-rw-r--r-- | src/include/taler_merchantdb_plugin.h | 6 |
10 files changed, 34 insertions, 85 deletions
diff --git a/src/backend/taler-merchant-httpd_get-templates-ID.c b/src/backend/taler-merchant-httpd_get-templates-ID.c index add67b4d..a2ad9bff 100644 --- a/src/backend/taler-merchant-httpd_get-templates-ID.c +++ b/src/backend/taler-merchant-httpd_get-templates-ID.c @@ -62,9 +62,6 @@ TMH_get_templates_ID ( connection, MHD_HTTP_OK, GNUNET_JSON_pack_allow_null ( - GNUNET_JSON_pack_string ("required_currency", - tp.required_currency)), - GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_object_incref ("editable_defaults", tp.editable_defaults)), GNUNET_JSON_pack_object_incref ("template_contract", diff --git a/src/backend/taler-merchant-httpd_private-get-templates-ID.c b/src/backend/taler-merchant-httpd_private-get-templates-ID.c index 35fdd1d0..db464297 100644 --- a/src/backend/taler-merchant-httpd_private-get-templates-ID.c +++ b/src/backend/taler-merchant-httpd_private-get-templates-ID.c @@ -62,9 +62,6 @@ TMH_private_get_templates_ID ( connection, MHD_HTTP_OK, GNUNET_JSON_pack_allow_null ( - GNUNET_JSON_pack_string ("required_currency", - tp.required_currency)), - GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_object_incref ("editable_defaults", tp.editable_defaults)), GNUNET_JSON_pack_string ("template_description", diff --git a/src/backend/taler-merchant-httpd_private-patch-templates-ID.c b/src/backend/taler-merchant-httpd_private-patch-templates-ID.c index e8a6c531..80b3dfc6 100644 --- a/src/backend/taler-merchant-httpd_private-patch-templates-ID.c +++ b/src/backend/taler-merchant-httpd_private-patch-templates-ID.c @@ -113,10 +113,6 @@ TMH_private_patch_templates_ID (const struct TMH_RequestHandler *rh, GNUNET_JSON_spec_json ("template_contract", &tp.template_contract), GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_string ("required_currency", - (const char **) &tp.required_currency), - NULL), - GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_json ("editable_defaults", &tp.editable_defaults), NULL), @@ -146,28 +142,6 @@ TMH_private_patch_templates_ID (const struct TMH_RequestHandler *rh, TALER_EC_GENERIC_PARAMETER_MALFORMED, "template_contract"); } - if ( (NULL != tp.required_currency) && - (GNUNET_OK != - TALER_check_currency (tp.required_currency)) ) - { - GNUNET_break_op (0); - GNUNET_JSON_parse_free (spec); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_GENERIC_PARAMETER_MALFORMED, - "required_currency"); - } - if ( (NULL != tp.required_currency) && - (NULL != json_object_get (tp.template_contract, - "amount")) ) - { - GNUNET_break_op (0); - GNUNET_JSON_parse_free (spec); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_GENERIC_PARAMETER_MALFORMED, - "required_currency and contract::amount specified"); - } if (NULL != tp.editable_defaults) { const char *key; diff --git a/src/backend/taler-merchant-httpd_private-post-templates.c b/src/backend/taler-merchant-httpd_private-post-templates.c index 7aa72992..ae2a6948 100644 --- a/src/backend/taler-merchant-httpd_private-post-templates.c +++ b/src/backend/taler-merchant-httpd_private-post-templates.c @@ -47,12 +47,6 @@ templates_equal (const struct TALER_MERCHANTDB_TemplateDetails *t1, (NULL != t2->otp_id) && (0 == strcmp (t1->otp_id, t2->otp_id))) ) && - ( ( (NULL == t1->required_currency) && - (NULL == t2->required_currency) ) || - ( (NULL != t1->required_currency) && - (NULL != t2->required_currency) && - (0 == strcmp (t1->required_currency, - t2->required_currency))) ) && ( ( (NULL == t1->editable_defaults) && (NULL == t2->editable_defaults) ) || ( (NULL != t1->editable_defaults) && @@ -85,10 +79,6 @@ TMH_private_post_templates (const struct TMH_RequestHandler *rh, GNUNET_JSON_spec_json ("template_contract", &tp.template_contract), GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_string ("required_currency", - (const char **) &tp.required_currency), - NULL), - GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_json ("editable_defaults", &tp.editable_defaults), NULL), @@ -124,28 +114,6 @@ TMH_private_post_templates (const struct TMH_RequestHandler *rh, "template_contract"); } - if ( (NULL != tp.required_currency) && - (GNUNET_OK != - TALER_check_currency (tp.required_currency)) ) - { - GNUNET_break_op (0); - GNUNET_JSON_parse_free (spec); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_GENERIC_PARAMETER_MALFORMED, - "required_currency"); - } - if ( (NULL != tp.required_currency) && - (NULL != json_object_get (tp.template_contract, - "amount")) ) - { - GNUNET_break_op (0); - GNUNET_JSON_parse_free (spec); - return TALER_MHD_reply_with_error (connection, - MHD_HTTP_BAD_REQUEST, - TALER_EC_GENERIC_PARAMETER_MALFORMED, - "required_currency and contract::amount specified"); - } if (NULL != tp.editable_defaults) { const char *key; diff --git a/src/backenddb/merchant-0009.sql b/src/backenddb/merchant-0009.sql new file mode 100644 index 00000000..56705c3e --- /dev/null +++ b/src/backenddb/merchant-0009.sql @@ -0,0 +1,33 @@ +-- +-- This file is part of TALER +-- Copyright (C) 2024 Taler Systems SA +-- +-- TALER is free software; you can redistribute it and/or modify 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 GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License along with +-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> +-- + +-- @file merchant-0009.sql +-- @brief Remove redundant required_currencies column +-- @author Florian Dold + +-- Everything in one big transaction +BEGIN; + +-- Check patch versioning is in place. +SELECT _v.register_patch('merchant-0009', NULL, NULL); + +SET search_path TO merchant + DROP COLUMN required_currency; + +ALTER TABLE merchant_template ; + +-- Complete transaction +COMMIT; diff --git a/src/backenddb/merchantdb_helper.c b/src/backenddb/merchantdb_helper.c index 6c1d2ec6..72b1c9a7 100644 --- a/src/backenddb/merchantdb_helper.c +++ b/src/backenddb/merchantdb_helper.c @@ -43,7 +43,6 @@ TALER_MERCHANTDB_template_details_free ( { GNUNET_free (tp->template_description); GNUNET_free (tp->otp_id); - GNUNET_free (tp->required_currency); json_decref (tp->editable_defaults); json_decref (tp->template_contract); } diff --git a/src/backenddb/pg_insert_template.c b/src/backenddb/pg_insert_template.c index 67cae495..a755ba9a 100644 --- a/src/backenddb/pg_insert_template.c +++ b/src/backenddb/pg_insert_template.c @@ -45,9 +45,6 @@ TMH_PG_insert_template (void *cls, (NULL == td->editable_defaults) ? GNUNET_PQ_query_param_null () : TALER_PQ_query_param_json (td->editable_defaults), - (NULL == td->required_currency) - ? GNUNET_PQ_query_param_null () - : GNUNET_PQ_query_param_string (td->required_currency), GNUNET_PQ_query_param_end }; @@ -61,10 +58,9 @@ TMH_PG_insert_template (void *cls, ",otp_device_id" ",template_contract" ",editable_defaults" - ",required_currency" ")" " SELECT merchant_serial," - " $2, $3, $4, $5, $6, $7" + " $2, $3, $4, $5, $6" " FROM merchant_instances" " WHERE merchant_id=$1"); return GNUNET_PQ_eval_prepared_non_select (pg->conn, diff --git a/src/backenddb/pg_lookup_template.c b/src/backenddb/pg_lookup_template.c index 6e9d3681..95b097df 100644 --- a/src/backenddb/pg_lookup_template.c +++ b/src/backenddb/pg_lookup_template.c @@ -56,7 +56,6 @@ TMH_PG_lookup_template (void *cls, " mt.template_description" ",mod.otp_id" ",mt.template_contract" - ",mt.required_currency" ",mt.editable_defaults" " FROM merchant_template mt" " JOIN merchant_instances mi" @@ -85,10 +84,6 @@ TMH_PG_lookup_template (void *cls, GNUNET_PQ_result_spec_string ("otp_id", &td->otp_id), NULL), - GNUNET_PQ_result_spec_allow_null ( - GNUNET_PQ_result_spec_string ("required_currency", - &td->required_currency), - NULL), TALER_PQ_result_spec_json ("template_contract", &td->template_contract), GNUNET_PQ_result_spec_allow_null ( diff --git a/src/backenddb/pg_update_template.c b/src/backenddb/pg_update_template.c index c0c35df3..98259624 100644 --- a/src/backenddb/pg_update_template.c +++ b/src/backenddb/pg_update_template.c @@ -44,9 +44,6 @@ TMH_PG_update_template (void *cls, (NULL == td->editable_defaults) ? GNUNET_PQ_query_param_null () : TALER_PQ_query_param_json (td->editable_defaults), - (NULL == td->required_currency) - ? GNUNET_PQ_query_param_null () - : GNUNET_PQ_query_param_string (td->required_currency), GNUNET_PQ_query_param_end }; @@ -69,7 +66,6 @@ TMH_PG_update_template (void *cls, " FROM otp), NULL)" ",template_contract=$5" ",editable_defaults=$6" - ",required_currency=$7" " WHERE merchant_serial=" " (SELECT merchant_serial" " FROM mid)" diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h index 2474c1d0..0b41ddcb 100644 --- a/src/include/taler_merchantdb_plugin.h +++ b/src/include/taler_merchantdb_plugin.h @@ -398,12 +398,6 @@ struct TALER_MERCHANTDB_TemplateDetails char *otp_id; /** - * Currency the payment must be in, NULL to allow any - * supported currency. - */ - char *required_currency; - - /** * Editable default values for fields not specified * in the @e template_contract. NULL if the user * cannot edit anything. |