Method to mark a merchant as NOT KYC-checked.

This commit is contained in:
Marcello Stanisci 2018-07-09 10:55:31 +02:00
parent cd2538efb5
commit 01158a4817
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
3 changed files with 70 additions and 7 deletions

View File

@ -1294,7 +1294,7 @@ postgres_prepare (PGconn *db_conn)
* *
* 1 Sum money flow for a (unchecked) merchant. * 1 Sum money flow for a (unchecked) merchant.
* 2 Change KYC status for a 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. * 4 Put money flow event for a merchant.
* 5 Delete money flow records for a fresh-checked merchant. * 5 Delete money flow records for a fresh-checked merchant.
* 6 Put a merchant. V * 6 Put a merchant. V
@ -1314,6 +1314,14 @@ postgres_prepare (PGconn *db_conn)
"($1, FALSE)", "($1, FALSE)",
1), 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", GNUNET_PQ_make_prepare ("mark_kyc_merchant",
"UPDATE kyc_merchants" "UPDATE kyc_merchants"
" SET" " SET"
@ -6532,17 +6540,44 @@ postgres_select_deposits_missing_wire (void *cls,
} }
/** /**
* Mark a merchant as KYC-checked. * Mark a merchant as NOT KYC-checked.
* *
* @param payto_url payto:// URL indentifying the merchant * @param payto_url payto:// URL indentifying the merchant
* to check. Note, different banks may have different * to unmark. Note, different banks may have different
* policies to check their customers. * policies to check their customers.
* @return database transaction status. * @return database transaction status.
*/ */
static enum GNUNET_DB_QueryStatus static enum GNUNET_DB_QueryStatus
postgres_mark_kyc_merchant (void *cls, postgres_unmark_kyc_merchant
struct TALER_EXCHANGEDB_Session *session, (void *cls,
const char *payto_url) 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 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)
{ {
struct GNUNET_PQ_QueryParam params[] = { 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->insert_kyc_merchant = postgres_insert_kyc_merchant;
plugin->mark_kyc_merchant = postgres_mark_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; plugin->get_kyc_status = postgres_get_kyc_status;
return plugin; return plugin;

View File

@ -2199,9 +2199,21 @@ run (void *cls)
session, session,
"payto://mock", "payto://mock",
&kyc_checked)); &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, plugin->preflight (plugin->cls,
session); session);

View File

@ -2248,6 +2248,21 @@ struct TALER_EXCHANGEDB_Plugin
struct TALER_EXCHANGEDB_Session *session, struct TALER_EXCHANGEDB_Session *session,
const char *payto_url); 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. * Retrieve KYC-check status related to a particular merchant.
* *