libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 3fcbe27ff2dba6778607e19d10367adaff095a65
parent c117fc2e208adc9a22a85c196a61c6d0a0a39ade
Author: Antoine A <>
Date:   Mon,  6 Jan 2025 11:42:58 +0100

common: better polymorphism schema

Diffstat:
Mbank/src/main/kotlin/tech/libeufin/bank/db/ExchangeDAO.kt | 9++++-----
Mbank/src/main/kotlin/tech/libeufin/bank/db/TransactionDAO.kt | 16+++-------------
Mbank/src/test/kotlin/bench.kt | 25++++++++++++++-----------
Mcommon/src/main/kotlin/test/bench.kt | 3++-
Mdatabase-versioning/libeufin-bank-0012.sql | 19+++++++++++++++++++
Mdatabase-versioning/libeufin-bank-procedures.sql | 30+++++++++++-------------------
Mdatabase-versioning/libeufin-conversion-setup.sql | 17++++++++++++++++-
Adatabase-versioning/libeufin-nexus-0010.sql | 42++++++++++++++++++++++++++++++++++++++++++
Mdatabase-versioning/libeufin-nexus-procedures.sql | 33+++++++++++++++++++++++----------
Mnexus/src/main/kotlin/tech/libeufin/nexus/db/ExchangeDAO.kt | 7+++----
Mnexus/src/main/kotlin/tech/libeufin/nexus/db/ListDAO.kt | 9++++-----
Mnexus/src/main/kotlin/tech/libeufin/nexus/db/PaymentDAO.kt | 18++++--------------
Mnexus/src/test/kotlin/bench.kt | 8++++----
Mtestbench/src/test/kotlin/MigrationTest.kt | 8+++++++-
14 files changed, 156 insertions(+), 88 deletions(-)

