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 (3378B)


      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 "exchange_do_withdraw.sql"
     27 #include "exchange_do_refresh.sql"
     28 #include "exchange_do_deposit.sql"
     29 #include "exchange_do_check_deposit_idempotent.sql"
     30 #include "exchange_do_melt.sql"
     31 #include "exchange_do_select_deposits_missing_wire.sql"
     32 #include "exchange_do_select_justification_for_missing_wire.sql"
     33 #include "exchange_do_refund.sql"
     34 #include "exchange_do_recoup_to_reserve.sql"
     35 #include "exchange_do_recoup_to_coin.sql"
     36 #include "exchange_do_main_gc.sql"
     37 #include "exchange_do_purse_delete.sql"
     38 #include "exchange_do_purse_deposit.sql"
     39 #include "exchange_do_purse_merge.sql"
     40 #include "exchange_do_reserve_purse.sql"
     41 #include "exchange_do_expire_purse.sql"
     42 #include "exchange_do_reserve_open_deposit.sql"
     43 #include "exchange_do_reserve_open.sql"
     44 #include "exchange_do_insert_or_update_policy_details.sql"
     45 #include "exchange_do_insert_aml_decision.sql"
     46 #include "exchange_do_insert_successor_measure.sql"
     47 #include "exchange_do_insert_aml_officer.sql"
     48 #include "exchange_do_reserves_in_insert.sql"
     49 #include "exchange_do_batch_reserves_update.sql"
     50 #include "exchange_do_get_link_data.sql"
     51 #include "exchange_do_batch_coin_known.sql"
     52 #include "exchange_do_kycauth_in_insert.sql"
     53 #include "exchange_do_trigger_kyc_rule_for_account.sql"
     54 #include "exchange_do_lookup_kyc_requirement_by_row.sql"
     55 #include "exchange_do_insert_active_legitimization_measure.sql"
     56 #include "exchange_do_select_aggregations_above_serial.sql"
     57 #include "exchange_do_persist_kyc_attributes.sql"
     58 #include "exchange_do_insert_aml_program_failure.sql"
     59 #include "exchange_do_set_aml_lock.sql"
     60 #include "exchange_do_insert_sanction_list_hit.sql"
     61 #include "exchange_statistics_helpers.sql"
     62 #include "exchange_trigger_purse_requests_insert.sql"
     63 #include "exchange_trigger_withdraw_delete.sql"
     64 #include "exchange_trigger_withdraw_insert.sql"
     65 #include "exchange_trigger_reserves_in_insert.sql"
     66 #include "exchange_trigger_purse_decision_insert.sql"
     67 #include "exchange_do_get_kyc_rules.sql"
     68 
     69 DROP PROCEDURE IF EXISTS exchange_do_gc;
     70 CREATE PROCEDURE exchange_do_gc(
     71   IN in_ancient_date INT8,
     72   IN in_now INT8)
     73 LANGUAGE plpgsql
     74 AS $$
     75 BEGIN
     76   CALL exchange_do_main_gc(in_ancient_date,in_now);
     77   CALL exchange_statistic_amount_gc ();
     78   CALL exchange_statistic_bucket_gc ();
     79   CALL exchange_statistic_counter_gc ();
     80 END $$;
     81 COMMENT ON PROCEDURE exchange_do_gc
     82   IS 'calls all other garbage collection subroutines';
     83 
     84 COMMIT;