aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/integrationtests/test-payment-fault.ts
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2024-04-10 22:26:07 -0600
committerIván Ávalos <avalos@disroot.org>2024-05-15 09:41:30 -0600
commit9e54425cc66e7522198ba0010fea42afb6ba0e6c (patch)
tree27613b90d5378dd7ea6e7a38bff2515caab93364 /packages/taler-harness/src/integrationtests/test-payment-fault.ts
parente20eb6003873b520ba121f36476e25a3096010bc (diff)
downloadwallet-core-9e54425cc66e7522198ba0010fea42afb6ba0e6c.tar.xz
harness: make more tests run against libeufin
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-payment-fault.ts')
-rw-r--r--packages/taler-harness/src/integrationtests/test-payment-fault.ts45
1 files changed, 33 insertions, 12 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-payment-fault.ts b/packages/taler-harness/src/integrationtests/test-payment-fault.ts
index c48b8e2a2..abb589477 100644
--- a/packages/taler-harness/src/integrationtests/test-payment-fault.ts
+++ b/packages/taler-harness/src/integrationtests/test-payment-fault.ts
@@ -21,7 +21,7 @@
/**
* Imports.
*/
-import { ConfirmPayResultType, MerchantApiClient } from "@gnu-taler/taler-util";
+import { ConfirmPayResultType, MerchantApiClient, TalerCorebankApiClient } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { defaultCoinConfig } from "../harness/denomStructures.js";
import {
@@ -30,8 +30,8 @@ import {
FaultInjectionResponseContext,
} from "../harness/faultInjection.js";
import {
+ BankService,
ExchangeService,
- FakebankService,
GlobalTestState,
MerchantService,
generateRandomPayto,
@@ -39,7 +39,7 @@ import {
} from "../harness/harness.js";
import {
createWalletDaemonWithClient,
- withdrawViaBankV2,
+ withdrawViaBankV3,
} from "../harness/helpers.js";
/**
@@ -50,7 +50,7 @@ export async function runPaymentFaultTest(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,
@@ -64,10 +64,17 @@ export async function runPaymentFaultTest(t: GlobalTestState) {
database: db.connStr,
});
- const exchangeBankAccount = await bank.createExchangeAccount(
- "myexchange",
- "x",
- );
+ 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,
+ });
const faultyExchange = new FaultInjectedExchangeService(t, exchange, 8091);
// Base URL must contain port that the proxy is listening on.
@@ -77,14 +84,28 @@ export async function runPaymentFaultTest(t: GlobalTestState) {
bank.setSuggestedExchange(
faultyExchange,
- exchangeBankAccount.accountPaytoUri,
+ 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,
+ });
+
exchange.addOfferedCoins(defaultCoinConfig);
await exchange.start();
@@ -128,9 +149,9 @@ export async function runPaymentFaultTest(t: GlobalTestState) {
await walletClient.call(WalletApiOperation.GetBalances, {});
- const wres = await withdrawViaBankV2(t, {
+ const wres = await withdrawViaBankV3(t, {
walletClient,
- bank,
+ bankClient,
exchange: faultyExchange,
amount: "TESTKUDOS:20",
});