aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/integrationtests/test-revocation.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-revocation.ts')
-rw-r--r--packages/taler-harness/src/integrationtests/test-revocation.ts62
1 files changed, 45 insertions, 17 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-revocation.ts b/packages/taler-harness/src/integrationtests/test-revocation.ts
index ad5f89cd9..e0f77a445 100644
--- a/packages/taler-harness/src/integrationtests/test-revocation.ts
+++ b/packages/taler-harness/src/integrationtests/test-revocation.ts
@@ -28,14 +28,16 @@ import {
delayMs,
generateRandomPayto,
WalletClient,
- FakebankService,
+ BankService,
} from "../harness/harness.js";
import {
SimpleTestEnvironmentNg,
+ SimpleTestEnvironmentNg3,
createWalletDaemonWithClient,
makeTestPaymentV2,
- withdrawViaBankV2,
+ withdrawViaBankV3,
} from "../harness/helpers.js";
+import { TalerCorebankApiClient } from "@gnu-taler/taler-util";
async function revokeAllWalletCoins(req: {
walletClient: WalletClient;
@@ -62,10 +64,10 @@ async function revokeAllWalletCoins(req: {
async function createTestEnvironment(
t: GlobalTestState,
-): Promise<SimpleTestEnvironmentNg> {
+): Promise<SimpleTestEnvironmentNg3> {
const db = await setupDb(t);
- const bank = await FakebankService.create(t, {
+ const bank = await BankService.create(t, {
allowRegistrations: true,
currency: "TESTKUDOS",
database: db.connStr,
@@ -86,18 +88,39 @@ async function createTestEnvironment(
database: db.connStr,
});
- const exchangeBankAccount = await bank.createExchangeAccount(
- "myexchange",
- "x",
- );
- exchange.addBankAccount("1", exchangeBankAccount);
+ 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, 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 coin_u1: CoinConfig = {
cipher: "RSA" as const,
durationLegal: "3 years",
@@ -151,8 +174,13 @@ async function createTestEnvironment(
merchant,
walletClient,
walletService,
- bank,
- exchangeBankAccount,
+ bankClient,
+ exchangeBankAccount: {
+ accountName: '',
+ accountPassword: '',
+ accountPaytoUri: '',
+ wireGatewayApiBaseUrl: '',
+ },
};
}
@@ -162,14 +190,14 @@ async function createTestEnvironment(
export async function runRevocationTest(t: GlobalTestState) {
// Set up test environment
- const { walletClient, bank, exchange, merchant } =
+ const { walletClient, bankClient, exchange, merchant } =
await createTestEnvironment(t);
// Withdraw digital cash into the wallet.
- const wres = await withdrawViaBankV2(t, {
+ const wres = await withdrawViaBankV3(t, {
walletClient,
- bank,
+ bankClient,
exchange,
amount: "TESTKUDOS:15",
});
@@ -197,9 +225,9 @@ export async function runRevocationTest(t: GlobalTestState) {
await walletClient.call(WalletApiOperation.ClearDb, {});
- await withdrawViaBankV2(t, {
+ await withdrawViaBankV3(t, {
walletClient,
- bank,
+ bankClient,
exchange,
amount: "TESTKUDOS:15",
});