Skip to content

Commit

Permalink
Merge pull request #574 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 15.0.2
  • Loading branch information
Aleffio authored Jun 18, 2021
2 parents a49b1c6 + 1d1e0e5 commit 46860c7
Show file tree
Hide file tree
Showing 10 changed files with 510 additions and 111 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @rkewlani @martinsrenato @Aleffio @abhilash-adyen @saquibsayyad @AlexandrosMor
* @rkewlani @martinsrenato @Aleffio @abhilash-adyen @saquibsayyad
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You can use Maven and add this dependency to your project's POM:
<dependency>
<groupId>com.adyen</groupId>
<artifactId>adyen-java-api-library</artifactId>
<version>15.0.1</version>
<version>15.0.2</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.adyen</groupId>
<artifactId>adyen-java-api-library</artifactId>
<packaging>jar</packaging>
<version>15.0.1</version>
<version>15.0.2</version>
<name>Adyen Java API Library</name>
<description>Adyen API Client Library for Java</description>
<url>https://github.com/adyen/adyen-java-api-library</url>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/adyen/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class Client {
public static final String MARKETPAY_NOTIFICATION_API_VERSION = "v6";
public static final String MARKETPAY_HOP_API_VERSION = "v6";
public static final String LIB_NAME = "adyen-java-api-library";
public static final String LIB_VERSION = "15.0.1";
public static final String LIB_VERSION = "15.0.2";
public static final String CHECKOUT_ENDPOINT_TEST = "https://checkout-test.adyen.com/checkout";
public static final String CHECKOUT_ENDPOINT_LIVE_SUFFIX = "-checkout-live.adyenpayments.com/checkout";
public static final String CHECKOUT_API_VERSION = "v67";
Expand Down
45 changes: 22 additions & 23 deletions src/main/java/com/adyen/httpclient/AdyenHttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URI;
Expand All @@ -70,7 +69,6 @@ public class AdyenHttpClient implements ClientInterface {

private static final String CHARSET = "UTF-8";
private static final String TERMINAL_CERTIFICATE_ALIAS = "TerminalCertificate";
private static final String JAVA_KEYSTORE = "JKS";
private static final String SSL = "SSL";
private Proxy proxy;

Expand Down Expand Up @@ -150,25 +148,26 @@ private void setHeaders(Config config, RequestOptions requestOptions, HttpReques
}
}

private HttpRequestBase createHttpRequestBase(URI endpoint, String requestBody, ApiConstants.HttpMethod httpMethod) throws HTTPClientException {
try {
switch (httpMethod) {
case GET:
return new HttpGet(endpoint);
case PATCH:
HttpPatch httpPatch = new HttpPatch(endpoint);
httpPatch.setEntity(new StringEntity(requestBody));
return httpPatch;
case DELETE:
new HttpDelete(endpoint);
default:
// Default to POST if httpMethod is not provided
HttpPost httpPost = new HttpPost(endpoint);
httpPost.setEntity(new StringEntity(requestBody));
return httpPost;
}
} catch (UnsupportedEncodingException e) {
throw new HTTPClientException("Unsupported encoding", e);
private HttpRequestBase createHttpRequestBase(URI endpoint, String requestBody, ApiConstants.HttpMethod httpMethod) {
StringEntity requestEntity = null;
if (requestBody != null && !requestBody.isEmpty()) {
requestEntity = new StringEntity(requestBody, CHARSET);
}

switch (httpMethod) {
case GET:
return new HttpGet(endpoint);
case PATCH:
HttpPatch httpPatch = new HttpPatch(endpoint);
httpPatch.setEntity(requestEntity);
return httpPatch;
case DELETE:
return new HttpDelete(endpoint);
default:
// Default to POST if httpMethod is not provided
HttpPost httpPost = new HttpPost(endpoint);
httpPost.setEntity(requestEntity);
return httpPost;
}
}

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

Expand Down Expand Up @@ -275,4 +274,4 @@ private void setBasicAuthentication(HttpUriRequest httpUriRequest, String userna

httpUriRequest.addHeader("Authorization", "Basic " + authStringEnc);
}
}
}
Loading

0 comments on commit 46860c7

Please sign in to comment.