move bank API client to taler-util, update typescript config

This commit is contained in:
Florian Dold 2023-09-06 13:24:34 +02:00
parent 7450bede5b
commit b63937703c
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
56 changed files with 972 additions and 608 deletions

31
.vscode/tasks.json vendored
View File

@ -1,18 +1,17 @@
{ {
// See https://go.microsoft.com/fwlink/?LinkId=733558 // See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format // for the documentation about the tasks.json format
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"type": "typescript", "type": "typescript",
"tsconfig": "tsconfig.build.json", "tsconfig": "tsconfig.build.json",
"problemMatcher": [ "problemMatcher": ["$tsc"],
"$tsc" "group": {
], "kind": "build",
"group": { "isDefault": true
"kind": "build", },
"isDefault": true, "label": "tsc: build - tsconfig.build.json"
}, }
} ]
]
} }

View File

@ -15,6 +15,7 @@
"eslint": "^8.29.0", "eslint": "^8.29.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"nx": "15.0.1", "nx": "15.0.1",
"prettier": "^2.8.8" "prettier": "^2.8.8",
"typescript": "^5.2.2"
} }
} }

View File

@ -59,7 +59,7 @@
"postcss": "^8.4.23", "postcss": "^8.4.23",
"postcss-cli": "^10.1.0", "postcss-cli": "^10.1.0",
"tailwindcss": "^3.3.2", "tailwindcss": "^3.3.2",
"typescript": "5.1.3" "typescript": "5.2.2"
}, },
"pogen": { "pogen": {
"domain": "aml-backoffice" "domain": "aml-backoffice"

View File

@ -1,12 +1,9 @@
{ {
"compilerOptions": { "compilerOptions": {
/* Basic Options */ /* Basic Options */
"target": "ES5", "target": "ES2020",
"module": "ES6", "module": "Node16",
"lib": [ "lib": ["DOM", "ES2020"],
"DOM",
"ES2017"
],
"allowJs": true /* Allow javascript files to be compiled. */, "allowJs": true /* Allow javascript files to be compiled. */,
// "checkJs": true, /* Report errors in .js files. */ // "checkJs": true, /* Report errors in .js files. */
"jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */, "jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
@ -45,7 +42,5 @@
/* Advanced Options */ /* Advanced Options */
"skipLibCheck": true /* Skip type checking of declaration files. */ "skipLibCheck": true /* Skip type checking of declaration files. */
}, },
"include": [ "include": ["src/**/*"]
"src/**/*"
]
} }

View File

@ -33,12 +33,12 @@
"@types/node": "^18.11.17", "@types/node": "^18.11.17",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"typedoc": "^0.24.8", "typedoc": "^0.25.1",
"typescript": "^5.1.3" "typescript": "^5.2.2"
}, },
"dependencies": { "dependencies": {
"@gnu-taler/taler-util": "workspace:*",
"@gnu-taler/anastasis-core": "workspace:*", "@gnu-taler/anastasis-core": "workspace:*",
"@gnu-taler/taler-util": "workspace:*",
"tslib": "^2.5.3" "tslib": "^2.5.3"
} }
} }

View File

