diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2018-07-09 10:55:31 +0200 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2018-07-09 10:55:31 +0200 |
commit | 01158a48171d6dbfddec1cf274b70d2e730a1a04 (patch) | |
tree | 10af6f856b200e4a6cc8d68e817d1e1727a2e5f6 | |
parent | cd2538efb57d34d592efc551695a1b1174433ccb (diff) | |
download | exchange-01158a48171d6dbfddec1cf274b70d2e730a1a04.tar.xz |
Method to mark a merchant as NOT KYC-checked.
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 46 | ||||
-rw-r--r-- | src/exchangedb/test_exchangedb.c | 14 | ||||
-rw-r--r-- | src/include/taler_exchangedb_plugin.h | 15 |
3 files changed, 69 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); diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index 8c67d9705..80814efb1 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -2248,6 +2248,21 @@ struct TALER_EXCHANGEDB_Plugin struct TALER_EXCHANGEDB_Session *session, const char *payto_url); + + /** + * 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. + */ + enum GNUNET_DB_QueryStatus + (*unmark_kyc_merchant) (void *cls, + struct TALER_EXCHANGEDB_Session *session, + const char *payto_url); + + /** * Retrieve KYC-check status related to a particular merchant. * |