pg_inactivate_account.sql (1479B)
1 -- 2 -- This file is part of TALER 3 -- Copyright (C) 2026 Taler Systems SA 4 -- 5 -- TALER is free software; you can redistribute it and/or modify it under the 6 -- terms of the GNU General Public License as published by the Free Software 7 -- Foundation; either version 3, or (at your option) any later version. 8 -- 9 -- TALER is distributed in the hope that it will be useful, but WITHOUT ANY 10 -- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 -- A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 -- 13 -- You should have received a copy of the GNU General Public License along with 14 -- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 -- 16 17 DROP FUNCTION IF EXISTS merchant_do_inactivate_account; 18 CREATE FUNCTION merchant_do_inactivate_account ( 19 IN in_instance_name TEXT 20 ,IN in_h_wire BYTEA 21 ,OUT out_found BOOL 22 ) 23 LANGUAGE plpgsql 24 AS $$ 25 DECLARE 26 my_instance INT8; 27 BEGIN 28 SELECT merchant_serial 29 INTO my_instance 30 FROM merchant_instances 31 WHERE merchant_id=in_instance_name; 32 IF NOT FOUND 33 THEN 34 out_found = FALSE; 35 RETURN; 36 END IF; 37 UPDATE merchant_accounts 38 SET active=FALSE 39 WHERE h_wire=in_h_wire 40 AND merchant_serial=my_instance; 41 out_found = FOUND; 42 IF out_found 43 THEN 44 -- Notify taler-merchant-kyccheck about the change in 45 -- accounts. (TALER_DBEVENT_MERCHANT_ACCOUNTS_CHANGED) 46 NOTIFY XDQM4Z4N0D3GX0H9JEXH70EBC2T3KY7HC0TJB0Z60D2H781RXR6AG; 47 END IF; 48 49 END $$;