[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: add wirewatch CRU(D) functions t
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: add wirewatch CRU(D) functions to merchant DB API |
Date: |
Wed, 12 Apr 2023 15:44:59 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new c176ce9d add wirewatch CRU(D) functions to merchant DB API
c176ce9d is described below
commit c176ce9d0402195ee19a1bcae792ee2ccbd33e3b
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Apr 12 15:44:47 2023 +0200
add wirewatch CRU(D) functions to merchant DB API
---
src/backenddb/Makefile.am | 3 ++
src/backenddb/pg_insert_wirewatch_progress.c | 53 ++++++++++++++++++++++++++
src/backenddb/pg_insert_wirewatch_progress.h | 44 ++++++++++++++++++++++
src/backenddb/pg_select_wirewatch_progress.c | 56 ++++++++++++++++++++++++++++
src/backenddb/pg_select_wirewatch_progress.h | 44 ++++++++++++++++++++++
src/backenddb/pg_update_wirewatch_progress.c | 51 +++++++++++++++++++++++++
src/backenddb/pg_update_wirewatch_progress.h | 44 ++++++++++++++++++++++
src/backenddb/plugin_merchantdb_postgres.c | 9 +++++
src/include/taler_merchantdb_plugin.h | 43 +++++++++++++++++++++
9 files changed, 347 insertions(+)
diff --git a/src/backenddb/Makefile.am b/src/backenddb/Makefile.am
index 008af262..b8d2cbbf 100644
--- a/src/backenddb/Makefile.am
+++ b/src/backenddb/Makefile.am
@@ -52,6 +52,9 @@ libtalermerchantdb_la_LDFLAGS = \
-no-undefined
libtaler_plugin_merchantdb_postgres_la_SOURCES = \
+ pg_insert_wirewatch_progress.h pg_insert_wirewatch_progress.c \
+ pg_update_wirewatch_progress.h pg_update_wirewatch_progress.c \
+ pg_select_wirewatch_progress.h pg_select_wirewatch_progress.c \
pg_lookup_transfers.h pg_lookup_transfers.c \
plugin_merchantdb_postgres.c pg_helper.h
libtaler_plugin_merchantdb_postgres_la_LIBADD = \
diff --git a/src/backenddb/pg_insert_wirewatch_progress.c
b/src/backenddb/pg_insert_wirewatch_progress.c
new file mode 100644
index 00000000..f4d1b0f8
--- /dev/null
+++ b/src/backenddb/pg_insert_wirewatch_progress.c
@@ -0,0 +1,53 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2022 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 backenddb/pg_insert_wirewatch_progress.c
+ * @brief Implementation of the insert_wirewatch_progress function for Postgres
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include <taler/taler_error_codes.h>
+#include <taler/taler_dbevents.h>
+#include <taler/taler_pq_lib.h>
+#include "pg_insert_wirewatch_progress.h"
+#include "pg_helper.h"
+
+
+enum GNUNET_DB_QueryStatus
+TMH_PG_insert_wirewatch_progress (
+ void *cls,
+ const char *section,
+ uint64_t last_serial)
+{
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_string (section),
+ GNUNET_PQ_query_param_uint64 (&last_serial),
+ GNUNET_PQ_query_param_end
+ };
+
+ PREPARE (pg,
+ "insert_wirewatch_progress",
+ "INSERT INTO merchant_wirewatch"
+ " (account_section"
+ " ,last_bank_serial)"
+ " VALUES"
+ " ($1,$2);");
+ check_connection (pg);
+ return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "insert_wirewatch_progress",
+ params);
+}
diff --git a/src/backenddb/pg_insert_wirewatch_progress.h
b/src/backenddb/pg_insert_wirewatch_progress.h
new file mode 100644
index 00000000..b4edd37b
--- /dev/null
+++ b/src/backenddb/pg_insert_wirewatch_progress.h
@@ -0,0 +1,44 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2022 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 backenddb/pg_insert_wirewatch_progress.h
+ * @brief implementation of the insert_wirewatch_progress function for Postgres
+ * @author Christian Grothoff
+ */
+#ifndef PG_INSERT_WIREWATCH_PROGRESS_H
+#define PG_INSERT_WIREWATCH_PROGRESS_H
+
+#include <taler/taler_util.h>
+#include <taler/taler_json_lib.h>
+#include <taler/taler_merchantdb_plugin.h>
+
+
+/**
+ * Insert information about progress made by taler-merchant-wirewatch.
+ *
+ * @param cls closure
+ * @param section configuration section of the taler-merchant-wirewatch
+ * @param last_serial last serial imported from the bank
+ * @return transaction status
+ */
+enum GNUNET_DB_QueryStatus
+TMH_PG_insert_wirewatch_progress (
+ void *cls,
+ const char *section,
+ uint64_t last_serial);
+
+
+#endif
diff --git a/src/backenddb/pg_select_wirewatch_progress.c
b/src/backenddb/pg_select_wirewatch_progress.c
new file mode 100644
index 00000000..c8049e14
--- /dev/null
+++ b/src/backenddb/pg_select_wirewatch_progress.c
@@ -0,0 +1,56 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2022 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 backenddb/pg_select_wirewatch_progress.c
+ * @brief Implementation of the select_wirewatch_progress function for Postgres
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include <taler/taler_error_codes.h>
+#include <taler/taler_dbevents.h>
+#include <taler/taler_pq_lib.h>
+#include "pg_select_wirewatch_progress.h"
+#include "pg_helper.h"
+
+
+enum GNUNET_DB_QueryStatus
+TMH_PG_select_wirewatch_progress (
+ void *cls,
+ const char *section,
+ uint64_t *last_serial)
+{
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_string (section),
+ GNUNET_PQ_query_param_end
+ };
+ struct GNUNET_PQ_ResultSpec rs[] = {
+ GNUNET_PQ_result_spec_uint64 ("last_bank_serial",
+ last_serial),
+ GNUNET_PQ_result_spec_end
+ };
+
+ PREPARE (pg,
+ "select_wirewatch_progress",
+ "SELECT last_bank_serial"
+ " FROM merchant_wirewatch"
+ " WHERE account_section=$1");
+ check_connection (pg);
+ return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+ "select_wirewatch_progress",
+ params,
+ rs);
+}
diff --git a/src/backenddb/pg_select_wirewatch_progress.h
b/src/backenddb/pg_select_wirewatch_progress.h
new file mode 100644
index 00000000..f03b0506
--- /dev/null
+++ b/src/backenddb/pg_select_wirewatch_progress.h
@@ -0,0 +1,44 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2022 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 backenddb/pg_select_wirewatch_progress.h
+ * @brief implementation of the select_wirewatch_progress function for Postgres
+ * @author Christian Grothoff
+ */
+#ifndef PG_SELECT_WIREWATCH_PROGRESS_H
+#define PG_SELECT_WIREWATCH_PROGRESS_H
+
+#include <taler/taler_util.h>
+#include <taler/taler_json_lib.h>
+#include <taler/taler_merchantdb_plugin.h>
+
+
+/**
+ * Select information about progress made by taler-merchant-wirewatch.
+ *
+ * @param cls closure
+ * @param section configuration section of the taler-merchant-wirewatch
+ * @param[out] last_serial set to last serial imported from the bank
+ * @return transaction status
+ */
+enum GNUNET_DB_QueryStatus
+TMH_PG_select_wirewatch_progress (
+ void *cls,
+ const char *section,
+ uint64_t *last_serial);
+
+
+#endif
diff --git a/src/backenddb/pg_update_wirewatch_progress.c
b/src/backenddb/pg_update_wirewatch_progress.c
new file mode 100644
index 00000000..d702c314
--- /dev/null
+++ b/src/backenddb/pg_update_wirewatch_progress.c
@@ -0,0 +1,51 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2022 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 backenddb/pg_update_wirewatch_progress.c
+ * @brief Implementation of the update_wirewatch_progress function for Postgres
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include <taler/taler_error_codes.h>
+#include <taler/taler_dbevents.h>
+#include <taler/taler_pq_lib.h>
+#include "pg_update_wirewatch_progress.h"
+#include "pg_helper.h"
+
+
+enum GNUNET_DB_QueryStatus
+TMH_PG_update_wirewatch_progress (
+ void *cls,
+ const char *section,
+ uint64_t last_serial)
+{
+ struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_string (section),
+ GNUNET_PQ_query_param_uint64 (&last_serial),
+ GNUNET_PQ_query_param_end
+ };
+
+ PREPARE (pg,
+ "update_wirewatch_progress",
+ "UPDATE merchant_wirewatch"
+ " SET last_bank_serial=$2"
+ " WHERE account_section=$1");
+ check_connection (pg);
+ return GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "update_wirewatch_progress",
+ params);
+}
diff --git a/src/backenddb/pg_update_wirewatch_progress.h
b/src/backenddb/pg_update_wirewatch_progress.h
new file mode 100644
index 00000000..58c8649d
--- /dev/null
+++ b/src/backenddb/pg_update_wirewatch_progress.h
@@ -0,0 +1,44 @@
+/*
+ This file is part of TALER
+ Copyright (C) 2022 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 backenddb/pg_update_wirewatch_progress.h
+ * @brief implementation of the update_wirewatch_progress function for Postgres
+ * @author Christian Grothoff
+ */
+#ifndef PG_UPDATE_WIREWATCH_PROGRESS_H
+#define PG_UPDATE_WIREWATCH_PROGRESS_H
+
+#include <taler/taler_util.h>
+#include <taler/taler_json_lib.h>
+#include <taler/taler_merchantdb_plugin.h>
+
+
+/**
+ * Update information about progress made by taler-merchant-wirewatch.
+ *
+ * @param cls closure
+ * @param section configuration section of the taler-merchant-wirewatch
+ * @param last_serial last serial imported from the bank
+ * @return transaction status
+ */
+enum GNUNET_DB_QueryStatus
+TMH_PG_update_wirewatch_progress (
+ void *cls,
+ const char *section,
+ uint64_t last_serial);
+
+
+#endif
diff --git a/src/backenddb/plugin_merchantdb_postgres.c
b/src/backenddb/plugin_merchantdb_postgres.c
index 5553c059..6f3789a6 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -31,6 +31,9 @@
#include "taler_merchantdb_plugin.h"
#include "pg_helper.h"
#include "pg_lookup_transfers.h"
+#include "pg_insert_wirewatch_progress.h"
+#include "pg_update_wirewatch_progress.h"
+#include "pg_select_wirewatch_progress.h"
/**
@@ -10201,6 +10204,12 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
plugin->lookup_transfer_details = &postgres_lookup_transfer_details;
plugin->lookup_transfers
= &TMH_PG_lookup_transfers;
+ plugin->insert_wirewatch_progress
+ = &TMH_PG_insert_wirewatch_progress;
+ plugin->update_wirewatch_progress
+ = &TMH_PG_update_wirewatch_progress;
+ plugin->select_wirewatch_progress
+ = &TMH_PG_select_wirewatch_progress;
plugin->store_wire_fee_by_exchange = &postgres_store_wire_fee_by_exchange;
plugin->insert_reserve = &postgres_insert_reserve;
plugin->activate_reserve = &postgres_activate_reserve;
diff --git a/src/include/taler_merchantdb_plugin.h
b/src/include/taler_merchantdb_plugin.h
index 07bfffd6..c1d5ae27 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -1998,6 +1998,49 @@ struct TALER_MERCHANTDB_Plugin
const char *session_id,
char **order_id);
+ /**
+ * Insert information about progress made by taler-merchant-wirewatch.
+ *
+ * @param cls closure
+ * @param section configuration section of the taler-merchant-wirewatch
+ * @param last_serial last serial imported from the bank
+ * @return transaction status
+ */
+ enum GNUNET_DB_QueryStatus
+ (*insert_wirewatch_progress)(
+ void *cls,
+ const char *section,
+ uint64_t last_serial);
+
+ /**
+ * Update information about progress made by taler-merchant-wirewatch.
+ *
+ * @param cls closure
+ * @param section configuration section of the taler-merchant-wirewatch
+ * @param last_serial last serial imported from the bank
+ * @return transaction status
+ */
+ enum GNUNET_DB_QueryStatus
+ (*update_wirewatch_progress)(
+ void *cls,
+ const char *section,
+ uint64_t last_serial);
+
+ /**
+ * Select information about progress made by taler-merchant-wirewatch.
+ *
+ * @param cls closure
+ * @param section configuration section of the taler-merchant-wirewatch
+ * @param[out] last_serial set to last serial imported from the bank
+ * @return transaction status
+ */
+ enum GNUNET_DB_QueryStatus
+ (*select_wirewatch_progress)(
+ void *cls,
+ const char *section,
+ uint64_t *last_serial);
+
+
/**
* Insert information about a wire transfer the merchant has received.
*
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: add wirewatch CRU(D) functions to merchant DB API,
gnunet <=