diff options
Diffstat (limited to 'packages/taler-harness')
-rw-r--r-- | packages/taler-harness/src/harness/harness.ts | 3 | ||||
-rw-r--r-- | packages/taler-harness/src/harness/helpers.ts | 34 | ||||
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-payment.ts | 10 |
3 files changed, 18 insertions, 29 deletions
diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts index ac65844bc..d7ec4c2f6 100644 --- a/packages/taler-harness/src/harness/harness.ts +++ b/packages/taler-harness/src/harness/harness.ts @@ -779,6 +779,9 @@ export class LibeufinBankService config.setString("libeufin-bank", "currency", bc.currency); config.setString("libeufin-bank", "port", `${bc.httpPort}`); config.setString("libeufin-bank", "serve", "tcp"); + config.setString("libeufin-bank", "wire_type", "x-taler-bank"); + config.setString("libeufin-bank", "x_taler_bank_payto_hostname", "localhost"); + config.setString("libeufin-bank", "default_debt_limit", bc.maxDebt ?? `${bc.currency}:100`); config.setString( "libeufin-bank", "DEFAULT_DEBT_LIMIT", diff --git a/packages/taler-harness/src/harness/helpers.ts b/packages/taler-harness/src/harness/helpers.ts index 8891a9316..2763ad0a5 100644 --- a/packages/taler-harness/src/harness/helpers.ts +++ b/packages/taler-harness/src/harness/helpers.ts @@ -448,13 +448,10 @@ export async function createSimpleTestkudosEnvironmentV3( database: db.connStr, }); - const receiverName = "exchange"; + const receiverName = "Exchange"; const exchangeBankUsername = "exchange"; const exchangeBankPassword = "mypw"; - const exchangePlainPayto = opts.withLibeufin === true - ? `payto://iban/SANDBOXX/${generateRandomTestIban()}` - : `payto://x-taler-bank/localhost/${receiverName}` - const exchangeExtendedPayto = `${exchangePlainPayto}?receiver-name=${receiverName}` + const exchangePaytoUri = generateRandomPayto(exchangeBankUsername); const wireGatewayApiBaseUrl = new URL( "accounts/exchange/taler-wire-gateway/", bank.corebankApiBaseUrl, @@ -464,10 +461,10 @@ export async function createSimpleTestkudosEnvironmentV3( wireGatewayApiBaseUrl, accountName: exchangeBankUsername, accountPassword: exchangeBankPassword, - accountPaytoUri: exchangeExtendedPayto, - } + accountPaytoUri: exchangePaytoUri, + }; - exchange.addBankAccount("1", exchangeBankAccount); + await exchange.addBankAccount("1", exchangeBankAccount); bank.setSuggestedExchange(exchange, exchangeBankAccount.accountPaytoUri); @@ -801,18 +798,13 @@ export async function withdrawViaBankV3( ): Promise<WithdrawViaBankResult> { const { walletClient: wallet, bankClient, exchange, amount } = p; - console.log("line 804") - const user = await bankClient.createRandomBankUser(); - const bankClient2 = new TalerCorebankApiClient(bankClient.baseUrl, { - auth: { - username: user.username, - password: user.password, - } + bankClient.setAuth({ + username: user.username, + password: user.password, }); - const wop = await bankClient2.createWithdrawalOperation(user.username, amount); - console.log("line 815") + const wop = await bankClient.createWithdrawalOperation(user.username, amount); // Hand it to the wallet @@ -821,8 +813,6 @@ export async function withdrawViaBankV3( restrictAge: p.restrictAge, }); - console.log("line 824") - // Withdraw (AKA select) const acceptRes = await wallet.client.call( @@ -834,8 +824,6 @@ export async function withdrawViaBankV3( }, ); - console.log("line 837") - const withdrawalFinishedCond = wallet.waitForNotificationCond( (x) => x.type === NotificationType.TransactionStateTransition && @@ -843,11 +831,9 @@ export async function withdrawViaBankV3( x.transactionId === acceptRes.transactionId, ); - console.log("line 846") - // Confirm it - await bankClient2.confirmWithdrawalOperation(user.username, { + await bankClient.confirmWithdrawalOperation(user.username, { withdrawalOperationId: wop.withdrawal_id, }); diff --git a/packages/taler-harness/src/integrationtests/test-payment.ts b/packages/taler-harness/src/integrationtests/test-payment.ts index da9f97bf4..651d0edfa 100644 --- a/packages/taler-harness/src/integrationtests/test-payment.ts +++ b/packages/taler-harness/src/integrationtests/test-payment.ts @@ -24,6 +24,7 @@ import { createSimpleTestkudosEnvironmentV3, makeTestPaymentV2, withdrawViaBankV2, + withdrawViaBankV3, } from "../harness/helpers.js"; /** @@ -32,24 +33,23 @@ import { export async function runPaymentTest(t: GlobalTestState) { // Set up test environment - const { bank, walletClient, exchange, merchant } = + const { bankClient, walletClient, exchange, merchant } = await createSimpleTestkudosEnvironmentV3(t, undefined, { withLibeufin: false, }); // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + t.assertTrue(bankClient !== undefined); + await withdrawViaBankV3(t, { walletClient, exchange, amount: "TESTKUDOS:20", - bank, + bankClient, }); await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); - console.log("line 51"); - const order = { summary: "Buy me!", amount: "TESTKUDOS:5", |