diff --git a/bank/src/main/kotlin/tech/libeufin/bank/db/ExchangeDAO.kt b/bank/src/main/kotlin/tech/libeufin/bank/db/ExchangeDAO.kt @@ -1,6 +1,6 @@ /* * This file is part of LibEuFin. - * Copyright (C) 2023-2024 Taler Systems S.A. + * Copyright (C) 2023-2025 Taler Systems S.A. * LibEuFin is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -39,8 +39,7 @@ class ExchangeDAO(private val db: Database) { ,debtor_payto ,debtor_name ,type - ,reserve_pub - ,account_pub + ,metadata FROM taler_exchange_incoming AS tfr JOIN bank_account_transactions AS txs ON bank_transaction=txs.bank_transaction_id @@ -53,14 +52,14 @@ class ExchangeDAO(private val db: Database) { date = it.getTalerTimestamp("transaction_date"), amount = it.getAmount("amount", db.bankCurrency), debit_account = it.getBankPayto("debtor_payto", "debtor_name", db.ctx), - reserve_pub = EddsaPublicKey(it.getBytes("reserve_pub")), + reserve_pub = EddsaPublicKey(it.getBytes("metadata")), ) TalerIncomingType.kyc -> IncomingKycAuthTransaction( row_id = it.getLong("bank_transaction_id"), date = it.getTalerTimestamp("transaction_date"), amount = it.getAmount("amount", db.bankCurrency), debit_account = it.getBankPayto("debtor_payto", "debtor_name", db.ctx), - account_pub = EddsaPublicKey(it.getBytes("account_pub")), + account_pub = EddsaPublicKey(it.getBytes("metadata")), ) TalerIncomingType.wad -> throw UnsupportedOperationException() } diff --git a/bank/src/main/kotlin/tech/libeufin/bank/db/TransactionDAO.kt b/bank/src/main/kotlin/tech/libeufin/bank/db/TransactionDAO.kt @@ -115,21 +115,11 @@ class TransactionDAO(private val db: Database) { } else if (exchangeCreditor) { val bounceCause = runCatching { parseIncomingTxMetadata(subject) }.fold( onSuccess = { metadata -> - val registered = conn.withStatement("CALL register_incoming(?, ?::taler_incoming_type, ?, ?, ?)") { + val registered = conn.withStatement("CALL register_incoming(?, ?::taler_incoming_type, ?, ?)") { setLong(1, creditRowId) setString(2, metadata.type.name) - when (metadata.type) { - TalerIncomingType.reserve -> { - setBytes(3, metadata.key.raw) - setNull(4, Types.BINARY) - } - TalerIncomingType.kyc -> { - setNull(3, Types.BINARY) - setBytes(4, metadata.key.raw) - } - TalerIncomingType.wad -> throw UnsupportedOperationException() - } - setLong(5, creditAccountId) + setBytes(3, metadata.key.raw) + setLong(4, creditAccountId) executeProcedureViolation() } if (!registered) { diff --git a/bank/src/test/kotlin/bench.kt b/bank/src/test/kotlin/bench.kt @@ -1,6 +1,6 @@ /* * This file is part of LibEuFin. - * Copyright (C) 2024 Taler Systems S.A. + * Copyright (C) 2024-2025 Taler Systems S.A. * LibEuFin is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -93,12 +93,12 @@ class Bench { "\\\\x$hex32\t\\\\x$hex64\t(42, 0)\turl\t\\N\t$it\t0\tpayto://x-taler-bank/localhost/10\tpermanent_failure\tfailure\n" } }, - "taler_exchange_incoming(type, reserve_pub, account_pub, bank_transaction)" to { + "taler_exchange_incoming(type, metadata, bank_transaction)" to { val hex = token32.rand().encodeHex() if (it % 2 == 0) { - "reserve\t\\\\x$hex\t\\N\t${it*2}\n" + "reserve\t\\\\x$hex\t${it*2}\n" } else { - "kyc\t\\N\t\\\\x$hex\t${it*2}\n" + "kyc\t\\\\x$hex\t${it*2}\n" } }, "bank_stats(timeframe, start_time)" to { @@ -170,9 +170,6 @@ class Bench { measureAction("account_get") { client.getA("/accounts/account_bench_$it").assertOk() } - measureAction("account_delete") { - client.deleteA("/accounts/account_bench_$it").assertNoContent() - } // Tokens val tokens = measureAction("token_create") { @@ -315,7 +312,7 @@ class Bench { // TAN challenges val challenges = measureAction("tan_send") { - val id = client.patchA("/accounts/customer") { + val id = client.patchA("/accounts/account_bench_$it") { json { "contact_data" to obj { "phone" to "+99" @@ -324,17 +321,23 @@ class Bench { "tan_channel" to "sms" } }.assertAcceptedJson<TanChallenge>().challenge_id - val res = client.postA("/accounts/customer/challenge/$id").assertOkJson<TanTransmission>() + val res = client.postA("/accounts/account_bench_$it/challenge/$id").assertOkJson<TanTransmission>() val code = tanCode(res.tan_info) Pair(id, code) } - measureAction("tan_send") { + measureAction("tan_confirm") { val (id, code) = challenges[it] - client.postA("/accounts/customer/challenge/$id/confirm") { + client.postA("/accounts/account_bench_$it/challenge/$id/confirm") { json { "tan" to code } }.assertNoContent() } + // Delete accounts + + measureAction("account_delete") { + client.deleteA("/accounts/account_bench_$it").assertNoContent() + } + // Other measureAction("monitor") { client.getAdmin("/monitor").assertOk() diff --git a/common/src/main/kotlin/test/bench.kt b/common/src/main/kotlin/test/bench.kt @@ -1,6 +1,6 @@ /* * This file is part of LibEuFin. - * Copyright (C) 2024 Taler Systems S.A. + * Copyright (C) 2024-2025 Taler Systems S.A. * LibEuFin is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -70,6 +70,7 @@ class Benchmark(private val iter: Int) { } suspend fun <R> measureAction(name: String, lambda: suspend (Int) -> R): List<R> { + println("Measure action $name") val results = mutableListOf<R>() val times = LongArray(iter) { idx -> measureTime { diff --git a/database-versioning/libeufin-bank-0012.sql b/database-versioning/libeufin-bank-0012.sql @@ -21,4 +21,23 @@ SET search_path TO libeufin_bank; -- Add no_amount_to_wallet for withdrawal ALTER TABLE taler_withdrawal_operations ADD COLUMN no_amount_to_wallet BOOLEAN DEFAULT false; +-- Better polymorphism schema +ALTER TABLE taler_exchange_incoming ADD COLUMN metadata BYTEA; +INSERT INTO taler_exchange_incoming (metadata) + SELECT COALESCE (reserve_pub, account_pub, wad_id) + FROM taler_exchange_incoming; +ALTER TABLE taler_exchange_incoming + DROP CONSTRAINT incoming_polymorphism, + DROP COLUMN reserve_pub, + DROP COLUMN account_pub, + DROP COLUMN wad_id, + ALTER COLUMN metadata SET NOT NULL, + ADD CONSTRAINT polymorphism CHECK( + CASE type + WHEN 'wad' THEN LENGTH(metadata)=24 AND origin_exchange_url IS NOT NULL + ELSE LENGTH(metadata)=32 AND origin_exchange_url IS NULL + END + ); +CREATE UNIQUE INDEX taler_exchange_incoming_unique_reserve_pub ON taler_exchange_incoming (metadata) WHERE type = 'reserve'; + COMMIT; diff --git a/database-versioning/libeufin-bank-procedures.sql b/database-versioning/libeufin-bank-procedures.sql @@ -604,8 +604,7 @@ COMMENT ON FUNCTION account_delete IS 'Deletes an account if the balance is zero CREATE PROCEDURE register_incoming( IN in_tx_row_id INT8, IN in_type taler_incoming_type, - IN in_reserve_pub BYTEA, - IN in_account_pub BYTEA, + IN in_metadata BYTEA, IN in_account_id INT8 ) LANGUAGE plpgsql AS $$ @@ -613,15 +612,12 @@ DECLARE local_amount taler_amount; BEGIN -- Register incoming transaction -INSERT - INTO taler_exchange_incoming ( - reserve_pub, - account_pub, - bank_transaction, - type +INSERT INTO taler_exchange_incoming ( + metadata, + bank_transaction, + type ) VALUES ( - in_reserve_pub, - in_account_pub, + in_metadata, in_tx_row_id, in_type ); @@ -810,7 +806,7 @@ sender_bank_account_id INT8; BEGIN -- Check conflict IF in_type = 'reserve'::taler_incoming_type THEN - SELECT EXISTS(SELECT FROM taler_exchange_incoming WHERE reserve_pub = in_key) OR + SELECT EXISTS(SELECT FROM taler_exchange_incoming WHERE metadata = in_key AND type = 'reserve') OR EXISTS(SELECT FROM taler_withdrawal_operations WHERE reserve_pub = in_key) INTO out_reserve_pub_reuse; IF out_reserve_pub_reuse THEN @@ -860,11 +856,7 @@ IF out_debitor_balance_insufficient THEN RETURN; END IF; -- Register incoming transaction -CASE in_type - WHEN 'reserve' THEN CALL register_incoming(out_tx_row_id, 'reserve', in_key, NULL, exchange_bank_account_id); - WHEN 'kyc' THEN CALL register_incoming(out_tx_row_id, 'kyc', NULL, in_key, exchange_bank_account_id); - ELSE RAISE EXCEPTION 'Unsupported incoming type %', in_type; -END CASE; +CALL register_incoming(out_tx_row_id, in_type, in_key, exchange_bank_account_id); END $$; COMMENT ON FUNCTION taler_add_incoming IS 'Create an incoming taler transaction and register it'; @@ -1083,7 +1075,7 @@ END IF; IF not_selected THEN -- Check reserve_pub reuse - SELECT EXISTS(SELECT FROM taler_exchange_incoming WHERE reserve_pub = in_reserve_pub) OR + SELECT EXISTS(SELECT FROM taler_exchange_incoming WHERE metadata = in_reserve_pub AND type = 'reserve') OR EXISTS(SELECT FROM taler_withdrawal_operations WHERE reserve_pub = in_reserve_pub) INTO out_reserve_pub_reuse; IF out_reserve_pub_reuse THEN @@ -1254,7 +1246,7 @@ UPDATE taler_withdrawal_operations WHERE withdrawal_uuid=in_withdrawal_uuid; -- Register incoming transaction -CALL register_incoming(tx_row_id, 'reserve'::taler_incoming_type, reserve_pub_local, NULL, exchange_bank_account_id); +CALL register_incoming(tx_row_id, 'reserve'::taler_incoming_type, reserve_pub_local, exchange_bank_account_id); -- Notify status change PERFORM pg_notify('bank_withdrawal_status', in_withdrawal_uuid::text || ' confirmed'); @@ -1332,7 +1324,7 @@ IF out_balance_insufficient THEN END IF; -- Register incoming transaction -CALL register_incoming(tx_row_id, 'reserve'::taler_incoming_type, in_reserve_pub, NULL, exchange_account_id); +CALL register_incoming(tx_row_id, 'reserve'::taler_incoming_type, in_reserve_pub, exchange_account_id); -- update stats CALL stats_register_payment('cashin', NULL, converted_amount, in_amount); diff --git a/database-versioning/libeufin-conversion-setup.sql b/database-versioning/libeufin-conversion-setup.sql @@ -1,3 +1,18 @@ +-- +-- This file is part of TALER +-- Copyright (C) 2024-2025 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/> + BEGIN; SET search_path TO libeufin_bank; @@ -65,7 +80,7 @@ LANGUAGE plpgsql AS $$ SET search_path TO libeufin_bank; SELECT out_too_small, out_balance_insufficient, out_no_account, out_no_config INTO too_small, balance_insufficient, no_account, no_config - FROM libeufin_bank.cashin(now_date, NEW.reserve_public_key, local_amount, local_subject); + FROM libeufin_bank.cashin(now_date, NEW.metadata, local_amount, local_subject); SET search_path TO libeufin_nexus; -- Bounce on soft failures diff --git a/database-versioning/libeufin-nexus-0010.sql b/database-versioning/libeufin-nexus-0010.sql @@ -0,0 +1,42 @@ +-- +-- This file is part of TALER +-- Copyright (C) 2025 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/> + +BEGIN; + +SELECT _v.register_patch('libeufin-nexus-0010', NULL, NULL); + +SET search_path TO libeufin_nexus; + +-- Better polymorphism schema +ALTER TABLE talerable_incoming_transactions ADD COLUMN metadata BYTEA; +INSERT INTO talerable_incoming_transactions (metadata) + SELECT COALESCE (reserve_public_key, account_pub, wad_id) + FROM talerable_incoming_transactions; +ALTER TABLE talerable_incoming_transactions + DROP CONSTRAINT incoming_polymorphism, + DROP COLUMN reserve_public_key, + DROP COLUMN account_pub, + DROP COLUMN wad_id, + ALTER COLUMN metadata SET NOT NULL, + ADD CONSTRAINT polymorphism CHECK( + CASE type + WHEN 'wad' THEN LENGTH(metadata)=24 AND origin_exchange_url IS NOT NULL + ELSE LENGTH(metadata)=32 AND origin_exchange_url IS NULL + END + ); +CREATE INDEX talerable_incoming_polymorphism ON talerable_incoming_transactions (type, metadata); +CREATE UNIQUE INDEX talerable_incoming_transactions_unique_reserve_pub ON talerable_incoming_transactions (metadata) WHERE type = 'reserve'; + +COMMIT; diff --git a/database-versioning/libeufin-nexus-procedures.sql b/database-versioning/libeufin-nexus-procedures.sql @@ -1,3 +1,18 @@ +-- +-- This file is part of TALER +-- Copyright (C) 2023-2025 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/> + BEGIN; SET search_path TO public; CREATE EXTENSION IF NOT EXISTS pgcrypto; @@ -199,8 +214,7 @@ CREATE FUNCTION register_incoming( ,IN in_debit_payto TEXT ,IN in_bank_id TEXT ,IN in_type taler_incoming_type - ,IN in_reserve_pub BYTEA - ,IN in_account_pub BYTEA + ,IN in_metadata BYTEA -- Error status ,OUT out_reserve_pub_reuse BOOLEAN -- Success return @@ -231,7 +245,7 @@ ELSIF in_type = 'reserve' THEN INTO out_tx_id, out_reserve_pub_reuse, need_reconcile FROM talerable_incoming_transactions JOIN incoming_transactions USING(incoming_transaction_id) - WHERE reserve_public_key = in_reserve_pub; + WHERE metadata = in_metadata AND type = 'reserve'; IF FOUND THEN IF need_reconcile THEN @@ -249,10 +263,11 @@ ELSIF in_type = 'kyc' THEN INTO out_tx_id, need_reconcile FROM talerable_incoming_transactions JOIN incoming_transactions USING(incoming_transaction_id) - WHERE account_pub = in_account_pub + WHERE metadata = in_metadata AND amount = in_amount AND debit_payto = in_debit_payto - AND subject = in_subject; + AND subject = in_subject + AND type = 'kyc'; IF FOUND THEN -- If bank_id is missing we assume it's the same transaction @@ -312,13 +327,11 @@ IF in_type IS NOT NULL AND NOT EXISTS(SELECT FROM talerable_incoming_transaction INSERT INTO talerable_incoming_transactions ( incoming_transaction_id ,type - ,reserve_public_key - ,account_pub + ,metadata ) VALUES ( out_tx_id ,in_type - ,in_reserve_pub - ,in_account_pub + ,in_metadata ); PERFORM pg_notify('nexus_incoming_tx', out_tx_id::text); END IF; @@ -345,7 +358,7 @@ bounce_amount taler_amount; BEGIN -- Register incoming transaction SELECT reg.out_found, reg.out_tx_id - FROM register_incoming(in_amount, in_credit_fee, in_subject, in_execution_time, in_debit_payto, in_bank_id, NULL, NULL, NULL) as reg + FROM register_incoming(in_amount, in_credit_fee, in_subject, in_execution_time, in_debit_payto, in_bank_id, NULL, NULL) as reg INTO out_found, out_tx_id; -- Bounce incoming transaction diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/db/ExchangeDAO.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/db/ExchangeDAO.kt @@ -39,8 +39,7 @@ class ExchangeDAO(private val db: Database) { ,(credit_fee).frac AS credit_fee_frac ,debit_payto ,type - ,reserve_public_key - ,account_pub + ,metadata FROM talerable_incoming_transactions JOIN incoming_transactions USING(incoming_transaction_id) WHERE @@ -53,7 +52,7 @@ class ExchangeDAO(private val db: Database) { amount = it.getAmount("amount", db.bankCurrency), credit_fee = it.getAmount("credit_fee", db.bankCurrency).notZeroOrNull(), debit_account = it.getString("debit_payto"), - reserve_pub = EddsaPublicKey(it.getBytes("reserve_public_key")), + reserve_pub = EddsaPublicKey(it.getBytes("metadata")), ) TalerIncomingType.kyc -> IncomingKycAuthTransaction( row_id = it.getLong("incoming_transaction_id"), @@ -61,7 +60,7 @@ class ExchangeDAO(private val db: Database) { amount = it.getAmount("amount", db.bankCurrency), credit_fee = it.getAmount("credit_fee", db.bankCurrency).notZeroOrNull(), debit_account = it.getString("debit_payto"), - account_pub = EddsaPublicKey(it.getBytes("account_pub")), + account_pub = EddsaPublicKey(it.getBytes("metadata")), ) TalerIncomingType.wad -> throw UnsupportedOperationException() } diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/db/ListDAO.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/db/ListDAO.kt @@ -1,6 +1,6 @@ /* * This file is part of LibEuFin. - * Copyright (C) 2024 Taler Systems S.A. + * Copyright (C) 2024-2025 Taler Systems S.A. * LibEuFin is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -42,8 +42,7 @@ class ListDAO(private val db: Database) { ,debit_payto ,bank_id ,type - ,reserve_public_key - ,account_pub + ,metadata FROM incoming_transactions AS incoming LEFT JOIN talerable_incoming_transactions USING (incoming_transaction_id) LEFT JOIN bounced_transactions USING (incoming_transaction_id) @@ -61,8 +60,8 @@ class ListDAO(private val db: Database) { id = it.getString("bank_id"), talerable = when (type) { null -> if (it.getBoolean("bounced")) "bounced" else "" - TalerIncomingType.reserve -> "reserve ${EddsaPublicKey(it.getBytes("reserve_public_key"))}" - TalerIncomingType.kyc -> "kyc ${EddsaPublicKey(it.getBytes("account_pub"))}" + TalerIncomingType.reserve -> "reserve ${EddsaPublicKey(it.getBytes("metadata"))}" + TalerIncomingType.kyc -> "kyc ${EddsaPublicKey(it.getBytes("metadata"))}" TalerIncomingType.wad -> throw UnsupportedOperationException() } ) diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/db/PaymentDAO.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/db/PaymentDAO.kt @@ -1,6 +1,6 @@ /* * This file is part of LibEuFin. - * Copyright (C) 2024 Taler Systems S.A. + * Copyright (C) 2024-2025 Taler Systems S.A. * LibEuFin is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -120,7 +120,7 @@ class PaymentDAO(private val db: Database) { ): IncomingRegistrationResult = db.serializable( """ SELECT out_reserve_pub_reuse, out_found, out_tx_id - FROM register_incoming((?,?)::taler_amount,(?,?)::taler_amount,?,?,?,?,?::taler_incoming_type,?,?) + FROM register_incoming((?,?)::taler_amount,(?,?)::taler_amount,?,?,?,?,?::taler_incoming_type,?) """ ) { val executionTime = payment.executionTime.micros() @@ -133,17 +133,7 @@ class PaymentDAO(private val db: Database) { setString(7, payment.debtorPayto.toString()) setString(8, payment.bankId) setString(9, metadata.type.name) - when (metadata.type) { - TalerIncomingType.reserve -> { - setBytes(10, metadata.key.raw) - setNull(11, Types.BINARY) - } - TalerIncomingType.kyc -> { - setNull(10, Types.BINARY) - setBytes(11, metadata.key.raw) - } - TalerIncomingType.wad -> throw UnsupportedOperationException() - } + setBytes(10, metadata.key.raw) one { when { it.getBoolean("out_reserve_pub_reuse") -> IncomingRegistrationResult.ReservePubReuse @@ -161,7 +151,7 @@ class PaymentDAO(private val db: Database) { ): IncomingRegistrationResult.Success = db.serializable( """ SELECT out_found, out_tx_id - FROM register_incoming((?,?)::taler_amount,(?,?)::taler_amount,?,?,?,?,NULL,NULL,NULL) + FROM register_incoming((?,?)::taler_amount,(?,?)::taler_amount,?,?,?,?,NULL,NULL) """ ) { val executionTime = payment.executionTime.micros() diff --git a/nexus/src/test/kotlin/bench.kt b/nexus/src/test/kotlin/bench.kt @@ -1,6 +1,6 @@ /* * This file is part of LibEuFin. - * Copyright (C) 2024 Taler Systems S.A. + * Copyright (C) 2024-2025 Taler Systems S.A. * LibEuFin is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -46,12 +46,12 @@ class Bench { "initiated_outgoing_transactions(amount, subject, initiation_time, credit_payto, outgoing_transaction_id, end_to_end_id)" to { "(42,0)\tsubject\t0\tcredit_payto\t${it*2}\tE2E_ID$it\n" }, - "talerable_incoming_transactions(type, reserve_public_key, account_pub, incoming_transaction_id)" to { + "talerable_incoming_transactions(type, metadata, incoming_transaction_id)" to { val hex = token32.rand().encodeHex() if (it % 2 == 0) { - "reserve\t\\\\x$hex\t\\N\t${it*2}\n" + "reserve\t\\\\x$hex\t${it*2}\n" } else { - "kyc\t\\N\t\\\\x$hex\t${it*2}\n" + "kyc\t\\\\x$hex\t${it*2}\n" } }, "talerable_outgoing_transactions(wtid, exchange_base_url, outgoing_transaction_id)" to { diff --git a/testbench/src/test/kotlin/MigrationTest.kt b/testbench/src/test/kotlin/MigrationTest.kt @@ -1,6 +1,6 @@ /* * This file is part of LibEuFin. - * Copyright (C) 2025 Taler Systems S.A. + * Copyright (C) 2024-2025 Taler Systems S.A. * LibEuFin is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -121,5 +121,11 @@ class MigrationTest { // libeufin-nexus-0008 conn.execSQLUpdate(Path("../database-versioning/libeufin-nexus-0008.sql").readText()) + + // libeufin-nexus-0009 + conn.execSQLUpdate(Path("../database-versioning/libeufin-nexus-0009.sql").readText()) + + // libeufin-nexus-0010 + conn.execSQLUpdate(Path("../database-versioning/libeufin-nexus-0010.sql").readText()) } } \ No newline at end of file