Skip to content

Commit

Permalink
Merge pull request #1044 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 20.1.0
  • Loading branch information
jillingk authored Jun 8, 2023
2 parents 8b7c040 + aab24c5 commit 5f6f38b
Show file tree
Hide file tree
Showing 864 changed files with 46,802 additions and 4,920 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ openapi-generator-cli:=java -jar $(openapi-generator-jar)

generator:=java
library:=okhttp-gson
modelGen:=balanceplatform binlookup checkout legalentitymanagement management payment payout recurring transfers
modelGen:=balancecontrol balanceplatform binlookup capital checkout dataprotection legalentitymanagement management payment payout posterminalmanagement recurring transfers storedvalue configurationwebhooks reportwebhooks transferwebhooks
models:=src/main/java/com/adyen/model
output:=target/out

Expand Down Expand Up @@ -40,8 +40,12 @@ marketpay/fund: spec=FundService-v6
marketpay/configuration: spec=NotificationConfigurationService-v6
marketpay/webhooks: spec=MarketPayNotificationService-v6
hop: spec=HopService-v6
# Balance Webhooks
configurationwebhooks: spec=BalancePlatformConfigurationNotification-v1
reportwebhooks: spec=BalancePlatformReportNotification-v1
transferwebhooks: spec=BalancePlatformTransferNotification-v3

$(services): target/spec $(openapi-generator-jar)
$(modelGen): target/spec $(openapi-generator-jar)
rm -rf $(models)/$@ $(output)
$(openapi-generator-cli) generate \
-i target/spec/json/$(spec).json \
Expand All @@ -64,7 +68,7 @@ $(services): target/spec $(openapi-generator-jar)
mv $(output)/$(models)/JSON.java $(models)/$@

# Full service + models automation
bigServices:=balanceplatform checkout storedValue payout management legalentitymanagement transfers
bigServices:=balanceplatform checkout payout management legalentitymanagement transfers
singleFileServices:=balancecontrol binlookup dataprotection storedvalue posterminalmanagement recurring payment capital

services: $(bigServices) $(singleFileServices)
Expand Down Expand Up @@ -95,7 +99,8 @@ $(bigServices): target/spec $(openapi-generator-jar)
mv $(output)/src/main/java/com/adyen/service/$@ src/main/java/com/adyen/service/$@

$(singleFileServices): target/spec $(openapi-generator-jar)
cat <<< "$$(jq 'del(.paths[][].tags)' target/spec/json/$(spec).json)" > target/spec/json/$(spec).json
jq -e 'del(.paths[][].tags)' target/spec/json/$(spec).json > target/spec/json/$(spec).tmp
mv target/spec/json/$(spec).tmp target/spec/json/$(spec).json
rm -rf $(models)/$@ $(output)
rm -rf src/main/java/com/adyen/service/$@ $(output)
$(openapi-generator-cli) generate \
Expand Down
62 changes: 47 additions & 15 deletions README.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions 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>20.0.0</version>
<version>20.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 All @@ -25,7 +25,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<swagger-core-version>1.6.10</swagger-core-version>
<swagger-core-version>1.6.11</swagger-core-version>
</properties>
<scm>
<connection>scm:git:[email protected]:Adyen/adyen-java-api-library.git</connection>
Expand Down Expand Up @@ -88,7 +88,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
Expand Down Expand Up @@ -142,7 +142,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.2.2</version>
<version>3.3.0</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
Expand All @@ -162,7 +162,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.8</version>
<version>5.1.9</version>
<executions>
<execution>
<id>bundle-manifest</id>
Expand Down Expand Up @@ -220,7 +220,7 @@
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.9</version>
<version>2.2.11</version>
<scope>compile</scope>
</dependency>
<dependency>
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 @@ -44,7 +44,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 = "20.0.0";
public static final String LIB_VERSION = "20.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_ENDPOINT_CERT_LIVE = "https://checkoutcert-live-%s.adyen.com/checkout";
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/adyen/constants/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ interface RequestProperty {
String CONTENT_TYPE = "Content-Type";
String API_KEY = "x-api-key";
String APPLICATION_JSON_TYPE = "application/json";
String REQUESTED_VERIFICATION_CODE_HEADER = "x-requested-verification-code";
}

