diff options
author | Iván Ávalos <avalos@disroot.org> | 2023-05-08 21:48:41 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2023-05-08 21:48:41 -0600 |
commit | 75c1fbfe39a625320bb8a0a219bdb599927cf552 (patch) | |
tree | eaf795e9833f4ff7ba1533096833ecdba7024994 /src/backenddb/plugin_merchantdb_postgres.c | |
parent | 7b9000278b12e07350e3d4fb502693d5af08e1bc (diff) | |
download | merchant-75c1fbfe39a625320bb8a0a219bdb599927cf552.tar.gz merchant-75c1fbfe39a625320bb8a0a219bdb599927cf552.tar.bz2 merchant-75c1fbfe39a625320bb8a0a219bdb599927cf552.zip |
Factor out activate_account (shit job)
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r-- | src/backenddb/plugin_merchantdb_postgres.c | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index b5f8debc..0e0e7abb 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -52,6 +52,7 @@ #include "pg_update_instance.h" #include "pg_update_instance_auth.h" #include "pg_inactivate_account.h" +#include "pg_activate_account.h" #include "pg_set_transfer_status_to_confirmed.h" @@ -330,33 +331,6 @@ postgres_commit (void *cls) /** - * Set an instance's account in our database to "active". - * - * @param cls closure - * @param merchant_id merchant backend instance ID - * @param h_wire hash of the wire account to set to active - * @return database result code - */ -static enum GNUNET_DB_QueryStatus -postgres_activate_account (void *cls, - const char *merchant_id, - const struct TALER_MerchantWireHashP *h_wire) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_string (merchant_id), - GNUNET_PQ_query_param_auto_from_type (h_wire), - GNUNET_PQ_query_param_end - }; - - check_connection (pg); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "activate_account", - params); -} - - -/** * Context used for postgres_lookup_products(). */ struct LookupProductsContext @@ -6566,15 +6540,6 @@ postgres_connect (void *cls) struct GNUNET_PQ_PreparedStatement ps[] = { GNUNET_PQ_make_prepare ("end_transaction", "COMMIT"), - /* for postgres_activate_account() */ - GNUNET_PQ_make_prepare ("activate_account", - "UPDATE merchant_accounts SET" - " active=TRUE" - " WHERE h_wire=$2 AND" - " merchant_serial=" - " (SELECT merchant_serial" - " FROM merchant_instances" - " WHERE merchant_id=$1)"), /* for postgres_lookup_products() */ GNUNET_PQ_make_prepare ("lookup_products", "SELECT" @@ -8890,7 +8855,8 @@ libtaler_plugin_merchantdb_postgres_init (void *cls) = &TMH_PG_update_instance; plugin->update_instance_auth = &TMH_PG_update_instance_auth; - plugin->activate_account = &postgres_activate_account; + plugin->activate_account + = &TMH_PG_activate_account; plugin->inactivate_account = &TMH_PG_inactivate_account; plugin->update_transfer_status |