aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/harness/helpers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-harness/src/harness/helpers.ts')
-rw-r--r--packages/taler-harness/src/harness/helpers.ts35
1 files changed, 34 insertions, 1 deletions
diff --git a/packages/taler-harness/src/harness/helpers.ts b/packages/taler-harness/src/harness/helpers.ts
index c1ce463fa..d203cc608 100644
--- a/packages/taler-harness/src/harness/helpers.ts
+++ b/packages/taler-harness/src/harness/helpers.ts
@@ -31,6 +31,7 @@ import {
PreparePayResultType,
NotificationType,
WithdrawalGroupFinishedNotification,
+ WalletNotification,
} from "@gnu-taler/taler-util";
import {
BankAccessApi,
@@ -297,7 +298,6 @@ export async function createSimpleTestkudosEnvironmentV2(
const walletService = new WalletService(t, {
name: "wallet",
- useInMemoryDb: true,
});
await walletService.start();
await walletService.pingUntilAvailable();
@@ -326,6 +326,39 @@ export async function createSimpleTestkudosEnvironmentV2(
};
}
+export interface CreateWalletArgs {
+ handleNotification?(wn: WalletNotification): void;
+ name: string;
+}
+
+export async function createWalletDaemonWithClient(
+ t: GlobalTestState,
+ args: CreateWalletArgs,
+): Promise<{ walletClient: WalletClient; walletService: WalletService }> {
+ const walletService = new WalletService(t, {
+ name: "wallet",
+ useInMemoryDb: true,
+ });
+ await walletService.start();
+ await walletService.pingUntilAvailable();
+
+ const walletClient = new WalletClient({
+ unixPath: walletService.socketPath,
+ onNotification(n) {
+ console.log("got notification", n);
+ if (args.handleNotification) {
+ args.handleNotification(n);
+ }
+ },
+ });
+ await walletClient.connect();
+ await walletClient.client.call(WalletApiOperation.InitWallet, {
+ skipDefaults: true,
+ });
+
+ return { walletClient, walletService };
+}
+
export interface FaultyMerchantTestEnvironment {
commonDb: DbInfo;
bank: BankService;