Skip to content

Commit cac68ff

Browse files
authored
added option to set a custom HTTP timeout (#79)
1 parent 7bf724b commit cac68ff

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

force-app/main/default/classes/AdyenClient.cls

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public with sharing class AdyenClient {
3838
httpReq.setMethod('POST');
3939
httpReq.setHeader('X-API-KEY', config.getApiKey());
4040
httpReq.setHeader('Content-Type', 'application/json');
41+
Integer timeout = config.getTimeout();
42+
if (timeout != null) {
43+
httpReq.setTimeout(timeout);
44+
}
4145
httpReq.setBody(request);
4246
return httpReq;
4347
}

force-app/main/default/classes/AdyenConfig.cls

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public with sharing class AdyenConfig {
1313
private String environment;
1414
private String endpoint;
1515
private String apiKey;
16+
private Integer timeout;
1617

1718
@namespaceAccessible
1819
public void setEnvironment(String environment){
@@ -38,4 +39,14 @@ public with sharing class AdyenConfig {
3839
public String getApiKey(){
3940
return this.apiKey;
4041
}
42+
43+
@namespaceAccessible
44+
public void setTimeout(Integer timeout){
45+
this.timeout = timeout;
46+
}
47+
48+
@namespaceAccessible
49+
public Integer getTimeout(){
50+
return this.timeout;
51+
}
4152
}

0 commit comments

Comments
 (0)