Skip to content

Commit 46860c7

Browse files
authored
Merge pull request #574 from Adyen/develop
Release 15.0.2
2 parents a49b1c6 + 1d1e0e5 commit 46860c7

File tree

10 files changed

+510
-111
lines changed

10 files changed

+510
-111
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @rkewlani @martinsrenato @Aleffio @abhilash-adyen @saquibsayyad @AlexandrosMor
1+
* @rkewlani @martinsrenato @Aleffio @abhilash-adyen @saquibsayyad

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ You can use Maven and add this dependency to your project's POM:
4141
<dependency>
4242
<groupId>com.adyen</groupId>
4343
<artifactId>adyen-java-api-library</artifactId>
44-
<version>15.0.1</version>
44+
<version>15.0.2</version>
4545
</dependency>
4646
```
4747

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.adyen</groupId>
55
<artifactId>adyen-java-api-library</artifactId>
66
<packaging>jar</packaging>
7-
<version>15.0.1</version>
7+
<version>15.0.2</version>
88
<name>Adyen Java API Library</name>
99
<description>Adyen API Client Library for Java</description>
1010
<url>https://github.com/adyen/adyen-java-api-library</url>

src/main/java/com/adyen/Client.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class Client {
4545
public static final String MARKETPAY_NOTIFICATION_API_VERSION = "v6";
4646
public static final String MARKETPAY_HOP_API_VERSION = "v6";
4747
public static final String LIB_NAME = "adyen-java-api-library";
48-
public static final String LIB_VERSION = "15.0.1";
48+
public static final String LIB_VERSION = "15.0.2";
4949
public static final String CHECKOUT_ENDPOINT_TEST = "https://checkout-test.adyen.com/checkout";
5050
public static final String CHECKOUT_ENDPOINT_LIVE_SUFFIX = "-checkout-live.adyenpayments.com/checkout";
5151
public static final String CHECKOUT_API_VERSION = "v67";

src/main/java/com/adyen/httpclient/AdyenHttpClient.java

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import javax.net.ssl.TrustManager;
4949
import javax.net.ssl.TrustManagerFactory;
5050
import java.io.IOException;
51-
import java.io.UnsupportedEncodingException;
5251
import java.net.InetSocketAddress;
5352
import java.net.Proxy;
5453
import java.net.URI;
@@ -70,7 +69,6 @@ public class AdyenHttpClient implements ClientInterface {
7069

7170
private static final String CHARSET = "UTF-8";
7271
private static final String TERMINAL_CERTIFICATE_ALIAS = "TerminalCertificate";
73-
private static final String JAVA_KEYSTORE = "JKS";
7472
private static final String SSL = "SSL";
7573
private Proxy proxy;
7674

@@ -150,25 +148,26 @@ private void setHeaders(Config config, RequestOptions requestOptions, HttpReques
150148
}
151149
}
152150

153-
private HttpRequestBase createHttpRequestBase(URI endpoint, String requestBody, ApiConstants.HttpMethod httpMethod) throws HTTPClientException {
154-
try {
155-
switch (httpMethod) {
156-
case GET:
157-
return new HttpGet(endpoint);
158-
case PATCH:
159-
HttpPatch httpPatch = new HttpPatch(endpoint);
160-
httpPatch.setEntity(new StringEntity(requestBody));
161-
return httpPatch;
162-
case DELETE:
163-
new HttpDelete(endpoint);
164-
default:
165-
// Default to POST if httpMethod is not provided
166-
HttpPost httpPost = new HttpPost(endpoint);
167-
httpPost.setEntity(new StringEntity(requestBody));
168-
return httpPost;
169-
}
170-
} catch (UnsupportedEncodingException e) {
171-
throw new HTTPClientException("Unsupported encoding", e);
151+
private HttpRequestBase createHttpRequestBase(URI endpoint, String requestBody, ApiConstants.HttpMethod httpMethod) {
152+
StringEntity requestEntity = null;
153+
if (requestBody != null && !requestBody.isEmpty()) {
154+
requestEntity = new StringEntity(requestBody, CHARSET);
155+
}
156+
157+
switch (httpMethod) {
158+
case GET:
159+
return new HttpGet(endpoint);
160+
case PATCH:
161+
HttpPatch httpPatch = new HttpPatch(endpoint);
162+
httpPatch.setEntity(requestEntity);
163+
return httpPatch;
164+
case DELETE:
165+
return new HttpDelete(endpoint);
166+
default:
167+
// Default to POST if httpMethod is not provided
168+
HttpPost httpPost = new HttpPost(endpoint);
169+
httpPost.setEntity(requestEntity);
170+
return httpPost;
172171
}
173172
}
174173

@@ -193,7 +192,7 @@ private CloseableHttpClient createCloseableHttpClient(Config config) throws HTTP
193192
HttpClientBuilder httpClientBuilder = HttpClients.custom();
194193
// Create new KeyStore for the terminal certificate
195194
try {
196-
KeyStore keyStore = KeyStore.getInstance(JAVA_KEYSTORE);
195+
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
197196
keyStore.load(null, null);
198197
keyStore.setCertificateEntry(TERMINAL_CERTIFICATE_ALIAS, config.getTerminalCertificate());
199198

@@ -275,4 +274,4 @@ private void setBasicAuthentication(HttpUriRequest httpUriRequest, String userna
275274

276275
httpUriRequest.addHeader("Authorization", "Basic " + authStringEnc);
277276
}
278-
}
277+
}

0 commit comments

Comments
 (0)