summaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-12-29 11:48:57 +0100
committerChristian Grothoff <christian@grothoff.org>2022-12-29 11:48:57 +0100
commit26aa9d985e2f9ba6ce3895e7e2625226e2008bfb (patch)
tree951a3d49375a225103c363f005bd0399a195eed4 /src/exchangedb
parentfa840f7071da56c4794c887b813ca2a6f491f836 (diff)
downloadexchange-26aa9d985e2f9ba6ce3895e7e2625226e2008bfb.tar.gz
exchange-26aa9d985e2f9ba6ce3895e7e2625226e2008bfb.tar.bz2
exchange-26aa9d985e2f9ba6ce3895e7e2625226e2008bfb.zip
expand DB API with AML functions, fix purse refund calculations in libtalerexchange
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/0003-aml_history.sql2
-rw-r--r--src/exchangedb/0003-aml_staff.sql3
-rw-r--r--src/exchangedb/0003-aml_status.sql2
-rw-r--r--src/exchangedb/pg_lookup_kyc_process_by_account.c3
-rw-r--r--src/exchangedb/pg_select_purse.c28
5 files changed, 21 insertions, 17 deletions
diff --git a/src/exchangedb/0003-aml_history.sql b/src/exchangedb/0003-aml_history.sql
index 009f79d89..d3650f6c6 100644
--- a/src/exchangedb/0003-aml_history.sql
+++ b/src/exchangedb/0003-aml_history.sql
@@ -57,7 +57,7 @@ BEGIN
,partition_suffix
);
PERFORM comment_partitioned_column(
- '0 for AML decision required, 1 for AML is OK, -1 for account is frozen (prevents further transactions)'
+ '0 for all OK, 1 for AML decision required, 2 for account is frozen (prevents further transactions)'
,'new_status'
,table_name
,partition_suffix
diff --git a/src/exchangedb/0003-aml_staff.sql b/src/exchangedb/0003-aml_staff.sql
index dca0fc8d5..00f60985a 100644
--- a/src/exchangedb/0003-aml_staff.sql
+++ b/src/exchangedb/0003-aml_staff.sql
@@ -21,6 +21,7 @@ CREATE TABLE aml_staff
,master_sig BYTEA CHECK (LENGTH(master_sig)=64)
,decider_name VARCHAR NOT NULL
,is_active BOOLEAN NOT NULL
+ ,read_only BOOLEAN NOT NULL
,last_change INT8 NOT NULL
);
COMMENT ON TABLE aml_staff
@@ -33,5 +34,7 @@ COMMENT ON COLUMN aml_staff.decider_name
IS 'Name of the staff member.';
COMMENT ON COLUMN aml_staff.is_active
IS 'true if we are currently supporting the use of this AML staff member.';
+COMMENT ON COLUMN aml_staff.is_active
+ IS 'true if the member has read-only access.';
COMMENT ON COLUMN aml_staff.last_change
IS 'Latest time when active status changed. Used to detect replays of old messages.';
diff --git a/src/exchangedb/0003-aml_status.sql b/src/exchangedb/0003-aml_status.sql
index 1e676bc1c..c0683c0d8 100644
--- a/src/exchangedb/0003-aml_status.sql
+++ b/src/exchangedb/0003-aml_status.sql
@@ -53,7 +53,7 @@ BEGIN
,partition_suffix
);
PERFORM comment_partitioned_column(
- '0 for AML decision required, 1 for AML is OK, -1 for account is frozen (prevents further transactions)'
+ '0 for all OK, 1 for AML decision required, 2 for account is frozen (prevents further transactions)'
,'status'
,table_name
,partition_suffix
diff --git a/src/exchangedb/pg_lookup_kyc_process_by_account.c b/src/exchangedb/pg_lookup_kyc_process_by_account.c
index 6183ae7af..79a9d6c8f 100644
--- a/src/exchangedb/pg_lookup_kyc_process_by_account.c
+++ b/src/exchangedb/pg_lookup_kyc_process_by_account.c
@@ -25,6 +25,7 @@
#include "pg_lookup_kyc_process_by_account.h"
#include "pg_helper.h"
+
enum GNUNET_DB_QueryStatus
TEH_PG_lookup_kyc_process_by_account (
void *cls,
@@ -59,7 +60,7 @@ TEH_PG_lookup_kyc_process_by_account (
*provider_account_id = NULL;
*provider_legitimization_id = NULL;
- /* Used in #postgres_lookup_kyc_process_by_account() */
+ /* Used in #postgres_lookup_kyc_process_by_account() */
PREPARE (pg,
"lookup_process_by_account",
"SELECT "
diff --git a/src/exchangedb/pg_select_purse.c b/src/exchangedb/pg_select_purse.c
index 9143e8721..6496d4a28 100644
--- a/src/exchangedb/pg_select_purse.c
+++ b/src/exchangedb/pg_select_purse.c
@@ -66,20 +66,20 @@ TEH_PG_select_purse (
PREPARE (pg,
"select_purse",
"SELECT "
- " merge_pub"
- ",purse_creation"
- ",purse_expiration"
- ",h_contract_terms"
- ",amount_with_fee_val"
- ",amount_with_fee_frac"
- ",balance_val"
- ",balance_frac"
- ",merge_timestamp"
- ",purse_sig IS NOT NULL AS purse_deleted"
- " FROM purse_requests"
- " LEFT JOIN purse_merges USING (purse_pub)"
- " LEFT JOIN purse_deletion USING (purse_pub)"
- " WHERE purse_pub=$1;");
+ " pr.merge_pub"
+ ",pr.purse_creation"
+ ",pr.purse_expiration"
+ ",pr.h_contract_terms"
+ ",pr.amount_with_fee_val"
+ ",pr.amount_with_fee_frac"
+ ",pr.balance_val"
+ ",pr.balance_frac"
+ ",pm.merge_timestamp"
+ ",pd.purse_sig IS NOT NULL AS purse_deleted"
+ " FROM purse_requests pr"
+ " LEFT JOIN purse_merges pm ON (pm.purse_pub = pr.purse_pub)"
+ " LEFT JOIN purse_deletion pd ON (pd.purse_pub = pr.purse_pub)"
+ " WHERE pr.purse_pub=$1;");
*merge_timestamp = GNUNET_TIME_UNIT_FOREVER_TS;
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"select_purse",