Skip to content

Commit

Permalink
Merge pull request #85 from buckaroo-it/BA-646-configurable-http-clie…
Browse files Browse the repository at this point in the history
…nt-timeout

BA-646-configurable-http-client-timeout
  • Loading branch information
vildanbina authored Dec 18, 2024
2 parents fe35ab5 + bc613a9 commit 085523a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Request/HttpsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export default class HttpsClient {
protected _options: AxiosRequestConfig = {};
private _axiosInstance: AxiosInstance;

constructor(agent?: Agent) {
this._options.timeout = 10000;
constructor(agent?: Agent, timeout?: number) {
this._options.timeout = timeout ?? 10000;
this._options.maxRedirects = 10;
this._options.withCredentials = true;

Expand Down
1 change: 1 addition & 0 deletions src/Utils/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export declare interface IConfig {
returnURLReject?: string;
activePaymentMethods?: ServiceCode[];
disabledPaymentMethods?: ServiceCode[];
timeout?: number;
}

export declare interface ICredentials {
Expand Down
2 changes: 1 addition & 1 deletion src/buckaroo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class Buckaroo {
constructor(credentials: ICredentials, config?: IConfig, agent?: Agent) {
this._credentials = new Credentials(credentials.secretKey, credentials.websiteKey);
this._config = { ...(config ?? { mode: 'TEST', currency: 'EUR' }) };
this._httpClient = new HttpsClient(agent);
this._httpClient = new HttpsClient(agent, this._config.timeout);
}

static get Client(): Buckaroo {
Expand Down

0 comments on commit 085523a

Please sign in to comment.