aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/index.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-04-22 14:17:49 +0200
committerFlorian Dold <florian@dold.me>2023-04-22 14:17:49 +0200
commit15feebecfeeda4758a96d1da99a98d9494c4bd2b (patch)
tree54a7536b93673202137927e097d4e5b5dcbc85eb /packages/taler-harness/src/index.ts
parente331012c9f8efef86c6a8a9297b44a67ba8cda66 (diff)
downloadwallet-core-15feebecfeeda4758a96d1da99a98d9494c4bd2b.tar.xz
wallet-core: towards DD37 for deposits
Diffstat (limited to 'packages/taler-harness/src/index.ts')
-rw-r--r--packages/taler-harness/src/index.ts70
1 files changed, 68 insertions, 2 deletions
diff --git a/packages/taler-harness/src/index.ts b/packages/taler-harness/src/index.ts
index 59fa80411..287e1f5be 100644
--- a/packages/taler-harness/src/index.ts
+++ b/packages/taler-harness/src/index.ts
@@ -47,7 +47,14 @@ import { lintExchangeDeployment } from "./lint.js";
import { runEnvFull } from "./env-full.js";
import { clk } from "@gnu-taler/taler-util/clk";
import { createPlatformHttpLib } from "@gnu-taler/taler-util/http";
-import { BankAccessApiClient } from "@gnu-taler/taler-wallet-core";
+import {
+ BankAccessApiClient,
+ checkReserve,
+ CryptoDispatcher,
+ downloadExchangeInfo,
+ SynchronousCryptoWorkerFactoryPlain,
+ topupReserveWithDemobank,
+} from "@gnu-taler/taler-wallet-core";
const logger = new Logger("taler-harness:index.ts");
@@ -162,7 +169,6 @@ advancedCli
await runTestWithState(testState, runEnv1, "env1", true);
});
-
const sandcastleCli = testingCli.subcommand("sandcastleArgs", "sandcastle", {
help: "Subcommands for handling GNU Taler sandcastle deployments.",
});
@@ -261,6 +267,66 @@ deploymentCli
});
deploymentCli
+ .subcommand("testTalerdotnetDemo", "test-demo-talerdotnet")
+ .action(async (args) => {
+ const http = createPlatformHttpLib();
+ const cryptiDisp = new CryptoDispatcher(
+ new SynchronousCryptoWorkerFactoryPlain(),
+ );
+ const cryptoApi = cryptiDisp.cryptoApi;
+ const reserveKeyPair = await cryptoApi.createEddsaKeypair({});
+ const exchangeBaseUrl = "https://exchange.demo.taler.net/";
+ const exchangeInfo = await downloadExchangeInfo(exchangeBaseUrl, http);
+ await topupReserveWithDemobank({
+ amount: "KUDOS:10",
+ bankAccessApiBaseUrl:
+ "https://bank.demo.taler.net/demobanks/default/access-api/",
+ bankBaseUrl: "",
+ exchangeInfo,
+ http,
+ reservePub: reserveKeyPair.pub,
+ });
+ let reserveUrl = new URL(`reserves/${reserveKeyPair.pub}`, exchangeBaseUrl);
+ reserveUrl.searchParams.set("timeout_ms", "30000");
+ console.log("requesting", reserveUrl.href);
+ const longpollReq = http.fetch(reserveUrl.href, {
+ method: "GET",
+ });
+ const reserveStatusResp = await longpollReq;
+ console.log("reserve status", reserveStatusResp.status);
+ });
+
+deploymentCli
+ .subcommand("testLocalhostDemo", "test-demo-localhost")
+ .action(async (args) => {
+ // Run checks against the "env-full" demo deployment on localhost
+ const http = createPlatformHttpLib();
+ const cryptiDisp = new CryptoDispatcher(
+ new SynchronousCryptoWorkerFactoryPlain(),
+ );
+ const cryptoApi = cryptiDisp.cryptoApi;
+ const reserveKeyPair = await cryptoApi.createEddsaKeypair({});
+ const exchangeBaseUrl = "http://localhost:8081/";
+ const exchangeInfo = await downloadExchangeInfo(exchangeBaseUrl, http);
+ await topupReserveWithDemobank({
+ amount: "TESTKUDOS:10",
+ bankAccessApiBaseUrl: "http://localhost:8082/taler-bank-access/",
+ bankBaseUrl: "",
+ exchangeInfo,
+ http,
+ reservePub: reserveKeyPair.pub,
+ });
+ let reserveUrl = new URL(`reserves/${reserveKeyPair.pub}`, exchangeBaseUrl);
+ reserveUrl.searchParams.set("timeout_ms", "30000");
+ console.log("requesting", reserveUrl.href);
+ const longpollReq = http.fetch(reserveUrl.href, {
+ method: "GET",
+ });
+ const reserveStatusResp = await longpollReq;
+ console.log("reserve status", reserveStatusResp.status);
+ });
+
+deploymentCli
.subcommand("tipStatus", "tip-status")
.requiredOption("merchantBaseUrl", ["--merchant-url"], clk.STRING)
.requiredOption("merchantApikey", ["--merchant-apikey"], clk.STRING)