@ -2,11 +2,11 @@
"compileOnSave": true, "compileOnSave": true,
"compilerOptions": { "compilerOptions": {
"composite": true, "composite": true,
"target": "ES2018", "target": "ES2020",
"module": "ESNext", "module": "Node16",
"moduleResolution": "Node16", "moduleResolution": "Node16",
"sourceMap": true, "sourceMap": true,
"lib": ["es6"], "lib": ["ES2020"],
"noImplicitReturns": true, "noImplicitReturns": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"strict": true, "strict": true,

View File

@ -18,7 +18,7 @@
"devDependencies": { "devDependencies": {
"ava": "^4.3.3", "ava": "^4.3.3",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"typescript": "^5.1.3" "typescript": "^5.2.2"
}, },
"dependencies": { "dependencies": {
"@gnu-taler/taler-util": "workspace:*", "@gnu-taler/taler-util": "workspace:*",

View File

@ -3,7 +3,7 @@
"compilerOptions": { "compilerOptions": {
"composite": true, "composite": true,
"target": "ES2020", "target": "ES2020",
"module": "ESNext", "module": "Node16",
"moduleResolution": "Node16", "moduleResolution": "Node16",
"sourceMap": true, "sourceMap": true,
"lib": ["ES2020"], "lib": ["ES2020"],

View File

@ -44,6 +44,6 @@
"chai": "^4.3.6", "chai": "^4.3.6",
"mocha": "^9.2.0", "mocha": "^9.2.0",
"sass": "1.56.1", "sass": "1.56.1",
"typescript": "^5.1.3" "typescript": "^5.2.2"
} }
} }

View File

@ -1,11 +1,11 @@
{ {
"compilerOptions": { "compilerOptions": {
/* Basic Options */ /* Basic Options */
"target": "ES5", "target": "ES2020",
"module": "ES6", "module": "Node16",
"lib": [ "lib": [
"DOM", "DOM",
"ES2017" "ES2020"
], ],
"allowJs": true /* Allow javascript files to be compiled. */, "allowJs": true /* Allow javascript files to be compiled. */,
// "checkJs": true, /* Report errors in .js files. */ // "checkJs": true, /* Report errors in .js files. */

View File

@ -60,7 +60,7 @@
"po2json": "^0.4.5", "po2json": "^0.4.5",
"preact-render-to-string": "^5.2.6", "preact-render-to-string": "^5.2.6",
"sass": "1.56.1", "sass": "1.56.1",
"typescript": "5.1.3" "typescript": "5.2.2"
}, },
"pogen": { "pogen": {
"domain": "bank" "domain": "bank"

View File

@ -1,12 +1,9 @@
{ {
"compilerOptions": { "compilerOptions": {
/* Basic Options */ /* Basic Options */
"target": "ES5", "target": "ES2020",
"module": "ES6", "module": "Node16",
"lib": [ "lib": ["DOM", "ES2020"],
"DOM",
"ES2016"
],
"allowJs": true /* Allow javascript files to be compiled. */, "allowJs": true /* Allow javascript files to be compiled. */,
// "checkJs": true, /* Report errors in .js files. */ // "checkJs": true, /* Report errors in .js files. */
"jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */, "jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
@ -45,7 +42,5 @@
/* Advanced Options */ /* Advanced Options */
"skipLibCheck": true /* Skip type checking of declaration files. */ "skipLibCheck": true /* Skip type checking of declaration files. */
}, },
"include": [ "include": ["src/**/*"]
"src/**/*"
]
} }

View File

@ -29,7 +29,7 @@
"ava": "^5.3.1", "ava": "^5.3.1",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"rimraf": "^5.0.1", "rimraf": "^5.0.1",
"typescript": "^5.1.6" "typescript": "^5.2.2"
}, },
"dependencies": { "dependencies": {
"tslib": "^2.6.0" "tslib": "^2.6.0"

View File

@ -1,8 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"composite": true, "composite": true,
"lib": ["es6"], "lib": ["ES2020"],
"module": "ES2020", "module": "Node16",
"moduleResolution": "Node16", "moduleResolution": "Node16",
"target": "ES2020", "target": "ES2020",
"allowJs": true, "allowJs": true,

View File

@ -65,6 +65,6 @@
"sirv-cli": "^1.0.11", "sirv-cli": "^1.0.11",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"tslib": "2.5.3", "tslib": "2.5.3",
"typescript": "5.1.3" "typescript": "5.2.2"
} }
} }

View File

@ -75,8 +75,8 @@
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"sass": "1.56.1", "sass": "1.56.1",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"typedoc": "^0.24.8", "typedoc": "^0.25.1",
"typescript": "5.1.3" "typescript": "5.2.2"
}, },
"pogen": { "pogen": {
"domain": "taler-merchant-backoffice" "domain": "taler-merchant-backoffice"

View File

@ -1,61 +1,58 @@
{ {
"compilerOptions": { "compilerOptions": {
/* Basic Options */ /* Basic Options */
"target": "ES6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ "target": "ES2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */,
"module": "ESNext", /* Specify module code generation: 'none', commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "module": "Node16" /* Specify module code generation: 'none', commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"lib": [ "lib": [
"es2021", "es2020",
"dom" "dom"
], /* Specify library files to be included in the compilation: */ ] /* Specify library files to be included in the compilation: */,
// "allowJs": true, /* Allow javascript files to be compiled. */ // "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */ // "checkJs": true, /* Report errors in .js files. */
"jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ "jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
"jsxFactory": "h", /* Specify the JSX factory function to use when targeting react JSX emit, e.g. React.createElement or h. */ "jsxFactory": "h" /* Specify the JSX factory function to use when targeting react JSX emit, e.g. React.createElement or h. */,
"jsxFragmentFactory": "Fragment", // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#custom-jsx-factories "jsxFragmentFactory": "Fragment", // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#custom-jsx-factories
// "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declaration": true, /* Generates corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */ // "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */ // "outDir": "./", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "removeComments": true, /* Do not emit comments to output. */ // "removeComments": true, /* Do not emit comments to output. */
"noEmit": true, /* Do not emit outputs. */ "noEmit": true /* Do not emit outputs. */,
// "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */ /* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */ "strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */ // "strictNullChecks": true, /* Enable strict null checks. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */ /* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */ // "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */ // "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */ /* Module Resolution Options */
"moduleResolution": "node16", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ "moduleResolution": "node16" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
"esModuleInterop": true, /* */ "esModuleInterop": true /* */,
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */ // "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */ // "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
/* Source Map Options */ /* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */ /* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
/* Advanced Options */ /* Advanced Options */
"skipLibCheck": true /* Skip type checking of declaration files. */ "skipLibCheck": true /* Skip type checking of declaration files. */
}, },
"include": [ "include": ["src/**/*", "tests/**/*"]
"src/**/*",
"tests/**/*"
]
} }

View File

@ -11,7 +11,7 @@
}, },
"devDependencies": { "devDependencies": {
"po2json": "^0.4.5", "po2json": "^0.4.5",
"typescript": "^5.1.3" "typescript": "^5.2.2"
}, },
"dependencies": { "dependencies": {
"@types/node": "^18.11.17", "@types/node": "^18.11.17",

View File

@ -7,7 +7,7 @@
"incremental": true, "incremental": true,
"moduleResolution": "node", "moduleResolution": "node",
"sourceMap": true, "sourceMap": true,
"lib": ["es6"], "lib": ["ES2020"],
"types": ["node"] "types": ["node"]
}, },
"include": ["src/**/*.ts"] "include": ["src/**/*.ts"]