interface ThreeDS2Property {
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/com/adyen/httpclient/AdyenHttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import static com.adyen.constants.ApiConstants.RequestProperty.APPLICATION_JSON_TYPE;
import static com.adyen.constants.ApiConstants.RequestProperty.CONTENT_TYPE;
import static com.adyen.constants.ApiConstants.RequestProperty.IDEMPOTENCY_KEY;
import static com.adyen.constants.ApiConstants.RequestProperty.REQUESTED_VERIFICATION_CODE_HEADER;
import static com.adyen.constants.ApiConstants.RequestProperty.USER_AGENT;

public class AdyenHttpClient implements ClientInterface {
Expand Down Expand Up @@ -151,8 +152,17 @@ private void setHeaders(Config config, RequestOptions requestOptions, HttpUriReq
httpUriRequest.addHeader(ADYEN_LIBRARY_NAME, Client.LIB_NAME);
httpUriRequest.addHeader(ADYEN_LIBRARY_VERSION, Client.LIB_VERSION);

if (requestOptions != null && requestOptions.getIdempotencyKey() != null) {
httpUriRequest.addHeader(IDEMPOTENCY_KEY, requestOptions.getIdempotencyKey());
if (requestOptions != null) {
if (requestOptions.getIdempotencyKey() != null) {
httpUriRequest.addHeader(IDEMPOTENCY_KEY, requestOptions.getIdempotencyKey());
}
if (requestOptions.getRequestedVerificationCodeHeader() != null) {
httpUriRequest.addHeader(REQUESTED_VERIFICATION_CODE_HEADER, requestOptions.getRequestedVerificationCodeHeader());
}

if (requestOptions.getAdditionalServiceHeaders() != null) {
requestOptions.getAdditionalServiceHeaders().forEach(httpUriRequest::addHeader);
}
}
}

Expand Down
19 changes: 19 additions & 0 deletions src/main/java/com/adyen/model/RequestOptions.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package com.adyen.model;

import java.util.HashMap;

public class RequestOptions {

private String idempotencyKey;
private String requestedVerificationCodeHeader;
private HashMap<String, String> additionalServiceHeaders;

public String getIdempotencyKey() {
return idempotencyKey;
Expand All @@ -12,5 +16,20 @@ public void setIdempotencyKey(String idempotencyKey) {
this.idempotencyKey = idempotencyKey;
}

public String getRequestedVerificationCodeHeader() {
return requestedVerificationCodeHeader;
}

public void setRequestedVerificationCodeHeader(String requestedVerificationCodeHeader) {
this.requestedVerificationCodeHeader = requestedVerificationCodeHeader;
}

public HashMap<String, String> getAdditionalServiceHeaders() {
return additionalServiceHeaders;
}

public void setAdditionalServiceHeaders(HashMap<String, String> additionalServiceHeaders) {
this.additionalServiceHeaders = additionalServiceHeaders;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* The Balance Control API lets you transfer funds between merchant accounts that belong to the same legal entity and are under the same company account. ## Authentication To connect to the Balance Control API, you must authenticate your requests with an [API key or basic auth username and password](https://docs.adyen.com/development-resources/api-authentication). To learn how you can generate these, see [API credentials](https://docs.adyen.com/development-resources/api-credentials).Here is an example of authenticating a request with an API key: ``` curl -H \"X-API-Key: Your_API_key\" \\ -H \"Content-Type: application/json\" \\ ... ``` Note that when going live, you need to generate API credentials to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning The Balance Control API supports [versioning](https://docs.adyen.com/development-resources/versioning) using a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://pal-test.adyen.com/pal/servlet/BalanceControl/v1/balanceTransfer ```
*
* The version of the OpenAPI document: 1
* Contact: [email protected]
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/com/adyen/model/balancecontrol/Amount.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* The Balance Control API lets you transfer funds between merchant accounts that belong to the same legal entity and are under the same company account. ## Authentication To connect to the Balance Control API, you must authenticate your requests with an [API key or basic auth username and password](https://docs.adyen.com/development-resources/api-authentication). To learn how you can generate these, see [API credentials](https://docs.adyen.com/development-resources/api-credentials).Here is an example of authenticating a request with an API key: ``` curl -H \"X-API-Key: Your_API_key\" \\ -H \"Content-Type: application/json\" \\ ... ``` Note that when going live, you need to generate API credentials to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning The Balance Control API supports [versioning](https://docs.adyen.com/development-resources/versioning) using a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://pal-test.adyen.com/pal/servlet/BalanceControl/v1/balanceTransfer ```
*
* The version of the OpenAPI document: 1
* Contact: [email protected]
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand Down Expand Up @@ -41,6 +41,8 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.adyen.model.balancecontrol.JSON;

Expand Down Expand Up @@ -159,6 +161,10 @@ private String toIndentedString(Object o) {
openapiRequiredFields.add("currency");
openapiRequiredFields.add("value");
}
/**
* logger for Deserialization Errors
*/
private static final Logger log = Logger.getLogger(Amount.class.getName());

/**
* Validates the JSON Object and throws an exception if issues found
Expand All @@ -179,7 +185,7 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException {
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
if (!Amount.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Amount` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
log.log(Level.WARNING, String.format("The field `%s` in the JSON string is not defined in the `Amount` properties.", entry.getKey()));
}
}

Expand All @@ -191,7 +197,7 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException {
}
// validate the optional field currency
if (jsonObj.get("currency") != null && !jsonObj.get("currency").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString()));
log.log(Level.WARNING, String.format("Expected the field `currency` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currency").toString()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* The Balance Control API lets you transfer funds between merchant accounts that belong to the same legal entity and are under the same company account. ## Authentication To connect to the Balance Control API, you must authenticate your requests with an [API key or basic auth username and password](https://docs.adyen.com/development-resources/api-authentication). To learn how you can generate these, see [API credentials](https://docs.adyen.com/development-resources/api-credentials).Here is an example of authenticating a request with an API key: ``` curl -H \"X-API-Key: Your_API_key\" \\ -H \"Content-Type: application/json\" \\ ... ``` Note that when going live, you need to generate API credentials to access the [live endpoints](https://docs.adyen.com/development-resources/live-endpoints). ## Versioning The Balance Control API supports [versioning](https://docs.adyen.com/development-resources/versioning) using a version suffix in the endpoint URL. This suffix has the following format: \"vXX\", where XX is the version number. For example: ``` https://pal-test.adyen.com/pal/servlet/BalanceControl/v1/balanceTransfer ```
*
* The version of the OpenAPI document: 1
* Contact: [email protected]
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
Expand Down Expand Up @@ -42,6 +42,8 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.adyen.model.balancecontrol.JSON;

Expand Down Expand Up @@ -333,6 +335,10 @@ private String toIndentedString(Object o) {
openapiRequiredFields.add("toMerchant");
openapiRequiredFields.add("type");
}
/**
* logger for Deserialization Errors
*/
private static final Logger log = Logger.getLogger(BalanceTransferRequest.class.getName());

/**
* Validates the JSON Object and throws an exception if issues found
Expand All @@ -353,7 +359,7 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException {
// check to see if the JSON string contains additional fields
for (Entry<String, JsonElement> entry : entries) {
if (!BalanceTransferRequest.openapiFields.contains(entry.getKey())) {
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BalanceTransferRequest` properties. JSON: %s", entry.getKey(), jsonObj.toString()));
log.log(Level.WARNING, String.format("The field `%s` in the JSON string is not defined in the `BalanceTransferRequest` properties.", entry.getKey()));
}
}

Expand All @@ -369,19 +375,19 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException {
}
// validate the optional field description
if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
log.log(Level.WARNING, String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
}
// validate the optional field fromMerchant
if (jsonObj.get("fromMerchant") != null && !jsonObj.get("fromMerchant").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `fromMerchant` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fromMerchant").toString()));
log.log(Level.WARNING, String.format("Expected the field `fromMerchant` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fromMerchant").toString()));
}
// validate the optional field reference
if (jsonObj.get("reference") != null && !jsonObj.get("reference").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `reference` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reference").toString()));
log.log(Level.WARNING, String.format("Expected the field `reference` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reference").toString()));
}
// validate the optional field toMerchant
if (jsonObj.get("toMerchant") != null && !jsonObj.get("toMerchant").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `toMerchant` to be a primitive type in the JSON string but got `%s`", jsonObj.get("toMerchant").toString()));
log.log(Level.WARNING, String.format("Expected the field `toMerchant` to be a primitive type in the JSON string but got `%s`", jsonObj.get("toMerchant").toString()));
}
// ensure the field type can be parsed to an enum value
if (jsonObj.get("type") != null) {
Expand Down
Loading

0 comments on commit 5f6f38b

Please sign in to comment.