merchant

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

merchant-0003.sql (1711B)


      1 --
      2 -- This file is part of TALER
      3 -- Copyright (C) 2024 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 -- Check patch versioning is in place.
     21 SELECT _v.register_patch('merchant-0003', NULL, NULL);
     22 
     23 SET search_path TO merchant;
     24 
     25 ALTER TABLE merchant_deposit_to_transfer
     26   ADD COLUMN wtid BYTEA CHECK (LENGTH(wtid)=32) DEFAULT NULL;
     27 
     28 UPDATE merchant_deposit_to_transfer dst
     29   SET wtid=src.wtid
     30   FROM merchant_transfers src
     31   WHERE (src.credit_serial = dst.credit_serial);
     32 
     33 ALTER TABLE merchant_deposit_to_transfer
     34   DROP COLUMN credit_serial,
     35   ALTER COLUMN wtid SET NOT NULL,
     36   ADD UNIQUE (deposit_serial,wtid);
     37 
     38 COMMENT ON COLUMN merchant_deposit_to_transfer.wtid
     39   IS 'wire transfer identifier of the transfer the exchange claims to have done';
     40 
     41 
     42 ALTER TABLE merchant_deposit_confirmations
     43   ADD COLUMN retry_backoff INT8 DEFAULT (0) NOT NULL;
     44 
     45 COMMENT ON COLUMN merchant_deposit_confirmations.retry_backoff
     46   IS 'exponentially increasing value we add to the wire_transfer_deadline on each failure to confirm the wire transfer';
     47 
     48 
     49 -- Complete transaction
     50 COMMIT;