exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

auditor-triggers-0002.sql (1929B)


      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 -- Everything in one big transaction
     18 BEGIN;
     19 
     20 SELECT _v.register_patch('auditor-triggers-0002');
     21 
     22 -- The AML helper listens to this trigger.  The channel is the one
     23 -- GNUNET_PQ_get_event_notify_channel() derives from a
     24 -- TALER_DBEVENT_EXCHANGE_AUDITOR_WAKE_HELPER_AML (1236) event header.
     25 CREATE OR REPLACE FUNCTION auditor_wake_aml_helper_trigger()
     26     RETURNS trigger
     27     LANGUAGE plpgsql
     28 AS $$
     29 BEGIN
     30     NOTIFY XYRBWY61ENX0AQVQ2M8X2MSZMTADQPK18VM1TAW7VWFFHD85CGXNG;
     31 RETURN NEW;
     32 END $$;
     33 COMMENT ON FUNCTION auditor_wake_aml_helper_trigger()
     34     IS 'Call auditor_call_db_notify on new entry';
     35 
     36 
     37 -- A status change of an AML officer; the helper checks the offline master
     38 -- key's signature on it.  aml_staff is append-only, so every change is an
     39 -- INSERT and this fires for all of them.
     40 CREATE OR REPLACE TRIGGER auditor_exchange_notify_helper_aml0
     41     AFTER INSERT ON exchange.aml_staff
     42 EXECUTE FUNCTION auditor_wake_aml_helper_trigger();
     43 
     44 
     45 -- An AML decision; the helper checks the officer's signature on it and
     46 -- that the officer was eligible to make it.
     47 CREATE OR REPLACE TRIGGER auditor_exchange_notify_helper_aml1
     48     AFTER INSERT ON exchange.aml_history
     49 EXECUTE FUNCTION auditor_wake_aml_helper_trigger();
     50 
     51 COMMIT;