diff options
author | Florian Dold <florian@dold.me> | 2023-11-29 17:54:41 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-11-29 17:54:41 +0100 |
commit | 1a0293add0a9c81eb035da57400254c8203ab9a6 (patch) | |
tree | 9b67e6522952ab5d5a3e7578928432e445d4f195 /packages/taler-wallet-core/src/dbless.ts | |
parent | e7cd29e5c6e4f27fecd351f1161ef2e61ccf9d25 (diff) | |
download | wallet-core-1a0293add0a9c81eb035da57400254c8203ab9a6.tar.xz |
harness: fix helper to create reserve via /admin/add-incoming
Diffstat (limited to 'packages/taler-wallet-core/src/dbless.ts')
-rw-r--r-- | packages/taler-wallet-core/src/dbless.ts | 29 |
1 files changed, 20 insertions, 9 deletions
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()); } |