commit 64c824fe55c68377dc6da6401d59ea1b5d3396ad
parent 57866faede9d014a8410ae0844ff91a9e0116c26
Author: Christian Grothoff <christian@grothoff.org>
Date: Thu, 13 Aug 2026 00:41:36 +0200
implement protocol v35: #10713 - new SQL file
Diffstat:
1 file changed, 58 insertions(+), 0 deletions(-)
diff --git a/src/backenddb/sql-schema/merchant-0044.sql b/src/backenddb/sql-schema/merchant-0044.sql
@@ -0,0 +1,58 @@
+--
+-- This file is part of TALER
+-- Copyright (C) 2026 Taler Systems SA
+--
+-- TALER is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 3, or (at your option) any later version.
+--
+-- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+-- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License along with
+-- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+
+-- @file merchant-0044.sql
+-- @brief record which exchange bank account a wire transfer came from (#10713)
+
+-- Exchange protocol v39 added an optional "exchange_payto_uri" to
+-- GET /transfers/$WTID. Store it so that GET /private/transfers can show
+-- the merchant which account to look for in their bank statement.
+-- Nullable in perpetuity: exchanges older than v39 never send it, and even a
+-- v39 exchange omits it for transfers aggregated before it began recording it.
+
+BEGIN;
+
+SELECT _v.register_patch('merchant-0044', NULL, NULL);
+
+SET search_path TO merchant;
+
+CREATE PROCEDURE merchant.merchant_0044_init(s TEXT)
+ LANGUAGE plpgsql
+ AS $OUTER$
+BEGIN
+
+ EXECUTE format('SET LOCAL search_path TO %I', s);
+
+ ALTER TABLE merchant_expected_transfers
+ ADD COLUMN exchange_payto_uri TEXT DEFAULT NULL;
+
+ COMMENT ON COLUMN merchant_expected_transfers.exchange_payto_uri
+ 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)';
+
+ SET LOCAL search_path TO merchant;
+
+END
+$OUTER$;
+
+INSERT INTO merchant.instance_fixups
+ (migration_name
+ ,version)
+ VALUES
+ ('merchant_0044_init'
+ ,44);
+-- Apply new fix-up to existing instances
+CALL merchant.fixup_instance_schema (44::INT8);
+
+COMMIT;