aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/bank-api-client.ts
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-04-24 12:53:20 -0300
committerSebastian <sebasjm@gmail.com>2023-04-24 12:53:20 -0300
commit205d7364ed74d90068ae2a1cc402e77ac2f0bbad (patch)
treea6fba8791c77a891bee2d64ffc4d8cf0c97f76ee /packages/taler-wallet-core/src/bank-api-client.ts
parent3004ece1f8153fdf8ddb283e5d767dd5b5c2e179 (diff)
downloadwallet-core-205d7364ed74d90068ae2a1cc402e77ac2f0bbad.tar.xz
wallet effective config
Diffstat (limited to 'packages/taler-wallet-core/src/bank-api-client.ts')
-rw-r--r--packages/taler-wallet-core/src/bank-api-client.ts35
1 files changed, 27 insertions, 8 deletions
diff --git a/packages/taler-wallet-core/src/bank-api-client.ts b/packages/taler-wallet-core/src/bank-api-client.ts
index 94ca2271b..677581e22 100644
--- a/packages/taler-wallet-core/src/bank-api-client.ts
+++ b/packages/taler-wallet-core/src/bank-api-client.ts
@@ -257,6 +257,8 @@ export interface BankAccessApiClientArgs {
baseUrl: string;
username: string;
password: string;
+ enableThrottling?: boolean;
+ allowHttp?: boolean;
}
export interface BankAccessApiCreateTransactionRequest {
@@ -268,22 +270,30 @@ export class WireGatewayApiClientArgs {
accountName: string;
accountPassword: string;
wireGatewayApiBaseUrl: string;
+ enableThrottling?: boolean;
+ allowHttp?: boolean;
}
+/**
+ * This API look like it belongs to harness
+ * but it will be nice to have in utils to be used by others
+ */
export class WireGatewayApiClient {
- httpLib = createPlatformHttpLib();
+ httpLib;
- constructor(private args: WireGatewayApiClientArgs) {}
+ constructor(private args: WireGatewayApiClientArgs) {
+ this.httpLib = createPlatformHttpLib({
+ enableThrottling: !!args.enableThrottling,
+ allowHttp: !!args.allowHttp,
+ });
+ }
async adminAddIncoming(params: {
amount: string;
reservePub: string;
debitAccountPayto: string;
}): Promise<void> {
- let url = new URL(
- `admin/add-incoming`,
- this.args.wireGatewayApiBaseUrl,
- );
+ let url = new URL(`admin/add-incoming`, this.args.wireGatewayApiBaseUrl);
const resp = await this.httpLib.fetch(url.href, {
method: "POST",
body: {
@@ -303,10 +313,19 @@ export class WireGatewayApiClient {
}
}
+/**
+ * This API look like it belongs to harness
+ * but it will be nice to have in utils to be used by others
+ */
export class BankAccessApiClient {
- httpLib = createPlatformHttpLib();
+ httpLib;
- constructor(private args: BankAccessApiClientArgs) {}
+ constructor(private args: BankAccessApiClientArgs) {
+ this.httpLib = createPlatformHttpLib({
+ enableThrottling: !!args.enableThrottling,
+ allowHttp: !!args.allowHttp,
+ });
+ }
async getTransactions(): Promise<void> {
const reqUrl = new URL(