merchant

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

merchant-0030.sql (2719B)


      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-0030.sql
     17 -- @brief Add field for long-poll signalling to taler-merchant-kyccheck
     18 -- @author Christian Grothoff
     19 
     20 BEGIN;
     21 
     22 -- Check patch versioning is in place.
     23 SELECT _v.register_patch('merchant-0030', NULL, NULL);
     24 
     25 SET search_path TO merchant;
     26 
     27 CREATE TABLE IF NOT EXISTS merchant_unclaim_signatures
     28   (unclaim_serial BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
     29   ,h_contract_terms BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64)
     30   ,unclaim_sig BYTEA PRIMARY KEY CHECK (LENGTH(unclaim_sig)=64)
     31   ,expiration_time INT8 NOT NULL
     32 );
     33 
     34 COMMENT ON TABLE merchant_unclaim_signatures
     35  IS 'Here we store proofs of wallets unclaiming a claim to a contract. Right now not really used, but theoretically legally important as this shows that the wallet was the one abandoing its rights to the proposal.';
     36 COMMENT ON COLUMN merchant_unclaim_signatures.h_contract_terms
     37  IS 'Hash over the contract terms of the unclaimed contract';
     38 COMMENT ON COLUMN merchant_unclaim_signatures.unclaim_sig
     39  IS 'Signature of purpose CONTRACT_UNCLAIM';
     40 COMMENT ON COLUMN merchant_unclaim_signatures.expiration_time
     41  IS 'Payment deadline of the original contract, at this point we should be OK to delete the unclaim signature via garbage collection.';
     42 
     43 
     44 CREATE INDEX merchant_unclaim_signatures_by_expiration
     45   ON merchant_unclaim_signatures
     46     (expiration_time);
     47 COMMENT ON INDEX merchant_unclaim_signatures_by_expiration
     48  IS 'For garbage collection of unclaim signatrues after payment deadlines have been passed.';
     49 
     50 
     51 ALTER TABLE merchant_exchange_keys
     52   ADD COLUMN exchange_http_status INT4 DEFAULT(0)
     53  ,ADD COLUMN exchange_ec_code INT4 DEFAULT(0)
     54  ,ALTER COLUMN keys_json DROP NOT NULL;
     55 
     56 COMMENT ON COLUMN merchant_exchange_keys.exchange_http_status
     57   IS 'Last HTTP status code from trying to fetch /keys; 0 for timeout or not attempted yet';
     58 COMMENT ON COLUMN merchant_exchange_keys.exchange_ec_code
     59   IS 'Error code from our last attempt to fetch /keys; 0 for no error in combination with an HTTP status of 200';
     60 
     61 COMMIT;