diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-04-23 22:57:55 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-04-23 22:57:55 +0200 |
commit | 154f964aab5df00cbadaa015474c2b323161aa96 (patch) | |
tree | 084f300e664fb96d0693baf73434ed245ef56641 /src/backenddb/plugin_merchantdb_postgres.c | |
parent | 889595f986d922ffbcdcd746fdfad7f1a0e53595 (diff) | |
download | merchant-154f964aab5df00cbadaa015474c2b323161aa96.tar.gz merchant-154f964aab5df00cbadaa015474c2b323161aa96.tar.bz2 merchant-154f964aab5df00cbadaa015474c2b323161aa96.zip |
API change for #6363
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r-- | src/backenddb/plugin_merchantdb_postgres.c | 49 |
1 files changed, 6 insertions, 43 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index 19bd022a..e70d8639 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -30,6 +30,8 @@ #include <taler/taler_mhd_lib.h> #include "taler_merchantdb_plugin.h" #include "pg_helper.h" +#include "pg_insert_account.h" +#include "pg_update_account.h" #include "pg_lookup_instances.h" #include "pg_lookup_transfers.h" #include "pg_update_wirewatch_progress.h" @@ -410,37 +412,6 @@ postgres_insert_instance ( /** - * Insert information about an instance's account into our database. - * - * @param cls closure - * @param id identifier of the instance - * @param account_details details about the account - * @return database result code - */ -static enum GNUNET_DB_QueryStatus -postgres_insert_account ( - void *cls, - const char *id, - const struct TALER_MERCHANTDB_AccountDetails *account_details) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_string (id), - GNUNET_PQ_query_param_auto_from_type (&account_details->h_wire), - GNUNET_PQ_query_param_auto_from_type (&account_details->salt), - GNUNET_PQ_query_param_string (account_details->payto_uri), - GNUNET_PQ_query_param_bool (account_details->active), - GNUNET_PQ_query_param_end - }; - - check_connection (pg); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "insert_account", - params); -} - - -/** * Closure for kyc_status_cb(). */ struct KycStatusContext @@ -7342,17 +7313,6 @@ postgres_connect (void *cls) " JOIN merchant_kyc" " USING (account_serial)" " WHERE merchant_instances.merchant_id=$1"), - /* for postgres_insert_account() */ - GNUNET_PQ_make_prepare ("insert_account", - "INSERT INTO merchant_accounts" - "(merchant_serial" - ",h_wire" - ",salt" - ",payto_uri" - ",active)" - " SELECT merchant_serial, $2, $3, $4, $5" - " FROM merchant_instances" - " WHERE merchant_id=$1"), /* for postgres_delete_instance_private_key() */ GNUNET_PQ_make_prepare ("delete_key", "DELETE FROM merchant_keys" @@ -9732,7 +9692,10 @@ libtaler_plugin_merchantdb_postgres_init (void *cls) plugin->commit = &postgres_commit; plugin->lookup_instance_auth = &postgres_lookup_instance_auth; plugin->insert_instance = &postgres_insert_instance; - plugin->insert_account = &postgres_insert_account; + plugin->insert_account + = &TMH_PG_insert_account; + plugin->update_account + = &TMH_PG_update_account; plugin->account_kyc_set_status = &postgres_account_kyc_set_status; plugin->account_kyc_get_status |