Skip to content

Commit

Permalink
Merge pull request #1021 from Adyen/develop
Browse files Browse the repository at this point in the history
Adyen Java API Library Release v20.0.0
  • Loading branch information
jillingk authored May 12, 2023
2 parents 1caad26 + 08cd39c commit 8b7c040
Show file tree
Hide file tree
Showing 672 changed files with 56,767 additions and 14,502 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
echo ::set-output name=pr_body::"OpenAPI spec or templates produced new models on $(date +%d-%m-%Y) \
by [commit](https://github.com/Adyen/adyen-openapi/commit/$(git rev-parse HEAD))."
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
committer: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
Expand Down
84 changes: 77 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,35 @@ openapi-generator-cli:=java -jar $(openapi-generator-jar)

generator:=java
library:=okhttp-gson
services:=balanceplatform binlookup checkout legalentitymanagement management payments payout recurring transfers
modelGen:=balanceplatform binlookup checkout legalentitymanagement management payment payout recurring transfers
models:=src/main/java/com/adyen/model
output:=target/out

# Generate models (for each service)
models: $(services)
models: $(modelGen)

binlookup: spec=BinLookupService-v52
balancecontrol: spec=BalanceControlService-v1
balancecontrol: smallServiceName=BalanceControlApi
binlookup: spec=BinLookupService-v54
binlookup: smallServiceName=BinLookupApi
checkout: spec=CheckoutService-v70
storedValue: spec=StoredValueService-v46
dataprotection: spec=DataProtectionService-v1
dataprotection: smallServiceName=DataProtectionApi
capital: spec=GrantService-v3
capital: smallServiceName=CapitalApi
storedvalue: spec=StoredValueService-v46
storedvalue: smallServiceName=StoredValueApi
posterminalmanagement: spec=TfmAPIService-v1
payments: spec=PaymentService-v68
posterminalmanagement: smallServiceName=PosTerminalManagementApi
payment: spec=PaymentService-v68
payment: smallServiceName=PaymentApi
recurring: spec=RecurringService-v68
recurring: smallServiceName=RecurringApi
payout: spec=PayoutService-v68
management: spec=ManagementService-v1
management: resourceClass=Management
balanceplatform: spec=BalancePlatformService-v2
transfers: spec=TransferService-v3
legalentitymanagement: spec=LegalEntityService-v2
legalentitymanagement: spec=LegalEntityService-v3
# Classic Platforms
marketpay/account: spec=AccountService-v6
marketpay/fund: spec=FundService-v6
Expand All @@ -45,13 +55,73 @@ $(services): target/spec $(openapi-generator-jar)
--library $(library) \
--global-property modelDocs=false \
--global-property modelTests=false \
--inline-schema-name-mappings PaymentDonationRequest_paymentMethod=CheckoutPaymentMethod \
--additional-properties=dateLibrary=java8 \
--additional-properties=serializationLibrary=gson \
--additional-properties=openApiNullable=false \
--additional-properties=resourceClass=$(resourceClass)Resource
mv $(output)/$(models)/$@ $(models)/$@
mv $(output)/$(models)/JSON.java $(models)/$@

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

services: $(bigServices) $(singleFileServices)

