exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

0002-wire_accounts.sql (2745B)


      1 --
      2 -- This file is part of TALER
      3 -- Copyright (C) 2014--2022 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 CREATE TABLE wire_accounts
     18   (payto_uri TEXT PRIMARY KEY
     19   ,master_sig BYTEA CHECK (LENGTH(master_sig)=64)
     20   ,is_active BOOLEAN NOT NULL
     21   ,last_change INT8 NOT NULL
     22   ,conversion_url TEXT DEFAULT (NULL)
     23   ,debit_restrictions TEXT DEFAULT (NULL)
     24   ,credit_restrictions TEXT DEFAULT (NULL)
     25   ,priority INT8 NOT NULL DEFAULT (0)
     26   ,bank_label TEXT DEFAULT (NULL)
     27   );
     28 COMMENT ON TABLE wire_accounts
     29   IS 'Table with current and historic bank accounts of the exchange. Entries never expire as we need to remember the last_change column indefinitely.';
     30 COMMENT ON COLUMN wire_accounts.payto_uri
     31   IS 'payto URI (RFC 8905) with the bank account of the exchange.';
     32 COMMENT ON COLUMN wire_accounts.master_sig
     33   IS 'Signature of purpose TALER_SIGNATURE_MASTER_WIRE_DETAILS';
     34 COMMENT ON COLUMN wire_accounts.is_active
     35   IS 'true if we are currently supporting the use of this account.';
     36 COMMENT ON COLUMN wire_accounts.last_change
     37   IS 'Latest time when active status changed. Used to detect replays of old messages.';
     38 COMMENT ON COLUMN wire_accounts.conversion_url
     39   IS 'URL of a currency conversion service if conversion is needed when this account is used; NULL if there is no conversion.';
     40 COMMENT ON COLUMN wire_accounts.debit_restrictions
     41   IS 'JSON array describing restrictions imposed when debiting this account. Empty for no restrictions, NULL if account was migrated from previous database revision or account is disabled.';
     42 COMMENT ON COLUMN wire_accounts.credit_restrictions
     43   IS 'JSON array describing restrictions imposed when crediting this account. Empty for no restrictions, NULL if account was migrated from previous database revision or account is disabled.';
     44 COMMENT ON COLUMN wire_accounts.priority
     45   IS 'priority determines the order in which wallets should display wire accounts';
     46 COMMENT ON COLUMN wire_accounts.bank_label
     47   IS 'label to show in the selector for this bank account in the wallet UI';
     48 
     49 
     50 -- "wire_accounts" has no sequence because it is a 'mutable' table
     51 --            and is of no concern to the auditor