taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit ec95635e50bb9669a6ffc4e7e0998cfbde5b112c
parent ce4876aafb13bfd1c7bb586c5670fb3df132d089
Author: Florian Dold <florian@dold.me>
Date:   Tue, 23 Jun 2026 20:43:41 +0200

harness: remove test that expect prospective balance

The wallet does not support prospective balances anymore.

Diffstat:
Dpackages/taler-harness/src/integrationtests/test-wallet-blocked-deposit.ts | 150-------------------------------------------------------------------------------
Dpackages/taler-harness/src/integrationtests/test-wallet-blocked-pay-merchant.ts | 152-------------------------------------------------------------------------------
Dpackages/taler-harness/src/integrationtests/test-wallet-blocked-pay-peer-pull.ts | 179-------------------------------------------------------------------------------
Dpackages/taler-harness/src/integrationtests/test-wallet-blocked-pay-peer-push.ts | 151------------------------------------------------------------------------------
Mpackages/taler-harness/src/integrationtests/testrunner.ts | 8--------
5 files changed, 0 insertions(+), 640 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-wallet-blocked-deposit.ts b/packages/taler-harness/src/integrationtests/test-wallet-blocked-deposit.ts @@ -1,150 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2020 Taler Systems S.A. - - GNU 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. - - GNU 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 - GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - -/** - * Imports. - */ -import { - AmountString, - TransactionMajorState, - TransactionMinorState, - j2s, -} from "@gnu-taler/taler-util"; -import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { CoinConfig } from "../harness/denomStructures.js"; -import { - createSimpleTestkudosEnvironmentV3, - createWalletDaemonWithClient, - makeTestPaymentV2, - withdrawViaBankV3, -} from "../harness/environments.js"; -import { - GlobalTestState, - getTestHarnessPaytoForLabel, -} from "../harness/harness.js"; - -const coinCommon = { - cipher: "RSA" as const, - durationLegal: "3 years", - durationSpend: "2 years", - durationWithdraw: "7 days", - feeDeposit: "TESTKUDOS:0", - feeRefresh: "TESTKUDOS:0", - feeRefund: "TESTKUDOS:0", - feeWithdraw: "TESTKUDOS:0", - rsaKeySize: 1024, -}; - -/** - * Run test for refreshe after a payment. - */ -export async function runWalletBlockedDepositTest(t: GlobalTestState) { - // Set up test environment - - const coinConfigList: CoinConfig[] = [ - { - ...coinCommon, - name: "n1", - value: "TESTKUDOS:1", - }, - { - ...coinCommon, - name: "n5", - value: "TESTKUDOS:5", - }, - ]; - - const { bankClient, exchange, merchant, merchantAdminAccessToken } = - await createSimpleTestkudosEnvironmentV3(t, coinConfigList); - - // Withdraw digital cash into the wallet. - - const { walletClient: w1 } = await createWalletDaemonWithClient(t, { - name: "w1", - persistent: true, - config: { - testing: { - devModeActive: true, - }, - }, - }); - - await withdrawViaBankV3(t, { - walletClient: w1, - bankClient, - exchange, - amount: "TESTKUDOS:20", - }); - - await w1.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); - - // Prevent the wallet from doing refreshes by injecting a 5xx - // status for all refresh requests. - await w1.call(WalletApiOperation.ApplyDevExperiment, { - devExperimentUri: "taler://dev-experiment/start-block-refresh", - }); - - await makeTestPaymentV2(t, { - merchant, - merchantAdminAccessToken, - walletClient: w1, - order: { - summary: "test", - amount: "TESTKUDOS:2", - }, - }); - - const userPayto = getTestHarnessPaytoForLabel("foo"); - - const bal = await w1.call(WalletApiOperation.GetBalances, {}); - console.log(`balance: ${j2s(bal)}`); - - const balDet = await w1.call(WalletApiOperation.GetBalanceDetail, { - currency: "TESTKUDOS", - }); - console.log(`balance details: ${j2s(balDet)}`); - - const depositCheckResp = await w1.call(WalletApiOperation.CheckDeposit, { - amount: "TESTKUDOS:18" as AmountString, - depositPaytoUri: userPayto, - }); - - console.log(`check resp: ${j2s(depositCheckResp)}`); - - const depositCreateResp = await w1.call( - WalletApiOperation.CreateDepositGroup, - { - amount: "TESTKUDOS:18" as AmountString, - depositPaytoUri: userPayto, - }, - ); - - console.log(`create resp: ${j2s(depositCreateResp)}`); - - await w1.call(WalletApiOperation.ApplyDevExperiment, { - devExperimentUri: "taler://dev-experiment/stop-block-refresh", - }); - - await w1.call(WalletApiOperation.TestingWaitTransactionState, { - transactionId: depositCreateResp.transactionId, - txState: { - major: TransactionMajorState.Finalizing, - minor: TransactionMinorState.Track, - }, - }); -} - -runWalletBlockedDepositTest.suites = ["wallet"]; diff --git a/packages/taler-harness/src/integrationtests/test-wallet-blocked-pay-merchant.ts b/packages/taler-harness/src/integrationtests/test-wallet-blocked-pay-merchant.ts @@ -1,152 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2020 Taler Systems S.A. - - GNU 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. - - GNU 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 - GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - -/** - * Imports. - */ -import { - PreparePayResultType, - TalerCorebankApiClient, - TalerMerchantInstanceHttpClient, - j2s, - succeedOrThrow, -} from "@gnu-taler/taler-util"; -import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { CoinConfig } from "../harness/denomStructures.js"; -import { - createSimpleTestkudosEnvironmentV2, - createWalletDaemonWithClient, - makeTestPaymentV2, - withdrawViaBankV3, -} from "../harness/environments.js"; -import { GlobalTestState } from "../harness/harness.js"; - -const coinCommon = { - cipher: "RSA" as const, - durationLegal: "3 years", - durationSpend: "2 years", - durationWithdraw: "7 days", - feeDeposit: "TESTKUDOS:0", - feeRefresh: "TESTKUDOS:0", - feeRefund: "TESTKUDOS:0", - feeWithdraw: "TESTKUDOS:0", - rsaKeySize: 1024, -}; - -const coinConfigList: CoinConfig[] = [ - { - ...coinCommon, - name: "n1", - value: "TESTKUDOS:1", - }, - { - ...coinCommon, - name: "n5", - value: "TESTKUDOS:5", - }, -]; - -/** - * Run test for paying a merchant with balance locked behind a pending refresh. - */ -export async function runWalletBlockedPayMerchantTest(t: GlobalTestState) { - // Set up test environment - - const { bank, exchange, merchant, merchantAdminAccessToken } = - await createSimpleTestkudosEnvironmentV2(t, coinConfigList); - - const bankClient = new TalerCorebankApiClient(bank.baseUrl); - - // Withdraw digital cash into the wallet. - - const { walletClient: w1 } = await createWalletDaemonWithClient(t, { - name: "w1", - persistent: true, - config: { - testing: { - devModeActive: true, - }, - }, - }); - - await withdrawViaBankV3(t, { - walletClient: w1, - bankClient, - exchange, - amount: "TESTKUDOS:20", - }); - - await w1.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); - - // Prevent the wallet from doing refreshes by injecting a 5xx - // status for all refresh requests. - await w1.call(WalletApiOperation.ApplyDevExperiment, { - devExperimentUri: "taler://dev-experiment/start-block-refresh", - }); - - // Do a payment that causes a refresh. - await makeTestPaymentV2(t, { - merchant, - merchantAdminAccessToken, - walletClient: w1, - order: { - summary: "test", - amount: "TESTKUDOS:2", - }, - }); - - const merchantClient = new TalerMerchantInstanceHttpClient( - merchant.makeInstanceBaseUrl(), - ); - - const orderResp = succeedOrThrow( - await merchantClient.createOrder(merchantAdminAccessToken, { - order: { - summary: "My Payment", - amount: "TESTKUDOS:18", - }, - }), - ); - - let orderStatus = succeedOrThrow( - await merchantClient.getOrderDetails( - merchantAdminAccessToken, - orderResp.order_id, - ), - ); - - t.assertTrue(orderStatus.order_status === "unpaid"); - - // Make wallet pay for the order - - const preparePayResult = await w1.call(WalletApiOperation.PreparePayForUri, { - talerPayUri: orderStatus.taler_pay_uri, - }); - - console.log(`prepare pay result: ${j2s(preparePayResult)}`); - - t.assertTrue( - preparePayResult.status === PreparePayResultType.PaymentPossible, - ); - - await w1.call(WalletApiOperation.ApplyDevExperiment, { - devExperimentUri: "taler://dev-experiment/stop-block-refresh", - }); - - await w1.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); -} - -runWalletBlockedPayMerchantTest.suites = ["wallet"]; diff --git a/packages/taler-harness/src/integrationtests/test-wallet-blocked-pay-peer-pull.ts b/packages/taler-harness/src/integrationtests/test-wallet-blocked-pay-peer-pull.ts @@ -1,179 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2020 Taler Systems S.A. - - GNU 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. - - GNU 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 - GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - -/** - * Imports. - */ -import { - AbsoluteTime, - AmountString, - Duration, - NotificationType, - TalerCorebankApiClient, - TransactionMajorState, - TransactionMinorState, - TransactionType, - j2s, -} from "@gnu-taler/taler-util"; -import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { CoinConfig } from "../harness/denomStructures.js"; -import { GlobalTestState } from "../harness/harness.js"; -import { - createSimpleTestkudosEnvironmentV2, - createWalletDaemonWithClient, - makeTestPaymentV2, - withdrawViaBankV3, -} from "../harness/environments.js"; - -const coinCommon = { - cipher: "RSA" as const, - durationLegal: "3 years", - durationSpend: "2 years", - durationWithdraw: "7 days", - feeDeposit: "TESTKUDOS:0", - feeRefresh: "TESTKUDOS:0", - feeRefund: "TESTKUDOS:0", - feeWithdraw: "TESTKUDOS:0", - rsaKeySize: 1024, -}; - -/** - * Run test for a peer push payment with balance locked behind a pending refresh. - */ -export async function runWalletBlockedPayPeerPullTest(t: GlobalTestState) { - // Set up test environment - - const coinConfigList: CoinConfig[] = [ - { - ...coinCommon, - name: "n1", - value: "TESTKUDOS:1", - }, - { - ...coinCommon, - name: "n5", - value: "TESTKUDOS:5", - }, - ]; - - const { bank, exchange, merchant, merchantAdminAccessToken } = - await createSimpleTestkudosEnvironmentV2(t, coinConfigList); - - // Withdraw digital cash into the wallet. - - const { walletClient: w1 } = await createWalletDaemonWithClient(t, { - name: "w1", - persistent: true, - config: { - testing: { - devModeActive: true, - }, - }, - }); - - const { walletClient: w2 } = await createWalletDaemonWithClient(t, { - name: "w2", - persistent: true, - config: { - testing: { - devModeActive: true, - }, - }, - }); - - const bankClient = new TalerCorebankApiClient(bank.baseUrl); - - await withdrawViaBankV3(t, { - walletClient: w1, - bankClient, - exchange, - amount: "TESTKUDOS:20", - }); - - await w1.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); - - // Prevent the wallet from doing refreshes by injecting a 5xx - // status for all refresh requests. - await w1.call(WalletApiOperation.ApplyDevExperiment, { - devExperimentUri: "taler://dev-experiment/start-block-refresh", - }); - - // Do a payment that causes a refresh. - await makeTestPaymentV2(t, { - merchant, - merchantAdminAccessToken, - walletClient: w1, - order: { - summary: "test", - amount: "TESTKUDOS:2", - }, - }); - - await w2.call(WalletApiOperation.AddExchange, { - exchangeBaseUrl: exchange.baseUrl, - }); - - const pullCreditReadyCond = w2.waitForNotificationCond((n) => { - return ( - n.type === NotificationType.TransactionStateTransition && - n.transactionId.startsWith("txn:peer-pull-credit:") && - n.newTxState.major === TransactionMajorState.Pending && - n.newTxState.minor === TransactionMinorState.Ready - ); - }); - - const initResp = await w2.call(WalletApiOperation.InitiatePeerPullCredit, { - partialContractTerms: { - summary: "hi!", - amount: "TESTKUDOS:18" as AmountString, - purse_expiration: AbsoluteTime.toProtocolTimestamp( - AbsoluteTime.addDuration( - AbsoluteTime.now(), - Duration.fromSpec({ hours: 1 }), - ), - ), - }, - }); - - await pullCreditReadyCond; - - const initTx = await w2.call(WalletApiOperation.GetTransactionById, { - transactionId: initResp.transactionId, - }); - - t.assertDeepEqual(initTx.type, TransactionType.PeerPullCredit); - t.assertTrue(!!initTx.talerUri); - - const checkResp = await w1.call(WalletApiOperation.PreparePeerPullDebit, { - talerUri: initTx.talerUri, - }); - - console.log(`check resp ${j2s(checkResp)}`); - - const confirmResp = await w1.call(WalletApiOperation.ConfirmPeerPullDebit, { - transactionId: checkResp.transactionId, - }); - - console.log(`confirm resp ${j2s(confirmResp)}`); - - await w1.call(WalletApiOperation.ApplyDevExperiment, { - devExperimentUri: "taler://dev-experiment/stop-block-refresh", - }); - - await w1.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); -} - -runWalletBlockedPayPeerPullTest.suites = ["wallet"]; diff --git a/packages/taler-harness/src/integrationtests/test-wallet-blocked-pay-peer-push.ts b/packages/taler-harness/src/integrationtests/test-wallet-blocked-pay-peer-push.ts @@ -1,151 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2020 Taler Systems S.A. - - GNU 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. - - GNU 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 - GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - -/** - * Imports. - */ -import { - AbsoluteTime, - AmountString, - Duration, - NotificationType, - TalerCorebankApiClient, - TransactionMajorState, - TransactionMinorState, - j2s, -} from "@gnu-taler/taler-util"; -import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { CoinConfig } from "../harness/denomStructures.js"; -import { - createSimpleTestkudosEnvironmentV2, - createWalletDaemonWithClient, - makeTestPaymentV2, - withdrawViaBankV3, -} from "../harness/environments.js"; -import { GlobalTestState } from "../harness/harness.js"; - -const coinCommon = { - cipher: "RSA" as const, - durationLegal: "3 years", - durationSpend: "2 years", - durationWithdraw: "7 days", - feeDeposit: "TESTKUDOS:0", - feeRefresh: "TESTKUDOS:0", - feeRefund: "TESTKUDOS:0", - feeWithdraw: "TESTKUDOS:0", - rsaKeySize: 1024, -}; - -/** - * Run test for a peer push payment with balance locked behind a pending refresh. - */ -export async function runWalletBlockedPayPeerPushTest(t: GlobalTestState) { - // Set up test environment - - const coinConfigList: CoinConfig[] = [ - { - ...coinCommon, - name: "n1", - value: "TESTKUDOS:1", - }, - { - ...coinCommon, - name: "n5", - value: "TESTKUDOS:5", - }, - ]; - - const { bank, exchange, merchant, merchantAdminAccessToken } = - await createSimpleTestkudosEnvironmentV2(t, coinConfigList); - - const bankClient = new TalerCorebankApiClient(bank.baseUrl); - - // Withdraw digital cash into the wallet. - - const { walletClient: w1 } = await createWalletDaemonWithClient(t, { - name: "w1", - persistent: true, - config: { - testing: { - devModeActive: true, - }, - }, - }); - - await withdrawViaBankV3(t, { - walletClient: w1, - bankClient, - exchange, - amount: "TESTKUDOS:20", - }); - - await w1.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); - - // Prevent the wallet from doing refreshes by injecting a 5xx - // status for all refresh requests. - await w1.call(WalletApiOperation.ApplyDevExperiment, { - devExperimentUri: "taler://dev-experiment/start-block-refresh", - }); - - // Do a payment that causes a refresh. - await makeTestPaymentV2(t, { - merchant, - merchantAdminAccessToken, - walletClient: w1, - order: { - summary: "test", - amount: "TESTKUDOS:2", - }, - }); - - const checkResp = await w1.call(WalletApiOperation.CheckPeerPushDebit, { - amount: "TESTKUDOS:18" as AmountString, - }); - - console.log(`check resp ${j2s(checkResp)}`); - - const readyCond = w1.waitForNotificationCond((n) => { - return ( - n.type === NotificationType.TransactionStateTransition && - n.transactionId.startsWith("txn:peer-push-debit:") && - n.newTxState.major === TransactionMajorState.Pending && - n.newTxState.minor === TransactionMinorState.Ready - ); - }); - - const confirmResp = await w1.call(WalletApiOperation.InitiatePeerPushDebit, { - partialContractTerms: { - summary: "hi!", - amount: "TESTKUDOS:18" as AmountString, - purse_expiration: AbsoluteTime.toProtocolTimestamp( - AbsoluteTime.addDuration( - AbsoluteTime.now(), - Duration.fromSpec({ hours: 1 }), - ), - ), - }, - }); - - console.log(`confirm resp ${j2s(confirmResp)}`); - - await w1.call(WalletApiOperation.ApplyDevExperiment, { - devExperimentUri: "taler://dev-experiment/stop-block-refresh", - }); - - await readyCond; -} - -runWalletBlockedPayPeerPushTest.suites = ["wallet"]; diff --git a/packages/taler-harness/src/integrationtests/testrunner.ts b/packages/taler-harness/src/integrationtests/testrunner.ts @@ -181,10 +181,6 @@ import { runWalletBalanceNotificationsTest } from "./test-wallet-balance-notific import { runWalletBalanceZeroTest } from "./test-wallet-balance-zero.js"; import { runWalletBalanceTest } from "./test-wallet-balance.js"; import { runWalletBbanTest } from "./test-wallet-bban.js"; -import { runWalletBlockedDepositTest } from "./test-wallet-blocked-deposit.js"; -import { runWalletBlockedPayMerchantTest } from "./test-wallet-blocked-pay-merchant.js"; -import { runWalletBlockedPayPeerPullTest } from "./test-wallet-blocked-pay-peer-pull.js"; -import { runWalletBlockedPayPeerPushTest } from "./test-wallet-blocked-pay-peer-push.js"; import { runWalletCliTerminationTest } from "./test-wallet-cli-termination.js"; import { runWalletContactsBasicTest } from "./test-wallet-contacts-basic.js"; import { runWalletCryptoWorkerTest } from "./test-wallet-cryptoworker.js"; @@ -329,10 +325,6 @@ const allTests: TestMainFunction[] = [ runWalletWirefeesTest, runDenomLostTest, runWalletDenomExpireTest, - runWalletBlockedDepositTest, - runWalletBlockedPayMerchantTest, - runWalletBlockedPayPeerPushTest, - runWalletBlockedPayPeerPullTest, runWalletExchangeUpdateTest, runWalletRefreshErrorsTest, runWalletNetworkAvailabilityTest,