aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/dbless.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/dbless.ts')
-rw-r--r--packages/taler-wallet-core/src/dbless.ts29
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());
}