merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

procedures.sql.in (1738B)


      1 --
      2 -- This file is part of TALER
      3 -- Copyright (C) 2024-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 merchant;
     20 
     21 #include "pg_insert_deposit_to_transfer.sql"
     22 #include "pg_insert_product.sql"
     23 #include "pg_insert_issued_token.sql"
     24 #include "pg_insert_spent_token.sql"
     25 #include "pg_insert_transfer_details.sql"
     26 #include "pg_update_product.sql"
     27 #include "pg_solve_mfa_challenge.sql"
     28 #include "pg_account_kyc_set_status.sql"
     29 #include "pg_account_kyc_set_failed.sql"
     30 #include "pg_statistics_helpers.sql"
     31 #include "pg_do_handle_inventory_changes.sql"
     32 #include "pg_do_handle_category_changes.sql"
     33 
     34 DROP PROCEDURE IF EXISTS merchant_do_gc;
     35 CREATE PROCEDURE merchant_do_gc(in_now INT8)
     36 LANGUAGE plpgsql
     37 AS $$
     38 BEGIN
     39   DELETE FROM merchant_instances
     40     WHERE validation_needed
     41       AND validation_expiration < in_now;
     42   CALL merchant_statistic_amount_gc ();
     43   CALL merchant_statistic_bucket_gc ();
     44   CALL merchant_statistic_counter_gc ();
     45 
     46   DELETE FROM tan_challenges
     47     WHERE expiration_date < in_now;
     48 END $$;
     49 COMMENT ON PROCEDURE merchant_do_gc
     50   IS 'calls all other garbage collection subroutines';
     51 
     52 
     53 COMMIT;