summaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorMarcello Stanisci <stanisci.m@gmail.com>2018-07-09 10:55:31 +0200
committerMarcello Stanisci <stanisci.m@gmail.com>2018-07-09 10:55:31 +0200
commit01158a48171d6dbfddec1cf274b70d2e730a1a04 (patch)
tree10af6f856b200e4a6cc8d68e817d1e1727a2e5f6 /src/exchangedb
parentcd2538efb57d34d592efc551695a1b1174433ccb (diff)
downloadexchange-01158a48171d6dbfddec1cf274b70d2e730a1a04.tar.gz
exchange-01158a48171d6dbfddec1cf274b70d2e730a1a04.tar.bz2
exchange-01158a48171d6dbfddec1cf274b70d2e730a1a04.zip
Method to mark a merchant as NOT KYC-checked.
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c46
-rw-r--r--src/exchangedb/test_exchangedb.c14
2 files changed, 54 insertions, 6 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 6d0889c80..dbd29481b 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -1294,7 +1294,7 @@ postgres_prepare (PGconn *db_conn)
*
* 1 Sum money flow for a (unchecked) merchant.
* 2 Change KYC status for a merchant.
- * 3 Get KYC status for a merchant. --
+ * 3 Get KYC status for a merchant. V
* 4 Put money flow event for a merchant.
* 5 Delete money flow records for a fresh-checked merchant.
* 6 Put a merchant. V
@@ -1314,6 +1314,14 @@ postgres_prepare (PGconn *db_conn)
"($1, FALSE)",
1),
+ GNUNET_PQ_make_prepare ("unmark_kyc_merchant",
+ "UPDATE kyc_merchants"
+ " SET"
+ " kyc_checked=FALSE"
+ " WHERE"
+ " payto_url=$1",
+ 1),
+
GNUNET_PQ_make_prepare ("mark_kyc_merchant",
"UPDATE kyc_merchants"
" SET"
@@ -6532,17 +6540,44 @@ postgres_select_deposits_missing_wire (void *cls,
}
/**
+ * Mark a merchant as NOT KYC-checked.
+ *
+ * @param payto_url payto:// URL indentifying the merchant
+ * to unmark. Note, different banks may have different
+ * policies to check their customers.
+ * @return database transaction status.
+ */
+static enum GNUNET_DB_QueryStatus
+postgres_unmark_kyc_merchant
+ (void *cls,
+ struct TALER_EXCHANGEDB_Session *session,
+ const char *payto_url)
+{
+
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_string (payto_url),
+ GNUNET_PQ_query_param_end
+ };
+
+ return GNUNET_PQ_eval_prepared_non_select
+ (session->conn,
+ "unmark_kyc_merchant",
+ params);
+}
+
+/**
* Mark a merchant as KYC-checked.
*
* @param payto_url payto:// URL indentifying the merchant
- * to check. Note, different banks may have different
+ * to mark. Note, different banks may have different
* policies to check their customers.
* @return database transaction status.
*/
static enum GNUNET_DB_QueryStatus
-postgres_mark_kyc_merchant (void *cls,
- struct TALER_EXCHANGEDB_Session *session,
- const char *payto_url)
+postgres_mark_kyc_merchant
+ (void *cls,
+ struct TALER_EXCHANGEDB_Session *session,
+ const char *payto_url)
{
struct GNUNET_PQ_QueryParam params[] = {
@@ -6747,6 +6782,7 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
plugin->insert_kyc_merchant = postgres_insert_kyc_merchant;
plugin->mark_kyc_merchant = postgres_mark_kyc_merchant;
+ plugin->unmark_kyc_merchant = postgres_unmark_kyc_merchant;
plugin->get_kyc_status = postgres_get_kyc_status;
return plugin;
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 06b0372f4..535077fbd 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -2199,9 +2199,21 @@ run (void *cls)
session,
"payto://mock",
&kyc_checked));
- FAILIF (GNUNET_YES != kyc_checked);
+ FAILIF (GNUNET_NO == kyc_checked);
+ FAILIF (GNUNET_OK !=
+ plugin->unmark_kyc_merchant (NULL,
+ session,
+ "payto://mock"));
+ FAILIF (GNUNET_OK !=
+ plugin->get_kyc_status (NULL,
+ session,
+ "payto://mock",
+ &kyc_checked));
+
+ FAILIF (GNUNET_YES == kyc_checked);
}
+
plugin->preflight (plugin->cls,
session);