exchange

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

procedures.sql.in (3108B)


      1 --
      2 -- This file is part of TALER
      3 -- Copyright (C) 2014--2025 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 BEGIN;
     18 
     19 SET search_path TO exchange;
     20 
     21 #include "exchange_do_create_partitioned_table.sql"
     22 #include "exchange_do_comment_partitioned_table.sql"
     23 #include "exchange_do_comment_partitioned_column.sql"
     24 #include "exchange_do_create_tables.sql"
     25 #include "exchange_do_amount_specific.sql"
     26 #include "../do_withdraw.sql"
     27 #include "../do_refresh.sql"
     28 #include "../do_deposit.sql"
     29 #include "../do_check_deposit_idempotent.sql"
     30 -- dead!?
     31 #include "exchange_do_melt.sql"
     32 #include "../select_batch_deposits_missing_wire.sql"
     33 -- dead!?
     34 #include "exchange_do_select_justification_for_missing_wire.sql"
     35 #include "../do_refund.sql"
     36 #include "../do_recoup.sql"
     37 #include "../do_recoup_refresh.sql"
     38 #include "../gc.sql"
     39 #include "../do_purse_delete.sql"
     40 #include "../do_purse_deposit.sql"
     41 #include "../do_purse_merge.sql"
     42 #include "../do_reserve_purse.sql"
     43 #include "../expire_purse.sql"
     44 #include "../insert_reserve_open_deposit.sql"
     45 #include "../do_reserve_open.sql"
     46 #include "../persist_policy_details.sql"
     47 #include "../insert_aml_decision.sql"
     48 #include "../insert_successor_measure.sql"
     49 #include "../insert_aml_officer.sql"
     50 #include "../reserves_in_insert.sql"
     51 -- semi-dead...
     52 #include "exchange_do_get_link_data.sql"
     53 #include "../batch_ensure_coin_known.sql"
     54 #include "../kycauth_in_insert.sql"
     55 #include "../trigger_kyc_rule_for_account.sql"
     56 #include "../lookup_kyc_requirement_by_row.sql"
     57 #include "../insert_active_legitimization_measure.sql"
     58 #include "../select_aggregations_above_serial.sql"
     59 #include "../persist_kyc_attributes.sql"
     60 #include "../insert_aml_program_failure.sql"
     61 #include "../set_aml_lock.sql"
     62 #include "../insert_sanction_list_hit.sql"
     63 #include "exchange_statistics_helpers.sql"
     64 #include "exchange_trigger_purse_requests_insert.sql"
     65 #include "exchange_trigger_withdraw_delete.sql"
     66 #include "exchange_trigger_withdraw_insert.sql"
     67 #include "exchange_trigger_reserves_in_insert.sql"
     68 #include "exchange_trigger_purse_decision_insert.sql"
     69 #include "../get_kyc_rules.sql"
     70 
     71 DROP PROCEDURE IF EXISTS exchange_do_gc;
     72 CREATE PROCEDURE exchange_do_gc(
     73   IN in_ancient_date INT8,
     74   IN in_now INT8)
     75 LANGUAGE plpgsql
     76 AS $$
     77 BEGIN
     78   CALL exchange_do_main_gc(in_ancient_date,in_now);
     79   CALL exchange_statistic_amount_gc ();
     80   CALL exchange_statistic_bucket_gc ();
     81   CALL exchange_statistic_counter_gc ();
     82 END $$;
     83 COMMENT ON PROCEDURE exchange_do_gc
     84   IS 'calls all other garbage collection subroutines';
     85 
     86 COMMIT;