Add "general_id" for merchants into the DB system.
This commit is contained in:
parent
1e09a0660e
commit
9942032ae9
@ -431,10 +431,20 @@ postgres_create_tables (void *cls)
|
|||||||
",buf BYTEA NOT NULL"
|
",buf BYTEA NOT NULL"
|
||||||
");"),
|
");"),
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The 'general_id' column represents _some_ identificator
|
||||||
|
* from the institution that cares about the merchant KYC status.
|
||||||
|
* If the institution is a bank, then this values might be
|
||||||
|
* _any_ alphanumeric code that uniquely identifies that merchant
|
||||||
|
* at that bank. Could also be NULL, if that bank's policy
|
||||||
|
* admits so.
|
||||||
|
*/
|
||||||
GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS kyc_merchants "
|
GNUNET_PQ_make_execute("CREATE TABLE IF NOT EXISTS kyc_merchants "
|
||||||
"(merchant_serial_id BIGSERIAL PRIMARY KEY"
|
"(merchant_serial_id BIGSERIAL PRIMARY KEY"
|
||||||
",kyc_checked BOOLEAN NOT NULL DEFAULT FALSE"
|
",kyc_checked BOOLEAN NOT NULL DEFAULT FALSE"
|
||||||
",payto_url VARCHAR UNIQUE NOT NULL"
|
",payto_url VARCHAR UNIQUE NOT NULL"
|
||||||
|
",general_id VARCHAR NOT NULL"
|
||||||
");"),
|
");"),
|
||||||
|
|
||||||
GNUNET_PQ_make_try_execute ("CREATE INDEX kyc_merchants_payto_url ON "
|
GNUNET_PQ_make_try_execute ("CREATE INDEX kyc_merchants_payto_url ON "
|
||||||
@ -1309,7 +1319,8 @@ postgres_prepare (PGconn *db_conn)
|
|||||||
|
|
||||||
GNUNET_PQ_make_prepare ("get_kyc_status",
|
GNUNET_PQ_make_prepare ("get_kyc_status",
|
||||||
"SELECT"
|
"SELECT"
|
||||||
" kyc_checked"
|
" general_id"
|
||||||
|
",kyc_checked"
|
||||||
",merchant_serial_id"
|
",merchant_serial_id"
|
||||||
" FROM kyc_merchants"
|
" FROM kyc_merchants"
|
||||||
" WHERE payto_url=$1",
|
" WHERE payto_url=$1",
|
||||||
@ -1317,9 +1328,11 @@ postgres_prepare (PGconn *db_conn)
|
|||||||
|
|
||||||
GNUNET_PQ_make_prepare ("insert_kyc_merchant",
|
GNUNET_PQ_make_prepare ("insert_kyc_merchant",
|
||||||
"INSERT INTO kyc_merchants "
|
"INSERT INTO kyc_merchants "
|
||||||
"(payto_url, kyc_checked) VALUES "
|
"(payto_url"
|
||||||
"($1, FALSE)",
|
",general_id"
|
||||||
1),
|
",kyc_checked) VALUES "
|
||||||
|
"($1, $2, FALSE)",
|
||||||
|
2),
|
||||||
|
|
||||||
|
|
||||||
/* NOTE: NOT used yet, just _potentially_ needed. */
|
/* NOTE: NOT used yet, just _potentially_ needed. */
|
||||||
@ -6771,6 +6784,7 @@ postgres_get_kyc_status (void *cls,
|
|||||||
uint8_t status;
|
uint8_t status;
|
||||||
uint64_t merchant_serial_id;
|
uint64_t merchant_serial_id;
|
||||||
enum GNUNET_DB_QueryStatus qs;
|
enum GNUNET_DB_QueryStatus qs;
|
||||||
|
char *general_id;
|
||||||
|
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
GNUNET_PQ_query_param_string (payto_url),
|
GNUNET_PQ_query_param_string (payto_url),
|
||||||
@ -6779,11 +6793,12 @@ postgres_get_kyc_status (void *cls,
|
|||||||
|
|
||||||
|
|
||||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||||
|
GNUNET_PQ_result_spec_string ("general_id",
|
||||||
|
&general_id),
|
||||||
GNUNET_PQ_result_spec_auto_from_type ("kyc_checked",
|
GNUNET_PQ_result_spec_auto_from_type ("kyc_checked",
|
||||||
&status),
|
&status),
|
||||||
GNUNET_PQ_result_spec_uint64 ("merchant_serial_id",
|
GNUNET_PQ_result_spec_uint64 ("merchant_serial_id",
|
||||||
&merchant_serial_id),
|
&merchant_serial_id),
|
||||||
|
|
||||||
GNUNET_PQ_result_spec_end
|
GNUNET_PQ_result_spec_end
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -6798,6 +6813,7 @@ postgres_get_kyc_status (void *cls,
|
|||||||
|
|
||||||
ksc (ksc_cls,
|
ksc (ksc_cls,
|
||||||
payto_url,
|
payto_url,
|
||||||
|
general_id,
|
||||||
status,
|
status,
|
||||||
merchant_serial_id);
|
merchant_serial_id);
|
||||||
|
|
||||||
@ -6816,10 +6832,12 @@ postgres_get_kyc_status (void *cls,
|
|||||||
static enum GNUNET_DB_QueryStatus
|
static enum GNUNET_DB_QueryStatus
|
||||||
postgres_insert_kyc_merchant (void *cls,
|
postgres_insert_kyc_merchant (void *cls,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
|
const char *general_id,
|
||||||
const char *payto_url)
|
const char *payto_url)
|
||||||
{
|
{
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
GNUNET_PQ_query_param_string (payto_url),
|
GNUNET_PQ_query_param_string (payto_url),
|
||||||
|
GNUNET_PQ_query_param_string (general_id),
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
return GNUNET_PQ_eval_prepared_non_select (session->conn,
|
return GNUNET_PQ_eval_prepared_non_select (session->conn,
|
||||||
|
@ -349,6 +349,7 @@ never_called_cb (void *cls,
|
|||||||
*
|
*
|
||||||
* @param cls closure
|
* @param cls closure
|
||||||
* @param payto_url payto URL of this particular merchant (bank account)
|
* @param payto_url payto URL of this particular merchant (bank account)
|
||||||
|
* @param general_id general identificator valid at the KYC-caring institution
|
||||||
* @param kyc_checked status of KYC check: if GNUNET_OK, the merchant was
|
* @param kyc_checked status of KYC check: if GNUNET_OK, the merchant was
|
||||||
* checked at least once, never otherwise.
|
* checked at least once, never otherwise.
|
||||||
* @param merchant_serial_id serial ID identifying this merchant (bank
|
* @param merchant_serial_id serial ID identifying this merchant (bank
|
||||||
@ -358,6 +359,7 @@ never_called_cb (void *cls,
|
|||||||
static void
|
static void
|
||||||
kcs (void *cls,
|
kcs (void *cls,
|
||||||
const char *payto_url,
|
const char *payto_url,
|
||||||
|
const char *general_id,
|
||||||
uint8_t kyc_checked,
|
uint8_t kyc_checked,
|
||||||
uint64_t merchant_serial_id)
|
uint64_t merchant_serial_id)
|
||||||
{
|
{
|
||||||
@ -2239,6 +2241,7 @@ run (void *cls)
|
|||||||
FAILIF (GNUNET_OK !=
|
FAILIF (GNUNET_OK !=
|
||||||
plugin->insert_kyc_merchant (NULL,
|
plugin->insert_kyc_merchant (NULL,
|
||||||
session,
|
session,
|
||||||
|
"dummy", // NULL segfaults.
|
||||||
"payto://mock"));
|
"payto://mock"));
|
||||||
FAILIF (GNUNET_OK !=
|
FAILIF (GNUNET_OK !=
|
||||||
plugin->mark_kyc_merchant (NULL,
|
plugin->mark_kyc_merchant (NULL,
|
||||||
|
@ -717,6 +717,7 @@ typedef int
|
|||||||
*
|
*
|
||||||
* @param cls closure
|
* @param cls closure
|
||||||
* @param payto_url payto URL of this particular merchant (bank account)
|
* @param payto_url payto URL of this particular merchant (bank account)
|
||||||
|
* @param general_id general identificator valid at the KYC-caring institution
|
||||||
* @param kyc_checked status of KYC check: if GNUNET_OK, the merchant was
|
* @param kyc_checked status of KYC check: if GNUNET_OK, the merchant was
|
||||||
* checked at least once, never otherwise.
|
* checked at least once, never otherwise.
|
||||||
* @param merchant_serial_id serial ID identifying this merchant (bank
|
* @param merchant_serial_id serial ID identifying this merchant (bank
|
||||||
@ -726,6 +727,7 @@ typedef int
|
|||||||
typedef void
|
typedef void
|
||||||
(*TALER_EXCHANGEDB_KycStatusCallback)(void *cls,
|
(*TALER_EXCHANGEDB_KycStatusCallback)(void *cls,
|
||||||
const char *payto_url,
|
const char *payto_url,
|
||||||
|
const char *general_id,
|
||||||
uint8_t kyc_checked,
|
uint8_t kyc_checked,
|
||||||
uint64_t merchant_serial_id);
|
uint64_t merchant_serial_id);
|
||||||
|
|
||||||
@ -2246,6 +2248,8 @@ struct TALER_EXCHANGEDB_Plugin
|
|||||||
*
|
*
|
||||||
* @param cls closure
|
* @param cls closure
|
||||||
* @param session db session
|
* @param session db session
|
||||||
|
* @param general_id identificator at the KYC-aware institution,
|
||||||
|
* can be NULL if this is in-line wiht the rules.
|
||||||
* @param payto_url payto:// URL indentifying the merchant
|
* @param payto_url payto:// URL indentifying the merchant
|
||||||
* bank account.
|
* bank account.
|
||||||
* @return database transaction status.
|
* @return database transaction status.
|
||||||
@ -2253,6 +2257,7 @@ struct TALER_EXCHANGEDB_Plugin
|
|||||||
enum GNUNET_DB_QueryStatus
|
enum GNUNET_DB_QueryStatus
|
||||||
(*insert_kyc_merchant)(void *cls,
|
(*insert_kyc_merchant)(void *cls,
|
||||||
struct TALER_EXCHANGEDB_Session *session,
|
struct TALER_EXCHANGEDB_Session *session,
|
||||||
|
const char *general_id,
|
||||||
const char *payto_url);
|
const char *payto_url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user