diff options
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts')
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts index 8351e5251..c55e1faf0 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,9 +33,11 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import * as http from "node:http"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { - BankService, + BankService, ExchangeService, + FakebankService, GlobalTestState, + HarnessExchangeBankAccount, MerchantService, generateRandomPayto, setupDb, @@ -102,7 +103,7 @@ async function runTestfakeConversionService(): Promise<TestfakeConversionService cashout_ratio: "1", cashout_rounding_mode: "zero", cashout_tiny_amount: "A:1" as AmountString, - } + }, } satisfies TalerBankConversionApi.IntegrationConfig), ); } else if (path === "/cashin-rate") { @@ -157,17 +158,40 @@ export async function runWithdrawalConversionTest(t: GlobalTestState) { database: db.connStr, }); - const exchangeBankAccount = await bank.createExchangeAccount( - "myexchange", - "x", - ); - exchangeBankAccount.conversionUrl = "http://localhost:8071/"; + let exchangeBankAccount: HarnessExchangeBankAccount = { + wireGatewayApiBaseUrl: new URL( + "accounts/myexchange/taler-wire-gateway/", + bank.corebankApiBaseUrl, + ).href, + accountName: "myexchange", + accountPassword: "x", + accountPaytoUri: generateRandomPayto("myexchange"), + conversionUrl: "http://localhost:8071/", + }; + await exchange.addBankAccount("1", exchangeBankAccount); await bank.start(); await bank.pingUntilAvailable(); + const bankClientAuth = { + username: "admin", + password: "adminpw", + }; + + const bankClient = new TalerCorebankApiClient(bank.corebankApiBaseUrl, { + auth: bankClientAuth, + }); + + await bankClient.registerAccountExtended({ + name: exchangeBankAccount.accountName, + username: exchangeBankAccount.accountName, + password: exchangeBankAccount.accountPassword, + is_taler_exchange: true, + payto_uri: exchangeBankAccount.accountPaytoUri, + }); + exchange.addOfferedCoins(defaultCoinConfig); await exchange.start(); @@ -195,7 +219,7 @@ export async function runWithdrawalConversionTest(t: GlobalTestState) { ), }); - const { walletClient, walletService } = await createWalletDaemonWithClient( + const { walletClient } = await createWalletDaemonWithClient( t, { name: "wallet" }, ); @@ -204,11 +228,7 @@ export async function runWithdrawalConversionTest(t: GlobalTestState) { // 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, @@ -278,10 +298,7 @@ export async function runWithdrawalConversionTest(t: GlobalTestState) { const wireGatewayApiClient = new WireGatewayApiClient( exchangeBankAccount.wireGatewayApiBaseUrl, { - auth: { - username: exchangeBankAccount.accountName, - password: exchangeBankAccount.accountPassword, - }, + auth: bankClientAuth, }, ); |