diff options
-rw-r--r-- | packages/taler-harness/src/bench2.ts | 6 | ||||
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts | 4 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/dbless.ts | 29 |
3 files changed, 25 insertions, 14 deletions
diff --git a/packages/taler-harness/src/bench2.ts b/packages/taler-harness/src/bench2.ts index 87bc2ff7f..35c12b2d4 100644 --- a/packages/taler-harness/src/bench2.ts +++ b/packages/taler-harness/src/bench2.ts @@ -28,7 +28,7 @@ import { import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; import { checkReserve, - createFakebankReserve, + createTestingReserve, CryptoDispatcher, depositCoin, downloadExchangeInfo, @@ -72,10 +72,10 @@ export async function runBench2(configJson: any): Promise<void> { console.log("creating fakebank reserve"); - await createFakebankReserve({ + await createTestingReserve({ amount: `${curr}:${reserveAmount}`, exchangeInfo, - fakebankBaseUrl: benchConf.bank, + corebankApiBaseUrl: benchConf.bank, http, reservePub: reserveKeyPair.pub, }); diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts index 69c6427ca..fae91be52 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts @@ -29,6 +29,8 @@ import { j2s, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import * as http from "node:http"; +import { defaultCoinConfig } from "../harness/denomStructures.js"; import { BankService, ExchangeService, @@ -38,8 +40,6 @@ import { setupDb, } from "../harness/harness.js"; import { createWalletDaemonWithClient } from "../harness/helpers.js"; -import { defaultCoinConfig } from "../harness/denomStructures.js"; -import * as http from "node:http"; const logger = new Logger("test-withdrawal-conversion.ts"); diff --git a/packages/taler-wallet-core/src/dbless.ts b/packages/taler-wallet-core/src/dbless.ts index b6b80009f..f946d865d 100644 --- a/packages/taler-wallet-core/src/dbless.ts +++ b/packages/taler-wallet-core/src/dbless.ts @@ -379,14 +379,19 @@ export async function refreshCoin(req: { // benchmark the exchange. } -export async function createFakebankReserve(args: { +/** + * Create a reserve for testing withdrawals. + * + * The reserve is created using the test-only API "/admin/add-incoming". + */ +export async function createTestingReserve(args: { http: HttpRequestLibrary; - fakebankBaseUrl: string; + corebankApiBaseUrl: string; amount: string; reservePub: string; exchangeInfo: ExchangeInfo; }): Promise<void> { - const { http, fakebankBaseUrl, amount, reservePub } = args; + const { http, corebankApiBaseUrl, amount, reservePub } = args; const paytoUri = args.exchangeInfo.keys.accounts[0].payto_uri; const pt = parsePaytoUri(paytoUri); if (!pt) { @@ -394,13 +399,19 @@ export async function createFakebankReserve(args: { } const components = pt.targetPath.split("/"); const creditorAcct = components[components.length - 1]; - const fbReq = await http.postJson( - new URL(`${creditorAcct}/admin/add-incoming`, fakebankBaseUrl).href, + const fbReq = await http.fetch( + new URL( + `taler-wire-gateway/${creditorAcct}/admin/add-incoming`, + corebankApiBaseUrl, + ).href, { - amount, - reserve_pub: reservePub, - debit_account: "payto://x-taler-bank/localhost/testdebtor", + method: "POST", + body: { + amount, + reserve_pub: reservePub, + debit_account: "payto://x-taler-bank/localhost/testdebtor", + }, }, ); - const fbResp = await readSuccessResponseJsonOrThrow(fbReq, codecForAny()); + await readSuccessResponseJsonOrThrow(fbReq, codecForAny()); } |