$(bigServices): target/spec $(openapi-generator-jar)
rm -rf $(models)/$@ $(output)
rm -rf src/main/java/com/adyen/service/$@ $(output)
$(openapi-generator-cli) generate \
-i target/spec/json/$(spec).json \
-g $(generator) \
-t templates \
-o $(output) \
--reserved-words-mappings configuration=configuration \
--ignore-file-override ./.openapi-generator-ignore \
--skip-validate-spec \
--model-package $(subst /,.,com.adyen.model.$@) \
--library $(library) \
--api-package com.adyen.service.$@ \
--api-name-suffix Api \
--global-property modelDocs=false \
--global-property modelTests=false \
--inline-schema-name-mappings PaymentDonationRequest_paymentMethod=CheckoutPaymentMethod \
--additional-properties=dateLibrary=java8 \
--additional-properties=serializationLibrary=gson \
--additional-properties=openApiNullable=false
mv $(output)/$(models)/$@ $(models)/$@
mv $(output)/src/main/java/com/adyen/service/JSON.java $(models)/$@
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
rm -rf $(models)/$@ $(output)
rm -rf src/main/java/com/adyen/service/$@ $(output)
$(openapi-generator-cli) generate \
-i target/spec/json/$(spec).json \
-g $(generator) \
-c templates/libraries/okhttp-gson/config.yaml \
-o $(output) \
--reserved-words-mappings configuration=configuration \
--ignore-file-override ./.openapi-generator-ignore \
--skip-validate-spec \
--model-package $(subst /,.,com.adyen.model.$@) \
--library $(library) \
--additional-properties customApi=$@ \
--api-package com.adyen.service \
--api-name-suffix Api \
--global-property modelDocs=false \
--global-property modelTests=false \
--inline-schema-name-mappings PaymentDonationRequest_paymentMethod=CheckoutPaymentMethod \
--additional-properties=dateLibrary=java8 \
--additional-properties=serializationLibrary=gson \
--additional-properties=openApiNullable=false \
--additional-properties=smallServiceName=$(smallServiceName)
mv $(output)/$(models)/$@ $(models)/$@
mv $(output)/src/main/java/com/adyen/JSON.java $(models)/$@
mv $(output)/src/main/java/com/adyen/service/*Single.java src/main/java/com/adyen/service/$(smallServiceName).java


# Checkout spec (and patch version)
target/spec:
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ The Library supports all APIs under the following services:

| API | Description | Service Name | Supported version |
|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|-------------------|
| [BIN lookup API](https://docs.adyen.com/api-explorer/#/BinLookup/v52/overview) | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | BinLookup | **v52** |
| [Checkout API](https://docs.adyen.com/api-explorer/#/CheckoutService/v69/overview) | Our latest integration for accepting online payments. | Checkout | **v69** |
| [BIN lookup API](https://docs.adyen.com/api-explorer/BinLookup/54/overview) | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | BinLookup | **v54** |
| [Capital API](https://docs.adyen.com/api-explorer/capital/3/overview) | Adyen Capital allows you to build an embedded financing offering for your users to serve their operational needs. | Capital | **v3** |
| [Checkout API](https://docs.adyen.com/api-explorer/Checkout/70/overview) | Our latest integration for accepting online payments. | Checkout | **v70** |
| [Configuration API](https://docs.adyen.com/api-explorer/#/balanceplatform/v2/overview) | The Configuration API enables you to create a platform where you can onboard your users as account holders and create balance accounts, cards, and business accounts. | balanceplatform package subclasses | **v2** |
| [DataProtection API](https://docs.adyen.com/development-resources/data-protection-api) | Adyen Data Protection API provides a way for you to process [Subject Erasure Requests](https://gdpr-info.eu/art-17-gdpr/) as mandated in GDPR. Use our API to submit a request to delete shopper's data, including payment details and other related information (for example, delivery address or shopper email) | DataProtection | **v1** |
| [Legal Entity Management API](https://docs.adyen.com/api-explorer/#/legalentity/v2/overview) | Manage legal entities that contain information required for verification. | legalentitymanagement package subclasses | **v2** |
| [Legal Entity Management API](https://docs.adyen.com/api-explorer/legalentity/3/overview) | Manage legal entities that contain information required for verification. | legalentitymanagement package subclasses | **v3** |
| [Local/Cloud-based Terminal API](https://docs.adyen.com/point-of-sale/terminal-api-reference) | Our point-of-sale integration. | TerminalLocalAPI or TerminalCloudAPI | - |
| [Management API](https://docs.adyen.com/api-explorer/#/ManagementService/v1/overview) | Configure and manage your Adyen company and merchant accounts, stores, and payment terminals. | management package subclasses | **v1** |
| [Payments API](https://docs.adyen.com/api-explorer/#/Payment/v68/overview) | Our classic integration for online payments. | Payment | **v68** |
Expand Down Expand Up @@ -49,7 +50,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>19.0.0</version>
<version>20.0.0</version>
</dependency>
```

Expand Down Expand Up @@ -191,6 +192,8 @@ For a closer look at how our Java library works, you can clone one of our exampl

These include commented code, highlighting key features and concepts, and examples of API calls that can be made using the library.

## Feedback
We value your input! Help us enhance our API Libraries and improve the integration experience by providing your feedback. Please take a moment to fill out [our feedback form](https://forms.gle/A4EERrR6CWgKWe5r9) to share your thoughts, suggestions or ideas.

## Contributing

Expand Down
4 changes: 4 additions & 0 deletions checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files="src/main/java/com.adyen/service/*" checks="[a-zA-Z0-9]*" />
</suppressions>
19 changes: 10 additions & 9 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>19.0.0</version>
<version>20.0.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.9</swagger-core-version>
<swagger-core-version>1.6.10</swagger-core-version>
</properties>
<scm>
<connection>scm:git:[email protected]:Adyen/adyen-java-api-library.git</connection>
Expand All @@ -44,7 +44,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
Expand Down Expand Up @@ -75,7 +75,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<version>0.8.10</version>
<executions>
<execution>
<id>default-prepare-agent</id>
Expand Down Expand Up @@ -117,7 +117,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<version>3.1.0</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -142,9 +142,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.2.1</version>
<version>3.2.2</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
</configuration>
Expand Down Expand Up @@ -207,7 +208,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.0.0</version>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -219,13 +220,13 @@
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.8</version>
<version>2.2.9</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>2.1.6</version>
<version>3.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
5 changes: 3 additions & 2 deletions 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 = "19.0.0";
public static final String LIB_VERSION = "20.0.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 All @@ -70,7 +70,7 @@ public class Client {
public static final String TRANSFER_VERSION = "v3";
public static final String LEGAL_ENTITY_MANAGEMENT_ENDPOINT_TEST = "https://kyc-test.adyen.com/lem/";
public static final String LEGAL_ENTITY_MANAGEMENT_ENDPOINT_LIVE = "https://kyc-test.adyen.com/lem/";
public static final String LEGAL_ENTITY_MANAGEMENT_VERSION = "v2";
public static final String LEGAL_ENTITY_MANAGEMENT_VERSION = "v3";
public static final String MANAGEMENT_ENDPOINT_TEST = "https://management-test.adyen.com/";
public static final String MANAGEMENT_ENDPOINT_LIVE = "https://management-live.adyen.com/";
public static final String MANAGEMENT_VERSION = "v1";
Expand Down Expand Up @@ -216,6 +216,7 @@ public void setEnvironment(Environment environment, String liveEndpointUrlPrefix
this.config.setEnvironment(environment);
this.config.setMarketPayEndpoint(MARKETPAY_ENDPOINT_LIVE);
if (liveEndpointUrlPrefix != null && !liveEndpointUrlPrefix.isEmpty()) {
this.config.liveEndpointUrlPrefix = liveEndpointUrlPrefix;
this.config.setEndpoint(ENDPOINT_PROTOCOL + liveEndpointUrlPrefix + ENDPOINT_LIVE_SUFFIX);
this.config.setCheckoutEndpoint(ENDPOINT_PROTOCOL + liveEndpointUrlPrefix + CHECKOUT_ENDPOINT_LIVE_SUFFIX);
} else {
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/com/adyen/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
package com.adyen;

import com.adyen.enums.Environment;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

Expand Down Expand Up @@ -49,4 +50,27 @@ public void setApiKeyRequired(boolean apiKeyRequired) {
isApiKeyRequired = apiKeyRequired;
}

protected String createBaseURL(String url) {
Config config = this.getClient().getConfig();
if (config.getEnvironment() != Environment.LIVE) {
return url;
}

if (url.contains("pal-")) {
if (config.getLiveEndpointUrlPrefix() == null) {
throw new IllegalArgumentException("please provide a live url prefix in the client");
}
url = url.replaceFirst("https://pal-test.adyen.com/pal/servlet/",
"https://" + config.getLiveEndpointUrlPrefix() + "-pal-live.adyenpayments.com/pal/servlet/");
}

if (url.contains("checkout-")) {
if (config.getLiveEndpointUrlPrefix() == null) {
throw new IllegalArgumentException("please provide a live url prefix in the client");
}
url = url.replaceFirst("https://checkout-test.adyen.com/",
"https://" + config.getLiveEndpointUrlPrefix() + "-checkout-live.adyenpayments.com/checkout/");
}
return url.replaceFirst("-test", "-live");
}
}
Loading

0 comments on commit 8b7c040

Please sign in to comment.