diff options
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-payment-multiple.ts')
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-payment-multiple.ts | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-payment-multiple.ts b/packages/taler-harness/src/integrationtests/test-payment-multiple.ts index a3f95518c..3c902ee17 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-multiple.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-multiple.ts @@ -17,12 +17,12 @@ /** * Imports. */ -import { MerchantApiClient } from "@gnu-taler/taler-util"; +import { MerchantApiClient, TalerCorebankApiClient } 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, @@ -30,17 +30,17 @@ import { } from "../harness/harness.js"; import { createWalletDaemonWithClient, - withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; async function setupTest(t: GlobalTestState): Promise<{ merchant: MerchantService; exchange: ExchangeService; - bank: FakebankService; + bankClient: TalerCorebankApiClient; }> { const db = await setupDb(t); - const bank = await FakebankService.create(t, { + const bank = await BankService.create(t, { allowRegistrations: true, currency: "TESTKUDOS", database: db.connStr, @@ -54,20 +54,40 @@ async function setupTest(t: GlobalTestState): Promise<{ database: db.connStr, }); - const exchangeBankAccount = await bank.createExchangeAccount( - "myexchange", - "x", - ); - exchange.addOfferedCoins([coin_ct10, coin_u1]); - bank.setSuggestedExchange(exchange, exchangeBankAccount.accountPaytoUri); + let receiverName = "Exchange"; + let exchangeBankUsername = "exchange"; + let exchangeBankPassword = "mypw"; + let exchangePaytoUri = generateRandomPayto(exchangeBankUsername); + + await exchange.addBankAccount("1", { + accountName: exchangeBankUsername, + accountPassword: exchangeBankPassword, + wireGatewayApiBaseUrl: new URL("accounts/exchange/taler-wire-gateway/", bank.baseUrl).href, + accountPaytoUri: exchangePaytoUri, + }); + + bank.setSuggestedExchange(exchange, exchangePaytoUri); await bank.start(); await bank.pingUntilAvailable(); - await exchange.addBankAccount("1", exchangeBankAccount); + 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, + }); await exchange.start(); await exchange.pingUntilAvailable(); @@ -100,7 +120,7 @@ async function setupTest(t: GlobalTestState): Promise<{ return { merchant, - bank, + bankClient, exchange, }; } @@ -113,7 +133,7 @@ async function setupTest(t: GlobalTestState): Promise<{ export async function runPaymentMultipleTest(t: GlobalTestState) { // Set up test environment - const { merchant, bank, exchange } = await setupTest(t); + const { merchant, bankClient, exchange } = await setupTest(t); const { walletClient } = await createWalletDaemonWithClient(t, { name: "default", @@ -123,9 +143,9 @@ export async function runPaymentMultipleTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV3(t, { walletClient, - bank, + bankClient, exchange, amount: "TESTKUDOS:100", }); |