diff options
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-wallet-notifications.ts')
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-wallet-notifications.ts | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-wallet-notifications.ts b/packages/taler-harness/src/integrationtests/test-wallet-notifications.ts index c87a9a264..5088c8228 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-notifications.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-notifications.ts @@ -26,12 +26,13 @@ import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { + BankService, ExchangeService, - FakebankService, GlobalTestState, MerchantService, WalletClient, WalletService, + generateRandomPayto, generateRandomTestIban, setupDb, } from "../harness/harness.js"; @@ -44,7 +45,7 @@ export async function runWalletNotificationsTest(t: GlobalTestState) { const db = await setupDb(t); - const bank = await FakebankService.create(t, { + const bank = await BankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, @@ -58,6 +59,11 @@ export async function runWalletNotificationsTest(t: GlobalTestState) { database: db.connStr, }); + let receiverName = "Exchange"; + let exchangeBankUsername = "exchange"; + let exchangeBankPassword = "mypw"; + let exchangePaytoUri = generateRandomPayto(exchangeBankUsername); + const merchant = await MerchantService.create(t, { name: "testmerchant-1", currency: "TESTKUDOS", @@ -65,18 +71,34 @@ export async function runWalletNotificationsTest(t: GlobalTestState) { database: db.connStr, }); - const exchangeBankAccount = await bank.createExchangeAccount( - "myexchange", - "x", - ); - exchange.addBankAccount("1", exchangeBankAccount); + await exchange.addBankAccount("1", { + accountName: exchangeBankUsername, + accountPassword: exchangeBankPassword, + wireGatewayApiBaseUrl: new URL("accounts/exchange/taler-wire-gateway/", bank.baseUrl).href, + accountPaytoUri: exchangePaytoUri, + }); - bank.setSuggestedExchange(exchange, exchangeBankAccount.accountPaytoUri); + bank.setSuggestedExchange(exchange, exchangePaytoUri); await bank.start(); await bank.pingUntilAvailable(); + const bankClient = new TalerCorebankApiClient(bank.corebankApiBaseUrl, { + auth: { + username: "admin", + password: "adminpw", + }, + }); + + await bankClient.registerAccountExtended({ + name: receiverName, + password: exchangeBankPassword, + username: exchangeBankUsername, + is_taler_exchange: true, + payto_uri: exchangePaytoUri, + }); + const coinConfig: CoinConfig[] = defaultCoinConfig.map((x) => x("TESTKUDOS")); exchange.addCoinConfigList(coinConfig); @@ -111,6 +133,7 @@ export async function runWalletNotificationsTest(t: GlobalTestState) { await walletService.pingUntilAvailable(); const walletClient = new WalletClient({ + name: "wallet", unixPath: walletService.socketPath, onNotification(n) { console.log("got notification", n); @@ -118,15 +141,16 @@ export async function runWalletNotificationsTest(t: GlobalTestState) { }); await walletClient.connect(); await walletClient.client.call(WalletApiOperation.InitWallet, { - skipDefaults: true, + config: { + testing: { + skipDefaults: true, + } + } }); - 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:20", ); @@ -161,7 +185,7 @@ export async function runWalletNotificationsTest(t: GlobalTestState) { // Confirm it - await bankAccessApiClient.confirmWithdrawalOperation(user.username, { + await bankClient.confirmWithdrawalOperation(user.username, { withdrawalOperationId: wop.withdrawal_id, }); |