Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Code scanning - action"

on:
push:
pull_request:
schedule:
- cron: '0 0 * * 4'

jobs:
CodeQL-Build:

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The Library supports all APIs under the following services:
* notifications
* BIN lookup
* terminal API
* stored value

## Requirements

Expand All @@ -38,7 +39,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>com.adyen</groupId>
<artifactId>adyen-java-api-library</artifactId>
<version>7.0.1</version>
<version>7.1.0</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>7.0.1</version>
<version>7.1.0</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
10 changes: 6 additions & 4 deletions src/main/java/com/adyen/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import com.adyen.httpclient.ClientInterface;
import com.adyen.httpclient.HttpURLConnectionClient;

import java.util.Optional;

public class Client {
private ClientInterface httpClient;
private Config config;
Expand All @@ -42,7 +44,7 @@ public class Client {
public static final String MARKETPAY_FUND_API_VERSION = "v5";
public static final String MARKETPAY_NOTIFICATION_API_VERSION = "v1";
public static final String LIB_NAME = "adyen-java-api-library";
public static final String LIB_VERSION = "7.0.1";
public static final String LIB_VERSION = "7.1.0";
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 = "v52";
Expand All @@ -51,6 +53,8 @@ public class Client {
public static final String CHECKOUT_UTILITY_API_VERSION = "v1";
public static final String TERMINAL_API_ENDPOINT_TEST = "https://terminal-api-test.adyen.com";
public static final String TERMINAL_API_ENDPOINT_LIVE = "https://terminal-api-live.adyen.com";
public static final String STORED_VALUE_PAL_SUFFIX = "/pal/servlet/StoredValue/";
public static final String STORED_VALUE_API_VERSION = "v46";
public static final String ENDPOINT_PROTOCOL = "https://";

public Client() {
Expand Down Expand Up @@ -181,9 +185,7 @@ public String toString() {
}

public ClientInterface getHttpClient() {
if (this.httpClient == null) {
this.httpClient = new HttpURLConnectionClient();
}
this.httpClient = Optional.ofNullable(this.httpClient).orElseGet(() -> new HttpURLConnectionClient());
return this.httpClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ private static String getResponseBody(InputStream responseStream) throws IOExcep
public String post(String requestUrl, Map<String, String> params, Config config) throws IOException, HTTPClientException {
String postQuery = getQuery(params);
HttpURLConnection httpConnection = createRequest(requestUrl, config.getApplicationName());
String response = doPostRequest(httpConnection, postQuery);

return response;
return doPostRequest(httpConnection, postQuery);
}

/**
Expand Down Expand Up @@ -243,9 +241,7 @@ private String doPostRequest(HttpURLConnection httpConnection, String requestBod
response = getResponseBody(httpConnection.getErrorStream());
}

HTTPClientException httpClientException = new HTTPClientException(responseCode, "HTTP Exception", httpConnection.getHeaderFields(), response);

throw httpClientException;
throw new HTTPClientException(responseCode, "HTTP Exception", httpConnection.getHeaderFields(), response);
}

//InputStream is only available on successful requests >= 200 <400
Expand Down
13 changes: 3 additions & 10 deletions src/main/java/com/adyen/model/AbstractPaymentRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
import java.util.Objects;


import static com.adyen.util.Util.toIndentedString;


/**
* AbstractPaymentRequest Base for PaymentRequest and PaymentRequest3D
*/
Expand Down Expand Up @@ -1007,14 +1010,4 @@ private String stringifyAdditionalData() {
return nonSensitiveAdditionalData.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

}
14 changes: 4 additions & 10 deletions src/main/java/com/adyen/model/AccountInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
import java.util.Date;
import java.util.Objects;


import static com.adyen.util.Util.toIndentedString;

/**
* AccountInfo
*/
Expand Down Expand Up @@ -779,14 +782,5 @@ public String toString() {
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

}
17 changes: 5 additions & 12 deletions src/main/java/com/adyen/model/Address.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
*/
package com.adyen.model;

import java.util.Objects;
import com.google.gson.annotations.SerializedName;

import java.util.Objects;


import static com.adyen.util.Util.toIndentedString;

/**
* Address
*/
Expand Down Expand Up @@ -192,16 +196,5 @@ public String toString() {
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

}

22 changes: 8 additions & 14 deletions src/main/java/com/adyen/model/Amount.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@
*/
package com.adyen.model;

import com.adyen.util.Util;
import com.google.gson.annotations.SerializedName;

import java.math.BigDecimal;
import java.util.Objects;
import com.adyen.Util.Util;
import com.google.gson.annotations.SerializedName;


import static com.adyen.util.Util.toIndentedString;

/**
* Amount
Expand All @@ -36,8 +40,7 @@ public class Amount {
private String currency = null;

public BigDecimal getDecimalValue() {
BigDecimal amountValue = BigDecimal.valueOf(getValue(), Util.getDecimalPlaces(getCurrency()));
return amountValue;
return BigDecimal.valueOf(getValue(), Util.getDecimalPlaces(getCurrency()));
}

public Amount value(Long value) {
Expand Down Expand Up @@ -107,16 +110,7 @@ public String toString() {
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}


}

14 changes: 4 additions & 10 deletions src/main/java/com/adyen/model/ApiError.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

import java.util.List;


import static com.adyen.util.Util.toIndentedString;

/**
* Represents the API error responses
*/
Expand Down Expand Up @@ -110,14 +113,5 @@ public String toString() {
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

}
14 changes: 3 additions & 11 deletions src/main/java/com/adyen/model/AuthenticationResultRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

import java.util.Objects;


import static com.adyen.util.Util.toIndentedString;

/**
* AuthenticationResultRequest
*/
Expand Down Expand Up @@ -99,15 +102,4 @@ public String toString() {
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

}
14 changes: 3 additions & 11 deletions src/main/java/com/adyen/model/AuthenticationResultResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

import java.util.Objects;


import static com.adyen.util.Util.toIndentedString;

/**
* AuthenticationResultResponse
*/
Expand Down Expand Up @@ -99,15 +102,4 @@ public String toString() {
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

}
17 changes: 5 additions & 12 deletions src/main/java/com/adyen/model/BankAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
*/
package com.adyen.model;

import java.util.Objects;
import com.google.gson.annotations.SerializedName;

import java.util.Objects;


import static com.adyen.util.Util.toIndentedString;

/**
* BankAccount
*/
Expand Down Expand Up @@ -262,16 +266,5 @@ public String toString() {
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}

}

Loading