diff options
Diffstat (limited to 'packages/taler-wallet-core/src/bank-api-client.ts')
-rw-r--r-- | packages/taler-wallet-core/src/bank-api-client.ts | 35 |
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( |