diff options
Diffstat (limited to 'packages/taler-harness/src')
63 files changed, 352 insertions, 360 deletions
diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts index d7ec4c2f6..77b6f0e11 100644 --- a/packages/taler-harness/src/harness/harness.ts +++ b/packages/taler-harness/src/harness/harness.ts @@ -890,7 +890,7 @@ export class LibeufinBankService } // Use libeufin bank instead of pybank. -const useLibeufinBank = false; +export const useLibeufinBank = process.env["WITH_LIBEUFIN"] === "1"; export interface BankServiceHandle { readonly corebankApiBaseUrl: string; @@ -902,7 +902,9 @@ export interface BankServiceHandle { } export type BankService = BankServiceHandle; -export const BankService = FakebankService; +export const BankService = useLibeufinBank + ? FakebankService + : LibeufinBankService; export interface ExchangeConfig { name: string; @@ -2241,7 +2243,6 @@ export function generateRandomTestIban(salt: string | null = null): string { } export function getWireMethodForTest(): string { - if (useLibeufinBank) return "iban"; return "x-taler-bank"; } @@ -2250,10 +2251,6 @@ export function getWireMethodForTest(): string { * on whether the banking is served by euFin or Pybank. */ export function generateRandomPayto(label: string): string { - if (useLibeufinBank) - return `payto://iban/SANDBOXX/${generateRandomTestIban( - label, - )}?receiver-name=${label}`; return `payto://x-taler-bank/localhost/${label}?receiver-name=${label}`; } diff --git a/packages/taler-harness/src/harness/helpers.ts b/packages/taler-harness/src/harness/helpers.ts index 1bea855cf..0f63a6739 100644 --- a/packages/taler-harness/src/harness/helpers.ts +++ b/packages/taler-harness/src/harness/helpers.ts @@ -36,8 +36,6 @@ import { TalerCorebankApiClient, TransactionMajorState, WalletNotification, - WireGatewayApiClient, - createEddsaKeyPair, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "./denomStructures.js"; @@ -61,9 +59,9 @@ import { WalletService, WithAuthorization, generateRandomPayto, - generateRandomTestIban, setupDb, setupSharedDb, + useLibeufinBank, } from "./harness.js"; import * as fs from "fs"; @@ -88,8 +86,21 @@ export interface SimpleTestEnvironment { */ export interface SimpleTestEnvironmentNg { commonDb: DbInfo; - bank: BankService; - bankClient?: TalerCorebankApiClient, + bank: FakebankService; + exchange: ExchangeService; + exchangeBankAccount: HarnessExchangeBankAccount; + merchant: MerchantService; + walletClient: WalletClient; + walletService: WalletService; +} + +/** + * Improved version of the simple test environment, + * passing bankClient instead of bank service. + */ +export interface SimpleTestEnvironmentNg3 { + commonDb: DbInfo; + bankClient: TalerCorebankApiClient, exchange: ExchangeService; exchangeBankAccount: HarnessExchangeBankAccount; merchant: MerchantService; @@ -140,7 +151,7 @@ export async function useSharedTestkudosEnvironment(t: GlobalTestState) { }); } else { logger.info("creating new bank config"); - bank = await BankService.create(t, { + bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, @@ -299,7 +310,7 @@ export async function createSimpleTestkudosEnvironmentV2( ): Promise<SimpleTestEnvironmentNg> { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, @@ -418,7 +429,7 @@ export async function createSimpleTestkudosEnvironmentV3( t: GlobalTestState, coinConfig: CoinConfig[] = defaultCoinConfig.map((x) => x("TESTKUDOS")), opts: EnvOptions = {}, -): Promise<SimpleTestEnvironmentNg> { +): Promise<SimpleTestEnvironmentNg3> { const db = await setupDb(t); const bc = { @@ -428,7 +439,7 @@ export async function createSimpleTestkudosEnvironmentV3( httpPort: 8082, }; - const bank: BankService = process.env["WITH_LIBEUFIN"] === "1" + const bank: BankService = useLibeufinBank ? await LibeufinBankService.create(t, bc) : await FakebankService.create(t, bc); @@ -555,7 +566,6 @@ export async function createSimpleTestkudosEnvironmentV3( merchant, walletClient, walletService, - bank, bankClient, exchangeBankAccount, }; @@ -616,7 +626,7 @@ export async function createWalletDaemonWithClient( export interface FaultyMerchantTestEnvironment { commonDb: DbInfo; - bank: BankService; + bank: FakebankService; exchange: ExchangeService; faultyExchange: FaultInjectedExchangeService; exchangeBankAccount: HarnessExchangeBankAccount; @@ -634,7 +644,7 @@ export async function createFaultInjectedMerchantTestkudosEnvironment( ): Promise<FaultyMerchantTestEnvironment> { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, @@ -797,12 +807,13 @@ export async function withdrawViaBankV3( const { walletClient: wallet, bankClient, exchange, amount } = p; const user = await bankClient.createRandomBankUser(); - bankClient.setAuth({ + const bankClient2 = new TalerCorebankApiClient(bankClient.baseUrl); + bankClient2.setAuth({ username: user.username, password: user.password, }); - const wop = await bankClient.createWithdrawalOperation(user.username, amount); + const wop = await bankClient2.createWithdrawalOperation(user.username, amount); // Hand it to the wallet @@ -831,7 +842,7 @@ export async function withdrawViaBankV3( // Confirm it - await bankClient.confirmWithdrawalOperation(user.username, { + await bankClient2.confirmWithdrawalOperation(user.username, { withdrawalOperationId: wop.withdrawal_id, }); diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-deposit.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-deposit.ts index d36ba0e61..a0e97c218 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-deposit.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-deposit.ts @@ -26,8 +26,8 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState, generateRandomPayto } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; import { defaultCoinConfig } from "../harness/denomStructures.js"; @@ -37,8 +37,8 @@ import { defaultCoinConfig } from "../harness/denomStructures.js"; export async function runAgeRestrictionsDepositTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange } = - await createSimpleTestkudosEnvironmentV2( + const { walletClient, bankClient, exchange } = + await createSimpleTestkudosEnvironmentV3( t, defaultCoinConfig.map((x) => x("TESTKUDOS")), { @@ -48,9 +48,9 @@ export async function runAgeRestrictionsDepositTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - const withdrawalResult = await withdrawViaBankV2(t, { + const withdrawalResult = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts index bba571328..89f285ae2 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts @@ -22,10 +22,10 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, createWalletDaemonWithClient, makeTestPaymentV2, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -36,11 +36,11 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { const { walletClient: walletClientOne, - bank, + bankClient, exchange, merchant, exchangeBankAccount, - } = await createSimpleTestkudosEnvironmentV2( + } = await createSimpleTestkudosEnvironmentV3( t, defaultCoinConfig.map((x) => x("TESTKUDOS")), { @@ -66,9 +66,9 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { name: "w0", }); - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient: walletClientZero, - bank, + bankClient, exchange, amount: "TESTKUDOS:20" as AmountString, restrictAge: 13, @@ -96,9 +96,9 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { { const walletClient = walletClientOne; - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20" as AmountString, restrictAge: 13, @@ -122,9 +122,9 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { { const walletClient = walletClientTwo; - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20" as AmountString, restrictAge: 13, @@ -147,9 +147,9 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { { const walletClient = walletClientThree; - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20" as AmountString, }); diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-mixed-merchant.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-mixed-merchant.ts index 244de1972..898c7b3f7 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-mixed-merchant.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-mixed-merchant.ts @@ -21,10 +21,10 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, createWalletDaemonWithClient, makeTestPaymentV2, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; import { AmountString } from "@gnu-taler/taler-util"; @@ -36,10 +36,10 @@ export async function runAgeRestrictionsMixedMerchantTest(t: GlobalTestState) { const { walletClient: walletOne, - bank, + bankClient, exchange, merchant, - } = await createSimpleTestkudosEnvironmentV2( + } = await createSimpleTestkudosEnvironmentV3( t, defaultCoinConfig.map((x) => x("TESTKUDOS")), { @@ -59,9 +59,9 @@ export async function runAgeRestrictionsMixedMerchantTest(t: GlobalTestState) { { const walletClient = walletOne; - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20" as AmountString, restrictAge: 13, @@ -84,9 +84,9 @@ export async function runAgeRestrictionsMixedMerchantTest(t: GlobalTestState) { } { - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient: walletTwo, - bank, + bankClient, exchange, amount: "TESTKUDOS:20" as AmountString, restrictAge: 13, @@ -106,9 +106,9 @@ export async function runAgeRestrictionsMixedMerchantTest(t: GlobalTestState) { } { - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient: walletThree, - bank, + bankClient, exchange, amount: "TESTKUDOS:20" as AmountString, }); diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts index aea59b706..b10ecac24 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts @@ -31,9 +31,9 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, createWalletDaemonWithClient, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -42,7 +42,7 @@ import { export async function runAgeRestrictionsPeerTest(t: GlobalTestState) { // Set up test environment - const { bank, exchange } = await createSimpleTestkudosEnvironmentV2( + const { bankClient, exchange } = await createSimpleTestkudosEnvironmentV3( t, defaultCoinConfig.map((x) => x("TESTKUDOS")), { @@ -63,9 +63,9 @@ export async function runAgeRestrictionsPeerTest(t: GlobalTestState) { const wallet2 = w2.walletClient; { - const withdrawalRes = await withdrawViaBankV2(t, { + const withdrawalRes = await withdrawViaBankV3(t, { walletClient: wallet1, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", restrictAge: 13, diff --git a/packages/taler-harness/src/integrationtests/test-bank-api.ts b/packages/taler-harness/src/integrationtests/test-bank-api.ts index 9c5b06397..490931d83 100644 --- a/packages/taler-harness/src/integrationtests/test-bank-api.ts +++ b/packages/taler-harness/src/integrationtests/test-bank-api.ts @@ -26,8 +26,8 @@ import { } from "@gnu-taler/taler-util"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, generateRandomPayto, @@ -42,7 +42,7 @@ export async function runBankApiTest(t: GlobalTestState) { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { currency: "TESTKUDOS", httpPort: 8082, database: db.connStr, @@ -146,4 +146,4 @@ export async function runBankApiTest(t: GlobalTestState) { ); } -runBankApiTest.suites = ["fakebank"]
\ No newline at end of file +runBankApiTest.suites = ["fakebank"] diff --git a/packages/taler-harness/src/integrationtests/test-claim-loop.ts b/packages/taler-harness/src/integrationtests/test-claim-loop.ts index a424e0101..01be6ea80 100644 --- a/packages/taler-harness/src/integrationtests/test-claim-loop.ts +++ b/packages/taler-harness/src/integrationtests/test-claim-loop.ts @@ -21,8 +21,8 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { URL } from "url"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; import { MerchantApiClient } from "@gnu-taler/taler-util"; @@ -35,12 +35,12 @@ import { MerchantApiClient } from "@gnu-taler/taler-util"; export async function runClaimLoopTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); @@ -79,4 +79,4 @@ export async function runClaimLoopTest(t: GlobalTestState) { await t.shutdown(); } -runClaimLoopTest.suites = ["merchant"];
\ No newline at end of file +runClaimLoopTest.suites = ["merchant"]; diff --git a/packages/taler-harness/src/integrationtests/test-clause-schnorr.ts b/packages/taler-harness/src/integrationtests/test-clause-schnorr.ts index a5ad382a7..adab764ef 100644 --- a/packages/taler-harness/src/integrationtests/test-clause-schnorr.ts +++ b/packages/taler-harness/src/integrationtests/test-clause-schnorr.ts @@ -21,9 +21,9 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, makeTestPaymentV2, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -54,14 +54,14 @@ export async function runClauseSchnorrTest(t: GlobalTestState) { name: "rsa_dummy", }); - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t, coinConfig); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t, coinConfig); // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-currency-scope.ts b/packages/taler-harness/src/integrationtests/test-currency-scope.ts index 058941e16..69e45f678 100644 --- a/packages/taler-harness/src/integrationtests/test-currency-scope.ts +++ b/packages/taler-harness/src/integrationtests/test-currency-scope.ts @@ -21,8 +21,8 @@ import { Duration, j2s } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, generateRandomPayto, @@ -44,7 +44,7 @@ export async function runCurrencyScopeTest(t: GlobalTestState) { nameSuffix: "exchange2", }); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: dbDefault.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-denom-lost.ts b/packages/taler-harness/src/integrationtests/test-denom-lost.ts index 307ae352a..b57518437 100644 --- a/packages/taler-harness/src/integrationtests/test-denom-lost.ts +++ b/packages/taler-harness/src/integrationtests/test-denom-lost.ts @@ -20,8 +20,8 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -30,14 +30,14 @@ import { export async function runDenomLostTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange } = + await createSimpleTestkudosEnvironmentV3(t); // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts index 6a82d586c..9581f9876 100644 --- a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts +++ b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts @@ -26,21 +26,21 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; export async function runDenomUnofferedTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); @@ -139,9 +139,9 @@ export async function runDenomUnofferedTest(t: GlobalTestState) { }); // Now withdrawal should work again. - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-deposit.ts b/packages/taler-harness/src/integrationtests/test-deposit.ts index 74b318226..0879c9e9f 100644 --- a/packages/taler-harness/src/integrationtests/test-deposit.ts +++ b/packages/taler-harness/src/integrationtests/test-deposit.ts @@ -27,8 +27,8 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState, generateRandomPayto } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -37,14 +37,14 @@ import { export async function runDepositTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange } = + await createSimpleTestkudosEnvironmentV3(t); // Withdraw digital cash into the wallet. - const withdrawalResult = await withdrawViaBankV2(t, { + const withdrawalResult = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-exchange-management-fault.ts b/packages/taler-harness/src/integrationtests/test-exchange-management-fault.ts index d3bd022ae..5f02c2080 100644 --- a/packages/taler-harness/src/integrationtests/test-exchange-management-fault.ts +++ b/packages/taler-harness/src/integrationtests/test-exchange-management-fault.ts @@ -31,8 +31,8 @@ import { FaultInjectionResponseContext, } from "../harness/faultInjection.js"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, WalletCli, @@ -50,7 +50,7 @@ export async function runExchangeManagementFaultTest( const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-exchange-management.ts b/packages/taler-harness/src/integrationtests/test-exchange-management.ts index 9d3c1d867..072e9736d 100644 --- a/packages/taler-harness/src/integrationtests/test-exchange-management.ts +++ b/packages/taler-harness/src/integrationtests/test-exchange-management.ts @@ -19,7 +19,7 @@ */ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; -import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; +import { createSimpleTestkudosEnvironmentV3 } from "../harness/helpers.js"; /** * Test if the wallet handles outdated exchange versions correctly. @@ -30,7 +30,7 @@ export async function runExchangeManagementTest( // Set up test environment const { walletClient, exchange } = - await createSimpleTestkudosEnvironmentV2(t); + await createSimpleTestkudosEnvironmentV3(t); // Since the default exchanges can change, we start the wallet in tests // with no built-in defaults. Thus the list of exchanges is empty here. diff --git a/packages/taler-harness/src/integrationtests/test-exchange-timetravel.ts b/packages/taler-harness/src/integrationtests/test-exchange-timetravel.ts index 714a7f879..181392ac8 100644 --- a/packages/taler-harness/src/integrationtests/test-exchange-timetravel.ts +++ b/packages/taler-harness/src/integrationtests/test-exchange-timetravel.ts @@ -32,8 +32,8 @@ import { } from "@gnu-taler/taler-util/http"; import { makeNoFeeCoinConfig } from "../harness/denomStructures.js"; import { - BankService, ExchangeService, + FakebankService, generateRandomPayto, GlobalTestState, MerchantService, @@ -103,7 +103,7 @@ export async function runExchangeTimetravelTest(t: GlobalTestState) { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-fee-regression.ts b/packages/taler-harness/src/integrationtests/test-fee-regression.ts index f164606c4..58002d5b7 100644 --- a/packages/taler-harness/src/integrationtests/test-fee-regression.ts +++ b/packages/taler-harness/src/integrationtests/test-fee-regression.ts @@ -19,8 +19,8 @@ */ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, generateRandomPayto, @@ -42,7 +42,7 @@ export async function createMyTestkudosEnvironment( ): Promise<SimpleTestEnvironmentNg> { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-kyc.ts b/packages/taler-harness/src/integrationtests/test-kyc.ts index a9ef654fd..ec80c0fc8 100644 --- a/packages/taler-harness/src/integrationtests/test-kyc.ts +++ b/packages/taler-harness/src/integrationtests/test-kyc.ts @@ -32,8 +32,8 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import * as http from "node:http"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, WalletClient, @@ -52,7 +52,7 @@ export async function createKycTestkudosEnvironment( ): Promise<SimpleTestEnvironmentNg> { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-bank.ts b/packages/taler-harness/src/integrationtests/test-libeufin-bank.ts index 3900779e2..01b20ddbf 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-bank.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-bank.ts @@ -72,11 +72,9 @@ export async function runLibeufinBankTest(t: GlobalTestState) { database: db.connStr, }); - const exchangeIban = generateRandomTestIban(); const exchangeBankUsername = "exchange"; const exchangeBankPw = "mypw"; - const exchangePlainPayto = `payto://iban/${exchangeIban}`; - const exchangeExtendedPayto = `payto://iban/${exchangeIban}?receiver-name=Exchange`; + const exchangePayto = generateRandomPayto(exchangeBankUsername); const wireGatewayApiBaseUrl = new URL( "accounts/exchange/taler-wire-gateway/", bank.baseUrl, @@ -88,7 +86,7 @@ export async function runLibeufinBankTest(t: GlobalTestState) { wireGatewayApiBaseUrl, accountName: exchangeBankUsername, accountPassword: exchangeBankPw, - accountPaytoUri: exchangeExtendedPayto, + accountPaytoUri: exchangePayto, }); bank.setSuggestedExchange(exchange); @@ -138,7 +136,7 @@ export async function runLibeufinBankTest(t: GlobalTestState) { password: exchangeBankPw, username: exchangeBankUsername, is_taler_exchange: true, - payto_uri: exchangePlainPayto, + payto_uri: exchangePayto, }); const bankUser = await bankClient.registerAccount("user1", "pw1"); diff --git a/packages/taler-harness/src/integrationtests/test-merchant-exchange-confusion.ts b/packages/taler-harness/src/integrationtests/test-merchant-exchange-confusion.ts index 35e3267b1..27e754b68 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-exchange-confusion.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-exchange-confusion.ts @@ -31,8 +31,8 @@ import { FaultInjectedMerchantService, } from "../harness/faultInjection.js"; import { - BankService, ExchangeService, + FakebankService, generateRandomPayto, GlobalTestState, harnessHttpLib, @@ -54,7 +54,7 @@ export async function createConfusedMerchantTestkudosEnvironment( ): Promise<FaultyMerchantTestEnvironment> { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts b/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts index bd63a8445..656fc4ded 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts @@ -27,8 +27,8 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState, harnessHttpLib } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -36,14 +36,14 @@ import { */ export async function runMerchantLongpollingTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts b/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts index 7ee4c977b..1d712f745 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts @@ -25,7 +25,6 @@ import { } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { - BankServiceHandle, ExchangeServiceInterface, GlobalTestState, MerchantServiceInterface, @@ -33,15 +32,14 @@ import { harnessHttpLib, } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; async function testRefundApiWithFulfillmentUrl( t: GlobalTestState, env: { merchant: MerchantServiceInterface; - bank: BankServiceHandle; walletClient: WalletClient; exchange: ExchangeServiceInterface; }, @@ -157,7 +155,6 @@ async function testRefundApiWithFulfillmentMessage( t: GlobalTestState, env: { merchant: MerchantServiceInterface; - bank: BankServiceHandle; walletClient: WalletClient; exchange: ExchangeServiceInterface; }, @@ -276,14 +273,14 @@ async function testRefundApiWithFulfillmentMessage( export async function runMerchantRefundApiTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); @@ -291,14 +288,12 @@ export async function runMerchantRefundApiTest(t: GlobalTestState) { await testRefundApiWithFulfillmentUrl(t, { walletClient, - bank, exchange, merchant, }); await testRefundApiWithFulfillmentMessage(t, { walletClient, - bank, exchange, merchant, }); diff --git a/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts b/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts index 8e664dfa9..6a26b1325 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts @@ -27,8 +27,8 @@ import { } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, harnessHttpLib, @@ -42,7 +42,7 @@ import { interface Context { merchant: MerchantService; merchantBaseUrl: string; - bank: BankService; + bank: FakebankService; exchange: ExchangeService; } diff --git a/packages/taler-harness/src/integrationtests/test-multiexchange.ts b/packages/taler-harness/src/integrationtests/test-multiexchange.ts index e27bccc46..86fe0fb5f 100644 --- a/packages/taler-harness/src/integrationtests/test-multiexchange.ts +++ b/packages/taler-harness/src/integrationtests/test-multiexchange.ts @@ -21,8 +21,8 @@ import { Duration } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, generateRandomPayto, @@ -45,7 +45,7 @@ export async function runMultiExchangeTest(t: GlobalTestState) { nameSuffix: "exchange2", }); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: dbDefault.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-otp.ts b/packages/taler-harness/src/integrationtests/test-otp.ts index d0aeba095..4fcc8c6e9 100644 --- a/packages/taler-harness/src/integrationtests/test-otp.ts +++ b/packages/taler-harness/src/integrationtests/test-otp.ts @@ -30,8 +30,8 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -40,8 +40,8 @@ import { export async function runOtpTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); const createOtpRes = await merchantClient.createOtpDevice({ @@ -69,12 +69,12 @@ export async function runOtpTest(t: GlobalTestState) { const getTemplateResp = await merchantClient.getTemplate("tpl1"); narrowOpSuccessOrThrow("getTemplate", getTemplateResp); - + console.log(`template: ${j2s(getTemplateResp.body)}`); - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-payment-claim.ts b/packages/taler-harness/src/integrationtests/test-payment-claim.ts index 3595a1750..dfadd9539 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-claim.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-claim.ts @@ -25,9 +25,9 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, createWalletDaemonWithClient, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -36,8 +36,8 @@ import { export async function runPaymentClaimTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); @@ -45,9 +45,9 @@ export async function runPaymentClaimTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-payment-deleted.ts b/packages/taler-harness/src/integrationtests/test-payment-deleted.ts index 1d25848fd..bab8a4df1 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-deleted.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-deleted.ts @@ -26,8 +26,8 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -36,16 +36,16 @@ import { export async function runPaymentDeletedTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); // First, make a "free" payment when we don't even have // any money in the // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-payment-expired.ts b/packages/taler-harness/src/integrationtests/test-payment-expired.ts index a837b18fa..73da165d8 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-expired.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-expired.ts @@ -30,8 +30,8 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { applyTimeTravelV2, - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -49,14 +49,14 @@ import { export async function runPaymentExpiredTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-payment-fault.ts b/packages/taler-harness/src/integrationtests/test-payment-fault.ts index cadcc9056..c48b8e2a2 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-fault.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-fault.ts @@ -30,8 +30,8 @@ import { FaultInjectionResponseContext, } from "../harness/faultInjection.js"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, generateRandomPayto, @@ -50,7 +50,7 @@ export async function runPaymentFaultTest(t: GlobalTestState) { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-payment-forgettable.ts b/packages/taler-harness/src/integrationtests/test-payment-forgettable.ts index 21d76397d..e47cfe7cd 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-forgettable.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-forgettable.ts @@ -20,9 +20,9 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, makeTestPaymentV2, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -31,14 +31,14 @@ import { export async function runPaymentForgettableTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-payment-idempotency.ts b/packages/taler-harness/src/integrationtests/test-payment-idempotency.ts index 65fd3a562..4a8e95af3 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-idempotency.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-idempotency.ts @@ -21,8 +21,8 @@ import { MerchantApiClient, PreparePayResultType } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -32,14 +32,14 @@ import { export async function runPaymentIdempotencyTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-payment-multiple.ts b/packages/taler-harness/src/integrationtests/test-payment-multiple.ts index 0caa3c3e7..a3f95518c 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-multiple.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-multiple.ts @@ -21,8 +21,8 @@ import { MerchantApiClient } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { coin_ct10, coin_u1 } from "../harness/denomStructures.js"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, generateRandomPayto, @@ -36,11 +36,11 @@ import { async function setupTest(t: GlobalTestState): Promise<{ merchant: MerchantService; exchange: ExchangeService; - bank: BankService; + bank: FakebankService; }> { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-payment-share.ts b/packages/taler-harness/src/integrationtests/test-payment-share.ts index 141faa81e..90d4a6fbb 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-share.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-share.ts @@ -27,9 +27,9 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, createWalletDaemonWithClient, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -39,17 +39,17 @@ export async function runPaymentShareTest(t: GlobalTestState) { // Set up test environment const { walletClient: firstWallet, - bank, + bankClient, exchange, merchant, - } = await createSimpleTestkudosEnvironmentV2(t); + } = await createSimpleTestkudosEnvironmentV3(t); const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient: firstWallet, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); @@ -59,9 +59,9 @@ export async function runPaymentShareTest(t: GlobalTestState) { name: "wallet2", }); - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient: secondWallet, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-payment-template.ts b/packages/taler-harness/src/integrationtests/test-payment-template.ts index c3ab5ffc8..96e4de119 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-template.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-template.ts @@ -27,8 +27,8 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -37,8 +37,8 @@ import { export async function runPaymentTemplateTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); @@ -59,9 +59,9 @@ export async function runPaymentTemplateTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-payment-zero.ts b/packages/taler-harness/src/integrationtests/test-payment-zero.ts index 7423751a5..3a74a9cf2 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-zero.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-zero.ts @@ -20,8 +20,8 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, makeTestPaymentV2, } from "../harness/helpers.js"; import { TransactionMajorState } from "@gnu-taler/taler-util"; @@ -33,14 +33,14 @@ import { TransactionMajorState } from "@gnu-taler/taler-util"; export async function runPaymentZeroTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); // First, make a "free" payment when we don't even have // any money in the // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20" }); + await withdrawViaBankV3(t, { walletClient, bankClient, exchange, amount: "TESTKUDOS:20" }); await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); diff --git a/packages/taler-harness/src/integrationtests/test-paywall-flow.ts b/packages/taler-harness/src/integrationtests/test-paywall-flow.ts index 247ec9cad..de3961dec 100644 --- a/packages/taler-harness/src/integrationtests/test-paywall-flow.ts +++ b/packages/taler-harness/src/integrationtests/test-paywall-flow.ts @@ -27,8 +27,8 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState, harnessHttpLib } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -37,16 +37,16 @@ import { export async function runPaywallFlowTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-peer-repair.ts b/packages/taler-harness/src/integrationtests/test-peer-repair.ts index 8bc7ed0a1..22d3fe7ad 100644 --- a/packages/taler-harness/src/integrationtests/test-peer-repair.ts +++ b/packages/taler-harness/src/integrationtests/test-peer-repair.ts @@ -31,15 +31,15 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import * as fs from "node:fs"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, createWalletDaemonWithClient, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; export async function runPeerRepairTest(t: GlobalTestState) { // Set up test environment - const { bank, exchange } = await createSimpleTestkudosEnvironmentV2(t); + const { bankClient, exchange } = await createSimpleTestkudosEnvironmentV3(t); let allW1Notifications: WalletNotification[] = []; let allW2Notifications: WalletNotification[] = []; @@ -69,9 +69,9 @@ export async function runPeerRepairTest(t: GlobalTestState) { x.transactionId.startsWith("txn:withdrawal:"), ); - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient: wallet1, - bank, + bankClient, exchange, amount: "TESTKUDOS:5", }); @@ -190,9 +190,9 @@ export async function runPeerRepairTest(t: GlobalTestState) { // Now withdraw so we have enough coins to re-select - const withdraw2Res = await withdrawViaBankV2(t, { + const withdraw2Res = await withdrawViaBankV3(t, { walletClient: wallet1, - bank, + bankClient, exchange, amount: "TESTKUDOS:5", }); diff --git a/packages/taler-harness/src/integrationtests/test-peer-to-peer-pull.ts b/packages/taler-harness/src/integrationtests/test-peer-to-peer-pull.ts index e1565f295..d94c5985f 100644 --- a/packages/taler-harness/src/integrationtests/test-peer-to-peer-pull.ts +++ b/packages/taler-harness/src/integrationtests/test-peer-to-peer-pull.ts @@ -23,6 +23,7 @@ import { Duration, j2s, NotificationType, + TalerCorebankApiClient, TransactionMajorState, TransactionMinorState, TransactionType, @@ -30,15 +31,14 @@ import { } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { - BankServiceHandle, ExchangeService, GlobalTestState, WalletClient, } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, createWalletDaemonWithClient, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -47,7 +47,7 @@ import { export async function runPeerToPeerPullTest(t: GlobalTestState) { // Set up test environment - const { bank, exchange } = await createSimpleTestkudosEnvironmentV2(t); + const { bankClient, exchange } = await createSimpleTestkudosEnvironmentV3(t); let allW1Notifications: WalletNotification[] = []; let allW2Notifications: WalletNotification[] = []; @@ -71,26 +71,26 @@ export async function runPeerToPeerPullTest(t: GlobalTestState) { const wallet1 = w1.walletClient; const wallet2 = w2.walletClient; - await checkNormalPeerPull(t, bank, exchange, wallet1, wallet2); + await checkNormalPeerPull(t, bankClient, exchange, wallet1, wallet2); console.log(`w1 notifications: ${j2s(allW1Notifications)}`); // Check that we don't have an excessive number of notifications. t.assertTrue(allW1Notifications.length <= 60); - await checkAbortedPeerPull(t, bank, exchange, wallet1, wallet2); + await checkAbortedPeerPull(t, bankClient, exchange, wallet1, wallet2); } async function checkNormalPeerPull( t: GlobalTestState, - bank: BankServiceHandle, + bankClient: TalerCorebankApiClient, exchange: ExchangeService, wallet1: WalletClient, wallet2: WalletClient, ): Promise<void> { - const withdrawRes = await withdrawViaBankV2(t, { + const withdrawRes = await withdrawViaBankV3(t, { walletClient: wallet2, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); @@ -179,14 +179,14 @@ async function checkNormalPeerPull( async function checkAbortedPeerPull( t: GlobalTestState, - bank: BankServiceHandle, + bankClient: TalerCorebankApiClient, exchange: ExchangeService, wallet1: WalletClient, wallet2: WalletClient, ): Promise<void> { - const withdrawRes = await withdrawViaBankV2(t, { + const withdrawRes = await withdrawViaBankV3(t, { walletClient: wallet2, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts b/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts index 21e0d384a..e38b690ab 100644 --- a/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts +++ b/packages/taler-harness/src/integrationtests/test-peer-to-peer-push.ts @@ -31,16 +31,16 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, createWalletDaemonWithClient, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; /** * Run a test for basic peer-push payments. */ export async function runPeerToPeerPushTest(t: GlobalTestState) { - const { bank, exchange } = await createSimpleTestkudosEnvironmentV2(t); + const { bankClient, exchange } = await createSimpleTestkudosEnvironmentV3(t); let allW1Notifications: WalletNotification[] = []; let allW2Notifications: WalletNotification[] = []; @@ -60,9 +60,9 @@ export async function runPeerToPeerPushTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - const withdrawRes = await withdrawViaBankV2(t, { + const withdrawRes = await withdrawViaBankV3(t, { walletClient: w1.walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-refund-auto.ts b/packages/taler-harness/src/integrationtests/test-refund-auto.ts index 2a2e26ea4..5fcfa066a 100644 --- a/packages/taler-harness/src/integrationtests/test-refund-auto.ts +++ b/packages/taler-harness/src/integrationtests/test-refund-auto.ts @@ -21,8 +21,8 @@ import { Duration, MerchantApiClient } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -31,16 +31,16 @@ import { export async function runRefundAutoTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-refund-gone.ts b/packages/taler-harness/src/integrationtests/test-refund-gone.ts index 8a661868f..ac3a5aebe 100644 --- a/packages/taler-harness/src/integrationtests/test-refund-gone.ts +++ b/packages/taler-harness/src/integrationtests/test-refund-gone.ts @@ -28,8 +28,8 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { applyTimeTravelV2, - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -39,16 +39,16 @@ import { export async function runRefundGoneTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-refund-incremental.ts b/packages/taler-harness/src/integrationtests/test-refund-incremental.ts index 8a5d23315..2f78d7e91 100644 --- a/packages/taler-harness/src/integrationtests/test-refund-incremental.ts +++ b/packages/taler-harness/src/integrationtests/test-refund-incremental.ts @@ -26,8 +26,8 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState, delayMs } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -36,16 +36,16 @@ import { export async function runRefundIncrementalTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-refund.ts b/packages/taler-harness/src/integrationtests/test-refund.ts index 999a9b621..4b197a01f 100644 --- a/packages/taler-harness/src/integrationtests/test-refund.ts +++ b/packages/taler-harness/src/integrationtests/test-refund.ts @@ -28,8 +28,8 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; export async function runRefundTest(t: GlobalTestState) { @@ -37,18 +37,18 @@ export async function runRefundTest(t: GlobalTestState) { const { walletClient: wallet, - bank, + bankClient, exchange, merchant, - } = await createSimpleTestkudosEnvironmentV2(t); + } = await createSimpleTestkudosEnvironmentV3(t); const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); // Withdraw digital cash into the wallet. - const withdrawalRes = await withdrawViaBankV2(t, { + const withdrawalRes = await withdrawViaBankV3(t, { walletClient: wallet, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-revocation.ts b/packages/taler-harness/src/integrationtests/test-revocation.ts index ac118e4eb..ad5f89cd9 100644 --- a/packages/taler-harness/src/integrationtests/test-revocation.ts +++ b/packages/taler-harness/src/integrationtests/test-revocation.ts @@ -20,15 +20,15 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig } from "../harness/denomStructures.js"; import { - BankService, - ExchangeService, GlobalTestState, + ExchangeService, MerchantService, WalletCli, - WalletClient, + setupDb, delayMs, generateRandomPayto, - setupDb, + WalletClient, + FakebankService, } from "../harness/harness.js"; import { SimpleTestEnvironmentNg, @@ -65,7 +65,7 @@ async function createTestEnvironment( ): Promise<SimpleTestEnvironmentNg> { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts index e144683cb..b52a2cf7b 100644 --- a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts +++ b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts @@ -27,8 +27,8 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { makeNoFeeCoinConfig } from "../harness/denomStructures.js"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, generateRandomPayto, @@ -48,7 +48,7 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-timetravel-withdraw.ts b/packages/taler-harness/src/integrationtests/test-timetravel-withdraw.ts index 9cd0beb42..4ee3a86e9 100644 --- a/packages/taler-harness/src/integrationtests/test-timetravel-withdraw.ts +++ b/packages/taler-harness/src/integrationtests/test-timetravel-withdraw.ts @@ -26,8 +26,8 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -36,14 +36,14 @@ import { export async function runTimetravelWithdrawTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); // Withdraw digital cash into the wallet. - const wres1 = await withdrawViaBankV2(t, { + const wres1 = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:15", }); @@ -70,9 +70,9 @@ export async function runTimetravelWithdrawTest(t: GlobalTestState) { console.log("starting withdrawal via bank"); // This should fail, as the wallet didn't time travel yet. - const wres2 = await withdrawViaBankV2(t, { + const wres2 = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-wallet-backup-basic.ts b/packages/taler-harness/src/integrationtests/test-wallet-backup-basic.ts index cb4a50a2b..94d43e195 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-backup-basic.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-backup-basic.ts @@ -21,9 +21,9 @@ import { j2s } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, createWalletDaemonWithClient, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; import { SyncService } from "../harness/sync.js"; @@ -33,8 +33,8 @@ import { SyncService } from "../harness/sync.js"; export async function runWalletBackupBasicTest(t: GlobalTestState) { // Set up test environment - const { commonDb, merchant, walletClient, bank, exchange } = - await createSimpleTestkudosEnvironmentV2(t); + const { commonDb, merchant, walletClient, bankClient, exchange } = + await createSimpleTestkudosEnvironmentV3(t); const sync = await SyncService.create(t, { currency: "TESTKUDOS", @@ -83,9 +83,9 @@ export async function runWalletBackupBasicTest(t: GlobalTestState) { ); } - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:10", }); @@ -99,9 +99,9 @@ export async function runWalletBackupBasicTest(t: GlobalTestState) { console.log(bi); } - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:5", }); @@ -158,9 +158,9 @@ export async function runWalletBackupBasicTest(t: GlobalTestState) { t.assertAmountEquals(bal1.balances[0].available, "TESTKUDOS:14.1"); - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient: walletClient2, - bank, + bankClient, exchange, amount: "TESTKUDOS:10", }); diff --git a/packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts b/packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts index c761c4fb0..abcd71a3b 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-backup-doublespend.ts @@ -21,18 +21,18 @@ import { MerchantApiClient, PreparePayResultType } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, createWalletDaemonWithClient, makeTestPaymentV2, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; import { SyncService } from "../harness/sync.js"; export async function runWalletBackupDoublespendTest(t: GlobalTestState) { // Set up test environment - const { commonDb, merchant, walletClient, bank, exchange } = - await createSimpleTestkudosEnvironmentV2(t); + const { commonDb, merchant, walletClient, bankClient, exchange } = + await createSimpleTestkudosEnvironmentV3(t); const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); @@ -56,9 +56,9 @@ export async function runWalletBackupDoublespendTest(t: GlobalTestState) { name: sync.baseUrl, }); - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:10", }); @@ -161,9 +161,9 @@ export async function runWalletBackupDoublespendTest(t: GlobalTestState) { // FIXME: wait for a notification that indicates insufficient funds! - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient: walletClientTwo, - bank, + bankClient, exchange, amount: "TESTKUDOS:50", }); diff --git a/packages/taler-harness/src/integrationtests/test-wallet-balance-notifications.ts b/packages/taler-harness/src/integrationtests/test-wallet-balance-notifications.ts index 290ef7e2d..1586e2a72 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-balance-notifications.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-balance-notifications.ts @@ -24,7 +24,7 @@ import { } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; -import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; +import { createSimpleTestkudosEnvironmentV3 } from "../harness/helpers.js"; /** * Test behavior when an order is deleted while the wallet is paying for it. @@ -32,14 +32,17 @@ import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; export async function runWalletBalanceNotificationsTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant, walletService } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, walletService } = + await createSimpleTestkudosEnvironmentV3(t); const amount = "TESTKUDOS:20"; - const bankClient = new TalerCorebankApiClient(bank.corebankApiBaseUrl); - const user = await bankClient.createRandomBankUser(); + bankClient.setAuth({ + username: user.username, + password: user.password, + }); + const wop = await bankClient.createWithdrawalOperation(user.username, amount); // Hand it to the wallet diff --git a/packages/taler-harness/src/integrationtests/test-wallet-balance-zero.ts b/packages/taler-harness/src/integrationtests/test-wallet-balance-zero.ts index 7d65b60cf..01cf7c159 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-balance-zero.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-balance-zero.ts @@ -22,9 +22,9 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { makeNoFeeCoinConfig } from "../harness/denomStructures.js"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, makeTestPaymentV2, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -36,12 +36,12 @@ export async function runWalletBalanceZeroTest(t: GlobalTestState) { const coinConfig = makeNoFeeCoinConfig("TESTKUDOS"); console.log(`coin config ${j2s(coinConfig)}`); - const { merchant, walletClient, exchange, bank } = - await createSimpleTestkudosEnvironmentV2(t, coinConfig); + const { merchant, walletClient, exchange, bankClient } = + await createSimpleTestkudosEnvironmentV3(t, coinConfig); - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { amount: "TESTKUDOS:10", - bank, + bankClient, exchange, walletClient, }); diff --git a/packages/taler-harness/src/integrationtests/test-wallet-balance.ts b/packages/taler-harness/src/integrationtests/test-wallet-balance.ts index eb7359781..365d9495e 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-balance.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-balance.ts @@ -27,8 +27,8 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -42,8 +42,8 @@ import { export async function runWalletBalanceTest(t: GlobalTestState) { // Set up test environment - const { merchant, walletClient, exchange, bank } = - await createSimpleTestkudosEnvironmentV2(t); + const { merchant, walletClient, exchange, bankClient } = + await createSimpleTestkudosEnvironmentV3(t); await merchant.addInstanceWithWireAccount({ id: "myinst", @@ -60,9 +60,9 @@ export async function runWalletBalanceTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-wallet-blocked-deposit.ts b/packages/taler-harness/src/integrationtests/test-wallet-blocked-deposit.ts index 69b721789..66f985114 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-blocked-deposit.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-blocked-deposit.ts @@ -28,10 +28,10 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig } from "../harness/denomStructures.js"; import { GlobalTestState, generateRandomPayto } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, createWalletDaemonWithClient, makeTestPaymentV2, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; const coinCommon = { @@ -65,8 +65,8 @@ export async function runWalletBlockedDepositTest(t: GlobalTestState) { }, ]; - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t, coinConfigList); + const { bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t, coinConfigList); // Withdraw digital cash into the wallet. @@ -80,9 +80,9 @@ export async function runWalletBlockedDepositTest(t: GlobalTestState) { }, }); - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient: w1, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-wallet-cli-termination.ts b/packages/taler-harness/src/integrationtests/test-wallet-cli-termination.ts index 4f015799f..bcd7de74b 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-cli-termination.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-cli-termination.ts @@ -21,8 +21,8 @@ import { AmountString } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, WalletCli, @@ -38,7 +38,7 @@ export async function runWalletCliTerminationTest(t: GlobalTestState) { const coinConfig: CoinConfig[] = defaultCoinConfig.map((x) => x("TESTKUDOS")); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-wallet-denom-expire.ts b/packages/taler-harness/src/integrationtests/test-wallet-denom-expire.ts index 4ce8cde4c..745c01e69 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-denom-expire.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-denom-expire.ts @@ -21,8 +21,8 @@ import { Duration, Logger, NotificationType, j2s } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { makeNoFeeCoinConfig } from "../harness/denomStructures.js"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, generateRandomPayto, @@ -44,7 +44,7 @@ export async function runWalletDenomExpireTest(t: GlobalTestState) { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-wallet-gendb.ts b/packages/taler-harness/src/integrationtests/test-wallet-gendb.ts index 9e3b60899..0c0180181 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-gendb.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-gendb.ts @@ -20,8 +20,8 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, - withdrawViaBankV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, makeTestPaymentV2, } from "../harness/helpers.js"; import { @@ -42,14 +42,14 @@ import { export async function runWalletGenDbTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:50", }); diff --git a/packages/taler-harness/src/integrationtests/test-wallet-refresh.ts b/packages/taler-harness/src/integrationtests/test-wallet-refresh.ts index f1c544a4e..fbf6fe8b6 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-refresh.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-refresh.ts @@ -31,9 +31,9 @@ import { } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState, generateRandomPayto } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironmentV2, + createSimpleTestkudosEnvironmentV3, makeTestPaymentV2, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -42,14 +42,14 @@ import { export async function runWalletRefreshTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, merchant } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, merchant } = + await createSimpleTestkudosEnvironmentV3(t); // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); @@ -143,9 +143,9 @@ export async function runWalletRefreshTest(t: GlobalTestState) { ); } - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:20", }); diff --git a/packages/taler-harness/src/integrationtests/test-wallet-wirefees.ts b/packages/taler-harness/src/integrationtests/test-wallet-wirefees.ts index 1bf9bd659..361eec0f9 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-wirefees.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-wirefees.ts @@ -27,8 +27,8 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, generateRandomPayto, @@ -47,7 +47,7 @@ export async function runWalletWirefeesTest(t: GlobalTestState) { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-wallettesting.ts b/packages/taler-harness/src/integrationtests/test-wallettesting.ts index 932284d62..001081532 100644 --- a/packages/taler-harness/src/integrationtests/test-wallettesting.ts +++ b/packages/taler-harness/src/integrationtests/test-wallettesting.ts @@ -26,12 +26,12 @@ import { AmountString, Amounts, CoinStatus } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { - BankService, ExchangeService, GlobalTestState, MerchantService, setupDb, generateRandomPayto, + FakebankService, } from "../harness/harness.js"; import { SimpleTestEnvironmentNg, @@ -50,7 +50,7 @@ export async function createMyEnvironment( ): Promise<SimpleTestEnvironmentNg> { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-abort-bank.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-abort-bank.ts index 39389e3c6..5ae53b69d 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-abort-bank.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-abort-bank.ts @@ -20,7 +20,7 @@ import { TalerCorebankApiClient, TalerErrorCode } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; -import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; +import { createSimpleTestkudosEnvironmentV3 } from "../harness/helpers.js"; /** * Run test for basic, bank-integrated withdrawal. @@ -28,17 +28,14 @@ import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; export async function runWithdrawalAbortBankTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange } = + await createSimpleTestkudosEnvironmentV3(t); // Create a withdrawal operation - const bankAccessApiClient = new TalerCorebankApiClient( - bank.corebankApiBaseUrl, - ); - const user = await bankAccessApiClient.createRandomBankUser(); - bankAccessApiClient.setAuth(user); - const wop = await bankAccessApiClient.createWithdrawalOperation( + const user = await bankClient.createRandomBankUser(); + bankClient.setAuth(user); + const wop = await bankClient.createWithdrawalOperation( user.username, "TESTKUDOS:10", ); @@ -53,7 +50,7 @@ export async function runWithdrawalAbortBankTest(t: GlobalTestState) { // Abort it - await bankAccessApiClient.abortWithdrawalOperation(wop); + await bankClient.abortWithdrawalOperationV2(user.username, wop); // Withdraw diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts index 76dec50d3..fffc6def6 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts @@ -28,7 +28,7 @@ import { } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; -import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; +import { createSimpleTestkudosEnvironmentV3 } from "../harness/helpers.js"; /** * Run test for basic, bank-integrated withdrawal. @@ -36,17 +36,13 @@ import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; export async function runWithdrawalBankIntegratedTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange } = + await createSimpleTestkudosEnvironmentV3(t); // Create a withdrawal operation - - const corebankApiClient = new TalerCorebankApiClient( - bank.corebankApiBaseUrl, - ); - const user = await corebankApiClient.createRandomBankUser(); - corebankApiClient.setAuth(user); - const wop = await corebankApiClient.createWithdrawalOperation( + const user = await bankClient.createRandomBankUser(); + bankClient.setAuth(user); + const wop = await bankClient.createWithdrawalOperation( user.username, "TESTKUDOS:10", ); @@ -129,7 +125,7 @@ export async function runWithdrawalBankIntegratedTest(t: GlobalTestState) { // Confirm it - await corebankApiClient.confirmWithdrawalOperation(user.username, { + await bankClient.confirmWithdrawalOperation(user.username, { withdrawalOperationId: wop.withdrawal_id, }); diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts index 8351e5251..a0757e357 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts @@ -20,7 +20,6 @@ import { AbsoluteTime, AmountString, - Amounts, Duration, Logger, TalerBankConversionApi, @@ -34,8 +33,8 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import * as http from "node:http"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, MerchantService, generateRandomPayto, @@ -136,7 +135,7 @@ export async function runWithdrawalConversionTest(t: GlobalTestState) { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-fees.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-fees.ts index f702376e1..7ab029932 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-fees.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-fees.ts @@ -21,8 +21,8 @@ import { TalerCorebankApiClient, j2s } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig } from "../harness/denomStructures.js"; import { - BankService, ExchangeService, + FakebankService, GlobalTestState, WalletCli, setupDb, @@ -67,7 +67,7 @@ export async function runWithdrawalFeesTest(t: GlobalTestState) { const db = await setupDb(t); - const bank = await BankService.create(t, { + const bank = await FakebankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-manual.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-manual.ts index 8ab029acc..cd7d137cc 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-manual.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-manual.ts @@ -27,7 +27,7 @@ import { } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; -import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; +import { createSimpleTestkudosEnvironmentV3 } from "../harness/helpers.js"; const logger = new Logger("test-withdrawal-manual.ts"); @@ -37,16 +37,12 @@ const logger = new Logger("test-withdrawal-manual.ts"); export async function runWithdrawalManualTest(t: GlobalTestState) { // Set up test environment - const { walletClient, bank, exchange, exchangeBankAccount } = - await createSimpleTestkudosEnvironmentV2(t); + const { walletClient, bankClient, exchange, exchangeBankAccount } = + await createSimpleTestkudosEnvironmentV3(t); // Create a withdrawal operation - const bankAccessApiClient = new TalerCorebankApiClient( - bank.corebankApiBaseUrl, - ); - - const user = await bankAccessApiClient.createRandomBankUser(); + const user = await bankClient.createRandomBankUser(); await walletClient.call(WalletApiOperation.AddExchange, { exchangeBaseUrl: exchange.baseUrl, @@ -80,8 +76,8 @@ export async function runWithdrawalManualTest(t: GlobalTestState) { exchangeBankAccount.wireGatewayApiBaseUrl, { auth: { - username: exchangeBankAccount.accountName, - password: exchangeBankAccount.accountPassword, + username: "admin", + password: "adminpw", }, }, ); |