aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb/exchange_do_insert_kyc_attributes.sql
diff options
context:
space:
mode:
authorÖzgür Kesim <oec-taler@kesim.org>2023-07-23 12:48:07 +0200
committerÖzgür Kesim <oec-taler@kesim.org>2023-07-23 12:48:07 +0200
commitd189fccd790a36046e1191d7170f45feb3dfb122 (patch)
treee1bb8b8d25be3e9245eabadb057c496a714947c7 /src/exchangedb/exchange_do_insert_kyc_attributes.sql
parenta56a903da3ec46b4c1d1109cc40c2dc149be956b (diff)
downloadexchange-d189fccd790a36046e1191d7170f45feb3dfb122.tar.xz
Added reserve_pub to kyc legitimization_processes
Where applicable, the reserve_pub will be passed on to the kcy-legitimization process and persisted along with h_payto. This allows us to set a birthday on the reserve itself, once a related kyc-process has provided one.
Diffstat (limited to 'src/exchangedb/exchange_do_insert_kyc_attributes.sql')
-rw-r--r--src/exchangedb/exchange_do_insert_kyc_attributes.sql11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/exchangedb/exchange_do_insert_kyc_attributes.sql b/src/exchangedb/exchange_do_insert_kyc_attributes.sql
index ae6a65759..c80033154 100644
--- a/src/exchangedb/exchange_do_insert_kyc_attributes.sql
+++ b/src/exchangedb/exchange_do_insert_kyc_attributes.sql
@@ -31,6 +31,8 @@ CREATE OR REPLACE FUNCTION exchange_do_insert_kyc_attributes(
OUT out_ok BOOLEAN)
LANGUAGE plpgsql
AS $$
+DECLARE
+ orig_reserve_pub BYTEA;
BEGIN
INSERT INTO exchange.kyc_attributes
@@ -48,20 +50,17 @@ INSERT INTO exchange.kyc_attributes
,in_expiration_time_ts
,in_enc_attributes);
--- FIXME-Oec: modify to 'return' the reserve_pub here
--- (requires of course to modify other code to store
--- the reserve pub in the right table in the first place)
UPDATE exchange.legitimization_processes
SET provider_user_id=in_provider_account_id
,provider_legitimization_id=in_provider_legitimization_id
,expiration_time=GREATEST(expiration_time,in_expiration_time)
WHERE h_payto=in_h_payto
AND legitimization_process_serial_id=in_process_row
- AND provider_section=in_provider_section;
+ AND provider_section=in_provider_section
+ RETURNING reserve_pub INTO orig_reserve_pub;
out_ok = FOUND;
--- FIXME-Oec: update exchange reserve table to store in_birthday here!
--- UPDATE exchange.reserves SET birthday=in_birthday WHERE reserve_pub=X;
+UPDATE exchange.reserves SET birthday=in_birthday WHERE reserve_pub=orig_reserve_pub;
IF in_require_aml
THEN