aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2024-06-05 12:47:39 -0600
committerIván Ávalos <avalos@disroot.org>2024-06-05 14:18:37 -0600
commit83d2efbe0a48ba0d8bf15ae212d7de941cd9efce (patch)
treed77862b5e796b1734a00a73322bedaf8b0cc911b /packages
parentdc5f99339c491a4f09ea7c627418cfb4b1c42990 (diff)
downloadwallet-core-83d2efbe0a48ba0d8bf15ae212d7de941cd9efce.tar.xz
harness: add libeufin support to currency-scope test
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-harness/src/integrationtests/test-currency-scope.ts71
1 files changed, 53 insertions, 18 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-currency-scope.ts b/packages/taler-harness/src/integrationtests/test-currency-scope.ts
index 69e45f678..34d18d87d 100644
--- a/packages/taler-harness/src/integrationtests/test-currency-scope.ts
+++ b/packages/taler-harness/src/integrationtests/test-currency-scope.ts
@@ -17,13 +17,14 @@
/**
* Imports.
*/
-import { Duration, j2s } from "@gnu-taler/taler-util";
+import { Duration, TalerCorebankApiClient, j2s } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { defaultCoinConfig } from "../harness/denomStructures.js";
import {
+ BankService,
ExchangeService,
- FakebankService,
GlobalTestState,
+ HarnessExchangeBankAccount,
MerchantService,
generateRandomPayto,
setupDb,
@@ -31,6 +32,7 @@ import {
import {
createWalletDaemonWithClient,
withdrawViaBankV2,
+ withdrawViaBankV3,
} from "../harness/helpers.js";
/**
@@ -44,7 +46,7 @@ export async function runCurrencyScopeTest(t: GlobalTestState) {
nameSuffix: "exchange2",
});
- const bank = await FakebankService.create(t, {
+ const bank = await BankService.create(t, {
allowRegistrations: true,
currency: "TESTKUDOS",
database: dbDefault.connStr,
@@ -72,17 +74,25 @@ export async function runCurrencyScopeTest(t: GlobalTestState) {
database: dbDefault.connStr,
});
- const exchangeOneBankAccount = await bank.createExchangeAccount(
- "myexchange",
- "x",
- );
- await exchangeOne.addBankAccount("1", exchangeOneBankAccount);
-
- const exchangeTwoBankAccount = await bank.createExchangeAccount(
- "myexchange2",
- "x",
- );
- await exchangeTwo.addBankAccount("1", exchangeTwoBankAccount);
+ let exchangeOneBankAccount: HarnessExchangeBankAccount = {
+ wireGatewayApiBaseUrl: new URL(
+ "accounts/myexchange/taler-wire-gateway/",
+ bank.corebankApiBaseUrl,
+ ).href,
+ accountName: "myexchange",
+ accountPassword: "x",
+ accountPaytoUri: generateRandomPayto("myexchange"),
+ };
+
+ let exchangeTwoBankAccount: HarnessExchangeBankAccount = {
+ wireGatewayApiBaseUrl: new URL(
+ "accounts/myexchange2/taler-wire-gateway/",
+ bank.corebankApiBaseUrl,
+ ).href,
+ accountName: "myexchange2",
+ accountPassword: "x",
+ accountPaytoUri: generateRandomPayto("myexchange2"),
+ };
bank.setSuggestedExchange(
exchangeOne,
@@ -93,6 +103,31 @@ export async function runCurrencyScopeTest(t: GlobalTestState) {
await bank.pingUntilAvailable();
+ const bankClient = new TalerCorebankApiClient(bank.corebankApiBaseUrl, {
+ auth: {
+ username: "admin",
+ password: "adminpw",
+ },
+ });
+
+ await bankClient.registerAccountExtended({
+ name: exchangeOneBankAccount.accountName,
+ username: exchangeOneBankAccount.accountName,
+ password: exchangeOneBankAccount.accountPassword,
+ is_taler_exchange: true,
+ payto_uri: exchangeOneBankAccount.accountPaytoUri,
+ });
+ await exchangeOne.addBankAccount("1", exchangeOneBankAccount);
+
+ await bankClient.registerAccountExtended({
+ name: exchangeTwoBankAccount.accountName,
+ username: exchangeTwoBankAccount.accountName,
+ password: exchangeTwoBankAccount.accountPassword,
+ is_taler_exchange: true,
+ payto_uri: exchangeTwoBankAccount.accountPaytoUri,
+ });
+ await exchangeTwo.addBankAccount("1", exchangeTwoBankAccount);
+
// Set up the first exchange
exchangeOne.addOfferedCoins(defaultCoinConfig);
@@ -139,16 +174,16 @@ export async function runCurrencyScopeTest(t: GlobalTestState) {
// Withdraw digital cash into the wallet.
- const w1 = await withdrawViaBankV2(t, {
+ const w1 = await withdrawViaBankV3(t, {
walletClient,
- bank,
+ bankClient,
exchange: exchangeOne,
amount: "TESTKUDOS:6",
});
- const w2 = await withdrawViaBankV2(t, {
+ const w2 = await withdrawViaBankV3(t, {
walletClient,
- bank,
+ bankClient,
exchange: exchangeTwo,
amount: "TESTKUDOS:6",
});