diff options
author | Florian Dold <florian@dold.me> | 2022-10-13 15:14:49 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2022-10-13 15:14:49 +0200 |
commit | 83d4a1addc313f71a71463f7811f1fcc622b51b6 (patch) | |
tree | 6643f8fb7312e8fdeeb7f6f85b07b1a5f2ca376c /packages/taler-wallet-cli/src | |
parent | b0223d662add93bf1b2199b51d6290ba5dadf1e7 (diff) | |
download | wallet-core-83d4a1addc313f71a71463f7811f1fcc622b51b6.tar.xz |
use node16 for wallet-core, delete unused taler-config-lib package
Diffstat (limited to 'packages/taler-wallet-cli/src')
40 files changed, 233 insertions, 210 deletions
diff --git a/packages/taler-wallet-cli/src/harness/harness.ts b/packages/taler-wallet-cli/src/harness/harness.ts index eac55281b..a5b519ec3 100644 --- a/packages/taler-wallet-cli/src/harness/harness.ts +++ b/packages/taler-wallet-cli/src/harness/harness.ts @@ -55,7 +55,7 @@ import { WalletCoreApiClient, } from "@gnu-taler/taler-wallet-core"; import { deepStrictEqual } from "assert"; -import axios, { AxiosError } from "axios"; +import axiosImp, { AxiosError } from "axios"; import { ChildProcess, spawn } from "child_process"; import * as fs from "fs"; import * as http from "http"; @@ -79,6 +79,8 @@ import { const exec = util.promisify(require("child_process").exec); +const axios = axiosImp.default; + export async function delayMs(ms: number): Promise<void> { return new Promise((resolve, reject) => { setTimeout(() => resolve(), ms); diff --git a/packages/taler-wallet-cli/src/harness/libeufin-apis.ts b/packages/taler-wallet-cli/src/harness/libeufin-apis.ts index 13d27c467..538d8e93f 100644 --- a/packages/taler-wallet-cli/src/harness/libeufin-apis.ts +++ b/packages/taler-wallet-cli/src/harness/libeufin-apis.ts @@ -1,4 +1,3 @@ - /** * This file defines most of the API calls offered * by Nexus and Sandbox. They don't have state, @@ -6,8 +5,8 @@ * the services get actually started and managed. */ - -import axios from "axios"; +import axiosImp from "axios"; +const axios = axiosImp.default; import { URL } from "@gnu-taler/taler-util"; export interface LibeufinSandboxServiceInterface { @@ -80,7 +79,6 @@ export interface PostNexusPermissionRequest { }; } - export interface CreateAnastasisFacadeRequest { name: string; connectionName: string; @@ -135,7 +133,6 @@ export interface SimulateIncomingTransactionRequest { amount: string; } - export interface CreateEbicsBankAccountRequest { subscriber: { hostID: string; @@ -171,7 +168,6 @@ function getRandomString(): string { } export namespace LibeufinSandboxApi { - /** * Return balance and payto-address of 'accountLabel'. * Note: the demobank serving the request is hard-coded @@ -182,14 +178,17 @@ export namespace LibeufinSandboxApi { username: string, password: string, libeufinSandboxService: LibeufinSandboxServiceInterface, - accountLabel: string + accountLabel: string, ) { - let url = new URL(`accounts/${accountLabel}`,libeufinSandboxService.baseUrl); + let url = new URL( + `accounts/${accountLabel}`, + libeufinSandboxService.baseUrl, + ); return await axios.get(url.href, { auth: { username: username, - password: password - } + password: password, + }, }); } @@ -199,10 +198,10 @@ export namespace LibeufinSandboxApi { password: string, libeufinSandboxService: LibeufinSandboxServiceInterface, ) { - let url = new URL("testing/register", libeufinSandboxService.baseUrl); + let url = new URL("testing/register", libeufinSandboxService.baseUrl); await axios.post(url.href, { username: username, - password: password + password: password, }); } @@ -215,17 +214,21 @@ export namespace LibeufinSandboxApi { ) { // baseUrl should already be pointed to one demobank. let url = new URL("ebics/subscribers", libeufinSandboxService.baseUrl); - await axios.post(url.href, { - userID: req.userID, - hostID: req.hostID, - partnerID: req.partnerID, - demobankAccountLabel: demobankAccountLabel, - }, { - auth: { - username: "admin", - password: "secret", + await axios.post( + url.href, + { + userID: req.userID, + hostID: req.hostID, + partnerID: req.partnerID, + demobankAccountLabel: demobankAccountLabel, }, - }); + { + auth: { + username: "admin", + password: "secret", + }, + }, + ); } export async function rotateKeys( @@ -234,12 +237,16 @@ export namespace LibeufinSandboxApi { ) { const baseUrl = libeufinSandboxService.baseUrl; let url = new URL(`admin/ebics/hosts/${hostID}/rotate-keys`, baseUrl); - await axios.post(url.href, {}, { - auth: { - username: "admin", - password: "secret", + await axios.post( + url.href, + {}, + { + auth: { + username: "admin", + password: "secret", + }, }, - }); + ); } export async function createEbicsHost( libeufinSandboxService: LibeufinSandboxServiceInterface, @@ -247,16 +254,19 @@ export namespace LibeufinSandboxApi { ) { const baseUrl = libeufinSandboxService.baseUrl; let url = new URL("admin/ebics/hosts", baseUrl); - await axios.post(url.href, { - hostID, - ebicsVersion: "2.5", - }, - { - auth: { - username: "admin", - password: "secret", + await axios.post( + url.href, + { + hostID, + ebicsVersion: "2.5", }, - }); + { + auth: { + username: "admin", + password: "secret", + }, + }, + ); } export async function createBankAccount( @@ -347,16 +357,19 @@ export namespace LibeufinSandboxApi { ): Promise<any> { const baseUrl = libeufinSandboxService.baseUrl; let url = new URL("admin/payments/camt", baseUrl); - return await axios.post(url.href, { - bankaccount: accountLabel, - type: 53, - }, - { - auth: { - username: "admin", - password: "secret", + return await axios.post( + url.href, + { + bankaccount: accountLabel, + type: 53, }, - }); + { + auth: { + username: "admin", + password: "secret", + }, + }, + ); } export async function getAccountInfoWithBalance( @@ -364,10 +377,7 @@ export namespace LibeufinSandboxApi { accountLabel: string, ): Promise<any> { const baseUrl = libeufinSandboxService.baseUrl; - let url = new URL( - `admin/bank-accounts/${accountLabel}`, - baseUrl, - ); + let url = new URL(`admin/bank-accounts/${accountLabel}`, baseUrl); return await axios.get(url.href, { auth: { username: "admin", @@ -439,22 +449,15 @@ export namespace LibeufinNexusApi { accountName: string, ): Promise<any> { const baseUrl = libeufinNexusService.baseUrl; - let url = new URL( - `bank-accounts/${accountName}`, - baseUrl, - ); - return await axios.get( - url.href, - { - auth: { - username: "admin", - password: "test", - }, + let url = new URL(`bank-accounts/${accountName}`, baseUrl); + return await axios.get(url.href, { + auth: { + username: "admin", + password: "test", }, - ); + }); } - export async function submitInitiatedPayment( libeufinNexusService: LibeufinNexusServiceInterface, accountName: string, @@ -582,7 +585,8 @@ export namespace LibeufinNexusApi { password: string = "test", ): Promise<any> { let url = new URL("history/incoming", anastasisBaseUrl); - let response = await axios.get(url.href, { params: params, + let response = await axios.get(url.href, { + params: params, auth: { username: username, password: password, @@ -854,4 +858,3 @@ export namespace LibeufinNexusApi { ); } } - diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts index 09ab414ac..6ae78bd47 100644 --- a/packages/taler-wallet-cli/src/index.ts +++ b/packages/taler-wallet-cli/src/index.ts @@ -59,7 +59,7 @@ import { WalletCoreApiClient, walletCoreDebugFlags, } from "@gnu-taler/taler-wallet-core"; -import type { TalerCryptoInterface } from "@gnu-taler/taler-wallet-core/src/crypto/cryptoImplementation"; +import type { TalerCryptoInterface } from "@gnu-taler/taler-wallet-core"; import { TextDecoder, TextEncoder } from "util"; import { runBench1 } from "./bench1.js"; import { runBench2 } from "./bench2.js"; @@ -68,7 +68,6 @@ import { runEnv1 } from "./env1.js"; import { GlobalTestState, runTestWithState } from "./harness/harness.js"; import { getTestInfo, runTests } from "./integrationtests/testrunner.js"; import { lintExchangeDeployment } from "./lint.js"; -import { checkLogicInvariant } from "@gnu-taler/taler-wallet-core/src/util/invariants.js"; // @ts-ignore global.TextEncoder = TextEncoder; // @ts-ignore diff --git a/packages/taler-wallet-cli/src/integrationtests/test-bank-api.ts b/packages/taler-wallet-cli/src/integrationtests/test-bank-api.ts index ab7ea1132..c7a23d3ce 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-bank-api.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-bank-api.ts @@ -27,7 +27,7 @@ import { getPayto, } from "../harness/harness.js"; import { createEddsaKeyPair, encodeCrock } from "@gnu-taler/taler-util"; -import { defaultCoinConfig } from "../harness/denomStructures"; +import { defaultCoinConfig } from "../harness/denomStructures.js"; import { BankApi, BankAccessApi, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-exchange-timetravel.ts b/packages/taler-wallet-cli/src/integrationtests/test-exchange-timetravel.ts index e2b81ee6a..074126e9f 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-exchange-timetravel.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-exchange-timetravel.ts @@ -28,7 +28,7 @@ import { NodeHttpLib, readSuccessResponseJsonOrThrow, } from "@gnu-taler/taler-wallet-core"; -import { makeNoFeeCoinConfig } from "../harness/denomStructures"; +import { makeNoFeeCoinConfig } from "../harness/denomStructures.js"; import { BankService, ExchangeService, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts index cb57c7d0a..26fecd77e 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts @@ -25,7 +25,7 @@ import { LibeufinSandboxService, LibeufinSandboxApi, findNexusPayment, -} from "../harness/libeufin"; +} from "../harness/libeufin.js"; /** * Run basic test with LibEuFin. diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankconnection.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankconnection.ts index f1d507c03..912b7b2ac 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankconnection.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankconnection.ts @@ -18,14 +18,7 @@ * Imports. */ import { GlobalTestState } from "../harness/harness.js"; -import { - NexusUserBundle, - LibeufinNexusApi, - LibeufinNexusService, - LibeufinSandboxService, - LibeufinSandboxApi, - findNexusPayment, -} from "../harness/libeufin"; +import { LibeufinNexusApi, LibeufinNexusService } from "../harness/libeufin.js"; /** * Run basic test with LibEuFin. diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-facade-bad-request.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-facade-bad-request.ts index b106cf304..a1da9e0da 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-facade-bad-request.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-facade-bad-request.ts @@ -17,18 +17,18 @@ /** * Imports. */ -import axios from "axios"; import { URL } from "@gnu-taler/taler-util"; +import axiosImp from "axios"; import { GlobalTestState } from "../harness/harness.js"; import { - SandboxUserBundle, - NexusUserBundle, launchLibeufinServices, - LibeufinNexusApi, -} from "../harness/libeufin"; + NexusUserBundle, + SandboxUserBundle, +} from "../harness/libeufin.js"; -export async function runLibeufinApiFacadeBadRequestTest(t: GlobalTestState) { +const axios = axiosImp.default; +export async function runLibeufinApiFacadeBadRequestTest(t: GlobalTestState) { /** * User saltetd "01" */ @@ -37,7 +37,7 @@ export async function runLibeufinApiFacadeBadRequestTest(t: GlobalTestState) { "http://localhost:5010/ebicsweb", ); const user01sandbox = new SandboxUserBundle("01"); - + /** * Launch Sandbox and Nexus. */ diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-facade.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-facade.ts index c49d49712..946c565d4 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-facade.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-facade.ts @@ -23,7 +23,7 @@ import { NexusUserBundle, launchLibeufinServices, LibeufinNexusApi, -} from "../harness/libeufin"; +} from "../harness/libeufin.js"; /** * Run basic test with LibEuFin. diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-permissions.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-permissions.ts index e64f459a0..f8f2d7d80 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-permissions.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-permissions.ts @@ -22,7 +22,7 @@ import { NexusUserBundle, LibeufinNexusApi, LibeufinNexusService, -} from "../harness/libeufin"; +} from "../harness/libeufin.js"; /** * Run basic test with LibEuFin. diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-camt.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-camt.ts index 3e0acb62d..250d17d3d 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-camt.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-camt.ts @@ -19,19 +19,14 @@ */ import { GlobalTestState } from "../harness/harness.js"; import { - NexusUserBundle, - LibeufinNexusApi, - LibeufinNexusService, - LibeufinSandboxService, LibeufinSandboxApi, - findNexusPayment, -} from "../harness/libeufin"; + LibeufinSandboxService, +} from "../harness/libeufin.js"; // This test only checks that LibEuFin doesn't fail when // it generates Camt statements - no assertions take place. // Furthermore, it prints the Camt.053 being generated. export async function runLibeufinApiSandboxCamtTest(t: GlobalTestState) { - const sandbox = await LibeufinSandboxService.create(t, { httpPort: 5012, databaseJdbcUri: `jdbc:sqlite:${t.testDir}/libeufin-sandbox.sqlite3`, @@ -50,10 +45,30 @@ export async function runLibeufinApiSandboxCamtTest(t: GlobalTestState) { name: "Mock Name", label: "mock-account-1", }); - await sandbox.makeTransaction("mock-account-0", "mock-account-1", "EUR:1", "+1"); - await sandbox.makeTransaction("mock-account-0", "mock-account-1", "EUR:1", "+1"); - await sandbox.makeTransaction("mock-account-0", "mock-account-1", "EUR:1", "+1"); - await sandbox.makeTransaction("mock-account-1", "mock-account-0", "EUR:5", "minus 5"); + await sandbox.makeTransaction( + "mock-account-0", + "mock-account-1", + "EUR:1", + "+1", + ); + await sandbox.makeTransaction( + "mock-account-0", + "mock-account-1", + "EUR:1", + "+1", + ); + await sandbox.makeTransaction( + "mock-account-0", + "mock-account-1", + "EUR:1", + "+1", + ); + await sandbox.makeTransaction( + "mock-account-1", + "mock-account-0", + "EUR:5", + "minus 5", + ); await sandbox.c53tick(); let ret = await LibeufinSandboxApi.getCamt053(sandbox, "mock-account-1"); console.log(ret); diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-transactions.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-transactions.ts index 859d26f00..224c45970 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-transactions.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-transactions.ts @@ -19,16 +19,13 @@ */ import { GlobalTestState } from "../harness/harness.js"; import { - NexusUserBundle, - LibeufinNexusApi, - LibeufinNexusService, - LibeufinSandboxService, LibeufinSandboxApi, - findNexusPayment, -} from "../harness/libeufin"; - -export async function runLibeufinApiSandboxTransactionsTest(t: GlobalTestState) { + LibeufinSandboxService, +} from "../harness/libeufin.js"; +export async function runLibeufinApiSandboxTransactionsTest( + t: GlobalTestState, +) { const sandbox = await LibeufinSandboxService.create(t, { httpPort: 5012, databaseJdbcUri: `jdbc:sqlite:${t.testDir}/libeufin-sandbox.sqlite3`, @@ -42,30 +39,31 @@ export async function runLibeufinApiSandboxTransactionsTest(t: GlobalTestState) label: "mock-account", }); await LibeufinSandboxApi.simulateIncomingTransaction( - sandbox, + sandbox, "mock-account", { - debtorIban: "DE84500105176881385584", debtorBic: "BELADEBEXXX", debtorName: "mock2", subject: "mock subject", - amount: "1" // EUR is default. - } - ) + amount: "1", // EUR is default. + }, + ); await LibeufinSandboxApi.simulateIncomingTransaction( - sandbox, + sandbox, "mock-account", { - debtorIban: "DE84500105176881385584", debtorBic: "BELADEBEXXX", debtorName: "mock2", subject: "mock subject 2", - amount: "1.1" // EUR is default. - } - ) - let ret = await LibeufinSandboxApi.getAccountInfoWithBalance(sandbox, "mock-account"); + amount: "1.1", // EUR is default. + }, + ); + let ret = await LibeufinSandboxApi.getAccountInfoWithBalance( + sandbox, + "mock-account", + ); t.assertAmountEquals(ret.data.balance, "EUR:2.1"); } runLibeufinApiSandboxTransactionsTest.suites = ["libeufin"]; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-scheduling.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-scheduling.ts index 3863c5711..95f4bfaa0 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-scheduling.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-scheduling.ts @@ -17,15 +17,14 @@ /** * Imports. */ -import { GlobalTestState, setupDb } from "../harness/harness.js"; +import { GlobalTestState } from "../harness/harness.js"; import { - SandboxUserBundle, - NexusUserBundle, launchLibeufinServices, - LibeufinSandboxApi, LibeufinNexusApi, LibeufinNexusService, -} from "../harness/libeufin"; + NexusUserBundle, + SandboxUserBundle, +} from "../harness/libeufin.js"; /** * Test Nexus scheduling API. It creates a task, check whether it shows diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-users.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-users.ts index edf66690b..bc3103c7e 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-users.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-users.ts @@ -18,7 +18,7 @@ * Imports. */ import { GlobalTestState } from "../harness/harness.js"; -import { LibeufinNexusApi, LibeufinNexusService } from "../harness/libeufin"; +import { LibeufinNexusApi, LibeufinNexusService } from "../harness/libeufin.js"; /** * Run basic test with LibEuFin. diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-bad-gateway.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-bad-gateway.ts index 786e61832..53aacca84 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-bad-gateway.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-bad-gateway.ts @@ -23,7 +23,7 @@ import { LibeufinNexusApi, LibeufinNexusService, LibeufinSandboxService, -} from "../harness/libeufin"; +} from "../harness/libeufin.js"; /** * Testing how Nexus reacts when the Sandbox is unreachable. diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts index 83231b358..300967c7a 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts @@ -22,7 +22,7 @@ import { WalletApiOperation, HarnessExchangeBankAccount, } from "@gnu-taler/taler-wallet-core"; -import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures"; +import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { DbInfo, ExchangeService, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-c5x.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-c5x.ts index 5a995fb69..cc46c6d33 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-c5x.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-c5x.ts @@ -17,14 +17,13 @@ /** * Imports. */ -import { GlobalTestState, delayMs } from "../harness/harness.js"; +import { GlobalTestState } from "../harness/harness.js"; import { - SandboxUserBundle, - NexusUserBundle, launchLibeufinServices, - LibeufinSandboxApi, LibeufinNexusApi, -} from "../harness/libeufin"; + NexusUserBundle, + SandboxUserBundle, +} from "../harness/libeufin.js"; /** * This test checks how the C52 and C53 coordinate. It'll test @@ -81,7 +80,7 @@ export async function runLibeufinC5xTest(t: GlobalTestState) { user01nexus.localAccountName, ); t.assertTrue(nexusTxs.data["transactions"].length == 0); - + // Addressing one payment to user 01 await libeufinServices.libeufinSandbox.makeTransaction( user02sandbox.ebicsBankAccount.label, // debit diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-facade-anastasis.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-facade-anastasis.ts index 0bbd4fd28..1ed258c3a 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-facade-anastasis.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-facade-anastasis.ts @@ -24,7 +24,7 @@ import { launchLibeufinServices, LibeufinNexusApi, LibeufinSandboxApi, -} from "../harness/libeufin"; +} from "../harness/libeufin.js"; /** * Testing the Anastasis API, offered by the Anastasis facade. diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-keyrotation.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-keyrotation.ts index 5dc31f0bf..21bf07de2 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-keyrotation.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-keyrotation.ts @@ -24,7 +24,7 @@ import { launchLibeufinServices, LibeufinSandboxApi, LibeufinNexusApi, -} from "../harness/libeufin"; +} from "../harness/libeufin.js"; /** * Run basic test with LibEuFin. diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-nexus-balance.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-nexus-balance.ts index 1402d9ae5..a52de8d96 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-nexus-balance.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-nexus-balance.ts @@ -23,7 +23,7 @@ import { NexusUserBundle, launchLibeufinServices, LibeufinNexusApi, -} from "../harness/libeufin"; +} from "../harness/libeufin.js"; /** * This test checks how the C52 and C53 coordinate. It'll test diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts index 39517f247..245f34331 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts @@ -24,7 +24,7 @@ import { launchLibeufinServices, LibeufinSandboxApi, LibeufinNexusApi, -} from "../harness/libeufin"; +} from "../harness/libeufin.js"; /** * User 01 expects a refund from user 02, and expectedly user 03 diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts index d91ae88bb..9d90121a0 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts @@ -24,7 +24,7 @@ import { launchLibeufinServices, LibeufinSandboxApi, LibeufinNexusApi, -} from "../harness/libeufin"; +} from "../harness/libeufin.js"; /** * Run basic test with LibEuFin. diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-sandbox-wire-transfer-cli.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-sandbox-wire-transfer-cli.ts index d784885fd..7f274f554 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-sandbox-wire-transfer-cli.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-sandbox-wire-transfer-cli.ts @@ -19,16 +19,13 @@ */ import { GlobalTestState } from "../harness/harness.js"; import { - NexusUserBundle, - LibeufinNexusApi, - LibeufinNexusService, - LibeufinSandboxService, LibeufinSandboxApi, - findNexusPayment, -} from "../harness/libeufin"; - -export async function runLibeufinSandboxWireTransferCliTest(t: GlobalTestState) { + LibeufinSandboxService, +} from "../harness/libeufin.js"; +export async function runLibeufinSandboxWireTransferCliTest( + t: GlobalTestState, +) { const sandbox = await LibeufinSandboxService.create(t, { httpPort: 5012, databaseJdbcUri: `jdbc:sqlite:${t.testDir}/libeufin-sandbox.sqlite3`, @@ -49,22 +46,40 @@ export async function runLibeufinSandboxWireTransferCliTest(t: GlobalTestState) label: "mock-account-2", }); await sandbox.makeTransaction( - "mock-account", "mock-account-2", "EUR:1", "one!" + "mock-account", + "mock-account-2", + "EUR:1", + "one!", ); await sandbox.makeTransaction( - "mock-account", "mock-account-2", "EUR:1", "two!" + "mock-account", + "mock-account-2", + "EUR:1", + "two!", ); await sandbox.makeTransaction( - "mock-account", "mock-account-2", "EUR:1", "three!" + "mock-account", + "mock-account-2", + "EUR:1", + "three!", ); await sandbox.makeTransaction( - "mock-account-2", "mock-account", "EUR:1", "Give one back." + "mock-account-2", + "mock-account", + "EUR:1", + "Give one back.", ); await sandbox.makeTransaction( - "mock-account-2", "mock-account", "EUR:0.11", "Give fraction back." + "mock-account-2", + "mock-account", + "EUR:0.11", + "Give fraction back.", + ); + let ret = await LibeufinSandboxApi.getAccountInfoWithBalance( + sandbox, + "mock-account-2", ); - let ret = await LibeufinSandboxApi.getAccountInfoWithBalance(sandbox, "mock-account-2"); - console.log(ret.data.balance) - t.assertTrue(ret.data.balance == "EUR:1.89") + console.log(ret.data.balance); + t.assertTrue(ret.data.balance == "EUR:1.89"); } runLibeufinSandboxWireTransferCliTest.suites = ["libeufin"]; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts index 71a1e8c4b..0701fd1c5 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts @@ -22,7 +22,7 @@ import { LibeufinNexusService, LibeufinSandboxService, LibeufinCli, -} from "../harness/libeufin"; +} from "../harness/libeufin.js"; /** * Run basic test with LibEuFin. diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts index 1e958fd73..30ab1cd4b 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-exchange-confusion.ts @@ -18,34 +18,33 @@ * Imports. */ import { + codecForMerchantOrderStatusUnpaid, + ConfirmPayResultType, + PreparePayResultType, +} from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import axiosImp from "axios"; +const axios = axiosImp.default; +import { URL } from "url"; +import { defaultCoinConfig } from "../harness/denomStructures.js"; +import { + FaultInjectedExchangeService, + FaultInjectedMerchantService, +} from "../harness/faultInjection.js"; +import { BankService, ExchangeService, + getPayto, GlobalTestState, MerchantPrivateApi, MerchantService, setupDb, WalletCli, - getPayto } from "../harness/harness.js"; import { - withdrawViaBank, - createFaultInjectedMerchantTestkudosEnvironment, FaultyMerchantTestEnvironment, + withdrawViaBank, } from "../harness/helpers.js"; -import { - PreparePayResultType, - codecForMerchantOrderStatusUnpaid, - ConfirmPayResultType, -} from "@gnu-taler/taler-util"; -import axios from "axios"; -import { - FaultInjectedExchangeService, - FaultInjectedMerchantService, - FaultInjectionRequestContext, -} from "../harness/faultInjection"; -import { defaultCoinConfig } from "../harness/denomStructures"; -import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { URL } from "url"; /** * Run a test case with a simple TESTKUDOS Taler environment, consisting @@ -115,7 +114,7 @@ export async function createConfusedMerchantTestkudosEnvironment( await merchant.addInstance({ id: "minst1", name: "minst1", - paytoUris: [getPayto("minst1")] + paytoUris: [getPayto("minst1")], }); console.log("setup done!"); @@ -141,12 +140,8 @@ export async function createConfusedMerchantTestkudosEnvironment( export async function runMerchantExchangeConfusionTest(t: GlobalTestState) { // Set up test environment - const { - wallet, - bank, - faultyExchange, - faultyMerchant, - } = await createConfusedMerchantTestkudosEnvironment(t); + const { wallet, bank, faultyExchange, faultyMerchant } = + await createConfusedMerchantTestkudosEnvironment(t); // Withdraw digital cash into the wallet. @@ -214,7 +209,10 @@ export async function runMerchantExchangeConfusionTest(t: GlobalTestState) { const proposalId = preparePayResp.proposalId; const orderUrlWithHash = new URL(publicOrderStatusUrl); - orderUrlWithHash.searchParams.set("h_contract", preparePayResp.contractTermsHash); + orderUrlWithHash.searchParams.set( + "h_contract", + preparePayResp.contractTermsHash, + ); console.log("requesting", orderUrlWithHash.href); diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances-delete.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances-delete.ts index 2bef87b20..09231cdd8 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances-delete.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances-delete.ts @@ -18,7 +18,8 @@ * Imports. */ import { URL } from "@gnu-taler/taler-util"; -import axios from "axios"; +import axiosImp from "axios"; +const axios = axiosImp.default; import { ExchangeService, GlobalTestState, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances-urls.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances-urls.ts index f72189014..a4e44c7f3 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances-urls.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances-urls.ts @@ -18,7 +18,8 @@ * Imports. */ import { Duration } from "@gnu-taler/taler-util"; -import axios from "axios"; +import axiosImp from "axios"; +const axios = axiosImp.default; import { ExchangeService, GlobalTestState, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts index 1bf6be4cd..3efe83241 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-instances.ts @@ -18,7 +18,8 @@ * Imports. */ import { URL } from "@gnu-taler/taler-util"; -import axios from "axios"; +import axiosImp from "axios"; +const axios = axiosImp.default; import { ExchangeService, GlobalTestState, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts index 556d9074e..4b9f53f05 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-longpolling.ts @@ -25,7 +25,8 @@ import { ConfirmPayResultType, URL, } from "@gnu-taler/taler-util"; -import axios from "axios"; +import axiosImp from "axios"; +const axios = axiosImp.default; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; /** diff --git a/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts b/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts index 539904f1c..5d9b23fa7 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-merchant-refund-api.ts @@ -34,7 +34,8 @@ import { PreparePayResultType, Duration, } from "@gnu-taler/taler-util"; -import axios from "axios"; +import axiosImp from "axios"; +const axios = axiosImp.default; import { WalletApiOperation, BankServiceHandle, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-pay-paid.ts b/packages/taler-wallet-cli/src/integrationtests/test-pay-paid.ts index 2d291ddd3..2ef91e4a8 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-pay-paid.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-pay-paid.ts @@ -28,8 +28,9 @@ import { ConfirmPayResultType, URL, } from "@gnu-taler/taler-util"; -import axios from "axios"; -import { FaultInjectionRequestContext } from "../harness/faultInjection"; +import axiosImp from "axios"; +const axios = axiosImp.default; +import { FaultInjectionRequestContext } from "../harness/faultInjection.js"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; /** @@ -43,12 +44,8 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; export async function runPayPaidTest(t: GlobalTestState) { // Set up test environment - const { - wallet, - bank, - faultyExchange, - faultyMerchant, - } = await createFaultInjectedMerchantTestkudosEnvironment(t); + const { wallet, bank, faultyExchange, faultyMerchant } = + await createFaultInjectedMerchantTestkudosEnvironment(t); // Withdraw digital cash into the wallet. diff --git a/packages/taler-wallet-cli/src/integrationtests/test-payment-fault.ts b/packages/taler-wallet-cli/src/integrationtests/test-payment-fault.ts index c78f030c8..dea538e35 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-payment-fault.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-payment-fault.ts @@ -35,9 +35,9 @@ import { FaultInjectedExchangeService, FaultInjectionRequestContext, FaultInjectionResponseContext, -} from "../harness/faultInjection"; +} from "../harness/faultInjection.js"; import { CoreApiResponse } from "@gnu-taler/taler-util"; -import { defaultCoinConfig } from "../harness/denomStructures"; +import { defaultCoinConfig } from "../harness/denomStructures.js"; import { WalletApiOperation, BankApi, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-payment-multiple.ts b/packages/taler-wallet-cli/src/integrationtests/test-payment-multiple.ts index 3084ecfe0..46325c05f 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-payment-multiple.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-payment-multiple.ts @@ -28,7 +28,7 @@ import { getPayto } from "../harness/harness.js"; import { withdrawViaBank } from "../harness/helpers.js"; -import { coin_ct10, coin_u1 } from "../harness/denomStructures"; +import { coin_ct10, coin_u1 } from "../harness/denomStructures.js"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; async function setupTest( diff --git a/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts b/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts index 7e178077e..b57b355c6 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-payment-transient.ts @@ -22,11 +22,9 @@ import { withdrawViaBank, createFaultInjectedMerchantTestkudosEnvironment, } from "../harness/helpers.js"; -import axios from "axios"; import { - FaultInjectionRequestContext, FaultInjectionResponseContext, -} from "../harness/faultInjection"; +} from "../harness/faultInjection.js"; import { codecForMerchantOrderStatusUnpaid, ConfirmPayResultType, @@ -36,6 +34,8 @@ import { URL, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import axiosImp from "axios"; +const axios = axiosImp.default; /** * Run test for a payment where the merchant has a transient diff --git a/packages/taler-wallet-cli/src/integrationtests/test-paywall-flow.ts b/packages/taler-wallet-cli/src/integrationtests/test-paywall-flow.ts index a8e3b3e95..a9601c625 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-paywall-flow.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-paywall-flow.ts @@ -18,14 +18,18 @@ * Imports. */ import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js"; -import { createSimpleTestkudosEnvironment, withdrawViaBank } from "../harness/helpers.js"; +import { + createSimpleTestkudosEnvironment, + withdrawViaBank, +} from "../harness/helpers.js"; import { PreparePayResultType, codecForMerchantOrderStatusUnpaid, ConfirmPayResultType, URL, } from "@gnu-taler/taler-util"; -import axios from "axios"; +import axiosImp from "axios"; +const axios = axiosImp.default; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; /** @@ -34,12 +38,8 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; export async function runPaywallFlowTest(t: GlobalTestState) { // Set up test environment - const { - wallet, - bank, - exchange, - merchant, - } = await createSimpleTestkudosEnvironment(t); + const { wallet, bank, exchange, merchant } = + await createSimpleTestkudosEnvironment(t); // Withdraw digital cash into the wallet. diff --git a/packages/taler-wallet-cli/src/integrationtests/test-revocation.ts b/packages/taler-wallet-cli/src/integrationtests/test-revocation.ts index bf35b5382..3ed071a18 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-revocation.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-revocation.ts @@ -18,7 +18,7 @@ * Imports. */ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { CoinConfig } from "../harness/denomStructures"; +import { CoinConfig } from "../harness/denomStructures.js"; import { GlobalTestState, ExchangeService, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-timetravel-autorefresh.ts b/packages/taler-wallet-cli/src/integrationtests/test-timetravel-autorefresh.ts index b55be9f82..54b66e0b2 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-timetravel-autorefresh.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-timetravel-autorefresh.ts @@ -27,7 +27,7 @@ import { PendingOperationsResponse, WalletApiOperation, } from "@gnu-taler/taler-wallet-core"; -import { makeNoFeeCoinConfig } from "../harness/denomStructures"; +import { makeNoFeeCoinConfig } from "../harness/denomStructures.js"; import { BankService, ExchangeService, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-basic.ts b/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-basic.ts index af294da8e..fc2f3335d 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-basic.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-basic.ts @@ -24,7 +24,7 @@ import { createSimpleTestkudosEnvironment, withdrawViaBank, } from "../harness/helpers.js"; -import { SyncService } from "../harness/sync"; +import { SyncService } from "../harness/sync.js"; /** * Run test for basic, bank-integrated withdrawal. diff --git a/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts b/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts index 228712da5..8b52260e9 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-wallet-backup-doublespend.ts @@ -29,7 +29,7 @@ import { makeTestPayment, withdrawViaBank, } from "../harness/helpers.js"; -import { SyncService } from "../harness/sync"; +import { SyncService } from "../harness/sync.js"; export async function runWalletBackupDoublespendTest(t: GlobalTestState) { // Set up test environment diff --git a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts index c22689e46..e4a2193bb 100644 --- a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts +++ b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts @@ -56,7 +56,7 @@ import { runLibeufinSandboxWireTransferCliTest } from "./test-libeufin-sandbox-w import { runLibeufinTutorialTest } from "./test-libeufin-tutorial.js"; import { runMerchantExchangeConfusionTest } from "./test-merchant-exchange-confusion.js"; import { runMerchantInstancesTest } from "./test-merchant-instances.js"; -import { runMerchantInstancesDeleteTest } from "./test-merchant-instances-delete"; +import { runMerchantInstancesDeleteTest } from "./test-merchant-instances-delete.js"; import { runMerchantInstancesUrlsTest } from "./test-merchant-instances-urls.js"; import { runMerchantLongpollingTest } from "./test-merchant-longpolling.js"; import { runMerchantRefundApiTest } from "./test-merchant-refund-api.js"; |