View File

@ -35,7 +35,7 @@
"esbuild": "^0.17.7", "esbuild": "^0.17.7",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"typescript": "^5.1.3" "typescript": "^5.2.2"
}, },
"dependencies": { "dependencies": {
"@gnu-taler/taler-util": "workspace:*", "@gnu-taler/taler-util": "workspace:*",

View File

@ -28,6 +28,7 @@ import {
AccountAddDetails, AccountAddDetails,
AmountJson, AmountJson,
Amounts, Amounts,
BankAccessApiClient,
Configuration, Configuration,
CoreApiResponse, CoreApiResponse,
Duration, Duration,
@ -46,13 +47,11 @@ import {
stringToBytes, stringToBytes,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { import {
HttpRequestLibrary,
createPlatformHttpLib, createPlatformHttpLib,
expectSuccessResponseOrThrow, expectSuccessResponseOrThrow,
} from "@gnu-taler/taler-util/http"; } from "@gnu-taler/taler-util/http";
import { import {
BankAccessApiClient,
BankServiceHandle,
HarnessExchangeBankAccount,
WalletCoreApiClient, WalletCoreApiClient,
WalletCoreRequestType, WalletCoreRequestType,
WalletCoreResponseType, 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. * Implementation of the bank service using the "taler-fakebank-run" tool.
*/ */
@ -701,6 +707,11 @@ export class FakebankService
// Use libeufin bank instead of pybank. // Use libeufin bank instead of pybank.
const useLibeufinBank = false; const useLibeufinBank = false;
export interface BankServiceHandle {
readonly bankAccessApiBaseUrl: string;
readonly http: HttpRequestLibrary;
}
export type BankService = BankServiceHandle; export type BankService = BankServiceHandle;
export const BankService = FakebankService; export const BankService = FakebankService;

View File

@ -25,21 +25,18 @@
*/ */
import { import {
AmountString, AmountString,
BankAccessApiClient,
ConfirmPayResultType, ConfirmPayResultType,
MerchantContractTerms,
Duration, Duration,
PreparePayResultType,
NotificationType,
WalletNotification,
TransactionMajorState,
Logger, Logger,
MerchantApiClient, MerchantApiClient,
MerchantContractTerms,
NotificationType,
PreparePayResultType,
TransactionMajorState,
WalletNotification,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
BankAccessApiClient,
HarnessExchangeBankAccount,
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
import { CoinConfig, defaultCoinConfig } from "./denomStructures.js"; import { CoinConfig, defaultCoinConfig } from "./denomStructures.js";
import { import {
FaultInjectedExchangeService, FaultInjectedExchangeService,
@ -51,16 +48,17 @@ import {
ExchangeService, ExchangeService,
ExchangeServiceInterface, ExchangeServiceInterface,
FakebankService, FakebankService,
getPayto,
GlobalTestState, GlobalTestState,
HarnessExchangeBankAccount,
MerchantService, MerchantService,
MerchantServiceInterface, MerchantServiceInterface,
setupDb,
setupSharedDb,
WalletCli, WalletCli,
WalletClient, WalletClient,
WalletService, WalletService,
WithAuthorization, WithAuthorization,
getPayto,
setupDb,
setupSharedDb,
} from "./harness.js"; } from "./harness.js";
import * as fs from "fs"; import * as fs from "fs";

View File

@ -20,6 +20,7 @@
import { import {
addPaytoQueryParams, addPaytoQueryParams,
Amounts, Amounts,
BankAccessApiClient,
Configuration, Configuration,
decodeCrock, decodeCrock,
j2s, j2s,
@ -31,7 +32,6 @@ import {
import { clk } from "@gnu-taler/taler-util/clk"; import { clk } from "@gnu-taler/taler-util/clk";
import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; import { createPlatformHttpLib } from "@gnu-taler/taler-util/http";
import { import {
BankAccessApiClient,
CryptoDispatcher, CryptoDispatcher,
downloadExchangeInfo, downloadExchangeInfo,
SynchronousCryptoWorkerFactoryPlain, SynchronousCryptoWorkerFactoryPlain,

View File

@ -17,11 +17,7 @@
/** /**
* Imports. * Imports.
*/ */
import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
BankAccessApiClient,
WalletApiOperation,
WireGatewayApiClient,
} from "@gnu-taler/taler-wallet-core";
import { defaultCoinConfig } from "../harness/denomStructures.js"; import { defaultCoinConfig } from "../harness/denomStructures.js";
import { getWireMethodForTest, GlobalTestState } from "../harness/harness.js"; import { getWireMethodForTest, GlobalTestState } from "../harness/harness.js";
import { import {
@ -30,7 +26,11 @@ import {
makeTestPaymentV2, makeTestPaymentV2,
withdrawViaBankV2, withdrawViaBankV2,
} from "../harness/helpers.js"; } 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. * Run test for basic, bank-integrated withdrawal and payment.

View File

@ -17,12 +17,13 @@
/** /**
* Imports. * Imports.
*/ */
import { createEddsaKeyPair, encodeCrock } from "@gnu-taler/taler-util";
import { import {
BankAccessApiClient, BankAccessApiClient,
CreditDebitIndicator, CreditDebitIndicator,
WireGatewayApiClient, WireGatewayApiClient,
} from "@gnu-taler/taler-wallet-core"; createEddsaKeyPair,
encodeCrock,
} from "@gnu-taler/taler-util";
import { defaultCoinConfig } from "../harness/denomStructures.js"; import { defaultCoinConfig } from "../harness/denomStructures.js";
import { import {
BankService, BankService,

View File

@ -18,29 +18,27 @@
* Imports. * Imports.
*/ */
import { import {
GlobalTestState,
WalletCli,
setupDb,
BankService,
ExchangeService,
MerchantService,
getPayto,
} from "../harness/harness.js";
import {
WalletApiOperation,
BankAccessApiClient, BankAccessApiClient,
} from "@gnu-taler/taler-wallet-core";
import {
ExchangesListResponse, ExchangesListResponse,
URL,
TalerErrorCode, TalerErrorCode,
URL,
j2s, j2s,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { defaultCoinConfig } from "../harness/denomStructures.js";
import { import {
FaultInjectedExchangeService, FaultInjectedExchangeService,
FaultInjectionResponseContext, FaultInjectionResponseContext,
} from "../harness/faultInjection.js"; } 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. * Test if the wallet handles outdated exchange versions correctly.

View File

@ -18,6 +18,7 @@
* Imports. * Imports.
*/ */
import { import {
BankAccessApiClient,
Duration, Duration,
j2s, j2s,
Logger, Logger,
@ -27,10 +28,7 @@ import {
TransactionType, TransactionType,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; import { createPlatformHttpLib } from "@gnu-taler/taler-util/http";
import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
BankAccessApiClient,
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
import * as http from "node:http"; import * as http from "node:http";
import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
import { import {

View File

@ -22,15 +22,13 @@ import {
Duration, Duration,
MerchantContractTerms, MerchantContractTerms,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
HarnessExchangeBankAccount,
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
import { import {
DbInfo, DbInfo,
ExchangeService, ExchangeService,
GlobalTestState, GlobalTestState,
HarnessExchangeBankAccount,
MerchantService, MerchantService,
WalletClient, WalletClient,
setupDb, setupDb,

View File

@ -24,11 +24,9 @@ import {
URL, URL,
durationFromSpec, durationFromSpec,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { import {
BankServiceHandle, BankServiceHandle,
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
import {
ExchangeServiceInterface, ExchangeServiceInterface,
GlobalTestState, GlobalTestState,
MerchantServiceInterface, MerchantServiceInterface,

View File

@ -21,11 +21,12 @@
/** /**
* Imports. * Imports.
*/ */
import { CoreApiResponse, MerchantApiClient } from "@gnu-taler/taler-util";
import { import {
BankAccessApiClient, BankAccessApiClient,
WalletApiOperation, CoreApiResponse,
} from "@gnu-taler/taler-wallet-core"; MerchantApiClient,
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import { defaultCoinConfig } from "../harness/denomStructures.js"; import { defaultCoinConfig } from "../harness/denomStructures.js";
import { import {
FaultInjectedExchangeService, FaultInjectedExchangeService,

View File

@ -18,13 +18,13 @@
* Imports. * Imports.
*/ */
import { import {
BankAccessApiClient,
MerchantApiClient, MerchantApiClient,
TransactionMajorState, TransactionMajorState,
WireGatewayApiClient,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { import {
BankAccessApiClient,
WalletApiOperation, WalletApiOperation,
WireGatewayApiClient,
} from "@gnu-taler/taler-wallet-core"; } from "@gnu-taler/taler-wallet-core";
import { GlobalTestState, getWireMethodForTest } from "../harness/harness.js"; import { GlobalTestState, getWireMethodForTest } from "../harness/harness.js";
import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js";

View File

@ -18,14 +18,12 @@
* Imports. * Imports.
*/ */
import { import {
BankAccessApiClient,
Duration, Duration,
NotificationType, NotificationType,
TransactionMajorState, TransactionMajorState,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
BankAccessApiClient,
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
import { import {
ExchangeService, ExchangeService,

View File

@ -17,11 +17,8 @@
/** /**
* Imports. * Imports.
*/ */
import { TalerErrorCode } from "@gnu-taler/taler-util"; import { BankAccessApiClient, TalerErrorCode } from "@gnu-taler/taler-util";
import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
WalletApiOperation,
BankAccessApiClient,
} from "@gnu-taler/taler-wallet-core";
import { GlobalTestState } from "../harness/harness.js"; import { GlobalTestState } from "../harness/harness.js";
import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js";

View File

@ -17,13 +17,8 @@
/** /**
* Imports. * Imports.
*/ */
import { GlobalTestState } from "../harness/harness.js";
import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js";
import { import {
BankAccessApiClient, BankAccessApiClient,
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
import {
j2s, j2s,
NotificationType, NotificationType,
TransactionMajorState, TransactionMajorState,
@ -31,6 +26,9 @@ import {
TransactionType, TransactionType,
WithdrawalType, WithdrawalType,
} from "@gnu-taler/taler-util"; } 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. * Run test for basic, bank-integrated withdrawal.

View File

@ -17,11 +17,8 @@
/** /**
* Imports. * Imports.
*/ */
import { j2s } from "@gnu-taler/taler-util"; import { BankAccessApiClient, j2s } from "@gnu-taler/taler-util";
import { import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
BankAccessApiClient,
WalletApiOperation,
} from "@gnu-taler/taler-wallet-core";
import { CoinConfig } from "../harness/denomStructures.js"; import { CoinConfig } from "../harness/denomStructures.js";
import { import {
BankService, BankService,

View File

@ -17,12 +17,14 @@
/** /**
* Imports. * Imports.
*/ */
import { AbsoluteTime, Logger, j2s } from "@gnu-taler/taler-util";
import { import {
AbsoluteTime,
BankAccessApiClient, BankAccessApiClient,
WalletApiOperation, Logger,
WireGatewayApiClient, 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 { GlobalTestState } from "../harness/harness.js";
import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js"; import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js";

View File

@ -3,10 +3,10 @@
"compilerOptions": { "compilerOptions": {
"composite": true, "composite": true,
"target": "ES2018", "target": "ES2018",
"module": "ESNext", "module": "Node16",
"moduleResolution": "Node16", "moduleResolution": "Node16",
"sourceMap": true, "sourceMap": true,
"lib": ["es6"], "lib": ["ES2020"],
"noImplicitReturns": true, "noImplicitReturns": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"strict": true, "strict": true,

View File

@ -68,14 +68,14 @@
"esbuild": "^0.17.7", "esbuild": "^0.17.7",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"typescript": "^5.1.3" "typescript": "^5.2.2"
}, },
"dependencies": { "dependencies": {
"big-integer": "^1.6.51", "big-integer": "^1.6.51",
"fflate": "^0.7.4", "fflate": "^0.7.4",
"hash-wasm": "^4.9.0",
"jed": "^1.1.1", "jed": "^1.1.1",
"tslib": "^2.5.3", "tslib": "^2.5.3"
"hash-wasm": "^4.9.0"
}, },
"ava": { "ava": {
"files": [ "files": [

View File

@ -58,11 +58,6 @@ export interface BankAccountBalanceResponse {
}; };
} }
export interface BankServiceHandle {
readonly bankAccessApiBaseUrl: string;
readonly http: HttpRequestLibrary;
}
export interface BankUser { export interface BankUser {
username: string; username: string;
password: string; password: string;
@ -74,16 +69,6 @@ export interface WithdrawalOperationInfo {
taler_withdraw_uri: string; taler_withdraw_uri: string;
} }
/**
* FIXME: Rename, this is not part of the integration test harness anymore.
*/
export interface HarnessExchangeBankAccount {
accountName: string;
accountPassword: string;
accountPaytoUri: string;
wireGatewayApiBaseUrl: string;
}
/** /**
* Helper function to generate the "Authorization" HTTP header. * Helper function to generate the "Authorization" HTTP header.
*/ */

View File

@ -16,7 +16,7 @@
SPDX-License-Identifier: AGPL3.0-or-later SPDX-License-Identifier: AGPL3.0-or-later
*/ */
import { CancellationToken } from "./CancellationToken.js"; import type { CancellationToken } from "./CancellationToken.js";
import { Codec } from "./codec.js"; import { Codec } from "./codec.js";
import { j2s } from "./helpers.js"; import { j2s } from "./helpers.js";
import { import {

View File

@ -41,3 +41,4 @@ export * from "./iban.js";
export * from "./transaction-test-data.js"; export * from "./transaction-test-data.js";
export * from "./libeufin-api-types.js"; export * from "./libeufin-api-types.js";
export * from "./MerchantApiClient.js"; export * from "./MerchantApiClient.js";
export * from "./bank-api-client.js";

View File

@ -5,8 +5,8 @@
"declaration": true, "declaration": true,
"declarationMap": false, "declarationMap": false,
"target": "ES2020", "target": "ES2020",
"module": "ES2020", "module": "Node16",
"moduleResolution": "node16", "moduleResolution": "Node16",
"sourceMap": true, "sourceMap": true,
"lib": ["ES2020"], "lib": ["ES2020"],
"types": ["node"], "types": ["node"],

View File

@ -33,8 +33,8 @@
"@types/node": "^18.11.17", "@types/node": "^18.11.17",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"typedoc": "^0.24.8", "typedoc": "^0.25.1",
"typescript": "^5.1.3" "typescript": "^5.2.2"
}, },
"dependencies": { "dependencies": {
"@gnu-taler/taler-util": "workspace:*", "@gnu-taler/taler-util": "workspace:*",

View File

@ -3,10 +3,10 @@
"compilerOptions": { "compilerOptions": {
"composite": true, "composite": true,
"target": "ES2018", "target": "ES2018",
"module": "ESNext", "module": "Node16",
"moduleResolution": "Node16", "moduleResolution": "Node16",
"sourceMap": true, "sourceMap": true,
"lib": ["es6"], "lib": ["ES2020"],
"noImplicitReturns": true, "noImplicitReturns": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"strict": true, "strict": true,

View File

@ -65,8 +65,8 @@
"po2json": "^0.4.5", "po2json": "^0.4.5",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"typedoc": "^0.24.8", "typedoc": "^0.25.1",
"typescript": "^5.1.3" "typescript": "^5.2.2"
}, },
"dependencies": { "dependencies": {
"@gnu-taler/idb-bridge": "workspace:*", "@gnu-taler/idb-bridge": "workspace:*",

View File

@ -52,7 +52,7 @@ import {
HttpRequestLibrary, HttpRequestLibrary,
readSuccessResponseJsonOrThrow, readSuccessResponseJsonOrThrow,
} from "@gnu-taler/taler-util/http"; } from "@gnu-taler/taler-util/http";
import { BankAccessApiClient, BankServiceHandle } from "./bank-api-client.js"; import { BankAccessApiClient } from "../../taler-util/src/bank-api-client.js";
import { TalerCryptoInterface } from "./crypto/cryptoImplementation.js"; import { TalerCryptoInterface } from "./crypto/cryptoImplementation.js";
import { DenominationRecord } from "./db.js"; import { DenominationRecord } from "./db.js";
import { isWithdrawableDenom } from "./index.js"; import { isWithdrawableDenom } from "./index.js";
@ -117,10 +117,6 @@ export async function topupReserveWithDemobank(
args: TopupReserveWithDemobankArgs, args: TopupReserveWithDemobankArgs,
) { ) {
const { http, bankAccessApiBaseUrl, amount, exchangeInfo, reservePub } = args; const { http, bankAccessApiBaseUrl, amount, exchangeInfo, reservePub } = args;
const bankHandle: BankServiceHandle = {
bankAccessApiBaseUrl: bankAccessApiBaseUrl,
http,
};
const bankClient = new BankAccessApiClient(bankAccessApiBaseUrl); const bankClient = new BankAccessApiClient(bankAccessApiBaseUrl);
const bankUser = await bankClient.createRandomBankUser(); const bankUser = await bankClient.createRandomBankUser();
const wopi = await bankClient.createWithdrawalOperation( const wopi = await bankClient.createWithdrawalOperation(

View File

@ -44,8 +44,6 @@ export * from "./operations/backup/index.js";
export * from "./operations/exchanges.js"; export * from "./operations/exchanges.js";
export * from "./bank-api-client.js";
export * from "./operations/withdraw.js"; export * from "./operations/withdraw.js";
export * from "./operations/refresh.js"; export * from "./operations/refresh.js";

View File

@ -129,10 +129,8 @@ import {
codecForTestingSetTimetravelRequest, codecForTestingSetTimetravelRequest,
setDangerousTimetravel, setDangerousTimetravel,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { import type { HttpRequestLibrary } from "@gnu-taler/taler-util/http";
HttpRequestLibrary, import { readSuccessResponseJsonOrThrow } from "@gnu-taler/taler-util/http";
readSuccessResponseJsonOrThrow,
} from "@gnu-taler/taler-util/http";
import { TalerCryptoInterface } from "./crypto/cryptoImplementation.js"; import { TalerCryptoInterface } from "./crypto/cryptoImplementation.js";
import { import {
CryptoDispatcher, CryptoDispatcher,

View File

@ -4,12 +4,12 @@
"composite": true, "composite": true,
"declaration": true, "declaration": true,
"declarationMap": false, "declarationMap": false,
"target": "ES2017", "target": "ES2020",
"module": "ESNext", "module": "Node16",
"moduleResolution": "Node16", "moduleResolution": "Node16",
"resolveJsonModule": true, "resolveJsonModule": true,
"sourceMap": true, "sourceMap": true,
"lib": ["es6"], "lib": ["ES2020"],
"resolvePackageJsonImports": true, "resolvePackageJsonImports": true,
"types": ["node"], "types": ["node"],
"noImplicitReturns": true, "noImplicitReturns": true,
@ -33,8 +33,5 @@
"path": "../taler-util/" "path": "../taler-util/"
} }
], ],
"include": [ "include": ["src/**/*", "src/*.json", "../taler-util/src/bank-api-client.ts"]
"src/**/*",
"src/*.json"
]
} }

View File

@ -5,10 +5,10 @@
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"target": "ES6", "target": "ES6",
"module": "ESNext", "module": "Node16",
"moduleResolution": "Node16", "moduleResolution": "Node16",
"sourceMap": true, "sourceMap": true,
"lib": ["es6"], "lib": ["ES2020"],
"noImplicitReturns": true, "noImplicitReturns": true,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"strict": true, "strict": true,

View File

@ -64,7 +64,7 @@
"preact-cli": "^3.3.5", "preact-cli": "^3.3.5",
"preact-render-to-string": "^5.1.19", "preact-render-to-string": "^5.1.19",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"typescript": "5.1.3" "typescript": "5.2.2"
}, },
"nyc": { "nyc": {
"include": [ "include": [

View File

@ -51,14 +51,11 @@ import {
importDb, importDb,
openPromise, openPromise,
} from "@gnu-taler/taler-wallet-core"; } from "@gnu-taler/taler-wallet-core";
import { import { MessageFromFrontend, MessageResponse } from "./platform/api.js";
MessageFromBackend,
MessageFromFrontend,
MessageResponse,
} from "./platform/api.js";
import { platform } from "./platform/background.js"; import { platform } from "./platform/background.js";
import { ExtensionOperations } from "./taler-wallet-interaction-loader.js"; import { ExtensionOperations } from "./taler-wallet-interaction-loader.js";
import { BackgroundOperations } from "./wxApi.js"; import { BackgroundOperations } from "./wxApi.js";
import { HttpRequestLibrary } from "@gnu-taler/taler-util/http";
/** /**
* Currently active wallet instance. Might be unloaded and * Currently active wallet instance. Might be unloaded and
@ -297,7 +294,7 @@ async function reinitWallet(): Promise<void> {
} }
currentDatabase = undefined; currentDatabase = undefined;
// setBadgeText({ text: "" }); // setBadgeText({ text: "" });
let httpLib; let httpLib: HttpRequestLibrary;
let cryptoWorker; let cryptoWorker;
let timer; let timer;
@ -318,7 +315,7 @@ async function reinitWallet(): Promise<void> {
logger.info("Setting up wallet"); logger.info("Setting up wallet");
const wallet = await Wallet.create( const wallet = await Wallet.create(
indexedDB as any, indexedDB as any,
httpLib, httpLib as any,
timer, timer,
cryptoWorker, cryptoWorker,
{ {

View File

@ -1,15 +1,12 @@
{ {
"compilerOptions": { "compilerOptions": {
"composite": true, "composite": true,
"lib": [ "lib": ["es2020", "DOM"],
"es2021", "jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
"DOM" "jsxFactory": "h" /* Specify the JSX factory function to use when targeting react JSX emit, e.g. React.createElement or h. */,
],
"jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
"jsxFactory": "h", /* Specify the JSX factory function to use when targeting react JSX emit, e.g. React.createElement or h. */
"jsxFragmentFactory": "Fragment", // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#custom-jsx-factories "jsxFragmentFactory": "Fragment", // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#custom-jsx-factories
"moduleResolution": "Node16", "moduleResolution": "Node16",
"module": "ES2020", "module": "Node16",
"target": "ES6", "target": "ES6",
"skipLibCheck": true, "skipLibCheck": true,
"preserveSymlinks": true, "preserveSymlinks": true,
@ -23,9 +20,7 @@
"esModuleInterop": true, "esModuleInterop": true,
"importHelpers": true, "importHelpers": true,
"rootDir": "./src", "rootDir": "./src",
"typeRoots": [ "typeRoots": ["./node_modules/@types"]
"./node_modules/@types"
]
}, },
"references": [ "references": [
{ {
@ -35,7 +30,5 @@
"path": "../taler-util/" "path": "../taler-util/"
} }
], ],
"include": [ "include": ["src/**/*"]
"src/**/*"
]
} }

View File

@ -56,7 +56,7 @@
"sass": "1.56.1", "sass": "1.56.1",
"swr": "2.0.3", "swr": "2.0.3",
"tslib": "^2.5.3", "tslib": "^2.5.3",
"typescript": "^5.1.3", "typescript": "^5.2.2",
"ws": "7.4.5" "ws": "7.4.5"
}, },
"dependencies": { "dependencies": {

View File

@ -3,17 +3,14 @@
"composite": true, "composite": true,
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"target": "ES6", "target": "ES2020",
"module": "ESNext", "module": "Node16",
"jsx": "react", "jsx": "react",
"jsxFactory": "h", "jsxFactory": "h",
"jsxFragmentFactory": "Fragment", "jsxFragmentFactory": "Fragment",
"moduleResolution": "Node16", "moduleResolution": "Node16",
"sourceMap": true, "sourceMap": true,
"lib": [ "lib": ["DOM", "ES2020"],
"DOM",
"es6"
],
"outDir": "lib", "outDir": "lib",
"preserveSymlinks": true, "preserveSymlinks": true,
"skipLibCheck": true, "skipLibCheck": true,
@ -27,11 +24,7 @@
"esModuleInterop": true, "esModuleInterop": true,
"importHelpers": true, "importHelpers": true,
"rootDir": "./src", "rootDir": "./src",
"typeRoots": [ "typeRoots": ["./node_modules/@types"]
"./node_modules/@types"
]
}, },
"include": [ "include": ["src/**/*"]
"src/**/*"
]
} }

File diff suppressed because it is too large Load Diff