diff options
Diffstat (limited to 'packages/taler-harness/src/harness')
-rw-r--r-- | packages/taler-harness/src/harness/harness.ts | 1 | ||||
-rw-r--r-- | packages/taler-harness/src/harness/libeufin-apis.ts | 79 |
2 files changed, 42 insertions, 38 deletions
diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts index 7c54c0c47..bac691637 100644 --- a/packages/taler-harness/src/harness/harness.ts +++ b/packages/taler-harness/src/harness/harness.ts @@ -1825,6 +1825,7 @@ export class MerchantService implements MerchantServiceInterface { if (!this.proc) { throw Error("merchant must be running to add instance"); } + console.trace("here!"); logger.info("adding instance"); const url = `http://localhost:${this.merchantConfig.httpPort}/management/instances`; const auth = instanceConfig.auth ?? { method: "external" }; diff --git a/packages/taler-harness/src/harness/libeufin-apis.ts b/packages/taler-harness/src/harness/libeufin-apis.ts index 3c57eee07..0553223cb 100644 --- a/packages/taler-harness/src/harness/libeufin-apis.ts +++ b/packages/taler-harness/src/harness/libeufin-apis.ts @@ -176,7 +176,10 @@ export interface LibeufinSandboxAddIncomingRequest { direction: string; } -const libeufinHttpLib = createPlatformHttpLib(); +const libeufinHarnessHttpLib = createPlatformHttpLib({ + allowHttp: true, + enableThrottling: false, +}); /** * APIs spread across Legacy and Access, it is therefore @@ -192,7 +195,7 @@ export namespace LibeufinSandboxApi { iban: string | null = null, ): Promise<void> { let url = new URL("testing/register", libeufinSandboxService.baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", body: { username: username, @@ -211,7 +214,7 @@ export namespace LibeufinSandboxApi { ): Promise<void> { // baseUrl should already be pointed to one demobank. let url = new URL("ebics/subscribers", libeufinSandboxService.baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", body: { userID: req.userID, @@ -228,7 +231,7 @@ export namespace LibeufinSandboxApi { ): Promise<void> { const baseUrl = libeufinSandboxService.baseUrl; let url = new URL(`admin/ebics/hosts/${hostID}/rotate-keys`, baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", body: {}, }); @@ -239,7 +242,7 @@ export namespace LibeufinSandboxApi { ): Promise<void> { const baseUrl = libeufinSandboxService.baseUrl; let url = new URL("admin/ebics/hosts", baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", body: { hostID, @@ -255,7 +258,7 @@ export namespace LibeufinSandboxApi { ): Promise<void> { const baseUrl = libeufinSandboxService.baseUrl; let url = new URL(`admin/bank-accounts/${req.label}`, baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", body: req, headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, @@ -272,7 +275,7 @@ export namespace LibeufinSandboxApi { ): Promise<void> { const baseUrl = libeufinSandboxService.baseUrl; let url = new URL("admin/ebics/subscribers", baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", body: req, headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, @@ -289,7 +292,7 @@ export namespace LibeufinSandboxApi { ): Promise<void> { const baseUrl = libeufinSandboxService.baseUrl; let url = new URL("admin/ebics/bank-accounts", baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", body: req, headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, @@ -306,7 +309,7 @@ export namespace LibeufinSandboxApi { `admin/bank-accounts/${accountLabel}/simulate-incoming-transaction`, baseUrl, ); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", body: req, headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, @@ -322,7 +325,7 @@ export namespace LibeufinSandboxApi { `admin/bank-accounts/${accountLabel}/transactions`, baseUrl, ); - const res = await libeufinHttpLib.fetch(url.href, { + const res = await libeufinHarnessHttpLib.fetch(url.href, { headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); return (await res.json()) as SandboxAccountTransactions; @@ -334,7 +337,7 @@ export namespace LibeufinSandboxApi { ): Promise<any> { const baseUrl = libeufinSandboxService.baseUrl; let url = new URL("admin/payments/camt", baseUrl); - return await libeufinHttpLib.fetch(url.href, { + return await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: { @@ -350,7 +353,7 @@ export namespace LibeufinSandboxApi { ): Promise<LibeufinSandboxAdminBankAccountBalance> { const baseUrl = libeufinSandboxService.baseUrl; let url = new URL(`admin/bank-accounts/${accountLabel}`, baseUrl); - const res = await libeufinHttpLib.fetch(url.href, { + const res = await libeufinHarnessHttpLib.fetch(url.href, { headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); return res.json(); @@ -362,7 +365,7 @@ export namespace LibeufinNexusApi { nexus: LibeufinNexusServiceInterface, ): Promise<NexusBankConnections> { let url = new URL("bank-connections", nexus.baseUrl); - const res = await libeufinHttpLib.fetch(url.href, { + const res = await libeufinHarnessHttpLib.fetch(url.href, { headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); return res.json(); @@ -374,7 +377,7 @@ export namespace LibeufinNexusApi { ): Promise<void> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL("bank-connections/delete-connection", baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: req, @@ -387,7 +390,7 @@ export namespace LibeufinNexusApi { ): Promise<void> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL("bank-connections", baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: { @@ -411,7 +414,7 @@ export namespace LibeufinNexusApi { ): Promise<any> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL(`bank-accounts/${accountName}`, baseUrl); - const resp = await libeufinHttpLib.fetch(url.href, { + const resp = await libeufinHarnessHttpLib.fetch(url.href, { headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); return resp.json(); @@ -427,7 +430,7 @@ export namespace LibeufinNexusApi { `bank-accounts/${accountName}/payment-initiations/${paymentId}/submit`, baseUrl, ); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: {}, @@ -443,7 +446,7 @@ export namespace LibeufinNexusApi { `bank-connections/${connectionName}/fetch-accounts`, baseUrl, ); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: {}, @@ -461,7 +464,7 @@ export namespace LibeufinNexusApi { `bank-connections/${connectionName}/import-account`, baseUrl, ); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: { @@ -477,7 +480,7 @@ export namespace LibeufinNexusApi { ): Promise<void> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL(`bank-connections/${connectionName}/connect`, baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: {}, @@ -495,7 +498,7 @@ export namespace LibeufinNexusApi { `/bank-accounts/${accountName}/payment-initiations`, baseUrl, ); - let response = await libeufinHttpLib.fetch(url.href, { + let response = await libeufinHarnessHttpLib.fetch(url.href, { headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); const respJson = await response.json(); @@ -518,7 +521,7 @@ export namespace LibeufinNexusApi { for (const [k, v] of Object.entries(params)) { url.searchParams.set(k, String(v)); } - let response = await libeufinHttpLib.fetch(url.href, { + let response = await libeufinHarnessHttpLib.fetch(url.href, { headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); return response.json(); @@ -534,7 +537,7 @@ export namespace LibeufinNexusApi { ): Promise<LibeufinNexusTransactions> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL(`/bank-accounts/${accountName}/transactions`, baseUrl); - let response = await libeufinHttpLib.fetch(url.href, { + let response = await libeufinHarnessHttpLib.fetch(url.href, { headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); return response.json(); @@ -553,7 +556,7 @@ export namespace LibeufinNexusApi { `/bank-accounts/${accountName}/fetch-transactions`, baseUrl, ); - const resp = await libeufinHttpLib.fetch(url.href, { + const resp = await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: { @@ -572,7 +575,7 @@ export namespace LibeufinNexusApi { ): Promise<void> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL(`/users/${username}/password`, baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: req, @@ -585,7 +588,7 @@ export namespace LibeufinNexusApi { ): Promise<NexusUserResponse> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL(`/user`, baseUrl); - const resp = await libeufinHttpLib.fetch(url.href, { + const resp = await libeufinHarnessHttpLib.fetch(url.href, { headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); return resp.json(); @@ -597,7 +600,7 @@ export namespace LibeufinNexusApi { ): Promise<void> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL(`/users`, baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: req, @@ -609,7 +612,7 @@ export namespace LibeufinNexusApi { ): Promise<NexusGetPermissionsResponse> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL(`/permissions`, baseUrl); - const resp = await libeufinHttpLib.fetch(url.href, { + const resp = await libeufinHarnessHttpLib.fetch(url.href, { headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); return resp.json(); @@ -621,7 +624,7 @@ export namespace LibeufinNexusApi { ): Promise<void> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL(`/permissions`, baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: req, @@ -634,7 +637,7 @@ export namespace LibeufinNexusApi { ): Promise<NexusTaskCollection> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL(`/bank-accounts/${bankAccountName}/schedule`, baseUrl); - const resp = await libeufinHttpLib.fetch(url.href, { + const resp = await libeufinHarnessHttpLib.fetch(url.href, { headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); return resp.json(); @@ -653,7 +656,7 @@ export namespace LibeufinNexusApi { baseUrl, ); if (taskName) url = new URL(taskName, `${url.href}/`); - const resp = await libeufinHttpLib.fetch(url.href, { + const resp = await libeufinHarnessHttpLib.fetch(url.href, { headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); return resp.json(); @@ -669,7 +672,7 @@ export namespace LibeufinNexusApi { `/bank-accounts/${bankAccountName}/schedule/${taskName}`, baseUrl, ); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "DELETE", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); @@ -682,7 +685,7 @@ export namespace LibeufinNexusApi { ): Promise<void> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL(`/bank-accounts/${bankAccountName}/schedule`, baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: req, @@ -695,7 +698,7 @@ export namespace LibeufinNexusApi { ): Promise<void> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL(`facades/${facadeName}`, baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "DELETE", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); @@ -706,7 +709,7 @@ export namespace LibeufinNexusApi { ): Promise<NexusFacadeListResponse> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL("facades", baseUrl); - const resp = await libeufinHttpLib.fetch(url.href, { + const resp = await libeufinHarnessHttpLib.fetch(url.href, { headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, }); // FIXME: Just return validated, typed response here! @@ -719,7 +722,7 @@ export namespace LibeufinNexusApi { ): Promise<void> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL("facades", baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: { @@ -741,7 +744,7 @@ export namespace LibeufinNexusApi { ): Promise<void> { const baseUrl = libeufinNexusService.baseUrl; let url = new URL("facades", baseUrl); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: { @@ -766,7 +769,7 @@ export namespace LibeufinNexusApi { `/bank-accounts/${accountId}/submit-all-payment-initiations`, baseUrl, ); - await libeufinHttpLib.fetch(url.href, { + await libeufinHarnessHttpLib.fetch(url.href, { method: "POST", headers: { Authorization: makeBasicAuthHeader("admin", "secret") }, body: {}, |