diff options
author | Florian Dold <florian@dold.me> | 2023-09-06 13:24:34 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-09-06 13:24:34 +0200 |
commit | b63937703ce1e269055497ee14ac90a28de2fc74 (patch) | |
tree | a2f9aa841b18f950028b34b17f88bf28c70dd5db /packages/taler-harness | |
parent | 7450bede5b5809f6a496b7e68852a454386850e5 (diff) | |
download | wallet-core-b63937703ce1e269055497ee14ac90a28de2fc74.tar.xz |
move bank API client to taler-util, update typescript config
Diffstat (limited to 'packages/taler-harness')
18 files changed, 75 insertions, 80 deletions
diff --git a/packages/taler-harness/package.json b/packages/taler-harness/package.json index 8916e5e9e..9f2b0d8e3 100644 --- a/packages/taler-harness/package.json +++ b/packages/taler-harness/package.json @@ -35,7 +35,7 @@ "esbuild": "^0.17.7", "prettier": "^2.8.8", "rimraf": "^3.0.2", - "typescript": "^5.1.3" + "typescript": "^5.2.2" }, "dependencies": { "@gnu-taler/taler-util": "workspace:*", diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts index d0719b4f7..24e42099e 100644 --- a/packages/taler-harness/src/harness/harness.ts +++ b/packages/taler-harness/src/harness/harness.ts @@ -28,6 +28,7 @@ import { AccountAddDetails, AmountJson, Amounts, + BankAccessApiClient, Configuration, CoreApiResponse, Duration, @@ -46,13 +47,11 @@ import { stringToBytes, } from "@gnu-taler/taler-util"; import { + HttpRequestLibrary, createPlatformHttpLib, expectSuccessResponseOrThrow, } from "@gnu-taler/taler-util/http"; import { - BankAccessApiClient, - BankServiceHandle, - HarnessExchangeBankAccount, WalletCoreApiClient, WalletCoreRequestType, WalletCoreResponseType, @@ -569,6 +568,13 @@ class BankServiceBase { ) {} } +export interface HarnessExchangeBankAccount { + accountName: string; + accountPassword: string; + accountPaytoUri: string; + wireGatewayApiBaseUrl: string; +} + /** * Implementation of the bank service using the "taler-fakebank-run" tool. */ @@ -701,6 +707,11 @@ export class FakebankService // Use libeufin bank instead of pybank. const useLibeufinBank = false; +export interface BankServiceHandle { + readonly bankAccessApiBaseUrl: string; + readonly http: HttpRequestLibrary; +} + export type BankService = BankServiceHandle; export const BankService = FakebankService; diff --git a/packages/taler-harness/src/harness/helpers.ts b/packages/taler-harness/src/harness/helpers.ts index f92fd4dd9..9892e600b 100644 --- a/packages/taler-harness/src/harness/helpers.ts +++ b/packages/taler-harness/src/harness/helpers.ts @@ -25,21 +25,18 @@ */ import { AmountString, + BankAccessApiClient, ConfirmPayResultType, - MerchantContractTerms, Duration, - PreparePayResultType, - NotificationType, - WalletNotification, - TransactionMajorState, Logger, MerchantApiClient, + MerchantContractTerms, + NotificationType, + PreparePayResultType, + TransactionMajorState, + WalletNotification, } from "@gnu-taler/taler-util"; -import { - BankAccessApiClient, - HarnessExchangeBankAccount, - WalletApiOperation, -} from "@gnu-taler/taler-wallet-core"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "./denomStructures.js"; import { FaultInjectedExchangeService, @@ -51,16 +48,17 @@ import { ExchangeService, ExchangeServiceInterface, FakebankService, - getPayto, GlobalTestState, + HarnessExchangeBankAccount, MerchantService, MerchantServiceInterface, - setupDb, - setupSharedDb, WalletCli, WalletClient, WalletService, WithAuthorization, + getPayto, + setupDb, + setupSharedDb, } from "./harness.js"; import * as fs from "fs"; diff --git a/packages/taler-harness/src/index.ts b/packages/taler-harness/src/index.ts index 185f6226d..534aec8c7 100644 --- a/packages/taler-harness/src/index.ts +++ b/packages/taler-harness/src/index.ts @@ -20,6 +20,7 @@ import { addPaytoQueryParams, Amounts, + BankAccessApiClient, Configuration, decodeCrock, j2s, @@ -31,7 +32,6 @@ import { import { clk } from "@gnu-taler/taler-util/clk"; import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; import { - BankAccessApiClient, CryptoDispatcher, downloadExchangeInfo, SynchronousCryptoWorkerFactoryPlain, diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts index bff13ae40..7f936a479 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts @@ -17,11 +17,7 @@ /** * Imports. */ -import { - BankAccessApiClient, - WalletApiOperation, - WireGatewayApiClient, -} from "@gnu-taler/taler-wallet-core"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { getWireMethodForTest, GlobalTestState } from "../harness/harness.js"; import { @@ -30,7 +26,11 @@ import { makeTestPaymentV2, withdrawViaBankV2, } from "../harness/helpers.js"; -import { MerchantApiClient } from "@gnu-taler/taler-util"; +import { + BankAccessApiClient, + MerchantApiClient, + WireGatewayApiClient, +} from "@gnu-taler/taler-util"; /** * Run test for basic, bank-integrated withdrawal and payment. diff --git a/packages/taler-harness/src/integrationtests/test-bank-api.ts b/packages/taler-harness/src/integrationtests/test-bank-api.ts index afb06b61a..77a13b791 100644 --- a/packages/taler-harness/src/integrationtests/test-bank-api.ts +++ b/packages/taler-harness/src/integrationtests/test-bank-api.ts @@ -17,12 +17,13 @@ /** * Imports. */ -import { createEddsaKeyPair, encodeCrock } from "@gnu-taler/taler-util"; import { BankAccessApiClient, CreditDebitIndicator, WireGatewayApiClient, -} from "@gnu-taler/taler-wallet-core"; + createEddsaKeyPair, + encodeCrock, +} from "@gnu-taler/taler-util"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { BankService, diff --git a/packages/taler-harness/src/integrationtests/test-exchange-management.ts b/packages/taler-harness/src/integrationtests/test-exchange-management.ts index 19be7c962..9338a8988 100644 --- a/packages/taler-harness/src/integrationtests/test-exchange-management.ts +++ b/packages/taler-harness/src/integrationtests/test-exchange-management.ts @@ -18,29 +18,27 @@ * Imports. */ import { - GlobalTestState, - WalletCli, - setupDb, - BankService, - ExchangeService, - MerchantService, - getPayto, -} from "../harness/harness.js"; -import { - WalletApiOperation, BankAccessApiClient, -} from "@gnu-taler/taler-wallet-core"; -import { ExchangesListResponse, - URL, TalerErrorCode, + URL, j2s, } from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { defaultCoinConfig } from "../harness/denomStructures.js"; import { FaultInjectedExchangeService, FaultInjectionResponseContext, } from "../harness/faultInjection.js"; -import { defaultCoinConfig } from "../harness/denomStructures.js"; +import { + BankService, + ExchangeService, + GlobalTestState, + MerchantService, + WalletCli, + getPayto, + setupDb, +} from "../harness/harness.js"; /** * Test if the wallet handles outdated exchange versions correctly. diff --git a/packages/taler-harness/src/integrationtests/test-kyc.ts b/packages/taler-harness/src/integrationtests/test-kyc.ts index 88875d4fc..1f7358b66 100644 --- a/packages/taler-harness/src/integrationtests/test-kyc.ts +++ b/packages/taler-harness/src/integrationtests/test-kyc.ts @@ -18,6 +18,7 @@ * Imports. */ import { + BankAccessApiClient, Duration, j2s, Logger, @@ -27,10 +28,7 @@ import { TransactionType, } from "@gnu-taler/taler-util"; import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; -import { - BankAccessApiClient, - WalletApiOperation, -} from "@gnu-taler/taler-wallet-core"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import * as http from "node:http"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { diff --git a/packages/taler-harness/src/integrationtests/test-libeufin-basic.ts b/packages/taler-harness/src/integrationtests/test-libeufin-basic.ts index 20fa34437..d87278197 100644 --- a/packages/taler-harness/src/integrationtests/test-libeufin-basic.ts +++ b/packages/taler-harness/src/integrationtests/test-libeufin-basic.ts @@ -22,15 +22,13 @@ import { Duration, MerchantContractTerms, } from "@gnu-taler/taler-util"; -import { - HarnessExchangeBankAccount, - WalletApiOperation, -} from "@gnu-taler/taler-wallet-core"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { DbInfo, ExchangeService, GlobalTestState, + HarnessExchangeBankAccount, MerchantService, WalletClient, setupDb, diff --git a/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts b/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts index 369f261dd..1b69b9de6 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-refund-api.ts @@ -24,11 +24,9 @@ import { URL, durationFromSpec, } from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { BankServiceHandle, - WalletApiOperation, -} from "@gnu-taler/taler-wallet-core"; -import { ExchangeServiceInterface, GlobalTestState, MerchantServiceInterface, diff --git a/packages/taler-harness/src/integrationtests/test-payment-fault.ts b/packages/taler-harness/src/integrationtests/test-payment-fault.ts index 3ad11d82d..e57427fac 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-fault.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-fault.ts @@ -21,11 +21,12 @@ /** * Imports. */ -import { CoreApiResponse, MerchantApiClient } from "@gnu-taler/taler-util"; import { BankAccessApiClient, - WalletApiOperation, -} from "@gnu-taler/taler-wallet-core"; + CoreApiResponse, + MerchantApiClient, +} from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { FaultInjectedExchangeService, diff --git a/packages/taler-harness/src/integrationtests/test-tipping.ts b/packages/taler-harness/src/integrationtests/test-tipping.ts index 9b980acad..4140311ab 100644 --- a/packages/taler-harness/src/integrationtests/test-tipping.ts +++ b/packages/taler-harness/src/integrationtests/test-tipping.ts @@ -18,13 +18,13 @@ * Imports. */ import { + BankAccessApiClient, MerchantApiClient, TransactionMajorState, + WireGatewayApiClient, } from "@gnu-taler/taler-util"; import { - BankAccessApiClient, WalletApiOperation, - WireGatewayApiClient, } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState, getWireMethodForTest } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; diff --git a/packages/taler-harness/src/integrationtests/test-wallet-notifications.ts b/packages/taler-harness/src/integrationtests/test-wallet-notifications.ts index 9b35884f0..9a0eb77ae 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-notifications.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-notifications.ts @@ -18,14 +18,12 @@ * Imports. */ import { + BankAccessApiClient, Duration, NotificationType, TransactionMajorState, } from "@gnu-taler/taler-util"; -import { - BankAccessApiClient, - WalletApiOperation, -} from "@gnu-taler/taler-wallet-core"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { ExchangeService, diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-abort-bank.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-abort-bank.ts index c62b98623..aa5e2b770 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-abort-bank.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-abort-bank.ts @@ -17,11 +17,8 @@ /** * Imports. */ -import { TalerErrorCode } from "@gnu-taler/taler-util"; -import { - WalletApiOperation, - BankAccessApiClient, -} from "@gnu-taler/taler-wallet-core"; +import { BankAccessApiClient, TalerErrorCode } from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts index 76c973a12..232b6d7c2 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts @@ -17,13 +17,8 @@ /** * Imports. */ -import { GlobalTestState } from "../harness/harness.js"; -import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; import { BankAccessApiClient, - WalletApiOperation, -} from "@gnu-taler/taler-wallet-core"; -import { j2s, NotificationType, TransactionMajorState, @@ -31,6 +26,9 @@ import { TransactionType, WithdrawalType, } from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { GlobalTestState } from "../harness/harness.js"; +import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; /** * Run test for basic, bank-integrated withdrawal. diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-fees.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-fees.ts index 9f4631c7e..bc2946a18 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-fees.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-fees.ts @@ -17,11 +17,8 @@ /** * Imports. */ -import { j2s } from "@gnu-taler/taler-util"; -import { - BankAccessApiClient, - WalletApiOperation, -} from "@gnu-taler/taler-wallet-core"; +import { BankAccessApiClient, j2s } from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig } from "../harness/denomStructures.js"; import { BankService, diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-manual.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-manual.ts index 324b8abc5..1d98cd46e 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-manual.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-manual.ts @@ -17,12 +17,14 @@ /** * Imports. */ -import { AbsoluteTime, Logger, j2s } from "@gnu-taler/taler-util"; import { + AbsoluteTime, BankAccessApiClient, - WalletApiOperation, + Logger, WireGatewayApiClient, -} from "@gnu-taler/taler-wallet-core"; + j2s, +} from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; diff --git a/packages/taler-harness/tsconfig.json b/packages/taler-harness/tsconfig.json index d022b16e8..ece83a85f 100644 --- a/packages/taler-harness/tsconfig.json +++ b/packages/taler-harness/tsconfig.json @@ -3,10 +3,10 @@ "compilerOptions": { "composite": true, "target": "ES2018", - "module": "ESNext", + "module": "Node16", "moduleResolution": "Node16", "sourceMap": true, - "lib": ["es6"], + "lib": ["ES2020"], "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "strict": true, |