commit 179fe8ac0838e045ecb7733e13ddb3402f567ef2
parent 47b4053b84f3a415b1e7f43ebd715af0689e9264
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Wed, 11 Mar 2026 12:47:11 +0100
implement #11226
Diffstat:
4 files changed, 3 insertions(+), 70 deletions(-)
diff --git a/bootstrap b/bootstrap
@@ -32,7 +32,7 @@ existence()
}
# Freeze SQL files that must no longer be edited.
-for n in 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032
+for n in 0001 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032 0033
do
chmod -w src/backenddb/merchant-$n.sql*
done
diff --git a/src/backenddb/Makefile.am b/src/backenddb/Makefile.am
@@ -49,6 +49,7 @@ sql_DATA = \
merchant-0030.sql \
merchant-0031.sql \
merchant-0032.sql \
+ merchant-0033.sql \
drop.sql
BUILT_SOURCES = \
diff --git a/src/backenddb/merchant-0032.sql b/src/backenddb/merchant-0032.sql
@@ -46,75 +46,6 @@ COMMENT ON FUNCTION random_bytea(INT)
IS 'Create BYTEA of the given length and fill it with random bytes';
-CREATE OR REPLACE PROCEDURE merchant_send_kyc_notification(
- in_account_serial INT8
- ,in_exchange_url TEXT
- )
-LANGUAGE plpgsql
-AS $$
-DECLARE
- my_instance_serial INT8;
- my_report_token BYTEA;
- my_h_wire BYTEA;
- my_email TEXT;
-BEGIN
- SELECT merchant_serial
- ,h_wire
- INTO my_instance_serial
- ,my_h_wire
- FROM merchant_accounts
- WHERE account_serial=in_account_serial;
- IF NOT FOUND
- THEN
- RAISE WARNING 'Account not found, KYC change notification not triggered';
- RETURN;
- END IF;
- SELECT email
- INTO my_email
- FROM merchant_instances
- WHERE merchant_serial=my_instance_serial;
- IF NOT FOUND
- THEN
- RAISE WARNING 'Instance not found, KYC change notification not triggered';
- RETURN;
- END IF;
- IF my_email IS NULL
- THEN
- -- Note: we MAY want to consider sending an SMS instead...
- RETURN;
- END IF;
-
- my_report_token = random_bytea(32);
- INSERT INTO merchant_reports (
- merchant_serial
- ,report_program_section
- ,report_description
- ,mime_type
- ,report_token
- ,data_source
- ,target_address
- ,frequency
- ,frequency_shift
- ,next_transmission
- ,one_shot_hidden
- ) VALUES (
- my_instance_serial
- ,'email'
- ,'automatically triggered KYC alert'
- ,'text/plain'
- ,my_report_token
- ,'/private/kyc?exchange_url=' || uri_escape(in_exchange_url)
- || '&h_wire=' || base32_crockford (my_h_wire)
- ,my_email
- ,0
- ,0
- ,0
- ,TRUE
- );
- -- Notify taler-merchant-report-generator
- NOTIFY XSSAB8NCBQR1K2VK7H2M6SMY3V5TNJT1C3BW0SN4F2QV0KHR3PRB0;
-END $$;
-
CREATE FUNCTION merchant_kyc_insert_trigger()
RETURNS trigger
LANGUAGE plpgsql
diff --git a/src/backenddb/procedures.sql.in b/src/backenddb/procedures.sql.in
@@ -39,6 +39,7 @@ SET search_path TO merchant;
#include "pg_base32_crockford.sql"
#include "pg_uri_escape.sql"
#include "pg_merchant_kyc_trigger.sql"
+#include "pg_merchant_send_kyc_notification.sql"
DROP PROCEDURE IF EXISTS merchant_do_gc;
CREATE PROCEDURE merchant_do_gc(in_now INT8)