merchant

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

merchant-0044.sql (2042B)


      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 -- @file merchant-0044.sql
     17 -- @brief record which exchange bank account a wire transfer came from (#10713)
     18 
     19 -- Exchange protocol v39 added an optional "exchange_payto_uri" to
     20 -- GET /transfers/$WTID.  Store it so that GET /private/transfers can show
     21 -- the merchant which account to look for in their bank statement.
     22 -- Nullable in perpetuity: exchanges older than v39 never send it, and even a
     23 -- v39 exchange omits it for transfers aggregated before it began recording it.
     24 
     25 BEGIN;
     26 
     27 SELECT _v.register_patch('merchant-0044', NULL, NULL);
     28 
     29 SET search_path TO merchant;
     30 
     31 CREATE PROCEDURE merchant.merchant_0044_init(s TEXT)
     32   LANGUAGE plpgsql
     33   AS $OUTER$
     34 BEGIN
     35 
     36   EXECUTE format('SET LOCAL search_path TO %I', s);
     37 
     38   ALTER TABLE merchant_expected_transfers
     39     ADD COLUMN exchange_payto_uri TEXT DEFAULT NULL;
     40 
     41   COMMENT ON COLUMN merchant_expected_transfers.exchange_payto_uri
     42     IS 'payto://-URI of the exchange bank account that was debited, as reported by the exchange; NULL if the exchange did not tell us (pre-v39 exchange, or transfer predates the exchange recording it)';
     43 
     44   SET LOCAL search_path TO merchant;
     45 
     46 END
     47 $OUTER$;
     48 
     49 INSERT INTO merchant.instance_fixups
     50   (migration_name
     51   ,version)
     52   VALUES
     53   ('merchant_0044_init'
     54   ,44);
     55 -- Apply new fix-up to existing instances
     56 CALL merchant.fixup_instance_schema (44::INT8);
     57 
     58 COMMIT;